[This is preliminary documentation and subject to change.]
The PACKET_BUFFER structure contains information about a packet of data that a virtual interface sends to its output system.
typedef struct PACKET_BUFFER {
LPBYTE Data; // storage for packet data
DWORD Start; // where the data begins
DWORD End; // where the data ends
DWORD Max; // the physical length of Data
DWORD Context;
WORD Protocol;
WORD AddressLength;
BYTE Address[16];
PACKET_COMPLETION_FUNC CompletionFunc;
} PACKET_BUFFER;
Value | Meaning |
---|---|
PACKET_BUFFER_PROTOCOL_IP | The packet body is a full IP packet, including header and body. Virtual interfaces should extract an IP address from the message body. The Address member of PACKET_BUFFER is not used. |
PACKET_BUFFER_PROTOCOL_VBI_RAW | The packet is a VBI frame. The Address member of PACKET_BUFFER is not used. |
The MMR keeps track of packets with the PACKET_BUFFER structure. A virtual interface uses PACKET_BUFFER to route packets from the MMR to a specific output system.
The PACKET_BUFFER structure provides virtual interfaces with an easy way to add or remove packet headers without requiring memory allocation and copy operations. For example, to remove an IP header from a packet, advance the Start member of PACKET_BUFFER by the length of the IP header. To add an Ethernet frame header to the front of a packet, first insure that there is sufficient space at the beginning of the packet buffer by checking to make sure that the Start member is greater than or equal to the length of an Ethernet header. Then, subtract the length of the Ethernet header from the Start member and fill in the appropriate members in the Ethernet header.
When the MMR calls the msbdnOutputSendPacket function on a specific instance of a virtual interface, such a virtual interface takes responsibility for the passed PACKET_BUFFER while processing it. This virtual interface must eventually call the PacketBufferComplete function to indicate to the MMR that the virtual interface is done processing.
msbdnOutputSendPacket, PacketBufferComplete