Go to the documentation of this file.
32 #ifndef __LWIP_NETBUF_H__
33 #define __LWIP_NETBUF_H__
37 #include "lwip/ip_addr.h"
44 #define NETBUF_FLAG_DESTADDR 0x01
46 #define NETBUF_FLAG_CHKSUM 0x02
52 #if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
53 #if LWIP_CHECKSUM_ON_COPY
57 #if LWIP_NETBUF_RECVINFO
69 const void *dataptr,
u16_t size);
74 void **dataptr,
u16_t *len);
79 #define netbuf_copy_partial(buf, dataptr, len, offset) \
80 pbuf_copy_partial((buf)->p, (dataptr), (len), (offset))
81 #define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0)
82 #define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len)
83 #define netbuf_len(buf) ((buf)->p->tot_len)
84 #define netbuf_fromaddr(buf) (&((buf)->addr))
85 #define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr)
86 #define netbuf_fromport(buf) ((buf)->port)
87 #if LWIP_NETBUF_RECVINFO
88 #define netbuf_destaddr(buf) (&((buf)->toaddr))
89 #define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr)
90 #define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0)
92 #if LWIP_CHECKSUM_ON_COPY
93 #define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \
94 (buf)->toport_chksum = chksum; } while(0)