msbdnOutputSendPacket

[This is preliminary documentation and subject to change.]

The msbdnOutputSendPacket function sends all packets of a data stream to the output system.

HRESULT msbdnOutputSendPacket(
  IN MSBDN_OUTPUT_SUBSYSTEM *Subsystem,
  IN PACKET_BUFFER *Packet    
);
 

Parameters

Subsystem
Address of an MSBDN_OUTPUT_SUBSYSTEM structure that contains details about the virtual interface implementation.
Packet
Address of a PACKET_BUFFER structure that describes a packet of data.

Return Values

Returns zero if the virtual interface successfully transmitted the packet. If the function fails, the return value is non-zero.

Remarks

While a stream is active, the stream functionality of the MMR calls the msbdnOutputSendPacket function in the virtual interface DLL. The MMR does so to send a stream's data packets to the broadcast encoder or to other output systems. The msbdnOutputSendPacket function is responsible for translating protocol types, generating network-specific addresses, and reformatting data to follow network-specific protocols.

The virtual interface can alter the Start and End members of a PACKET_BUFFER structure and can alter the memory to which the Data member of PACKET_BUFFER points. However, the virtual interface must not alter the information within the Data member itself. The MMR stores the actual data that the virtual interface transmits in the buffer to which the Data member of PACKET_BUFFER points. The data that the virtual interface transmits begins at the index given by the Start member of PACKET_BUFFER and ends at the index given by the End member of PACKET_BUFFER. The buffer for transmitted packets is structured in this manner to allow virtual interfaces to efficiently add or remove packet headers and trailers without requiring that the virtual interface copy the entire packet elsewhere in memory.

The length of the actual packet data is determined by subtracting the PACKET_BUFFER's Start member from its End member. Provided that there is sufficient space at the beginning of the packet buffer, the virtual interface could decrease the value of the PACKET_BUFFER's Start member and then store new data in that memory location. The virtual interface could also extend the packet by increasing the PACKET_BUFFER's End member. However, the virtual interface must never increase the value of the PACKET_BUFFER's End member beyond its Max member. The virtual interface can also change the values of the PACKET_BUFFER's Start and End members to decrease the length of the packet.

Examples of the virtual interface manipulating packets include:

The virtual interface can accomplish these tasks without copying the packet data, which facilitates high-speed applications.

The virtual interface must "complete" the packet buffer when it is done processing it. If the virtual interface can finish processing the packet immediately, it should complete the packet buffer before returning from msbdnOutputSendPacket; this operation is synchronous. Otherwise, the virtual interface might store the packet in a queue and complete the packet later in a different thread; this operation is asynchronous.

If the MMR receives data with protocol types it cannot decipher, it forwards the data to the virtual interface without modification.

See Also

MSBDN_OUTPUT_SUBSYSTEM, PacketBufferComplete, PACKET_BUFFER