NdisAllocatePacket 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.

NdisAllocatePacket allocates and initializes a packet descriptor.

Syntax

VOID NdisAllocatePacket(
  _Out_ PNDIS_STATUS Status,
  _Out_ PNDIS_PACKET *Packet,
  _In_  NDIS_HANDLE  PoolHandle
);

Parameters

  • Status [out]
    Pointer to a caller-supplied variable in which this function returns the final status of the request, which can be one of the following:

    • NDIS_STATUS_SUCCESS
      The caller can use the packet descriptor returned at Packet. A subsequent call to NdisFreePacket will return the given entry to the free list.

    • NDIS_STATUS_RESOURCES
      The free list for the packet pool currently has no available entries.

  • Packet [out]
    Pointer to a caller-supplied variable in which this function returns a pointer to the allocated packet descriptor.

  • PoolHandle [in]
    Specifies the handle returned by a preceding call to NdisAllocatePacketPool.

Return value

None

Remarks

NDIS drivers must allocate packet descriptors from packet pool. Protocol drivers call NdisAllocatePacket one or more times for their subsequent calls to NdisSend or NdisSendPackets. Miniport drivers call NdisAllocatePacket one or more times for subsequent calls to NdisMIndicateReceivePacket.. NDIS intermediate drivers must call NdisAllocatePacket to repackage sends and receive indications in fresh packet descriptors before passing incoming transfer requests on to other NDIS drivers.

Each packet descriptor will eventually have one or more buffer descriptors chained to it. NdisAllocatePacket zero-initializes the packet descriptor and sets its buffer chain pointer to NULL. The caller must chain the buffer descriptor(s) mapping the packet data to the packet descriptor before it is sent or indicated. Most NDIS drivers allocate buffer descriptors with NdisAllocateBuffer.

Drivers must use the NDIS_GET/SET_PACKET_XXX macros or NDIS_OOB_DATA_FROM_PACKET to access or set up any out-of-band information associated with the packet descriptor.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisAllocateNetBuffer instead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL.

See also

NdisAllocateBuffer

NdisAllocatePacketPool

NdisDprAllocatePacket

NdisDprFreePacket

NdisFreePacket

NDIS_GET_PACKET_HEADER_SIZE

NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO

NDIS_GET_PACKET_STATUS

NDIS_GET_PACKET_TIME_RECEIVED

NDIS_GET_PACKET_TIME_SENT

NDIS_GET_PACKET_TIME_TO_SEND

NdisMArcIndicateReceive

NdisMEthIndicateReceive

NdisMFddiIndicateReceive

NdisMIndicateReceivePacket

NdisMTrIndicateReceive

NDIS_OOB_DATA_FROM_PACKET

NDIS_PACKET

NDIS_PACKET_OOB_DATA

NdisSend

NdisSendPackets

NDIS_SET_PACKET_HEADER_SIZE

NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO

NDIS_SET_PACKET_STATUS

NDIS_SET_PACKET_TIME_RECEIVED

NDIS_SET_PACKET_TIME_SENT

NDIS_SET_PACKET_TIME_TO_SEND

 

 

Send comments about this topic to Microsoft