Packet Sniffer SDK DLL Edition

HNQueue :: Methods :: QueGetFreeItems

 Previous Next

Returns HNPacket objects with Free status from the queue.

Syntax:

DWORD __stdcall QueGetFreeItems(HANDLE hQue, DWORD Milliseconds, PHANDLE hPackets, DWORD dwCount);

Parameters:

hQue

[in] HNQueue object handle.

Milliseconds

[in] Specifies the time-out interval, in milliseconds. The function returns if the interval elapses, even if the object's state is nonsignaled (i.e., there are no any free objects in the queue). If Milliseconds is zero, the function tests the object's state and returns immediately. If Milliseconds is INFINITE(0xFFFFFFFF), the function's time-out interval never elapses.

hPackets

[in, out] Array of HNPacket objects handles.

dwCount

[in] The size of the array of HNPacket (see hPackets parameter). Means the maximal quantity of objects which hPackets parameter may contain.

Return values:

If this function succeeds, then the quantity of Free HNPacket objects copied to hPackets array will be returned. If returned value is equal to 0, then there are no free elements, or the status of the thread awaiting for packet enqueueing was changed by the QueUnblockWaitFree function.

Description:

Use QueGetFreeItems to get free elements from the queue. After this function is executed FreeCount [Get] property is changed.

Also, please take in account, that after an element of the queue is processed, you should return it to the queue using QueReturnFullItem(QueReturnFullItems) or QueReturnFreeItem(QueReturnFreeItems) functions.

Use QueReturnFullItem(QueReturnFullItems) functions to return HNPacket to the queue, if it must be considered as Full, and must be accessible by the QueGetFullItem(QueGetFullItems) functions call later.

Use QueReturnFreeItem(QueReturnFreeItems) functions to return HNPacket to the queue, if it must be considered as Free, and must be accessible by the QueGetFreeItems(QueGetFreeItems) functions call later.

Please, never call the QueReturnFullItem(QueReturnFullItems) and QueReturnFreeItem(QueReturnFreeItems) functions for HNPacket objects not belonging to the queue, i.e. objects, which aren't obtained from the queue by QueGetFreeItem(QueGetFreeItems) and QueGetFullItem(QueGetFullItems) functions, or in the OnPacketReceive event handler.
See also:HNQueue, HNPacket, QueUnblockWaitFree, QueGetFreeCount, QueGetFreeItem, QueReturnFullItem, QueReturnFullItems, QueReturnFreeItem, QueReturnFreeItems