Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more
netbuf.c File Reference
Network buffer management. More...
Go to the source code of this file.
| Functions | |
| struct netbuf * | netbuf_new (void) | 
| Create (allocate) and initialize a new netbuf. | |
| void | netbuf_delete (struct netbuf *buf) | 
| Deallocate a netbuf allocated by netbuf_new(). | |
| void * | netbuf_alloc (struct netbuf *buf, u16_t size) | 
| Allocate memory for a packet buffer for a given netbuf. | |
| void | netbuf_free (struct netbuf *buf) | 
| Free the packet buffer included in a netbuf. | |
| err_t | netbuf_ref (struct netbuf *buf, const void *dataptr, u16_t size) | 
| Let a netbuf reference existing (non-volatile) data. | |
| void | netbuf_chain (struct netbuf *head, struct netbuf *tail) | 
| Chain one netbuf to another (. | |
| err_t | netbuf_data (struct netbuf *buf, void **dataptr, u16_t *len) | 
| Get the data pointer and length of the data inside a netbuf. | |
| s8_t | netbuf_next (struct netbuf *buf) | 
| Move the current data pointer of a packet buffer contained in a netbuf to the next part. | |
| 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. | |
Detailed Description
Network buffer management.
Definition in file netbuf.c.
Function Documentation
| void* netbuf_alloc | ( | struct netbuf * | buf, | 
| u16_t | size | ||
| ) | 
| void netbuf_chain | ( | struct netbuf * | head, | 
| struct netbuf * | tail | ||
| ) | 
Chain one netbuf to another (.
- See also:
- pbuf_chain)
- Parameters:
- 
  head the first netbuf tail netbuf to chain after head, freed by this function, may not be reference after returning 
| err_t netbuf_data | ( | struct netbuf * | buf, | 
| void ** | dataptr, | ||
| u16_t * | len | ||
| ) | 
Get the data pointer and length of the data inside a netbuf.
- Parameters:
- 
  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 
- Returns:
- ERR_OK if the information was retreived, ERR_BUF on error.
| void netbuf_delete | ( | struct netbuf * | buf ) | 
Deallocate a netbuf allocated by netbuf_new().
- Parameters:
- 
  buf pointer to a netbuf allocated by netbuf_new() 
| void netbuf_first | ( | struct netbuf * | buf ) | 
| void netbuf_free | ( | struct netbuf * | buf ) | 
| struct netbuf* netbuf_new | ( | void | ) |  [read] | 
| s8_t netbuf_next | ( | struct netbuf * | buf ) | 
Move the current data pointer of a packet buffer contained in a netbuf to the next part.
The packet buffer itself is not modified.
- Parameters:
- 
  buf the netbuf to modify 
- Returns:
- -1 if there is no next part 1 if moved to the next part but now there is no next part 0 if moved to the next part and there are still more parts
| err_t netbuf_ref | ( | struct netbuf * | buf, | 
| const void * | dataptr, | ||
| u16_t | size | ||
| ) | 
Let a netbuf reference existing (non-volatile) data.
- Parameters:
- 
  buf netbuf which should reference the data dataptr pointer to the data to reference size size of the data 
- Returns:
- ERR_OK if data is referenced ERR_MEM if data couldn't be referenced due to lack of memory
Generated on Tue Jul 12 2022 18:14:55 by
 1.7.2
 1.7.2