From d397a53cfc34606dacb4f5519f3d331d024a5f5d Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 6 Feb 2021 16:46:03 +0100 Subject: tlv: add msgb_tv32_put(), similar to msgb_tv16_put() Change-Id: I11301b20038aa5d90d46d968f7eda3d53b560022 --- include/osmocom/gsm/tlv.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/osmocom') 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) -- cgit v1.2.3