tlv: Introduce API msgb_tv32_push()

msgb_tv32_put() already exists, but msgb_tv32_push doesn't.
The tv16 counterparts are already present, and having to pass 32bit
integers is also quite common, so let's add an API for it.

Change-Id: I68d5693a18d55ce8d0647359044157d7e5bfae50
This commit is contained in:
Pau Espin 2023-08-09 17:21:01 +02:00 committed by pespin
parent 3c577269c8
commit 6df53dc769
2 changed files with 11 additions and 0 deletions

View File

@ -17,3 +17,4 @@ libosmogsm ADD new osmo_sub_auth_data2 / osmo_auth_gen_vec2 / osmo_auth_gen_vec_
libosmogsm MODIFY osmo_auth_impl callback function signature change. No known external users
libosmogsm ADD osmo_auth_c2
libosmogsm ADD OSMO_AUTH_ALG_TUAK
libosmogsm ADD new API msgb_tv32_push()

View File

@ -457,6 +457,16 @@ static inline uint8_t *msgb_tv16_push(struct msgb *msg, uint8_t tag, uint16_t va
return buf;
}
/*! push (prepend) a TV32 field to a \ref msgb
* \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tv32_push(struct msgb *msg, uint8_t tag, uint32_t val)
{
uint8_t *buf = msgb_push(msg, 5);
*buf++ = tag;
osmo_store32be(val, buf);
return buf;
}
/*! push (prepend) a TvLV field to a \ref msgb
* \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tvlv_push(struct msgb *msg, uint8_t tag, uint16_t len,