aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm48.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-08-03 05:44:00 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-08-05 23:21:43 +0700
commit30cfeeb4a0a3992b55a48c3ccefc91f727ef079e (patch)
treec472c5ebf8f720228175c3a606de24992c1780f5 /src/gsm/gsm48.c
parent39a36d01932867f780474f4b17bf42224cd57edb (diff)
libosmogsm: (re)introduce gsm48_push_l3hdr()
There was gsm0480_l3hdr_push() declared in a header file, but not exposed in 'libosmogsm.map'. Furthermore, 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 GSM 04.08 API. Also, let's introduce an auxiliary wrapper for messages, where the transaction identifier is required (see GSM 04.07, section 11.2.3.1.2). Change-Id: I8a045efe8335d83fcbe8d43eb180972e3b1d9dda
Diffstat (limited to 'src/gsm/gsm48.c')
-rw-r--r--src/gsm/gsm48.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index b4892dea..136b9375 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -1024,4 +1024,24 @@ const struct value_string gsm48_reject_value_names[] = {
{ 0, NULL }
};
+/*! 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 1/2,
+ * sub-pdisc, trans_id or skip_ind 1/2,
+ * see section 11.2.3.1 for details
+ * \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 msg_type)
+{
+ struct gsm48_hdr *gh;
+
+ gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
+ gh->proto_discr = pdisc;
+ gh->msg_type = msg_type;
+
+ return gh;
+}
+
/*! @} */