Compartilhar via


NDIS_GET_ORIGINAL_PACKET (Compact 2013)

3/26/2014

This macro returns a pointer to a packet descriptor that the lowest-level driver in a layered stack of NDIS drivers indicated. The calling driver should access the out-of-band (OOB) data block from this original packet instead of the packet that the driver below the calling driver indicated. If the calling driver is not part of a layered stack, the returned packet descriptor will be identical to the packet that the driver below the calling driver indicated.

Syntax

PNDIS_PACKET NDIS_GET_ORIGINAL_PACKET(
  PNDIS_PACKET _P
);

Parameters

  • _P
    Points to a packet descriptor that the driver below the calling driver indicated

Return Value

The return value is a pointer to the packet descriptor that the lowest-level driver in a layered stack of NDIS drivers indicated, or if the calling driver is not part of a layered stack, the return value is the packet descriptor that the driver below the calling driver indicated.

Remarks

Typically, the packet that is returned by NDIS_GET_ORIGINAL_PACKET is the same packet that was indicated up by the driver below the calling driver. To indicate packets to a higher-level driver, a driver can call, for example, the NdisMIndicateReceivePacket function. To retrieve packets that were indicated up from a lower-level driver, a driver can call the NdisGetReceivedPacket function.

Call NDIS_GET_ORIGINAL_PACKET to obtain a pointer to a packet that was indicated up by the lowest-level driver in a layered stack of NDIS protocol and intermediate drivers. In this call, the drivers passed the pointer to the received packet through the higher-level layered drivers. In this manner, each driver in the layered stack can access the OOB data block associated with a packet received from the network, without requiring that the packet be copied to each layer.

The NDIS_GET_ORIGINAL_PACKET macro is defined as follows.

#define NDIS_GET_ORIGINAL_PACKET(_P) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, OriginalPacketInfo)

The following example code retrieves a packet that was received from the driver below and obtains the original packet from the retrieved packet.

// Get the original packet, which could be the received packet
// or the packet originating from the lowest-level driver.
// This result is based on the number of layered drivers in the stack.
//
Pkt = NdisGetReceivedPacket(BindingHandle, MacReceiveContext);
OrigPkt = NDIS_GET_ORIGINAL_PACKET(Pkt);

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Network Driver Macros
NDIS_PACKET
NdisGetReceivedPacket
NdisMIndicateReceivePacket
NDIS_PER_PACKET_INFO_FROM_PACKET
NDIS_PACKET_OOB_DATA
NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO
ProtocolReceive
NDIS 5.x Legacy Reference