56 netbuf *netbuf_new(
void)
66 #if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY 67 #if LWIP_CHECKSUM_ON_COPY 70 buf->toport_chksum = 0;
71 #if LWIP_NETBUF_RECVINFO 87 netbuf_delete(
struct netbuf *buf)
92 buf->p = buf->ptr =
NULL;
107 netbuf_alloc(
struct netbuf *buf,
u16_t size)
112 if (buf->p !=
NULL) {
116 if (buf->p ==
NULL) {
120 (buf->p->len >= size));
122 return buf->p->payload;
131 netbuf_free(
struct netbuf *buf)
134 if (buf->p !=
NULL) {
137 buf->p = buf->ptr =
NULL;
150 netbuf_ref(
struct netbuf *buf,
const void *dataptr,
u16_t size)
153 if (buf->p !=
NULL) {
157 if (buf->p ==
NULL) {
161 ((
struct pbuf_rom*)buf->p)->payload = dataptr;
162 buf->p->len = buf->p->tot_len = size;
174 netbuf_chain(
struct netbuf *head,
struct netbuf *tail)
177 LWIP_ERROR(
"netbuf_chain: invalid tail", (tail !=
NULL),
return;);
193 netbuf_data(
struct netbuf *buf,
void **dataptr,
u16_t *len)
199 if (buf->ptr ==
NULL) {
202 *dataptr = buf->ptr->payload;
203 *len = buf->ptr->len;
218 netbuf_next(
struct netbuf *buf)
220 LWIP_ERROR(
"netbuf_free: invalid buf", (buf !=
NULL),
return -1;);
221 if (buf->ptr->next ==
NULL) {
224 buf->ptr = buf->ptr->next;
225 if (buf->ptr->next ==
NULL) {
239 netbuf_first(
struct netbuf *buf)
void memp_free(memp_t type, void *mem)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u8_t pbuf_free(struct pbuf *p)
#define LWIP_ASSERT(message, assertion)
void pbuf_cat(struct pbuf *h, struct pbuf *t)
#define ip_addr_set_zero(ipaddr)
#define LWIP_ERROR(message, expression, handler)
void * memp_malloc(memp_t type)