This macro 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.
PNDIS_PACKET NDIS_SET_ORIGINAL_PACKET( PNDIS_PACKET _P, PNDIS_PACKET _OP );
Points to a packet descriptor that NDIS_SET_ORIGINAL_PACKET sets from the original packet descriptor in _OP or points to the current packet descriptor if OriginalPacket is NULL.
Points to a packet descriptor that was originally indicated up by a lower-level driver.
The return value is the _OP pointer.
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 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.
The NDIS_SET_ORIGINAL_PACKET macro is defined as followed.
#define NDIS_SET_ORIGINAL_PACKET(_P, _OP) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, OriginalPacketInfo) = _OP
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));
OS Versions: Windows CE .NET 4.0 and later.
NDIS_PACKET | NdisGetReceivedPacket | NdisMIndicateReceivePacket | NDIS_PER_PACKET_INFO_FROM_PACKET | NDIS_PACKET_OOB_DATA | NDIS_GET_PACKET_TIME_RECEIVED | NDIS_GET_ORIGINAL_PACKET | NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO | ProtocolReceive
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.