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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: msgb: Add msgb_pull_to_l2() analogous to msgb_pull_to_l3() ...................................................................... msgb: Add msgb_pull_to_l2() analogous to msgb_pull_to_l3() Introduce msgb_pull_to_l2() which pulls (removes) any msgb contents in front of the L2 header (msg->l2h). Change-Id: I7786a1b30f9e7eaa3dcdb3cbb2a85a126588f6cd --- M include/osmocom/core/msgb.h 1 file changed, 15 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h index 9cb1c24..afb887c 100644 --- a/include/osmocom/core/msgb.h +++ b/include/osmocom/core/msgb.h @@ -350,6 +350,21 @@ return ret; } +/*! \brief remove (pull) all headers in front of l2h from the message buffer. + * \param[in] msgb message buffer with a valid l2h + * \returns pointer to new start of msgb (l2h) + * + * This function moves the \a data pointer of the \ref msgb further back + * in the message, thereby shrinking the size of the message. + * l1h will be cleared. + */ +static inline unsigned char *msgb_pull_to_l2(struct msgb *msg) +{ + unsigned char *ret = msgb_pull(msg, msg->l2h - msg->data); + msg->l1h = NULL; + return ret; +} + /*! \brief remove uint8 from front of message * \param[in] msgb message buffer * \returns 8bit value taken from end of msgb -- To view, visit https://gerrit.osmocom.org/2366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7786a1b30f9e7eaa3dcdb3cbb2a85a126588f6cd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder