Поделиться через


NDIS_PACKET structure

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.

The NDIS_PACKET structure defines the packet descriptors with chained buffer descriptors for which 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
    This is 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
    This is reserved for use exclusively by NDIS.

  • MiniportReservedEx
    Deserialized and connection-oriented miniport drivers can use this area for their own purposes.

  • WrapperReservedEx
    This is reserved for use exclusively by NDIS.

  • MacReserved
    This is reserved for use by legacy drivers.

  • Reserved
    Serialized miniport drivers and NDIS intermediate drivers can use this area for their own purposes.

  • 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 or NdisAllocatePacketEx to allocate all packet descriptors they use to indicate receives to higher-level drivers with NdisMIndicateReceivePacket. NDIS drivers must call NdisAllocatePacket to allocate all packet descriptors they use for sends to underlying drivers with NdisSendPackets or NdisSend, as well as 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. NIC drivers and intermediate drivers allocate packet descriptors with four pointer's worth (4* sizeof (PVOID)) of ProtocolReserved space to be used by protocols for receive indications. On 32-bit systems, four pointer's worth of ProtocolReserved space equals 16 bytes. On 64-bit systems, four pointer's worth of ProtocolReserved space equals 32 bytes.

Any buffers allocated by lower-level NDIS drivers must be mapped by buffer descriptors that were allocated from buffer pool with NdisAllocateBuffer. Only highest-level Windows 2000 and later protocols can use MDLs set up by still higher-level drivers as substitutes for NDIS_BUFFER-type 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 containing 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. Consequently, NDIS intermediate drivers, which have both MiniportXxx and ProtocolXxx functions, cannot use these areas in incoming packet descriptors for their own purposes.

Drivers that supply and consume out-of-band data on network transfers and drivers that support multipacket receives and/or 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 NdisCoSendPackets, 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 descriptor(s)

  • All data buffers mapped by buffer descriptors chained to the packet descriptor(s)

  • 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 (include Ndis.h)

See also

MiniportSend

MiniportSendPackets

MiniportTransferData

NdisAllocateBuffer

NdisAllocatePacket

NdisChainBufferAtBack

NdisChainBufferAtFront

NdisCopyFromPacketToPacket

NdisFreePacket

NdisGetFirstBufferFromPacket

NdisGetFirstBufferFromPacketSafe

NdisGetPacketFlags

NdisMSendComplete

NdisMTransferDataComplete

NDIS_PACKET_OOB_DATA

NdisQueryPacket

NdisRecalculatePacketCounts

NdisReinitializePacket

NdisReturnPackets

NdisSend

NdisCoSendPackets

NdisSendPackets

NdisSetPacketFlags

NdisTransferData

NdisUnchainBufferAtBack

NdisUnchainBufferAtFront

ProtocolReceive

ProtocolReceivePacket

ProtocolSendComplete

ProtocolTransferDataComplete

 

 

Send comments about this topic to Microsoft