Lines Matching full:buf

32 void net_buf_simple_init_with_data(struct net_buf_simple *buf,  in net_buf_simple_init_with_data()  argument
35 buf->__buf = data; in net_buf_simple_init_with_data()
36 buf->data = data; in net_buf_simple_init_with_data()
37 buf->size = size; in net_buf_simple_init_with_data()
38 buf->len = size; in net_buf_simple_init_with_data()
41 void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve) in net_buf_simple_reserve() argument
43 __ASSERT_NO_MSG(buf); in net_buf_simple_reserve()
44 __ASSERT_NO_MSG(buf->len == 0U); in net_buf_simple_reserve()
45 NET_BUF_SIMPLE_DBG("buf %p reserve %zu", buf, reserve); in net_buf_simple_reserve()
47 buf->data = buf->__buf + reserve; in net_buf_simple_reserve()
56 void *net_buf_simple_add(struct net_buf_simple *buf, size_t len) in net_buf_simple_add() argument
58 uint8_t *tail = net_buf_simple_tail(buf); in net_buf_simple_add()
60 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_add()
62 __ASSERT_NO_MSG(net_buf_simple_tailroom(buf) >= len); in net_buf_simple_add()
64 buf->len += len; in net_buf_simple_add()
68 void *net_buf_simple_add_mem(struct net_buf_simple *buf, const void *mem, in net_buf_simple_add_mem() argument
71 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_add_mem()
73 return memcpy(net_buf_simple_add(buf, len), mem, len); in net_buf_simple_add_mem()
76 uint8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val) in net_buf_simple_add_u8() argument
80 NET_BUF_SIMPLE_DBG("buf %p val 0x%02x", buf, val); in net_buf_simple_add_u8()
82 u8 = net_buf_simple_add(buf, 1); in net_buf_simple_add_u8()
88 void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val) in net_buf_simple_add_le16() argument
90 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_le16()
92 sys_put_le16(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_le16()
95 void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val) in net_buf_simple_add_be16() argument
97 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_be16()
99 sys_put_be16(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_be16()
102 void net_buf_simple_add_le24(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_add_le24() argument
104 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_le24()
106 sys_put_le24(val, net_buf_simple_add(buf, 3)); in net_buf_simple_add_le24()
109 void net_buf_simple_add_be24(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_add_be24() argument
111 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_be24()
113 sys_put_be24(val, net_buf_simple_add(buf, 3)); in net_buf_simple_add_be24()
116 void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_add_le32() argument
118 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_le32()
120 sys_put_le32(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_le32()
123 void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_add_be32() argument
125 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_add_be32()
127 sys_put_be32(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_be32()
130 void net_buf_simple_add_le40(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_le40() argument
132 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_le40()
134 sys_put_le40(val, net_buf_simple_add(buf, 5)); in net_buf_simple_add_le40()
137 void net_buf_simple_add_be40(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_be40() argument
139 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_be40()
141 sys_put_be40(val, net_buf_simple_add(buf, 5)); in net_buf_simple_add_be40()
144 void net_buf_simple_add_le48(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_le48() argument
146 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_le48()
148 sys_put_le48(val, net_buf_simple_add(buf, 6)); in net_buf_simple_add_le48()
151 void net_buf_simple_add_be48(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_be48() argument
153 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_be48()
155 sys_put_be48(val, net_buf_simple_add(buf, 6)); in net_buf_simple_add_be48()
158 void net_buf_simple_add_le64(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_le64() argument
160 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_le64()
162 sys_put_le64(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_le64()
165 void net_buf_simple_add_be64(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_add_be64() argument
167 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_add_be64()
169 sys_put_be64(val, net_buf_simple_add(buf, sizeof(val))); in net_buf_simple_add_be64()
172 void *net_buf_simple_remove_mem(struct net_buf_simple *buf, size_t len) in net_buf_simple_remove_mem() argument
174 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_remove_mem()
176 __ASSERT_NO_MSG(buf->len >= len); in net_buf_simple_remove_mem()
178 buf->len -= len; in net_buf_simple_remove_mem()
179 return buf->data + buf->len; in net_buf_simple_remove_mem()
182 uint8_t net_buf_simple_remove_u8(struct net_buf_simple *buf) in net_buf_simple_remove_u8() argument
187 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_u8()
193 uint16_t net_buf_simple_remove_le16(struct net_buf_simple *buf) in net_buf_simple_remove_le16() argument
198 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le16()
204 uint16_t net_buf_simple_remove_be16(struct net_buf_simple *buf) in net_buf_simple_remove_be16() argument
209 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be16()
215 uint32_t net_buf_simple_remove_le24(struct net_buf_simple *buf) in net_buf_simple_remove_le24() argument
222 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le24()
228 uint32_t net_buf_simple_remove_be24(struct net_buf_simple *buf) in net_buf_simple_remove_be24() argument
235 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be24()
241 uint32_t net_buf_simple_remove_le32(struct net_buf_simple *buf) in net_buf_simple_remove_le32() argument
246 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le32()
252 uint32_t net_buf_simple_remove_be32(struct net_buf_simple *buf) in net_buf_simple_remove_be32() argument
257 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be32()
263 uint64_t net_buf_simple_remove_le40(struct net_buf_simple *buf) in net_buf_simple_remove_le40() argument
270 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le40()
276 uint64_t net_buf_simple_remove_be40(struct net_buf_simple *buf) in net_buf_simple_remove_be40() argument
283 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be40()
289 uint64_t net_buf_simple_remove_le48(struct net_buf_simple *buf) in net_buf_simple_remove_le48() argument
296 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le48()
302 uint64_t net_buf_simple_remove_be48(struct net_buf_simple *buf) in net_buf_simple_remove_be48() argument
309 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be48()
315 uint64_t net_buf_simple_remove_le64(struct net_buf_simple *buf) in net_buf_simple_remove_le64() argument
320 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_le64()
326 uint64_t net_buf_simple_remove_be64(struct net_buf_simple *buf) in net_buf_simple_remove_be64() argument
331 ptr = net_buf_simple_remove_mem(buf, sizeof(val)); in net_buf_simple_remove_be64()
337 void *net_buf_simple_push(struct net_buf_simple *buf, size_t len) in net_buf_simple_push() argument
339 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_push()
341 __ASSERT_NO_MSG(net_buf_simple_headroom(buf) >= len); in net_buf_simple_push()
343 buf->data -= len; in net_buf_simple_push()
344 buf->len += len; in net_buf_simple_push()
345 return buf->data; in net_buf_simple_push()
348 void *net_buf_simple_push_mem(struct net_buf_simple *buf, const void *mem, in net_buf_simple_push_mem() argument
351 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_push_mem()
353 return memcpy(net_buf_simple_push(buf, len), mem, len); in net_buf_simple_push_mem()
356 void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val) in net_buf_simple_push_le16() argument
358 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_le16()
360 sys_put_le16(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_le16()
363 void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val) in net_buf_simple_push_be16() argument
365 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_be16()
367 sys_put_be16(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_be16()
370 void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val) in net_buf_simple_push_u8() argument
372 uint8_t *data = net_buf_simple_push(buf, 1); in net_buf_simple_push_u8()
377 void net_buf_simple_push_le24(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_push_le24() argument
379 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_le24()
381 sys_put_le24(val, net_buf_simple_push(buf, 3)); in net_buf_simple_push_le24()
384 void net_buf_simple_push_be24(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_push_be24() argument
386 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_be24()
388 sys_put_be24(val, net_buf_simple_push(buf, 3)); in net_buf_simple_push_be24()
391 void net_buf_simple_push_le32(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_push_le32() argument
393 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_le32()
395 sys_put_le32(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_le32()
398 void net_buf_simple_push_be32(struct net_buf_simple *buf, uint32_t val) in net_buf_simple_push_be32() argument
400 NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); in net_buf_simple_push_be32()
402 sys_put_be32(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_be32()
405 void net_buf_simple_push_le40(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_le40() argument
407 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_le40()
409 sys_put_le40(val, net_buf_simple_push(buf, 5)); in net_buf_simple_push_le40()
412 void net_buf_simple_push_be40(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_be40() argument
414 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_be40()
416 sys_put_be40(val, net_buf_simple_push(buf, 5)); in net_buf_simple_push_be40()
419 void net_buf_simple_push_le48(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_le48() argument
421 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_le48()
423 sys_put_le48(val, net_buf_simple_push(buf, 6)); in net_buf_simple_push_le48()
426 void net_buf_simple_push_be48(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_be48() argument
428 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_be48()
430 sys_put_be48(val, net_buf_simple_push(buf, 6)); in net_buf_simple_push_be48()
433 void net_buf_simple_push_le64(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_le64() argument
435 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_le64()
437 sys_put_le64(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_le64()
440 void net_buf_simple_push_be64(struct net_buf_simple *buf, uint64_t val) in net_buf_simple_push_be64() argument
442 NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); in net_buf_simple_push_be64()
444 sys_put_be64(val, net_buf_simple_push(buf, sizeof(val))); in net_buf_simple_push_be64()
447 void *net_buf_simple_pull(struct net_buf_simple *buf, size_t len) in net_buf_simple_pull() argument
449 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_pull()
451 __ASSERT_NO_MSG(buf->len >= len); in net_buf_simple_pull()
453 buf->len -= len; in net_buf_simple_pull()
454 return buf->data += len; in net_buf_simple_pull()
457 void *net_buf_simple_pull_mem(struct net_buf_simple *buf, size_t len) in net_buf_simple_pull_mem() argument
459 void *data = buf->data; in net_buf_simple_pull_mem()
461 NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len); in net_buf_simple_pull_mem()
463 __ASSERT_NO_MSG(buf->len >= len); in net_buf_simple_pull_mem()
465 buf->len -= len; in net_buf_simple_pull_mem()
466 buf->data += len; in net_buf_simple_pull_mem()
471 uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf) in net_buf_simple_pull_u8() argument
475 val = buf->data[0]; in net_buf_simple_pull_u8()
476 net_buf_simple_pull(buf, 1); in net_buf_simple_pull_u8()
481 uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf) in net_buf_simple_pull_le16() argument
485 val = UNALIGNED_GET((uint16_t *)buf->data); in net_buf_simple_pull_le16()
486 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le16()
491 uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf) in net_buf_simple_pull_be16() argument
495 val = UNALIGNED_GET((uint16_t *)buf->data); in net_buf_simple_pull_be16()
496 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be16()
501 uint32_t net_buf_simple_pull_le24(struct net_buf_simple *buf) in net_buf_simple_pull_le24() argument
507 val = UNALIGNED_GET((struct uint24 *)buf->data); in net_buf_simple_pull_le24()
508 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le24()
513 uint32_t net_buf_simple_pull_be24(struct net_buf_simple *buf) in net_buf_simple_pull_be24() argument
519 val = UNALIGNED_GET((struct uint24 *)buf->data); in net_buf_simple_pull_be24()
520 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be24()
525 uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf) in net_buf_simple_pull_le32() argument
529 val = UNALIGNED_GET((uint32_t *)buf->data); in net_buf_simple_pull_le32()
530 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le32()
535 uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf) in net_buf_simple_pull_be32() argument
539 val = UNALIGNED_GET((uint32_t *)buf->data); in net_buf_simple_pull_be32()
540 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be32()
545 uint64_t net_buf_simple_pull_le40(struct net_buf_simple *buf) in net_buf_simple_pull_le40() argument
551 val = UNALIGNED_GET((struct uint40 *)buf->data); in net_buf_simple_pull_le40()
552 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le40()
557 uint64_t net_buf_simple_pull_be40(struct net_buf_simple *buf) in net_buf_simple_pull_be40() argument
563 val = UNALIGNED_GET((struct uint40 *)buf->data); in net_buf_simple_pull_be40()
564 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be40()
569 uint64_t net_buf_simple_pull_le48(struct net_buf_simple *buf) in net_buf_simple_pull_le48() argument
575 val = UNALIGNED_GET((struct uint48 *)buf->data); in net_buf_simple_pull_le48()
576 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le48()
581 uint64_t net_buf_simple_pull_be48(struct net_buf_simple *buf) in net_buf_simple_pull_be48() argument
587 val = UNALIGNED_GET((struct uint48 *)buf->data); in net_buf_simple_pull_be48()
588 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be48()
593 uint64_t net_buf_simple_pull_le64(struct net_buf_simple *buf) in net_buf_simple_pull_le64() argument
597 val = UNALIGNED_GET((uint64_t *)buf->data); in net_buf_simple_pull_le64()
598 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_le64()
603 uint64_t net_buf_simple_pull_be64(struct net_buf_simple *buf) in net_buf_simple_pull_be64() argument
607 val = UNALIGNED_GET((uint64_t *)buf->data); in net_buf_simple_pull_be64()
608 net_buf_simple_pull(buf, sizeof(val)); in net_buf_simple_pull_be64()
613 size_t net_buf_simple_headroom(const struct net_buf_simple *buf) in net_buf_simple_headroom() argument
615 return buf->data - buf->__buf; in net_buf_simple_headroom()
618 size_t net_buf_simple_tailroom(const struct net_buf_simple *buf) in net_buf_simple_tailroom() argument
620 return buf->size - net_buf_simple_headroom(buf) - buf->len; in net_buf_simple_tailroom()
623 uint16_t net_buf_simple_max_len(const struct net_buf_simple *buf) in net_buf_simple_max_len() argument
625 return buf->size - net_buf_simple_headroom(buf); in net_buf_simple_max_len()