diff --git a/nimble/host/mesh/include/mesh/glue.h b/nimble/host/mesh/include/mesh/glue.h index 7237a82af..b458ffebf 100644 --- a/nimble/host/mesh/include/mesh/glue.h +++ b/nimble/host/mesh/include/mesh/glue.h @@ -215,11 +215,13 @@ void net_buf_unref(struct os_mbuf *om); uint16_t net_buf_simple_pull_le16(struct os_mbuf *om); uint16_t net_buf_simple_pull_be16(struct os_mbuf *om); uint32_t net_buf_simple_pull_be32(struct os_mbuf *om); +uint32_t net_buf_simple_pull_le32(struct os_mbuf *om); uint8_t net_buf_simple_pull_u8(struct os_mbuf *om); void net_buf_simple_add_le16(struct os_mbuf *om, uint16_t val); void net_buf_simple_add_be16(struct os_mbuf *om, uint16_t val); void net_buf_simple_add_u8(struct os_mbuf *om, uint8_t val); void net_buf_simple_add_be32(struct os_mbuf *om, uint32_t val); +void net_buf_simple_add_le32(struct os_mbuf *om, uint32_t val); void net_buf_add_zeros(struct os_mbuf *om, uint8_t len); void net_buf_simple_push_le16(struct os_mbuf *om, uint16_t val); void net_buf_simple_push_be16(struct os_mbuf *om, uint16_t val); diff --git a/nimble/host/mesh/src/glue.c b/nimble/host/mesh/src/glue.c index 5933bb5ca..01dbdf431 100644 --- a/nimble/host/mesh/src/glue.c +++ b/nimble/host/mesh/src/glue.c @@ -183,6 +183,20 @@ net_buf_simple_pull_be32(struct os_mbuf *om) return val; } +uint32_t +net_buf_simple_pull_le32(struct os_mbuf *om) +{ + uint32_t val; + struct os_mbuf *old = om; + + om = os_mbuf_pullup(om, sizeof(val)); + assert(om == old); + val = get_le32(om->om_data); + os_mbuf_adj(om, sizeof(val)); + + return val; +} + uint8_t net_buf_simple_pull_u8(struct os_mbuf *om) { @@ -221,6 +235,14 @@ net_buf_simple_add_be32(struct os_mbuf *om, uint32_t val) ASSERT_NOT_CHAIN(om); } +void +net_buf_simple_add_le32(struct os_mbuf *om, uint32_t val) +{ + val = htole32(val); + os_mbuf_append(om, &val, sizeof(val)); + ASSERT_NOT_CHAIN(om); +} + void net_buf_simple_add_u8(struct os_mbuf *om, uint8_t val) {