mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-08 23:57:21 +00:00
Merge pull request #150 from michal-narajowski/glue-net-buf-ports
mesh: glue: Add utility net_buf functions for later use
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user