diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-02-06 16:46:03 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-02-06 16:07:54 +0000 |
commit | d397a53cfc34606dacb4f5519f3d331d024a5f5d (patch) | |
tree | 77754d90a5857564a98e887e1eda50e09b18a200 /include | |
parent | e3d32d574e0b67861cea133e0b80c84bc64286e3 (diff) |
tlv: add msgb_tv32_put(), similar to msgb_tv16_put()
Change-Id: I11301b20038aa5d90d46d968f7eda3d53b560022
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/gsm/tlv.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/osmocom/gsm/tlv.h b/include/osmocom/gsm/tlv.h index fe057f4b..bcdebb3f 100644 --- a/include/osmocom/gsm/tlv.h +++ b/include/osmocom/gsm/tlv.h @@ -414,6 +414,16 @@ static inline uint8_t *msgb_tv16_put(struct msgb *msg, uint8_t tag, uint16_t val return tv16_put(buf, tag, val); } +/*! put (append) a TV32 field to a \ref msgb + * \returns pointer to first byte after newly-put information */ +static inline uint8_t *msgb_tv32_put(struct msgb *msg, uint8_t tag, uint32_t val) +{ + uint8_t *buf = msgb_put(msg, 1 + 4); + *buf++ = tag; + osmo_store32be(val, buf); + return msg->tail; +} + /*! push (prepend) a TLV field to a \ref msgb * \returns pointer to first byte of newly-pushed information */ static inline uint8_t *msgb_tlv_push(struct msgb *msg, uint8_t tag, uint8_t len, const uint8_t *val) |