Change in libosmocore[master]: core/msgb.h: introduce msgb_l4len() helper

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.org
Tue Nov 6 20:56:36 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11647


Change subject: core/msgb.h: introduce msgb_l4len() helper
......................................................................

core/msgb.h: introduce msgb_l4len() helper

There is already a group of similar functions for L1, L2 and L3,
but L4 was missing. The L4 is usually used for parsing of complex
L3 messages, such as SS/USSD and SMS.

This change introduces a similar halper for L4.

Change-Id: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6
---
M TODO-RELEASE
M include/osmocom/core/msgb.h
2 files changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/11647/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 64833d2..5222ec9 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,3 +10,4 @@
 libosmogsm	gsm0480_l3hdr_push()	removed from gsm/gsm0480.h (was not exposed)
 libosmogsm	gsm48_push_l3hdr()	(re)introduced in gsm/gsm48.h (GSM 04.08 API)
 libosmogsm	gsm48_push_l3hdr_tid()	a wrapper around gsm48_push_l3hdr()
+libosmocore	msgb_l4len		new symbol (exposed as 'static inline' in msgb.h)
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index b1cb6ec..86177f1 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -169,6 +169,18 @@
 	return msgb->tail - (uint8_t *)msgb_l3(msgb);
 }
 
+/*! determine length of L4 message
+ *  \param[in] msgb message buffer
+ *  \returns size of L4 message in bytes
+ *
+ * This function computes the number of bytes between the tail of the
+ * message and the layer 4 header.
+ */
+static inline unsigned int msgb_l4len(const struct msgb *msgb)
+{
+	return msgb->tail - (uint8_t *)msgb_l4(msgb);
+}
+
 /*! determine the length of the header
  *  \param[in] msgb message buffer
  *  \returns number of bytes between start of buffer and start of msg

-- 
To view, visit https://gerrit.osmocom.org/11647
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: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6
Gerrit-Change-Number: 11647
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/20181106/f7287fb3/attachment.htm>


More information about the gerrit-log mailing list