NdisQueryPacket

This function returns information about a specified packet.

At a Glance

Header file: Ndis.h
Windows CE versions: 2.0 and later

Syntax

VOID NdisQueryPacket( IN PNDIS_PACKET Packet,
OUT PUINT
PhysicalBufferCount OPTIONAL,
OUT PUINT
BufferCount OPTIONAL,
OUT PNDIS_BUFFER *
FirstBuffer OPTIONAL,
OUT PUINT
TotalPacketLength OPTIONAL );

Parameters

Packet
Pointer to a packet descriptor.
PhysicalBufferCount
Pointer to a caller-supplied variable in which this function returns the maximum number of physical breaks mapped by the buffer descriptors chained to the given packet. This parameter can be NULL.
BufferCount
Pointer to a caller-supplied variable in which this function returns the number of buffer descriptors chained to the specified packet. This parameter can be NULL.
FirstBuffer
Pointer to a caller-supplied variable in which this function returns a pointer to the initial buffer descriptor chained to the specified packet. This parameter can be NULL.
TotalPacketLength
Pointer to a caller-supplied variable in which this function returns the number of bytes of packet data mapped by all chained buffer descriptors. This parameter can be NULL.

Remarks

This function returns caller-selected information about a specified packet. The caller must specify at least one of the PhysicalBufferCount, BufferCount, FirstBuffer, and TotalPacketLength pointers, along with the Packet parameter. A caller can specify explicit pointers for all parameters.

Specifying an explicit PhysicalBufferCount pointer is equivalent to summing calls to the NdisGetBufferPhysicalArraySize function for each buffer descriptor in the packet descriptor. A driver can call the NdisGetNextBuffer function as many times as necessary to retrieve pointers to any subsequent buffer descriptors in the chain, unless the call returns 0, indicating that the packet descriptor has no data.

If the caller supplies an explicit BufferCount pointer, this function returns the number of buffer descriptors in the packet chain. The return value can be used as a loop counter to retrieve buffer descriptors in the chain with either of the NdisUnchainBufferXXX functions.

If the caller supplies an explicit FirstBuffer pointer but the packet’s buffer chain is empty, this function returns NULL at FirstBuffer. Otherwise, the caller can use NdisQueryBuffer subsequently to get details about the initial buffer descriptor for the packet. As a faster alternative, drivers can call NdisGetFirstBufferFromPacket to get a pointer to the initial buffer descriptor.

If the caller supplies an explicit TotalPacketLength pointer, this function returns the total number of bytes specified by every buffer descriptor chained to the specified packet.

A driver that calls this function can run at any IRQL.

See Also

NdisGetFirstBufferFromPacket, NdisGetNextBuffer, NdisQueryBuffer, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront