This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/10328
Change subject: libosmogsm: (re)introduce gsm48_push_l3hdr()
......................................................................
libosmogsm: (re)introduce gsm48_push_l3hdr()
There was gsm0480_l3hdr_push() which was declared in a header,
but was not exposed in 'libosmogsm.map'. Also, for some reason
it was a part of GSM 04.80 API, what is not actually correct.
Let's rename this symbol, and properly expose it as a part of
the new GSM 04.08 auxiliary API, i.e. in a separate header.
Change-Id: I8a045efe8335d83fcbe8d43eb180972e3b1d9dda
---
M include/Makefile.am
M include/osmocom/gsm/gsm0480.h
A include/osmocom/gsm/gsm48_utils.h
M src/gsm/Makefile.am
M src/gsm/gsm0411_utils.c
M src/gsm/gsm0480.c
A src/gsm/gsm48_utils.c
M src/gsm/libosmogsm.map
8 files changed, 84 insertions(+), 25 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/10328/1
diff --git a/include/Makefile.am b/include/Makefile.am
index ef8ec65..cc29ca8 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -90,6 +90,7 @@
osmocom/gsm/gsm23003.h \
osmocom/gsm/gsm48.h \
osmocom/gsm/gsm48_ie.h \
+ osmocom/gsm/gsm48_utils.h \
osmocom/gsm/gsm_utils.h \
osmocom/gsm/gsup.h \
osmocom/gsm/ipa.h \
diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 246f4b3..827464e 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -121,6 +121,3 @@
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
int gsm0480_wrap_facility(struct msgb *msg);
-
-struct gsm48_hdr *gsm0480_l3hdr_push(struct msgb *msg, uint8_t proto_discr,
- uint8_t msg_type);
diff --git a/include/osmocom/gsm/gsm48_utils.h b/include/osmocom/gsm/gsm48_utils.h
new file mode 100644
index 0000000..0f19a0c
--- /dev/null
+++ b/include/osmocom/gsm/gsm48_utils.h
@@ -0,0 +1,5 @@
+#pragma once
+
+struct gsm48_hdr *gsm48_push_l3hdr(struct msgb *msg,
+ uint8_t pdisc, uint8_t tid,
+ uint8_t msg_type);
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 29299a6..a945c1e 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -21,7 +21,7 @@
BUILT_SOURCES = gsm0503_conv.c
libgsmint_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
- gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \
+ gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm48_utils.c gsm0808.c sysinfo.c \
gprs_cipher_core.c gprs_rlc.c gsm0480.c abis_nm.c gsm0502.c \
gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c gsm0414.c \
lapd_core.c lapdm.c kasumi.c gsm_04_08_gprs.c \
diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c
index 53d37a4..6384900 100644
--- a/src/gsm/gsm0411_utils.c
+++ b/src/gsm/gsm0411_utils.c
@@ -35,7 +35,7 @@
#include <osmocom/core/logging.h>
#include <osmocom/gsm/gsm48.h>
-#include <osmocom/gsm/gsm0480.h>
+#include <osmocom/gsm/gsm48_utils.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_03_40.h>
#include <osmocom/gsm/protocol/gsm_04_11.h>
@@ -354,7 +354,7 @@
uint8_t msg_type)
{
/* Outgoing proto_discr needs the highest bit set */
- gsm0480_l3hdr_push(msg, proto | (trans << 4), msg_type);
+ gsm48_push_l3hdr(msg, proto, trans, msg_type);
return 0;
}
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 3897743..ea39980 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -26,6 +26,7 @@
*/
#include <osmocom/gsm/gsm0480.h>
+#include <osmocom/gsm/gsm48_utils.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/core/logging.h>
@@ -863,10 +864,10 @@
msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);
/* And finally pre-pend the L3 header */
- gsm0480_l3hdr_push(msg,
- GSM48_PDISC_NC_SS | trans_id
- | (1<<7) /* TI direction = 1 */,
- GSM0480_MTYPE_RELEASE_COMPLETE);
+ gsm48_push_l3hdr(msg, GSM48_PDISC_NC_SS,
+ trans_id | (1 << 7), /* FIXME: TI direction is always 1 ?!? */
+ GSM0480_MTYPE_RELEASE_COMPLETE);
+
return msg;
}
@@ -932,17 +933,6 @@
return msg;
}
-
-struct gsm48_hdr *gsm0480_l3hdr_push(struct msgb *msg, uint8_t proto_discr,
- uint8_t msg_type)
-{
- struct gsm48_hdr *gh;
- gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
- gh->proto_discr = proto_discr;
- gh->msg_type = msg_type;
- return gh;
-}
-
struct msgb *gsm0480_create_ussd_notify(int level, const char *text)
{
struct msgb *msg;
@@ -954,7 +944,11 @@
gsm0480_wrap_invoke(msg, GSM0480_OP_CODE_USS_NOTIFY, 0);
gsm0480_wrap_facility(msg);
- gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS, GSM0480_MTYPE_REGISTER);
+ /* And finally pre-pend the L3 header */
+ gsm48_push_l3hdr(msg, GSM48_PDISC_NC_SS,
+ 0x00, /* FIXME: no transactionID?!? */
+ GSM0480_MTYPE_REGISTER);
+
return msg;
}
@@ -966,8 +960,10 @@
if (!msg)
return NULL;
- /* FIXME: should this set trans_id and TI direction flag? */
- gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS,
- GSM0480_MTYPE_RELEASE_COMPLETE);
+ /* And finally pre-pend the L3 header */
+ gsm48_push_l3hdr(msg, GSM48_PDISC_NC_SS,
+ 0x00, /* FIXME: no transactionID?!? */
+ GSM0480_MTYPE_RELEASE_COMPLETE);
+
return msg;
}
diff --git a/src/gsm/gsm48_utils.c b/src/gsm/gsm48_utils.c
new file mode 100644
index 0000000..f2a166e
--- /dev/null
+++ b/src/gsm/gsm48_utils.c
@@ -0,0 +1,58 @@
+/*! \file gsm0408_utils.c
+ * Auxiliary utilities for GSM TS 04.08 messages */
+/*
+ * (C) 2016 by Neels Hofmeyr <nhofmeyr at sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdint.h>
+
+#include <osmocom/core/msgb.h>
+
+#include <osmocom/gsm/gsm48_utils.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+/*! \addtogroup gsm0408_utils
+ * @{
+ * GSM TS 04.08 auxiliary utilities
+ */
+
+/*! Wrap a given \ref msg with \ref gsm48_hdr structure.
+ * \param[out] msg A message to be wrapped
+ * \param[in] pdisc GSM TS 04.07 protocol discriminator
+ * \param[in] tid GSM TS 04.07 transaction identifier
+ * \param[in] msg_type GSM TS 04.08 message type
+ * @return pointer to pushed header within \ref msg
+ */
+struct gsm48_hdr *gsm48_push_l3hdr(struct msgb *msg,
+ uint8_t pdisc, uint8_t tid,
+ uint8_t msg_type)
+{
+ struct gsm48_hdr *gh;
+
+ gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
+ gh->proto_discr = pdisc | (tid << 4);
+ gh->msg_type = msg_type;
+
+ return gh;
+}
+
+/*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 2bb9d97..ca53c8c 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -323,6 +323,8 @@
gsm48_pdisc_msgtype_name;
gsm48_reject_value_names;
+gsm48_push_l3hdr;
+
gsm_7bit_decode;
gsm_7bit_decode_ussd;
gsm_7bit_encode;
--
To view, visit https://gerrit.osmocom.org/10328
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a045efe8335d83fcbe8d43eb180972e3b1d9dda
Gerrit-Change-Number: 10328
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180802/41ae2322/attachment.htm>