Partager via


NDIS_OOB_DATA_FROM_PACKET (Compact 2013)

3/26/2014

This macro returns a pointer to the out-of-band (OOB) data block associated with a given packet descriptor.

Syntax

PNDIS_PACKET_OOB_DATA NDIS_OOB_DATA_FROM_PACKET(
  PNDIS_PACKET _P
);

Parameters

  • _P
    Points to a packet descriptor

Return Value

The return value is a pointer to the OOB data block associated with the given packet descriptor. The return value is NULL if there is no OOB information for the packet.

Remarks

Lower-level NDIS drivers that supply out-of-band information with the packet descriptors they allocate for indications can use NDIS_OOB_DATA_FROM_PACKET to gain access to the OOB block associated with a driver-allocated packet descriptor. Such a driver would then set up OOB information before it indicates a receive packet.

For example, an NDIS intermediate driver might copy the OOB information from a received packet into a fresh packet descriptor with NdisMoveMemory before forwarding the indication up to bound protocols. In this case, the intermediate driver calls NdisMoveMemory with the pointers returned by NDIS_OOB_DATA_FROM_PACKET as the Source and Destination pointers and sizeof(NDIS_PACKET_OOB_DATA) as the Length.

Lower-level NDIS drivers might also use this macro when the Status of an indicated packet is returned from NdisMIndicateReceivePacket with NDIS_STATUS_SUCCESS or when MiniportReturnPacket is called with a packet descriptor to be reinitialized for reuse. In these circumstances, the driver can call NdisZeroMemory with the pointer returned by NDIS_OOB_DATA_FROM_PACKET and sizeof(NDIS_PACKET_OOB_DATA) to clear the OOB data block associated with the packet descriptor. Or, such a driver can use the appropriate NDIS_SET_PACKET_XXX macros to reinitialize specific members in the OOB data block for subsequent indications with the returned packet descriptor.

Higher-level NDIS drivers can use NDIS_OOB_DATA_FROM_PACKET to reinitialize the OOB data block associated with the packet descriptors they allocate to specify sends when such a packet descriptor was returned to the ProtocolSendComplete function. Therefore, drivers underlying such a protocol might use NDIS_OOB_DATA_FROM_PACKET to read the OOB information for an incoming send packet.

A driver should never pass a packet descriptor to NdisZeroMemory in an attempt to clear the OOB data block associated with a packet descriptor. Doing this destroys the given packet descriptor, makes it useless for subsequent indications or sends, and causes a memory leak. A driver must pass the pointer returned by NDIS_OOB_DATA_FROM_PACKET to reinitialize the OOB data block associated with a driver-allocated packet descriptor.

The NDIS_OOB_DATA_FROM_PACKET macro is defined as follows.

#define NDIS_OOB_DATA_FROM_PACKET(_p)                                   \
                        (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_p) +          \
                        (_p)->Private.NdisPacketOobOffset)

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Network Driver Macros
MiniportReturnPacket
NDIS_PACKET_OOB_DATA
NdisAllocatePacket
NdisMIndicateReceivePacket
NdisMoveMemory
NdisZeroMemory
ProtocolSendComplete
NDIS 5.x Legacy Reference