summaryrefslogtreecommitdiffstats
path: root/include/osmocore/msgb.h
diff options
context:
space:
mode:
authorHarald Welte2010-03-01 22:30:51 +0100
committerHarald Welte2010-03-01 22:30:51 +0100
commitfdd0a700930bdd04bc8827ef88dc5039ecc5b6ce (patch)
treebc893c48db3d6b251e3b5bf7823bd62e294643e3 /include/osmocore/msgb.h
parentImport value_string utilities and some RSL stuff from OpenBSC (diff)
downloadlibosmocore-fdd0a700930bdd04bc8827ef88dc5039ecc5b6ce.tar.gz
libosmocore-fdd0a700930bdd04bc8827ef88dc5039ecc5b6ce.tar.xz
libosmocore-fdd0a700930bdd04bc8827ef88dc5039ecc5b6ce.zip
add msgb_l1() and msgb_l1len() inline functions
Diffstat (limited to 'include/osmocore/msgb.h')
-rw-r--r--include/osmocore/msgb.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/osmocore/msgb.h b/include/osmocore/msgb.h
index 7de242b..4f0c8c3 100644
--- a/include/osmocore/msgb.h
+++ b/include/osmocore/msgb.h
@@ -67,10 +67,16 @@ 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);
+#define msgb_l1(m) ((void *)(m->l1h))
#define msgb_l2(m) ((void *)(m->l2h))
#define msgb_l3(m) ((void *)(m->l3h))
#define msgb_sms(m) ((void *)(m->smsh))
+static inline unsigned int msgb_l1len(const struct msgb *msgb)
+{
+ return msgb->tail - (uint8_t *)msgb_l1(msgb);
+}
+
static inline unsigned int msgb_l2len(const struct msgb *msgb)
{
return msgb->tail - (uint8_t *)msgb_l2(msgb);