Network buffer management.
Functions | |
void * | netbuf_alloc (struct netbuf *buf, u16_t size) |
Allocate memory for a packet buffer for a given netbuf. More... | |
void | netbuf_chain (struct netbuf *head, struct netbuf *tail) |
Chain one netbuf to another (. More... | |
err_t | netbuf_data (struct netbuf *buf, void **dataptr, u16_t *len) |
Get the data pointer and length of the data inside a netbuf. More... | |
void | netbuf_delete (struct netbuf *buf) |
Deallocate a netbuf allocated by netbuf_new(). More... | |
void | netbuf_first (struct netbuf *buf) |
Move the current data pointer of a packet buffer contained in a netbuf to the beginning of the packet. More... | |
void | netbuf_free (struct netbuf *buf) |
Free the packet buffer included in a netbuf. More... | |
struct netbuf * | netbuf_new (void) |
Create (allocate) and initialize a new netbuf. More... | |
s8_t | netbuf_next (struct netbuf *buf) |
Move the current data pointer of a packet buffer contained in a netbuf to the next part. More... | |
err_t | netbuf_ref (struct netbuf *buf, const void *dataptr, u16_t size) |
Let a netbuf reference existing (non-volatile) data. More... | |
Allocate memory for a packet buffer for a given netbuf.
buf | the netbuf for which to allocate a packet buffer |
size | the size of the packet buffer to allocate |
References pbuf::len, LWIP_ASSERT, LWIP_ERROR(), NULL, netbuf::p, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_RAM, PBUF_TRANSPORT, and netbuf::ptr.
Referenced by lwip_sendto().
Chain one netbuf to another (.
head | the first netbuf |
tail | netbuf to chain after head, freed by this function, may not be reference after returning |
References LWIP_ERROR(), memp_free(), NULL, netbuf::p, pbuf_cat(), and netbuf::ptr.
Get the data pointer and length of the data inside a netbuf.
buf | netbuf to get the data from |
dataptr | pointer to a void pointer where to store the data pointer |
len | pointer to an u16_t where the length of the data is stored |
References ERR_ARG, ERR_BUF, ERR_OK, pbuf::len, LWIP_ERROR(), NULL, pbuf::payload, and netbuf::ptr.
Referenced by prvweb_ParseHTMLRequest().
Deallocate a netbuf allocated by netbuf_new().
buf | pointer to a netbuf allocated by netbuf_new() |
References memp_free(), NULL, netbuf::p, pbuf_free(), and netbuf::ptr.
Referenced by free_socket(), lwip_recvfrom(), netconn_drain(), and prvweb_ParseHTMLRequest().
Move the current data pointer of a packet buffer contained in a netbuf to the beginning of the packet.
The packet buffer itself is not modified.
buf | the netbuf to modify |
References LWIP_ERROR(), NULL, netbuf::p, and netbuf::ptr.
Free the packet buffer included in a netbuf.
buf | pointer to the netbuf which contains the packet buffer to free |
References LWIP_ERROR(), NULL, netbuf::p, pbuf_free(), and netbuf::ptr.
Referenced by lwip_sendto().
Create (allocate) and initialize a new netbuf.
The netbuf doesn't yet contain a packet buffer!
References netbuf::addr, ip_addr_set_any, memp_malloc(), NULL, netbuf::p, netbuf::port, and netbuf::ptr.
Move the current data pointer of a packet buffer contained in a netbuf to the next part.
The packet buffer itself is not modified.
buf | the netbuf to modify |
References LWIP_ERROR(), pbuf::next, NULL, and netbuf::ptr.
Let a netbuf reference existing (non-volatile) data.
buf | netbuf which should reference the data |
dataptr | pointer to the data to reference |
size | size of the data |
References ERR_ARG, ERR_MEM, ERR_OK, pbuf::len, LWIP_ERROR(), NULL, netbuf::p, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_REF, PBUF_TRANSPORT, netbuf::ptr, and pbuf::tot_len.
Referenced by lwip_sendto().