Freigeben über


NDIS_SET_ORIGINAL_PACKET function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NDIS_SET_ORIGINAL_PACKET sets the information in a given packet descriptor to the information from a packet descriptor that was originally indicated up by a lower-level driver.

Syntax

VOID NDIS_SET_ORIGINAL_PACKET(
  _Inout_ PNDIS_PACKET Packet,
  _In_    PNDIS_PACKET OriginalPacket
);

Parameters

  • Packet [in, out]
    Pointer to a packet descriptor that NDIS_SET_ORIGINAL_PACKET sets from the original packet descriptor in OriginalPacket or points to the current packet descriptor if OriginalPacket is NULL.

  • OriginalPacket [in]
    Pointer to a packet descriptor that was originally indicated up by a lower-level driver.

Return value

None

Remarks

If intermediate drivers are present in a layered stack of NDIS drivers, those intermediate drivers must repackage packets that they receive before indicating the packets up to the next layer. In this situation, intermediate drivers should call NDIS_SET_ORIGINAL_PACKET to set the contents of a new packet from a packet that was indicated up by a lower-level driver. To retrieve a packet that was received from a lower-level driver, drivers call the NdisGetReceivedPacket function. To obtain a pointer to the original packet that was indicated up by the lowest-level driver in the layered stack, drivers call the NDIS_GET_ORIGINAL_PACKET macro and pass the pointer to the received packet. Using this method of retrieving and repackaging, each driver in the layered stack can access the out-of-band (OOB) data block that is associated with packets that are received from the network without requiring that packets be copied to each layer.

Before calling NDIS_SET_ORIGINAL_PACKET, intermediate drivers must allocate a packet descriptor and map this packet descriptor's chain of buffer descriptors to the original packet descriptor's chain of buffer descriptors. Intermediate drivers should always allocate their packet descriptors from packet pools that the drivers set up during initialization.

Example

The following example code retrieves a packet that was received from the driver below, obtains the original packet from OldPkt, and then sets MyPkt with the original-packet contents.

// 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. 
// Then, set the result on the packet that will be indicated to the 
// next level so the OOB data block is accessible. 
//
OldPkt = NdisGetReceivedPacket(BindingHandle, MacReceiveContext);
NdisDprAllocatePacket(&Status, &MyPkt, RecvPacketPoolHandle);
MyPkt->Private.Head = OldPkt->Private.Head;
MyPkt->Private.Tail = OldPkt->Private.Tail;
NDIS_SET_ORIGINAL_PACKET(MyPkt, NDIS_GET_ORIGINAL_PACKET(OldPkt));

Requirements

Target platform

Desktop

Header

Ndis.h (include Ndis.h)

IRQL

Any level

See also

NdisDprAllocatePacket

NDIS_GET_ORIGINAL_PACKET

NdisGetReceivedPacket

NDIS_PACKET

NDIS_PACKET_EXTENSION

NDIS_PACKET_EXTENSION_FROM_PACKET

NDIS_PER_PACKET_INFO_FROM_PACKET

 

 

Send comments about this topic to Microsoft