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
239 typedef 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
255 extern volatile u8_t pbuf_free_ooseq_pending;
256 void 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);
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)
303 #if LWIP_CHECKSUM_ON_COPY
304 err_t pbuf_fill_chksum(
struct pbuf *p,
u16_t start_offset,
const void *dataptr,
307 #if LWIP_TCP && TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
308 void pbuf_split_64k(
struct pbuf *p,
struct pbuf **rest);
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
int16_t s16_t
Definition: arch.h:128
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
u16_t pbuf_memfind(const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)
Definition: pbuf.c:1476
u16_t pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n)
Definition: pbuf.c:1434
struct pbuf * pbuf_alloc_reference(void *payload, u16_t length, pbuf_type type)
Definition: pbuf.c:327
void pbuf_realloc(struct pbuf *p, u16_t size)
Definition: pbuf.c:402
struct pbuf * pbuf_coalesce(struct pbuf *p, pbuf_layer layer)
Definition: pbuf.c:1278
struct pbuf * pbuf_skip(struct pbuf *in, u16_t in_offset, u16_t *out_offset)
Definition: pbuf.c:1178
u8_t pbuf_get_at(const struct pbuf *p, u16_t offset)
Definition: pbuf.c:1371
void pbuf_ref(struct pbuf *p)
Definition: pbuf.c:829
void pbuf_cat(struct pbuf *head, struct pbuf *tail)
Definition: pbuf.c:853
void pbuf_chain(struct pbuf *head, struct pbuf *tail)
Definition: pbuf.c:895
int pbuf_try_get_at(const struct pbuf *p, u16_t offset)
Definition: pbuf.c:1389
u8_t pbuf_free(struct pbuf *p)
Definition: pbuf.c:725
pbuf_type
Definition: pbuf.h:145
err_t pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from)
Definition: pbuf.c:961
u16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, u16_t len, u16_t offset)
Definition: pbuf.c:1027
struct pbuf * pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type)
Definition: pbuf.c:224
void * pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset)
Definition: pbuf.c:1074
err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
Definition: pbuf.c:1196
err_t pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)
Definition: pbuf.c:1240
pbuf_layer
Definition: pbuf.h:89
void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data)
Definition: pbuf.c:1411
struct pbuf * pbuf_clone(pbuf_layer l, pbuf_type type, struct pbuf *p)
Definition: pbuf.c:1306
@ 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_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
#define PBUF_TYPE_FLAG_DATA_VOLATILE
Definition: pbuf.h:122
#define PBUF_TYPE_ALLOC_SRC_MASK_STD_MEMP_PBUF_POOL
Definition: pbuf.h:135
struct pbuf * pbuf_free_header(struct pbuf *q, u16_t size)
Definition: pbuf.c:671
u8_t pbuf_header_force(struct pbuf *p, s16_t header_size)
Definition: pbuf.c:656
u8_t pbuf_add_header(struct pbuf *p, size_t header_size_increment)
Definition: pbuf.c:551
#define PBUF_TYPE_ALLOC_SRC_MASK_STD_MEMP_PBUF
Definition: pbuf.h:134
#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
u16_t pbuf_clen(const struct pbuf *p)
Definition: pbuf.c:809
#define PBUF_TYPE_ALLOC_SRC_MASK_STD_HEAP
Definition: pbuf.h:133
u16_t pbuf_strstr(const struct pbuf *p, const char *substr)
Definition: pbuf.c:1503
u8_t pbuf_header(struct pbuf *p, s16_t header_size)
Definition: pbuf.c:646
#define PBUF_IP_HLEN
Definition: pbuf.h:82
u8_t pbuf_remove_header(struct pbuf *p, size_t header_size)
Definition: pbuf.c:582
struct pbuf * pbuf_dechain(struct pbuf *p)
Definition: pbuf.c:912
u8_t pbuf_add_header_force(struct pbuf *p, size_t header_size_increment)
Definition: pbuf.c:561
#define PBUF_TRANSPORT_HLEN
Definition: pbuf.h:78
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