38#ifndef LWIP_HDR_PBUF_H
39#define LWIP_HDR_PBUF_H
54#ifndef LWIP_SUPPORT_CUSTOM_PBUF
55#define LWIP_SUPPORT_CUSTOM_PBUF ((IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF) || (LWIP_IPV6 && LWIP_IPV6_FRAG))
71#ifndef PBUF_NEEDS_COPY
72#define PBUF_NEEDS_COPY(p) ((p)->type_internal & PBUF_TYPE_FLAG_DATA_VOLATILE)
78#define PBUF_TRANSPORT_HLEN 20
80#define PBUF_IP_HLEN 40
82#define PBUF_IP_HLEN 20
119#define PBUF_TYPE_FLAG_STRUCT_DATA_CONTIGUOUS 0x80
122#define PBUF_TYPE_FLAG_DATA_VOLATILE 0x40
125#define PBUF_TYPE_ALLOC_SRC_MASK 0x0F
129#define PBUF_ALLOC_FLAG_RX 0x0100
131#define PBUF_ALLOC_FLAG_DATA_CONTIGUOUS 0x0200
133#define PBUF_TYPE_ALLOC_SRC_MASK_STD_HEAP 0x00
134#define PBUF_TYPE_ALLOC_SRC_MASK_STD_MEMP_PBUF 0x01
135#define PBUF_TYPE_ALLOC_SRC_MASK_STD_MEMP_PBUF_POOL 0x02
137#define PBUF_TYPE_ALLOC_SRC_MASK_APP_MIN 0x03
139#define PBUF_TYPE_ALLOC_SRC_MASK_APP_MAX PBUF_TYPE_ALLOC_SRC_MASK
172#define PBUF_FLAG_PUSH 0x01U
175#define PBUF_FLAG_IS_CUSTOM 0x02U
177#define PBUF_FLAG_MCASTLOOP 0x04U
179#define PBUF_FLAG_LLBCAST 0x08U
181#define PBUF_FLAG_LLMCAST 0x10U
183#define PBUF_FLAG_TCP_FIN 0x20U
237#if LWIP_SUPPORT_CUSTOM_PBUF
239typedef void (*pbuf_free_custom_fn)(
struct pbuf *p);
246 pbuf_free_custom_fn custom_free_function;
251#ifndef PBUF_POOL_FREE_OOSEQ
252#define PBUF_POOL_FREE_OOSEQ 1
254#if LWIP_TCP && TCP_QUEUE_OOSEQ && NO_SYS && PBUF_POOL_FREE_OOSEQ
255extern volatile u8_t pbuf_free_ooseq_pending;
256void pbuf_free_ooseq(
void);
260#define PBUF_CHECK_FREE_OOSEQ() do { if(pbuf_free_ooseq_pending) { \
263 pbuf_free_ooseq(); }}while(0)
266 #define PBUF_CHECK_FREE_OOSEQ()
274#if LWIP_SUPPORT_CUSTOM_PBUF
276 struct pbuf_custom *p,
void *payload_mem,
277 u16_t payload_mem_len);
279void pbuf_realloc(
struct pbuf *p, u16_t size);
280#define pbuf_get_allocsrc(p) ((p)->type_internal & PBUF_TYPE_ALLOC_SRC_MASK)
281#define pbuf_match_allocsrc(p, type) (pbuf_get_allocsrc(p) == ((type) & PBUF_TYPE_ALLOC_SRC_MASK))
282#define pbuf_match_type(p, type) pbuf_match_allocsrc(p, type)
283u8_t pbuf_header(
struct pbuf *p, s16_t header_size);
284u8_t pbuf_header_force(
struct pbuf *p, s16_t header_size);
285u8_t pbuf_add_header(
struct pbuf *p,
size_t header_size_increment);
286u8_t pbuf_add_header_force(
struct pbuf *p,
size_t header_size_increment);
287u8_t pbuf_remove_header(
struct pbuf *p,
size_t header_size);
288struct pbuf *pbuf_free_header(
struct pbuf *q, u16_t size);
289void pbuf_ref(
struct pbuf *p);
290u8_t pbuf_free(
struct pbuf *p);
291u16_t pbuf_clen(
const struct pbuf *p);
292void pbuf_cat(
struct pbuf *head,
struct pbuf *tail);
293void pbuf_chain(
struct pbuf *head,
struct pbuf *tail);
294struct pbuf *pbuf_dechain(
struct pbuf *p);
295err_t pbuf_copy(
struct pbuf *p_to,
const struct pbuf *p_from);
296u16_t pbuf_copy_partial(
const struct pbuf *p,
void *dataptr, u16_t
len, u16_t offset);
297void *pbuf_get_contiguous(
const struct pbuf *p,
void *buffer,
size_t bufsize, u16_t
len, u16_t offset);
298err_t pbuf_take(
struct pbuf *buf,
const void *dataptr, u16_t
len);
299err_t pbuf_take_at(
struct pbuf *buf,
const void *dataptr, u16_t
len, u16_t offset);
300struct pbuf *pbuf_skip(
struct pbuf* in, u16_t in_offset, u16_t* out_offset);
303#if LWIP_CHECKSUM_ON_COPY
304err_t pbuf_fill_chksum(
struct pbuf *p, u16_t start_offset,
const void *dataptr,
305 u16_t
len, u16_t *chksum);
307#if LWIP_TCP && TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
308void pbuf_split_64k(
struct pbuf *p,
struct pbuf **rest);
311u8_t pbuf_get_at(
const struct pbuf* p, u16_t offset);
312int pbuf_try_get_at(
const struct pbuf* p, u16_t offset);
313void pbuf_put_at(
struct pbuf* p, u16_t offset, u8_t data);
314u16_t pbuf_memcmp(
const struct pbuf* p, u16_t offset,
const void* s2, u16_t n);
315u16_t pbuf_memfind(
const struct pbuf* p,
const void* mem, u16_t mem_len, u16_t start_offset);
316u16_t pbuf_strstr(
const struct pbuf* p,
const char* substr);
s8_t err_t
Definition: err.h:96
#define PBUF_LINK_HLEN
Definition: opt.h:1530
#define PBUF_LINK_ENCAPSULATION_HLEN
Definition: opt.h:1539
#define LWIP_PBUF_REF_T
Definition: opt.h:1556
#define PBUF_TYPE_FLAG_DATA_VOLATILE
Definition: pbuf.h:122
#define PBUF_ALLOC_FLAG_DATA_CONTIGUOUS
Definition: pbuf.h:131
#define PBUF_TYPE_FLAG_STRUCT_DATA_CONTIGUOUS
Definition: pbuf.h:119
#define PBUF_ALLOC_FLAG_RX
Definition: pbuf.h:129
pbuf_type
Definition: pbuf.h:145
@ PBUF_ROM
Definition: pbuf.h:156
@ PBUF_RAM
Definition: pbuf.h:152
@ PBUF_REF
Definition: pbuf.h:160
@ PBUF_POOL
Definition: pbuf.h:167
pbuf_layer
Definition: pbuf.h:89
@ PBUF_RAW_TX
Definition: pbuf.h:108
@ PBUF_RAW
Definition: pbuf.h:111
@ PBUF_TRANSPORT
Definition: pbuf.h:93
@ PBUF_LINK
Definition: pbuf.h:102
@ PBUF_IP
Definition: pbuf.h:97
const void * payload
Definition: pbuf.h:234
struct pbuf * next
Definition: pbuf.h:231
LWIP_PBUF_REF_T ref
Definition: pbuf.h:218
u16_t tot_len
Definition: pbuf.h:200
struct pbuf * next
Definition: pbuf.h:188
u8_t type_internal
Definition: pbuf.h:208
u8_t if_idx
Definition: pbuf.h:221
u16_t len
Definition: pbuf.h:203
void * payload
Definition: pbuf.h:191
u8_t flags
Definition: pbuf.h:211