diff --git a/TODO-RELEASE b/TODO-RELEASE index 64833d232..5222ec965 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 b1cb6ec70..8843db014 100644 --- a/include/osmocom/core/msgb.h +++ b/include/osmocom/core/msgb.h @@ -169,6 +169,18 @@ static inline unsigned int msgb_l3len(const struct msgb *msgb) 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_sms(msgb); +} + /*! determine the length of the header * \param[in] msgb message buffer * \returns number of bytes between start of buffer and start of msg