PACKET_BUFFER

[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;
 

Members

Data
Buffer containing the data that the virtual interface transmits.
Start
The beginning memory location of the transmitted data.
End
The ending memory location of the transmitted data.
Max
The maximum physical length of the transmitted data. The End member can never be increased beyond the value of Max.
Context
Value specifying the context of the transmitted data.
Protocol
Value specifying the format of the data. The following table lists and describes the valid format values.
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.

AddressLength
Size, in bytes, of the Address array. If Address is null, AddressLength is zero.
Address
An array of bytes specifying an address to which the packet belongs. This array can be no longer than 16 bytes.
CompletionFunc
Pointer to a function that a virtual interface DLL calls to inform the MMR that the DLL is done processing the packet buffer. In this call, the DLL provides status on the completed packet.

Remarks

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.

See Also

msbdnOutputSendPacket, PacketBufferComplete