diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-03-10 15:00:20 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-03-10 15:00:20 +0100 |
commit | 4b3de6840ef08b0630bafb9d4d19fc2d10aacdd1 (patch) | |
tree | 3d9ffc8100b1bdb4350bd1bea206f0eeae133f4c /include/osmocom | |
parent | 10f0bdecad8d711ccc5fcc04bb0be0adf11a7902 (diff) | |
parent | 8dac4159adb7377f016317808e3a6b0c79df7fa1 (diff) |
Merge branch 'jerlbeck/fixes/ladp-sms'
Diffstat (limited to 'include/osmocom')
-rw-r--r-- | include/osmocom/core/msgb.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h index fe2733b7..33e8081f 100644 --- a/include/osmocom/core/msgb.h +++ b/include/osmocom/core/msgb.h @@ -73,6 +73,7 @@ extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); extern struct msgb *msgb_dequeue(struct llist_head *queue); extern void msgb_reset(struct msgb *m); uint16_t msgb_length(const struct msgb *msg); +extern const char *msgb_hexdump(const struct msgb *msg); #ifdef MSGB_DEBUG #include <osmocom/core/panic.h> @@ -299,6 +300,21 @@ static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len) return msgb->data += len; } +/*! \brief remove (pull) all headers in front of l3h from the message buffer. + * \param[in] msgb message buffer with a valid l3h + * \returns pointer to new start of msgb (l3h) + * + * This function moves the \a data pointer of the \ref msgb further back + * in the message, thereby shrinking the size of the message. + * l1h and l2h will be cleared. + */ +static inline unsigned char *msgb_pull_to_l3(struct msgb *msg) +{ + unsigned char *ret = msgb_pull(msg, msg->l3h - msg->data); + msg->l1h = msg->l2h = NULL; + return ret; +} + /*! \brief remove uint8 from front of message * \param[in] msgb message buffer * \returns 8bit value taken from end of msgb |