NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | EXTENDED DESCRIPTION | ATTRIBUTES
#include <dki/f_dki.h>
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
DDI
Provides a generic representation of network frames.
As the implementation of network protocols must be independent of the network devices through which they communicate, a common representation of output and input network frames must be used between physical network device drivers and all upper layers.
The contents of a network frame are scattered into a set of contiguous memory buffers which is represented by a list of NetBuf structures.
typedef struct NetBuf { struct NetBuf* next; /* next buffer in the list or NULL */ uint32_f bufSize; /* size of memory buffer */ char* bufAddr; /* starting address of memory buffer */ } NetBuf;
The next field points to the next element in the list of NetBuf structures, if any. It is set to zero in the last element of the list.
The bufAddr field points to the beginning of the data area of the memory buffer.
The bufSize is the size of the memory buffer. All the fields of the NetBuf structures associated to a network frame are read-only for the consumer to which the network frame is provided. This constraint is respected by the following library functions which provide basic copy services of network memory buffers:
extern_C void copyToNetBuf (char* src, NetBuf* dstBufs, uint32_f size); extern_C void copyFromNetBuf (NetBuf* srcBufs, char* dst, uint32_f size); extern_C void netBufCopy (NetBuf* srcBufs, NetBuf* dstBufs, uint32_f size); |
The copyToNetBuf function copies size bytes from the contiguous memory area starting at address src to the dstBufs list of network memory buffers. The copyFromNetBuf function copies size bytes from the srcBufs list of network memory buffers to a contiguous memory area starting at address dst. The netBufCopy function copies size bytes from the srcBufs list of network memory buffers to the dstBufs list of network memory buffers.
typedef struct NetFrame* NetFramePtr; typedef void (*NetFrameFree)(NetFramePtr); typedef struct NetFrame { struct NetFrame* next; /* to build list of NetFrames */ uint32_f frameSize; /* total length of frame */ NetBuf* bufList; /* list of buffers holding the data */ NetFrameFree freeFrame; /* the free function of the frame */ } NetFrame; #define NET_FRAME_FREE(netFrame) (*netFrame->freeFrame)(netFrame)
The next field is for recording network frames as lists. The frameSize field specifies the total size in bytes of the frame. The bufList field points to a list of NetBuf structures which represent the memory buffers holding the frame data.
The freeFrame field points to the function which must be invoked to free the network frame. This function takes one argument, the address of the NetFrame structure itself. The freeFrame function of a network frame must be invoked by the consumer to return the network frame to its producer.
The NET_FRAME_FREE macro is provided as a short-cut for invoking the freeFrame function of a network frame. The next field of the NetFrame structure can be freely used by the consumer of a network frame until it frees it. All the other fields of the NetFrame structure are read-only for the consumer to which the network frame is provided.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | EXTENDED DESCRIPTION | ATTRIBUTES