Collaboration diagram for Network Buffer:
Detailed Description
Network buffer support.
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:
Function Documentation
|
|
Allocate or re-allocate a network buffer part.
- Parameters:
-
| 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:
- NBAF_DATALINK
- NBAF_NETWORK
- NBAF_TRANSPORT
- NBAF_APPLICATION
|
| size | Size of the part to be allocated. |
- Returns:
- Pointer to the allocated network buffer structure. A null pointer is returned if not enough memory is available and the whole structure is released.
|
|
|
Create a copy of an existing network buffer structure.
- Parameters:
-
| nb | Points to an existing network buffer structure, previously allocated by NutNetBufAlloc(). |
- Returns:
- Pointer to a newly allocated copy.
|
| int NutNetBufFree |
( |
NETBUF * |
nb |
) |
|
|
|
|
Release a network buffer structure.
Returns all memory previously allocated by a network buffer to the available heap space.
- Parameters:
-
| nb | Points to an existing network buffer structure, previously allocated by NutNetBufAlloc(). |
- Returns:
- 0 if successfull or -1 if the structure contains previously released memory space.
|