Compartilhar via


NDIS_PACKET (Compact 2013)

3/26/2014

This structure contains chained buffer descriptors. The buffer descriptor pointers are passed to many NdisXXX, MiniportXXX, and ProtocolXXX functions.

Syntax

typedef struct _NDIS_PACKET {
  NDIS_PACKET_PRIVATE Private;
  union {
    struct {
      UCHAR MiniportReserved[2*sizeof(PVOID)];
      UCHAR WrapperReserved[2*sizeof(PVOID)];
    };
    struct {
      UCHAR MiniportReservedEx[3*sizeof(PVOID)];
      UCHAR WrapperReservedEx[sizeof(PVOID)];
    };
    struct {
      UCHAR MacReserved[4*sizeof(PVOID)];
    };
  };
  ULONG_PTR Reserved[2];
  UCHAR ProtocolReserved[1];
} NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;

Members

  • Private
    Reserved for use exclusively by NDIS. Drivers must call the appropriate NdisXXX functions or NDIS-supplied macros to affect the contents of this area.
  • MiniportReserved
    Serialized miniport drivers and NDIS intermediate drivers can use this area for their own purposes.
  • WrapperReserved
    Reserved for use exclusively by NDIS.
  • MiniportReservedEx
    Deserialized and connection-oriented miniport drivers can use this area for their own purposes.
  • WrapperReservedEx
    Reserved for use exclusively by NDIS.
  • MacReserved
    Reserved for use by legacy drivers.
  • Reserved
    Reserved for use with Microsoft® Windows® 95 and Microsoft® Windows® 98.
  • ProtocolReserved
    Highest-level protocol drivers and NDIS intermediate drivers can use this variable-sized area for their own purposes, as long as each such driver is given a fresh packet descriptor.

Remarks

NDIS drivers must call NdisAllocatePacket to allocate all packet descriptors they use to indicate receives to higher-level drivers that have NdisMIndicateReceivePacket. NDIS drivers must call NdisAllocatePacket to allocate all packet descriptors they use for sends to underlying drivers that have NdisSendPackets or NdisSend, and packet descriptors they pass to NdisTransferData.

Chained to each packet descriptor are one or more buffer descriptors mapping buffers that contain network packet data, either received or to be transmitted. network adapter drivers and intermediate drivers allocate packet descriptors with at least 16 bytes of ProtocolReservedspace to be used by protocols for receive indications.

Any buffers allocated by lower-level NDIS drivers must be mapped by buffer descriptors that were allocated from the buffer pool with NdisAllocateBuffer. Only highest-level Microsoft® Windows® 2000 protocols can use memory descriptor lists (MDLs) set up by still higher-level drivers as substitutes for NDIS_BUFFER descriptors.

NDIS drivers typically use their respective XXXReserved areas to maintain per-packet state about outstanding transfers. For example, a protocol might store a pointer to a protocol-allocated buffer that contains lookahead data, which its ProtocolReceive function has already copied, in the ProtocolReserved area of a packet descriptor that the protocol allocates for a call to NdisTransferData.

A single driver can use the MiniportReserved(Ex) area and a single driver can use the ProtocolReserved area while a particular packet descriptor is being used in a transfer operation. Therefore, NDIS intermediate drivers, which have both MiniportXXX and ProtocolXXX functions, cannot use these areas in incoming packet descriptors for their own purposes.

Instead, NDIS intermediate drivers must repackage each incoming packet in a fresh packet descriptor before it passes the transfer request down to an underlying driver or up to a higher-level driver.

This strategy ensures that the NDIS intermediate driver and the underlying driver each have a MiniportReserved(Ex) area to use, that the intermediate driver and overlying protocol each have a ProtocolReserved area to use, and that the intermediate driver has a convenient and economical way to maintain per-packet state information about all current transfers. This also ensures that NDIS has correct information in the Private section of each packet descriptor.

Drivers that supply and consume out-of-band data on network transfers and drivers that support multipacket receives and sends must use the member-specific NDIS_GET/SET_XXX macros or the NDIS_OOB_DATA_FROM_PACKET macro to access the NDIS_PACKET_OOB_DATA block associated with each packet descriptor.

When a protocol driver calls NdisSendPackets or NdisSend with a packet descriptor, it relinquishes ownership of the following until that packet descriptor is returned to its ProtocolSendComplete function:

  • The protocol-allocated packet descriptors
  • All data buffers mapped by buffer descriptors chained to the packet descriptors
  • All NDIS_PACKET_OOB_DATA blocks associated with each protocol-allocated packet descriptor
  • Any out-of-band data buffer specified in an NDIS_PACKET_OOB_DATA block for an associated buffer descriptor

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Structures
NdisAllocatePacket
NdisMIndicateReceivePacket
NdisSendPackets
NdisSend
NdisTransferData
NdisAllocateBuffer
NDIS_BUFFER
ProtocolReceive
NDIS_OOB_DATA_FROM_PACKET
NDIS_PACKET_OOB_DATA
ProtocolSendComplete
NDIS 5.x Legacy Reference