Packet Sniffer SDK DLL Edition

HNAdapter :: Properties :: AdpSetPacketPool

 Previous Next

Set the size of the packets pool which is used by PSSDK for transfering captured packets from the internal driver to application and back.

Syntax:

DWORD __stdcall AdpSetPacketPool(HANDLE hAdp, DWORD PacketPool);

Parameters:

hAdp

[in] HNAdapter object handle.

PacketPool

[in] Packets pool size (1000 packets by default).

Return values:

If the function succeeds the return value will be the PacketPool parameter value.

Description:

Use AdpSetPacketPool to set the size of the packets pool which is used by PSSDK for transfering captured packets from the internal driver to application and back.

The packet pool is used by PSSDK in the following way:

  1. While adapter opening PSSDK maps HNPacket objects to the internal driver address space, that allows significantly decrease data copying operations quantity.
  2. Captured data are stored directly into the HNPacket object, and then transferred to application for further processing.
  3. After data processing at the appication level is completed, HNPacket object is remapped back to the PSSDK internal driver address space.

So, while traffic capturing HNPacket objects are constantly transferred from the application address space to the driver address space and back. In fact, PacketPool property is used by HNAdapter object to determine quantity of HNPacket objects which may be mapped to the PSSDK internal driver address space at the same time.

Experimenting with the PacketPool property value you can optimize both the application performance, and the memory required for it.

To get current PacketPool value please use AdpGetPacketPool function.

PacketPool is implemented only for WinNt platform (nt/2k/xp/2k3/vista/longhorn). It can't be changed under 9x systems.
If the HNQueue object is used (see HNAdapter.ReceiveQueue property), then the value of the PacketPool parameter can't be greater than HNQueue.ItemsCount.
If you're going to change PacketPool value in your application, it is very important to take into account the size of the memory available on the system: if the allocation of the memory necessary to the packets pool is impossible, you'll get HNERR_TOO_BIG_PACKETS_POOL error on the adapter opening.
If the PacketPool property was set to 0 before adapter opening, then the application will not receive captured data. This feature may be useful if you need the traffic statistics only, or your application only sends packets, or it only executes NDIS requests.
See also:HNAdapter, HNPacket, HNQueue, HNAdapter.ReceiveQueue, HNQueue.ItemsCount, AdpGetPacketPool