10#ifndef ZEPHYR_INCLUDE_NET_BUF_H_ 
   11#define ZEPHYR_INCLUDE_NET_BUF_H_ 
   31#define __net_buf_align __aligned(sizeof(void *)) 
   42#define NET_BUF_SIMPLE_DEFINE(_name, _size)     \ 
   43        uint8_t net_buf_data_##_name[_size];       \ 
   44        struct net_buf_simple _name = {         \ 
   45                .data   = net_buf_data_##_name, \ 
   48                .__buf  = net_buf_data_##_name, \ 
 
   61#define NET_BUF_SIMPLE_DEFINE_STATIC(_name, _size)        \ 
   62        static __noinit uint8_t net_buf_data_##_name[_size]; \ 
   63        static struct net_buf_simple _name = {            \ 
   64                .data   = net_buf_data_##_name,           \ 
   67                .__buf  = net_buf_data_##_name,           \ 
 
  119#define NET_BUF_SIMPLE(_size)                        \ 
  120        ((struct net_buf_simple *)(&(struct {        \ 
  121                struct net_buf_simple buf;           \ 
  122                uint8_t data[_size];                 \ 
 
  140                buf->__buf = (
uint8_t *)buf + 
sizeof(*buf);
 
  143        buf->
data = buf->__buf + reserve_head;
 
 
  157                                   void *
data, 
size_t size);
 
  169        buf->
data = buf->__buf;
 
 
  897#define NET_BUF_EXTERNAL_DATA  BIT(0) 
  987#if defined(CONFIG_NET_BUF_POOL_USAGE) 
 1005        struct net_buf * 
const __bufs;
 
 
 1009#if defined(CONFIG_NET_BUF_POOL_USAGE) 
 1010#define NET_BUF_POOL_INITIALIZER(_pool, _alloc, _bufs, _count, _ud_size, _destroy) \ 
 1012                .free = Z_LIFO_INITIALIZER(_pool.free),                            \ 
 1014                .buf_count = _count,                                               \ 
 1015                .uninit_count = _count,                                            \ 
 1016                .user_data_size = _ud_size,                                        \ 
 1017                .avail_count = ATOMIC_INIT(_count),                                \ 
 1018                .name = STRINGIFY(_pool),                                          \ 
 1019                .destroy = _destroy,                                               \ 
 1021                .__bufs = (struct net_buf *)_bufs,                                 \ 
 1024#define NET_BUF_POOL_INITIALIZER(_pool, _alloc, _bufs, _count, _ud_size, _destroy) \ 
 1026                .free = Z_LIFO_INITIALIZER(_pool.free),                            \ 
 1028                .buf_count = _count,                                               \ 
 1029                .uninit_count = _count,                                            \ 
 1030                .user_data_size = _ud_size,                                        \ 
 1031                .destroy = _destroy,                                               \ 
 1033                .__bufs = (struct net_buf *)_bufs,                                 \ 
 1037#define _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size)                                         \ 
 1038        struct _net_buf_##_name { uint8_t b[sizeof(struct net_buf)];                           \ 
 1039                                  uint8_t ud[_ud_size]; } __net_buf_align;                     \ 
 1040        BUILD_ASSERT(_ud_size <= UINT8_MAX);                                                   \ 
 1041        BUILD_ASSERT(offsetof(struct net_buf, user_data) ==                                    \ 
 1042                     offsetof(struct _net_buf_##_name, ud), "Invalid offset");                 \ 
 1043        BUILD_ASSERT(__alignof__(struct net_buf) ==                                            \ 
 1044                     __alignof__(struct _net_buf_##_name), "Invalid alignment");               \ 
 1045        BUILD_ASSERT(sizeof(struct _net_buf_##_name) ==                                        \ 
 1046                     ROUND_UP(sizeof(struct net_buf) + _ud_size, __alignof__(struct net_buf)), \ 
 1047                     "Size cannot be determined");                                             \ 
 1048        static struct _net_buf_##_name _net_buf_##_name[_count] __noinit 
 1080#define NET_BUF_POOL_HEAP_DEFINE(_name, _count, _ud_size, _destroy)          \ 
 1081        _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size);                      \ 
 1082        static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) =                \ 
 1083                NET_BUF_POOL_INITIALIZER(_name, &net_buf_heap_alloc,         \ 
 1084                                         _net_buf_##_name, _count, _ud_size, \ 
 
 1124#define NET_BUF_POOL_FIXED_DEFINE(_name, _count, _data_size, _ud_size, _destroy) \ 
 1125        _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size);                        \ 
 1126        static uint8_t __noinit net_buf_data_##_name[_count][_data_size] __net_buf_align; \ 
 1127        static const struct net_buf_pool_fixed net_buf_fixed_##_name = {       \ 
 1128                .data_size = _data_size,                                       \ 
 1129                .data_pool = (uint8_t *)net_buf_data_##_name,                  \ 
 1131        static const struct net_buf_data_alloc net_buf_fixed_alloc_##_name = { \ 
 1132                .cb = &net_buf_fixed_cb,                                       \ 
 1133                .alloc_data = (void *)&net_buf_fixed_##_name,                  \ 
 1135        static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) =                  \ 
 1136                NET_BUF_POOL_INITIALIZER(_name, &net_buf_fixed_alloc_##_name,  \ 
 1137                                         _net_buf_##_name, _count, _ud_size,   \ 
 
 1168#define NET_BUF_POOL_VAR_DEFINE(_name, _count, _data_size, _ud_size, _destroy) \ 
 1169        _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size);                        \ 
 1170        K_HEAP_DEFINE(net_buf_mem_pool_##_name, _data_size);                   \ 
 1171        static const struct net_buf_data_alloc net_buf_data_alloc_##_name = {  \ 
 1172                .cb = &net_buf_var_cb,                                         \ 
 1173                .alloc_data = &net_buf_mem_pool_##_name,                       \ 
 1175        static STRUCT_SECTION_ITERABLE(net_buf_pool, _name) =                  \ 
 1176                NET_BUF_POOL_INITIALIZER(_name, &net_buf_data_alloc_##_name,   \ 
 1177                                         _net_buf_##_name, _count, _ud_size,   \ 
 
 1201#define NET_BUF_POOL_DEFINE(_name, _count, _size, _ud_size, _destroy)        \ 
 1202        NET_BUF_POOL_FIXED_DEFINE(_name, _count, _size, _ud_size, _destroy) 
 
 1241#if defined(CONFIG_NET_BUF_LOG) 
 1246#define net_buf_alloc_fixed(_pool, _timeout) \ 
 1247        net_buf_alloc_fixed_debug(_pool, _timeout, __func__, __LINE__) 
 1277#if defined(CONFIG_NET_BUF_LOG) 
 1283#define net_buf_alloc_len(_pool, _size, _timeout) \ 
 1284        net_buf_alloc_len_debug(_pool, _size, _timeout, __func__, __LINE__) 
 1310#if defined(CONFIG_NET_BUF_LOG) 
 1314                                                            const char *
func, 
int line);
 
 1315#define net_buf_alloc_with_data(_pool, _data_, _size, _timeout)         \ 
 1316        net_buf_alloc_with_data_debug(_pool, _data_, _size, _timeout,   \ 
 1337#if defined(CONFIG_NET_BUF_LOG) 
 1340                                                const char *
func, 
int line);
 
 1341#define net_buf_get(_fifo, _timeout) \ 
 1342        net_buf_get_debug(_fifo, _timeout, __func__, __LINE__) 
 1424#if defined(CONFIG_NET_BUF_LOG) 
 1425void net_buf_unref_debug(
struct net_buf *buf, 
const char *
func, 
int line);
 
 1426#define net_buf_unref(_buf) \ 
 1427        net_buf_unref_debug(_buf, __func__, __LINE__) 
 2347#if defined(CONFIG_NET_BUF_LOG) 
 2350                                       const char *
func, 
int line);
 
 2351#define net_buf_frag_del(_parent, _frag) \ 
 2352        net_buf_frag_del_debug(_parent, _frag, __func__, __LINE__) 
 2373                         struct net_buf *src, 
size_t offset, 
size_t len);
 
 2434        while (buf && 
len--) {
 
 
long atomic_t
Definition atomic.h:22
 
ZTEST_BMEM int timeout
Definition main.c:31
 
struct k_fifo fifo
Definition errno.c:44
 
#define k_lifo_put(lifo, data)
Add an element to a LIFO queue.
Definition kernel.h:2678
 
struct net_buf * net_buf_get(struct k_fifo *fifo, k_timeout_t timeout)
Get a buffer from a FIFO.
 
void net_buf_simple_clone(const struct net_buf_simple *original, struct net_buf_simple *clone)
Clone buffer state, using the same data buffer.
 
static void net_buf_simple_init(struct net_buf_simple *buf, size_t reserve_head)
Initialize a net_buf_simple object.
Definition buf.h:136
 
struct net_buf * net_buf_frag_last(struct net_buf *frags)
Find the last fragment in the fragment list.
 
static void net_buf_add_be64(struct net_buf *buf, uint64_t val)
Add 64-bit value at the end of the buffer.
Definition buf.h:1677
 
static size_t net_buf_headroom(struct net_buf *buf)
Check buffer headroom.
Definition buf.h:2269
 
uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
Remove a 8-bit value from the beginning of the buffer.
 
uint16_t net_buf_simple_remove_le16(struct net_buf_simple *buf)
Remove and convert 16 bits from the end of the buffer.
 
static uint64_t net_buf_remove_le48(struct net_buf *buf)
Remove and convert 48 bits from the end of the buffer.
Definition buf.h:1812
 
struct net_buf * net_buf_frag_add(struct net_buf *head, struct net_buf *frag)
Add a new fragment to the end of a chain of bufs.
 
void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve)
Initialize buffer with the given headroom.
 
void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val)
Push 8-bit value to the beginning of the buffer.
 
static void net_buf_add_be24(struct net_buf *buf, uint32_t val)
Add 24-bit value at the end of the buffer.
Definition buf.h:1587
 
struct net_buf * net_buf_alloc_len(struct net_buf_pool *pool, size_t size, k_timeout_t timeout)
Allocate a new variable length buffer from a pool.
 
void net_buf_reset(struct net_buf *buf)
Reset buffer.
 
struct net_buf_pool * net_buf_pool_get(int id)
Looks up a pool based on its ID.
 
void * net_buf_simple_add(struct net_buf_simple *buf, size_t len)
Prepare data to be added at the end of the buffer.
 
uint64_t net_buf_simple_pull_be48(struct net_buf_simple *buf)
Remove and convert 48 bits from the beginning of the buffer.
 
uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf)
Remove and convert 32 bits from the beginning of the buffer.
 
void net_buf_simple_push_be48(struct net_buf_simple *buf, uint64_t val)
Push 48-bit value to the beginning of the buffer.
 
struct net_buf * net_buf_slist_get(sys_slist_t *list)
Get a buffer from a list.
 
struct net_buf * net_buf_ref(struct net_buf *buf)
Increment the reference count of a buffer.
 
struct net_buf *(* net_buf_allocator_cb)(k_timeout_t timeout, void *user_data)
Network buffer allocator callback.
Definition buf.h:2389
 
static struct net_buf * net_buf_skip(struct net_buf *buf, size_t len)
Skip N number of bytes in a net_buf.
Definition buf.h:2432
 
static void * net_buf_add(struct net_buf *buf, size_t len)
Prepare data to be added at the end of the buffer.
Definition buf.h:1493
 
static void net_buf_add_le24(struct net_buf *buf, uint32_t val)
Add 24-bit value at the end of the buffer.
Definition buf.h:1572
 
uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf)
Remove and convert 32 bits from the beginning of the buffer.
 
void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val)
Add 32-bit value at the end of the buffer.
 
static uint64_t net_buf_pull_be64(struct net_buf *buf)
Remove and convert 64 bits from the beginning of the buffer.
Definition buf.h:2241
 
static void net_buf_push_be64(struct net_buf *buf, uint64_t val)
Push 64-bit value to the beginning of the buffer.
Definition buf.h:2044
 
static uint64_t net_buf_remove_le64(struct net_buf *buf)
Remove and convert 64 bits from the end of the buffer.
Definition buf.h:1842
 
static void net_buf_simple_reset(struct net_buf_simple *buf)
Reset buffer.
Definition buf.h:166
 
uint32_t net_buf_simple_pull_be24(struct net_buf_simple *buf)
Remove and convert 24 bits from the beginning of the buffer.
 
uint32_t net_buf_simple_pull_le24(struct net_buf_simple *buf)
Remove and convert 24 bits from the beginning of the buffer.
 
uint32_t net_buf_simple_remove_le24(struct net_buf_simple *buf)
Remove and convert 24 bits from the end of the buffer.
 
void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val)
Push 16-bit value to the beginning of the buffer.
 
static struct net_buf * net_buf_alloc(struct net_buf_pool *pool, k_timeout_t timeout)
Definition buf.h:1256
 
static void net_buf_add_be32(struct net_buf *buf, uint32_t val)
Add 32-bit value at the end of the buffer.
Definition buf.h:1617
 
uint64_t net_buf_simple_remove_le64(struct net_buf_simple *buf)
Remove and convert 64 bits from the end of the buffer.
 
size_t net_buf_simple_tailroom(struct net_buf_simple *buf)
Check buffer tailroom.
 
static void net_buf_simple_save(struct net_buf_simple *buf, struct net_buf_simple_state *state)
Save the parsing state of a buffer.
Definition buf.h:865
 
void net_buf_simple_add_le48(struct net_buf_simple *buf, uint64_t val)
Add 48-bit value at the end of the buffer.
 
static uint16_t net_buf_remove_be16(struct net_buf *buf)
Remove and convert 16 bits from the end of the buffer.
Definition buf.h:1737
 
void net_buf_simple_add_be24(struct net_buf_simple *buf, uint32_t val)
Add 24-bit value at the end of the buffer.
 
static uint32_t net_buf_pull_le32(struct net_buf *buf)
Remove and convert 32 bits from the beginning of the buffer.
Definition buf.h:2166
 
static uint32_t net_buf_pull_be32(struct net_buf *buf)
Remove and convert 32 bits from the beginning of the buffer.
Definition buf.h:2181
 
struct net_buf * net_buf_frag_del(struct net_buf *parent, struct net_buf *frag)
Delete existing fragment from a chain of bufs.
 
uint64_t net_buf_simple_remove_be64(struct net_buf_simple *buf)
Remove and convert 64 bits from the end of the buffer.
 
static size_t net_buf_tailroom(struct net_buf *buf)
Check buffer tailroom.
Definition buf.h:2255
 
static void net_buf_add_be16(struct net_buf *buf, uint16_t val)
Add 16-bit value at the end of the buffer.
Definition buf.h:1557
 
size_t net_buf_append_bytes(struct net_buf *buf, size_t len, const void *value, k_timeout_t timeout, net_buf_allocator_cb allocate_cb, void *user_data)
Append data to a list of net_buf.
 
void * net_buf_simple_push(struct net_buf_simple *buf, size_t len)
Prepare data to be added to the start of the buffer.
 
void net_buf_simple_push_le48(struct net_buf_simple *buf, uint64_t val)
Push 48-bit value to the beginning of the buffer.
 
struct net_buf * net_buf_alloc_fixed(struct net_buf_pool *pool, k_timeout_t timeout)
Allocate a new fixed buffer from a pool.
 
static uint64_t net_buf_pull_be48(struct net_buf *buf)
Remove and convert 48 bits from the beginning of the buffer.
Definition buf.h:2211
 
uint64_t net_buf_simple_pull_le48(struct net_buf_simple *buf)
Remove and convert 48 bits from the beginning of the buffer.
 
void net_buf_slist_put(sys_slist_t *list, struct net_buf *buf)
Put a buffer into a list.
 
static void net_buf_push_be16(struct net_buf *buf, uint16_t val)
Push 16-bit value to the beginning of the buffer.
Definition buf.h:1932
 
static uint32_t net_buf_remove_be24(struct net_buf *buf)
Remove and convert 24 bits from the end of the buffer.
Definition buf.h:1752
 
static uint8_t net_buf_pull_u8(struct net_buf *buf)
Remove a 8-bit value from the beginning of the buffer.
Definition buf.h:2091
 
static void net_buf_destroy(struct net_buf *buf)
Destroy buffer from custom destroy callback.
Definition buf.h:1357
 
void net_buf_simple_push_le64(struct net_buf_simple *buf, uint64_t val)
Push 64-bit value to the beginning of the buffer.
 
void net_buf_simple_add_le64(struct net_buf_simple *buf, uint64_t val)
Add 64-bit value at the end of the buffer.
 
uint16_t net_buf_simple_max_len(struct net_buf_simple *buf)
Check maximum net_buf_simple::len value.
 
uint64_t net_buf_simple_pull_le64(struct net_buf_simple *buf)
Remove and convert 64 bits from the beginning of the buffer.
 
void net_buf_put(struct k_fifo *fifo, struct net_buf *buf)
Put a buffer to the end of a FIFO.
 
static void * net_buf_push_mem(struct net_buf *buf, const void *mem, size_t len)
Copies the given number of bytes to the start of the buffer.
Definition buf.h:1890
 
static uint64_t net_buf_pull_le48(struct net_buf *buf)
Remove and convert 48 bits from the beginning of the buffer.
Definition buf.h:2196
 
void net_buf_simple_init_with_data(struct net_buf_simple *buf, void *data, size_t size)
Initialize a net_buf_simple object with data.
 
void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val)
Push 16-bit value to the beginning of the buffer.
 
void * net_buf_simple_remove_mem(struct net_buf_simple *buf, size_t len)
Remove data from the end of the buffer.
 
static void net_buf_push_le48(struct net_buf *buf, uint64_t val)
Push 48-bit value to the beginning of the buffer.
Definition buf.h:2002
 
static uint32_t net_buf_pull_le24(struct net_buf *buf)
Remove and convert 24 bits from the beginning of the buffer.
Definition buf.h:2136
 
void net_buf_simple_push_le32(struct net_buf_simple *buf, uint32_t val)
Push 32-bit value to the beginning of the buffer.
 
static uint8_t * net_buf_add_u8(struct net_buf *buf, uint8_t val)
Add (8-bit) byte at the end of the buffer.
Definition buf.h:1527
 
static void net_buf_push_be24(struct net_buf *buf, uint32_t val)
Push 24-bit value to the beginning of the buffer.
Definition buf.h:1960
 
static void net_buf_push_le24(struct net_buf *buf, uint32_t val)
Push 24-bit value to the beginning of the buffer.
Definition buf.h:1946
 
static void net_buf_reserve(struct net_buf *buf, size_t reserve)
Initialize buffer with the given headroom.
Definition buf.h:1477
 
static uint64_t net_buf_remove_be64(struct net_buf *buf)
Remove and convert 64 bits from the end of the buffer.
Definition buf.h:1857
 
struct net_buf * net_buf_alloc_with_data(struct net_buf_pool *pool, void *data, size_t size, k_timeout_t timeout)
Allocate a new buffer from a pool but with external data pointer.
 
static uint8_t * net_buf_simple_tail(struct net_buf_simple *buf)
Get the tail pointer for a buffer.
Definition buf.h:805
 
static uint32_t net_buf_pull_be24(struct net_buf *buf)
Remove and convert 24 bits from the beginning of the buffer.
Definition buf.h:2151
 
void net_buf_simple_add_be64(struct net_buf_simple *buf, uint64_t val)
Add 64-bit value at the end of the buffer.
 
static void net_buf_add_be48(struct net_buf *buf, uint64_t val)
Add 48-bit value at the end of the buffer.
Definition buf.h:1647
 
uint8_t * net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val)
Add (8-bit) byte at the end of the buffer.
 
static uint32_t net_buf_remove_le24(struct net_buf *buf)
Remove and convert 24 bits from the end of the buffer.
Definition buf.h:1767
 
static void net_buf_push_u8(struct net_buf *buf, uint8_t val)
Push 8-bit value to the beginning of the buffer.
Definition buf.h:1904
 
void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val)
Add 16-bit value at the end of the buffer.
 
uint16_t net_buf_simple_remove_be16(struct net_buf_simple *buf)
Remove and convert 16 bits from the end of the buffer.
 
static void * net_buf_push(struct net_buf *buf, size_t len)
Prepare data to be added at the start of the buffer.
Definition buf.h:1873
 
static uint16_t net_buf_pull_be16(struct net_buf *buf)
Remove and convert 16 bits from the beginning of the buffer.
Definition buf.h:2121
 
static void net_buf_push_le32(struct net_buf *buf, uint32_t val)
Push 32-bit value to the beginning of the buffer.
Definition buf.h:1974
 
static uint64_t net_buf_pull_le64(struct net_buf *buf)
Remove and convert 64 bits from the beginning of the buffer.
Definition buf.h:2226
 
uint32_t net_buf_simple_remove_be24(struct net_buf_simple *buf)
Remove and convert 24 bits from the end of the buffer.
 
void * net_buf_simple_pull_mem(struct net_buf_simple *buf, size_t len)
Remove data from the beginning of the buffer.
 
uint32_t net_buf_simple_remove_le32(struct net_buf_simple *buf)
Remove and convert 32 bits from the end of the buffer.
 
void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val)
Add 16-bit value at the end of the buffer.
 
void * net_buf_simple_push_mem(struct net_buf_simple *buf, const void *mem, size_t len)
Copy given number of bytes from memory to the start of the buffer.
 
static uint64_t net_buf_remove_be48(struct net_buf *buf)
Remove and convert 48 bits from the end of the buffer.
Definition buf.h:1827
 
static uint16_t net_buf_max_len(struct net_buf *buf)
Check maximum net_buf::len value.
Definition buf.h:2283
 
void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val)
Add 32-bit value at the end of the buffer.
 
static uint16_t net_buf_remove_le16(struct net_buf *buf)
Remove and convert 16 bits from the end of the buffer.
Definition buf.h:1722
 
static void net_buf_push_le16(struct net_buf *buf, uint16_t val)
Push 16-bit value to the beginning of the buffer.
Definition buf.h:1918
 
uint64_t net_buf_simple_remove_be48(struct net_buf_simple *buf)
Remove and convert 48 bits from the end of the buffer.
 
void net_buf_simple_push_le24(struct net_buf_simple *buf, uint32_t val)
Push 24-bit value to the beginning of the buffer.
 
void net_buf_unref(struct net_buf *buf)
Decrements the reference count of a buffer.
 
static void net_buf_push_be48(struct net_buf *buf, uint64_t val)
Push 48-bit value to the beginning of the buffer.
Definition buf.h:2016
 
void net_buf_simple_push_be24(struct net_buf_simple *buf, uint32_t val)
Push 24-bit value to the beginning of the buffer.
 
void net_buf_frag_insert(struct net_buf *parent, struct net_buf *frag)
Insert a new fragment to a chain of bufs.
 
uint64_t net_buf_simple_remove_le48(struct net_buf_simple *buf)
Remove and convert 48 bits from the end of the buffer.
 
void * net_buf_simple_add_mem(struct net_buf_simple *buf, const void *mem, size_t len)
Copy given number of bytes from memory to the end of the buffer.
 
static void net_buf_add_le64(struct net_buf *buf, uint64_t val)
Add 64-bit value at the end of the buffer.
Definition buf.h:1662
 
static uint8_t * net_buf_tail(struct net_buf *buf)
Get the tail pointer for a buffer.
Definition buf.h:2297
 
static uint32_t net_buf_remove_be32(struct net_buf *buf)
Remove and convert 32 bits from the end of the buffer.
Definition buf.h:1797
 
static void * net_buf_remove_mem(struct net_buf *buf, size_t len)
Remove data from the end of the buffer.
Definition buf.h:1692
 
static void * net_buf_add_mem(struct net_buf *buf, const void *mem, size_t len)
Copies the given number of bytes to the end of the buffer.
Definition buf.h:1510
 
size_t net_buf_simple_headroom(struct net_buf_simple *buf)
Check buffer headroom.
 
uint64_t net_buf_simple_pull_be64(struct net_buf_simple *buf)
Remove and convert 64 bits from the beginning of the buffer.
 
void net_buf_simple_push_be32(struct net_buf_simple *buf, uint32_t val)
Push 32-bit value to the beginning of the buffer.
 
static void net_buf_push_le64(struct net_buf *buf, uint64_t val)
Push 64-bit value to the beginning of the buffer.
Definition buf.h:2030
 
uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf)
Remove and convert 16 bits from the beginning of the buffer.
 
int net_buf_id(struct net_buf *buf)
Get a zero-based index for a buffer.
 
static uint8_t net_buf_remove_u8(struct net_buf *buf)
Remove a 8-bit value from the end of the buffer.
Definition buf.h:1707
 
void net_buf_simple_add_be48(struct net_buf_simple *buf, uint64_t val)
Add 48-bit value at the end of the buffer.
 
static void net_buf_add_le16(struct net_buf *buf, uint16_t val)
Add 16-bit value at the end of the buffer.
Definition buf.h:1542
 
uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf)
Remove and convert 16 bits from the beginning of the buffer.
 
static void net_buf_push_be32(struct net_buf *buf, uint32_t val)
Push 32-bit value to the beginning of the buffer.
Definition buf.h:1988
 
static void net_buf_add_le32(struct net_buf *buf, uint32_t val)
Add 32-bit value at the end of the buffer.
Definition buf.h:1602
 
uint32_t net_buf_simple_remove_be32(struct net_buf_simple *buf)
Remove and convert 32 bits from the end of the buffer.
 
static uint32_t net_buf_remove_le32(struct net_buf *buf)
Remove and convert 32 bits from the end of the buffer.
Definition buf.h:1782
 
static size_t net_buf_frags_len(struct net_buf *buf)
Calculate amount of bytes stored in fragments.
Definition buf.h:2454
 
static uint16_t net_buf_pull_le16(struct net_buf *buf)
Remove and convert 16 bits from the beginning of the buffer.
Definition buf.h:2106
 
static void * net_buf_pull_mem(struct net_buf *buf, size_t len)
Remove data from the beginning of the buffer.
Definition buf.h:2076
 
static void net_buf_simple_restore(struct net_buf_simple *buf, struct net_buf_simple_state *state)
Restore the parsing state of a buffer.
Definition buf.h:881
 
static void * net_buf_pull(struct net_buf *buf, size_t len)
Remove data from the beginning of the buffer.
Definition buf.h:2060
 
static void net_buf_add_le48(struct net_buf *buf, uint64_t val)
Add 48-bit value at the end of the buffer.
Definition buf.h:1632
 
void net_buf_simple_add_le24(struct net_buf_simple *buf, uint32_t val)
Add 24-bit value at the end of the buffer.
 
static void * net_buf_user_data(const struct net_buf *buf)
Get a pointer to the user data of a buffer.
Definition buf.h:1464
 
struct net_buf * net_buf_clone(struct net_buf *buf, k_timeout_t timeout)
Clone buffer.
 
uint8_t net_buf_simple_remove_u8(struct net_buf_simple *buf)
Remove a 8-bit value from the end of the buffer.
 
void * net_buf_simple_pull(struct net_buf_simple *buf, size_t len)
Remove data from the beginning of the buffer.
 
size_t net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src, size_t offset, size_t len)
Copy bytes from net_buf chain starting at offset to linear buffer.
 
void net_buf_simple_push_be64(struct net_buf_simple *buf, uint64_t val)
Push 64-bit value to the beginning of the buffer.
 
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
 
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
 
state
Definition parser_state.h:29
 
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
 
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
 
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
 
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
 
Kernel Spin Lock.
Definition spinlock.h:45
 
Kernel timeout type.
Definition sys_clock.h:65
 
const struct net_buf_data_cb * cb
Definition buf.h:962
 
void * alloc_data
Definition buf.h:963
 
uint8_t *(* ref)(struct net_buf *buf, uint8_t *data)
Definition buf.h:957
 
uint8_t *(* alloc)(struct net_buf *buf, size_t *size, k_timeout_t timeout)
Definition buf.h:955
 
void(* unref)(struct net_buf *buf, uint8_t *data)
Definition buf.h:958
 
size_t data_size
Definition buf.h:1088
 
uint8_t * data_pool
Definition buf.h:1089
 
Network buffer pool representation.
Definition buf.h:971
 
void(*const destroy)(struct net_buf *buf)
Optional destroy callback when buffer is freed.
Definition buf.h:999
 
uint16_t uninit_count
Number of uninitialized buffers.
Definition buf.h:982
 
uint8_t user_data_size
Definition buf.h:985
 
const uint16_t buf_count
Number of buffers in pool.
Definition buf.h:979
 
const struct net_buf_data_alloc * alloc
Data allocation handlers.
Definition buf.h:1002
 
struct k_lifo free
LIFO to place the buffer into when free.
Definition buf.h:973
 
struct k_spinlock lock
Definition buf.h:976
 
Parsing state of a buffer.
Definition buf.h:850
 
uint16_t offset
Offset of the data pointer from the beginning of the storage.
Definition buf.h:852
 
uint16_t len
Length of data.
Definition buf.h:854
 
Simple network buffer representation.
Definition buf.h:83
 
uint8_t * data
Pointer to the start of data in the buffer.
Definition buf.h:85
 
uint16_t size
Amount of data that net_buf_simple::__buf can store.
Definition buf.h:95
 
uint16_t len
Length of the data behind the data pointer.
Definition buf.h:92
 
Network buffer representation.
Definition buf.h:906
 
uint16_t size
Amount of data that this buffer can store.
Definition buf.h:938
 
struct net_buf * frags
Fragments associated with this buffer.
Definition buf.h:911
 
uint8_t ref
Reference count.
Definition buf.h:914
 
uint8_t pool_id
Where the buffer should go when freed up.
Definition buf.h:920
 
sys_snode_t node
Allow placing the buffer into sys_slist_t.
Definition buf.h:908
 
uint8_t user_data_size
Definition buf.h:923
 
uint8_t flags
Bit-field of buffer flags.
Definition buf.h:917
 
uint8_t * data
Pointer to the start of data in the buffer.
Definition buf.h:932
 
uint8_t user_data[]
System metadata for this buffer.
Definition buf.h:951
 
struct net_buf_simple b
Definition buf.h:947
 
uint16_t len
Length of the data behind the data pointer.
Definition buf.h:935
 
static fdata_t data[2]
Definition test_fifo_contexts.c:15
 
static void func(void *arg1, void *arg2, void *arg3)
Definition main.c:22
 
static const intptr_t user_data[5]
Definition main.c:588