<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11647">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core/msgb.h: introduce msgb_l4len() helper<br><br>There is already a group of similar functions for L1, L2 and L3,<br>but L4 was missing. The L4 is usually used for parsing of complex<br>L3 messages, such as SS/USSD and SMS.<br><br>This change introduces a similar halper for L4.<br><br>Change-Id: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6<br>---<br>M TODO-RELEASE<br>M include/osmocom/core/msgb.h<br>2 files changed, 13 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/11647/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/TODO-RELEASE b/TODO-RELEASE</span><br><span>index 64833d2..5222ec9 100644</span><br><span>--- a/TODO-RELEASE</span><br><span>+++ b/TODO-RELEASE</span><br><span>@@ -10,3 +10,4 @@</span><br><span> libosmogsm      gsm0480_l3hdr_push()    removed from gsm/gsm0480.h (was not exposed)</span><br><span> libosmogsm      gsm48_push_l3hdr()      (re)introduced in gsm/gsm48.h (GSM 04.08 API)</span><br><span> libosmogsm     gsm48_push_l3hdr_tid()  a wrapper around gsm48_push_l3hdr()</span><br><span style="color: hsl(120, 100%, 40%);">+libosmocore        msgb_l4len              new symbol (exposed as 'static inline' in msgb.h)</span><br><span>diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h</span><br><span>index b1cb6ec..86177f1 100644</span><br><span>--- a/include/osmocom/core/msgb.h</span><br><span>+++ b/include/osmocom/core/msgb.h</span><br><span>@@ -169,6 +169,18 @@</span><br><span>    return msgb->tail - (uint8_t *)msgb_l3(msgb);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! determine length of L4 message</span><br><span style="color: hsl(120, 100%, 40%);">+ *  \param[in] msgb message buffer</span><br><span style="color: hsl(120, 100%, 40%);">+ *  \returns size of L4 message in bytes</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This function computes the number of bytes between the tail of the</span><br><span style="color: hsl(120, 100%, 40%);">+ * message and the layer 4 header.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static inline unsigned int msgb_l4len(const struct msgb *msgb)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    return msgb->tail - (uint8_t *)msgb_l4(msgb);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! determine the length of the header</span><br><span>  *  \param[in] msgb message buffer</span><br><span>  *  \returns number of bytes between start of buffer and start of msg</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11647">change 11647</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11647"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6 </div>
<div style="display:none"> Gerrit-Change-Number: 11647 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>