Packet Sniffer SDK DLL Edition

HNLBAdapter :: Properties :: LbAdpSetPacketPool

 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 LbAdpSetPacketPool(HANDLE hLbAdp, DWORD PacketPool);

Parameters:

hLbAdp

[in] HNLBAdapter 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 LbAdpSetPacketPool 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 HNLBAdapter 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 LbAdpGetPacketPool function.

If the HNQueue object is used (see HNLBAdapter.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 Loopback 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.
See also:HNLBAdapter, HNPacket, HNQueue, HNLBAdapter.ReceiveQueue, HNQueue.ItemsCount, LbAdpGetPacketPool