The network buffer handling is designed to make life easy when it comes to handling ISO-layered communications. By this we're thinking about communications structures that are hierarchically organized.
The idea is that network buffer structures are allocated every time a new packet is either received or ready for sending. The various fields of the network buffer are then handled by matching layers within the appropriate protocol stack.
Linked list of NETBUF structures:
Data Structures | |
struct | _NBDATA |
Data part of a network buffer structure. More... | |
struct | _NBDATA |
Data part of a network buffer structure. More... | |
struct | _NETBUF |
Network buffer structure. More... | |
struct | _NETBUF |
Network buffer structure. More... | |
Defines | |
#define | NBAF_ALL 0xf0 |
Masks allocated buffer flags flag. | |
#define | NBAF_APPLICATION 0x80 |
Application buffer allocated flag. | |
#define | NBAF_DATALINK 0x10 |
Datalink buffer allocated flag. | |
#define | NBAF_NETWORK 0x20 |
Network buffer allocated flag. | |
#define | NBAF_TRANSPORT 0x40 |
Transport buffer allocated flag. | |
Typedefs | |
typedef _NBDATA | NBDATA |
Network buffer data type. | |
typedef _NETBUF | NETBUF |
Network buffer type. | |
Functions | |
NETBUF * | NutNetBufAlloc (NETBUF *nb, u_char type, u_short size) |
Allocate or re-allocate a network buffer part. | |
NETBUF * | NutNetBufClone (NETBUF *nb) |
Create a copy of an existing network buffer structure. | |
int | NutNetBufFree (NETBUF *nb) |
Release a network buffer structure. |
Allocate or re-allocate a network buffer part.
nb | Points to an existing network buffer structure or NULL, if a new structure should be created. An existing buffer must not be used any further if this function returns a null pointer. | |
type | Part of the buffer to be allocated. This can be any of the following:
| |
size | Size of the part to be allocated. |
Create a copy of an existing network buffer structure.
nb | Points to an existing network buffer structure, previously allocated by NutNetBufAlloc(). |
int NutNetBufFree | ( | NETBUF * | nb | ) |
Release a network buffer structure.
Returns all memory previously allocated by a network buffer to the available heap space.
nb | Points to an existing network buffer structure, previously allocated by NutNetBufAlloc(). |