![]() |
Data Structures | |
struct | NBDATA |
Data part of a network buffer structure. More... | |
struct | NETBUF |
Network buffer structure. More... | |
Defines | |
#define | NBAF_UNICAST 0x08 |
Unicast address. | |
#define | NBAF_DATALINK 0x10 |
Datalink buffer allocated flag. | |
#define | NBAF_NETWORK 0x20 |
Network buffer allocated flag. | |
#define | NBAF_TRANSPORT 0x40 |
Transport buffer allocated flag. | |
#define | NBAF_APPLICATION 0x80 |
Application buffer allocated flag. | |
#define | NBAF_ALL 0xf0 |
Masks allocated buffer flags flag. | |
Functions | |
NETBUF * | NutNetBufAlloc (NETBUF *nb, uint8_t type, int size) |
Allocate or re-allocate a network buffer part. | |
NETBUF * | NutNetBufClone (NETBUF *nb) |
Create a copy of an existing network buffer structure. | |
void | NutNetBufFree (NETBUF *nb) |
Release a network buffer structure. |
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:
#define NBAF_UNICAST 0x08 |
Unicast address.
Definition at line 127 of file netbuf.h.
Referenced by NutIpInput(), NutTcpInput(), and NutUdpInput().
#define NBAF_DATALINK 0x10 |
Datalink buffer allocated flag.
Definition at line 129 of file netbuf.h.
Referenced by AhdlcRx(), CSNICrx(), NutEtherOutput(), NutNetBufAlloc(), NutNetBufClone(), NutNetBufFree(), and NutPppOutput().
#define NBAF_NETWORK 0x20 |
Network buffer allocated flag.
Definition at line 130 of file netbuf.h.
Referenced by NutArpAllocNetBuf(), NutIpcpOutput(), NutIpOutput(), NutLcpOutput(), NutNetBufAlloc(), NutNetBufClone(), NutNetBufFree(), and NutPapOutput().
#define NBAF_TRANSPORT 0x40 |
Transport buffer allocated flag.
Definition at line 131 of file netbuf.h.
Referenced by NutIcmpReply(), NutIgmpOutput(), NutNetBufAlloc(), NutNetBufClone(), NutNetBufFree(), NutTcpOutput(), and NutUdpOutput().
#define NBAF_APPLICATION 0x80 |
Application buffer allocated flag.
Definition at line 132 of file netbuf.h.
Referenced by IpcpTxConfReq(), LcpTxConfReq(), LcpTxProtRej(), NutIcmpResponse(), NutNetBufAlloc(), NutNetBufClone(), NutNetBufFree(), NutTcpOutput(), NutUdpSendTo(), and PapTxAuthReq().
NETBUF* NutNetBufAlloc | ( | NETBUF * | nb, | |
uint8_t | type, | |||
int | size | |||
) |
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. |
Definition at line 173 of file netbuf.c.
References NBAF_APPLICATION, NBAF_DATALINK, NBAF_NETWORK, NBAF_TRANSPORT, NUTASSERT, NutHeapAllocClear, NutHeapFree, and NutNetBufFree().
Referenced by AhdlcRx(), CSNICrx(), IpcpTxConfReq(), LcpTxConfReq(), LcpTxProtRej(), NutArpAllocNetBuf(), NutEtherOutput(), NutIcmpReply(), NutIcmpResponse(), NutIgmpOutput(), NutIpcpOutput(), NutIpOutput(), NutLcpOutput(), NutPapOutput(), NutPppOutput(), NutTcpOutput(), NutUdpOutput(), NutUdpSendTo(), and PapTxAuthReq().
NETBUF* NutNetBufClone | ( | NETBUF * | nb | ) |
Create a copy of an existing network buffer structure.
nb | Points to an existing network buffer structure, previously allocated by NutNetBufAlloc(). |
Definition at line 251 of file netbuf.c.
References memcpy(), NBAF_APPLICATION, NBAF_DATALINK, NBAF_NETWORK, NBAF_TRANSPORT, NUTASSERT, NutHeapAllocClear, and NutNetBufFree().
Referenced by NutTcpOutput().
void 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(). |
Definition at line 299 of file netbuf.c.
References NBAF_APPLICATION, NBAF_DATALINK, NBAF_NETWORK, NBAF_TRANSPORT, NUTASSERT, and NutHeapFree.
Referenced by EmacRxThread(), IpcpRxConfAck(), IpcpRxConfReq(), IpcpRxTermReq(), LcpTxProtRej(), NutArpCacheQuery(), NutArpInput(), NutEtherInput(), NutEtherOutput(), NutIcmpInput(), NutIgmpInput(), NutIpcpInput(), NutIpcpOutput(), NutIpInput(), NutIpOutput(), NutLcpInput(), NutLcpOutput(), NutNetBufAlloc(), NutNetBufClone(), NutPapInput(), NutPapOutput(), NutPppInput(), NutPppOutput(), NutTcpDiscardBuffers(), NutTcpInput(), NutTcpOutput(), NutTcpReceive(), NutTcpReject(), NutTcpStateMachine(), NutUdpDestroySocket(), NutUdpInput(), NutUdpReceiveFrom(), and NutUdpSendTo().