Packet Sniffer SDK DLL Edition

HNLBAdapter wrapper for Delphi

 Previous Next

File: HNLBAdapter.pas

{****************************************************************************
**                                                                         **
**                         PSSDK HNLBAdapter module                        **
**            Copyright (c) 1997 - 2007 microOLAP Technologies LTD,        **
**                       Khalturin A.P., Naumov D.A.                       **
**                                                                         **
****************************************************************************}

unit HNLBAdapter;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  HNPSManager, HNLBHosts, HNLBSession, HNPsSdkDef;

type
  TOnPacketReceive = procedure (Sender : TObject; ThParam: Pointer; hPacket: Pointer; pPacketData: Pointer; IncPacketSize: DWORD) of object;
  TOnConnect       = procedure (Sender : TObject; ThParam: Pointer; hLBSession :Pointer; hLBHosts: Pointer; Direction: Integer) of object;
  TOnDisconnect    = procedure (Sender : TObject; ThParam: Pointer; hLBSession :Pointer; Direction: Integer) of object;
  TOnTcpPktReceive = procedure (Sender : TObject; ThParam: Pointer; hLBSession :Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD) of object;
  TOnUdpPktReceive = procedure (Sender : TObject; ThParam: Pointer; hLBHosts:   Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD) of object;
  TOnThreadBegin   = procedure (Sender : TObject; var ThParam: Pointer) of object;
  TOnThreadEnd     = procedure (Sender : TObject; ThParam: Pointer) of object;

  //---------------------------------------------------------------------------
  // Class THNLBAdapter
  //---------------------------------------------------------------------------
  THNLBAdapter = class
  private
    hAdp             : Pointer;

    FOnPacketReceive : TOnPacketReceive;
    FOnConnect       : TOnConnect;
    FOnDisconnect    : TOnDisconnect;
    FOnTcpPktReceive : TOnTcpPktReceive;
    FOnUdpPktReceive : TOnUdpPktReceive;
    FOnThreadBegin   : TOnThreadBegin;
    FOnThreadEnd     : TOnThreadEnd;

    procedure DoOnPacketReceive(ThParam: Pointer; hPacket: Pointer; pPacketData: Pointer; IncPacketSize: DWORD);
    procedure DoOnConnect(ThParam: Pointer; hLBSession :Pointer; hLBHosts: Pointer; Direction: Integer);
    procedure DoOnDisconnect(ThParam: Pointer; hLBSession :Pointer; Direction: Integer);
    procedure DoOnTcpPktReceive(ThParam: Pointer; hLBSession :Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD);
    procedure DoOnUdpPktReceive(ThParam: Pointer; hLBHosts:   Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD);
    procedure DoOnThreadBegin(var ThParam: Pointer);
    procedure DoOnThreadEnd(ThParam: Pointer);
    // Add in 3.1
    function  GetCaptureTcp() : BOOL;
    procedure SetCaptureTcp(bCaptureTcp : BOOL);
    function  GetCaptureUdp() : BOOL;
    procedure SetCaptureUdp(bCaptureUdp : BOOL);
    function  GetUseTcpPortFilters() : BOOL;
    procedure SetUseTcpPortFilters(bUseTcpPortFilters : BOOL);
    function  GetUseUdpPortFilters() : BOOL;
    procedure SetUseUdpPortFilters(bUseUdpPortFilters : BOOL);
    // Add in 3.2
    procedure SetReceiveQueue(Value: Pointer);
    function GetReceiveQueue: Pointer;
    function GetMaxThreadCount: DWORD;
    procedure SetThreadCount(Value: DWORD);
    function GetThreadCount: DWORD;
    procedure SetUserFilter(Value: Pointer);
    function GetUserFilter: Pointer;
    procedure SetUserFilterActive(Value: BOOL);
    function GetUserFilterActive: BOOL;
    procedure SetUseFastUserFilter(Value: BOOL);
    function GetUseFastUserFilter: BOOL;
    function GetUseHighPrecisionTime: BOOL;
    procedure SetUseHighPrecisionTime(Value: BOOL);
    function GetEthEmulation: BOOL;
    procedure SetEthEmulation(Value: BOOL);
    function GetCalcCheckSum: BOOL;
    procedure SetCalcCheckSum(Value: BOOL);
    function GetPacketPool: DWORD;
    procedure SetPacketPool(Value: DWORD);

  protected
  public
    constructor Create();
    destructor Destroy(); override;
    function IsValid: BOOL;

    function OpenAdapter: DWORD;
    function CloseAdapter: DWORD;

    function Get_OpenTime(HiValue: PUINT): UINT;
    function Get_ProcessNameByID(ProcessID : DWORD; Name : PChar; Size : Cardinal) : DWORD;
    function Get_ProcessFileByID(ProcessID : DWORD; Name : PChar; Size : Cardinal) : DWORD;
    // Add in 3.1
    procedure AddFilterTcpPort(Port : WORD; PortType : DWORD);
    procedure RemoveFilterTcpPort(Port : WORD);
    procedure RemoveAllTcpPortFilters();
    procedure AddFilterUdpPort(Port : WORD; PortType : DWORD);
    procedure RemoveFilterUdpPort(Port : WORD);
    procedure RemoveAllUdpPortFilters();
    // Add in 3.2
    property MaxThreadCount: DWORD read GetMaxThreadCount;
    property ThreadCount: DWORD read GetThreadCount write SetThreadCount;
    property ReceiveQueue: Pointer read GetReceiveQueue write SetReceiveQueue;
    property UserFilter: Pointer read GetUserFilter write SetUserFilter;
    function UpdateUserStatistics: DWORD;
    function Get_RecvCount(HiValue: PUINT): UINT;
    function Get_AcceptCount(HiValue: PUINT): UINT;
    function Get_RejectCount(HiValue: PUINT): UINT;
    function Get_ProcessCount(HiValue: PUINT): UINT;
    function Get_LostCount(HiValue: PUINT): UINT;
    property PacketPool: DWORD read GetPacketPool write SetPacketPool;

  published
    property OnConnect          : TOnConnect       read FOnConnect       write FOnConnect;
    property OnDisconnect       : TOnDisconnect    read FOnDisconnect    write FOnDisconnect;
    property OnTcpPacketReceive : TOnTcpPktReceive read FOnTcpPktReceive write FOnTcpPktReceive;
    property OnUdpPacketReceive : TOnUdpPktReceive read FOnUdpPktReceive write FOnUdpPktReceive;
    property OnThreadBegin      : TOnThreadBegin   read FOnThreadBegin   write FOnThreadBegin;
    property OnThreadEnd        : TOnThreadEnd     read FOnThreadEnd     write FOnThreadEnd;
    // Add in 3.1
    property CaptureTcp : BOOL read GetCaptureTcp write SetCaptureTcp;
    property CaptureUdp : BOOL read GetCaptureUdp write SetCaptureUdp;
    property UseTcpPortFilters : BOOL read GetUseTcpPortFilters write SetUseTcpPortFilters;
    property UseUdpPortFilters : BOOL read GetUseUdpPortFilters write SetUseUdpPortFilters;
    // Add in 3.2
    property OnPacketReceive   : TOnPacketReceive read FOnPacketReceive write FOnPacketReceive;
    property UserFilterActive: BOOL read GetUserFilterActive write SetUserFilterActive;
    property UseFastUserFilter: BOOL read GetUseFastUserFilter write SetUseFastUserFilter;
    property UseHighPrecisionTime: BOOL read GetUseHighPrecisionTime write SetUseHighPrecisionTime;
    property EthEmulation: BOOL read GetEthEmulation write SetEthEmulation;
    property CalcCheckSum: BOOL read GetCalcCheckSum write SetCalcCheckSum;

  end;

implementation

{$INCLUDE 'HNPsSdkFun.pas'}

//---------------------------------------------------------------------------
// IntOnPacketReceive - OnPacketReceive event handler.
//---------------------------------------------------------------------------
procedure IntOnPacketReceive(Param: Pointer; ThParam: Pointer; hPacket: Pointer; pPacketData: Pointer; IncPacketSize: DWORD); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnPacketReceive(ThParam,hPacket,pPacketData,IncPacketSize);
 end;

//---------------------------------------------------------------------------
// IntOnConnect - OnConnect event handler.
//---------------------------------------------------------------------------
procedure IntOnConnect(Param: Pointer; ThParam: Pointer; hLBSession :Pointer; hLBHosts: Pointer; Direction: Integer); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnConnect(ThParam, hLBSession, hLBHosts, Direction);
 end;

//---------------------------------------------------------------------------
// DoOnConnect - Fires on the new TCP session is created.
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnConnect(ThParam: Pointer; hLBSession :Pointer; hLBHosts: Pointer; Direction: Integer);
 begin
   if Assigned(FOnConnect) then FOnConnect(Self, ThParam, hLBSession, hLBHosts, Direction);
 end;

//---------------------------------------------------------------------------
// IntOnDisconnect - OnDisconnect event handler.
//---------------------------------------------------------------------------
procedure IntOnDisconnect(Param: Pointer; ThParam: Pointer; hLBSession :Pointer; Direction: Integer); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnDisconnect(ThParam, hLBSession, Direction);
 end;

//---------------------------------------------------------------------------
// DoOnDisconnect - Fires when TCP session is closed.
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnDisconnect(ThParam: Pointer; hLBSession :Pointer; Direction: Integer);
 begin
   if Assigned(FOnDisconnect) then FOnDisconnect(Self, ThParam, hLBSession, Direction);
 end;

//---------------------------------------------------------------------------
// IntOnTcpPktReceive - OnTcpPacketReceive event handler.
//---------------------------------------------------------------------------
procedure IntOnTcpPktReceive(Param: Pointer; ThParam: Pointer; hLBSession :Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnTcpPktReceive(ThParam, hLBSession, Direction, Pid, hPacket, pData, DataLength);
 end;

//---------------------------------------------------------------------------
// DoOnTcpPktReceive - Fires when an application receives or sends TCP data
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnTcpPktReceive(ThParam: Pointer; hLBSession :Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD);
 begin
   if Assigned(FOnTcpPktReceive) then FOnTcpPktReceive(Self, ThParam, hLBSession, Direction, Pid, hPacket, pData, DataLength);
 end;

//---------------------------------------------------------------------------
// IntOnUdpPktReceive - OnUdpPacketReceive event handler.
//---------------------------------------------------------------------------
procedure IntOnUdpPktReceive(Param: Pointer; ThParam: Pointer; hLBHosts: Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnUdpPktReceive(ThParam, hLBHosts, Direction, Pid, hPacket, pData, DataLength);
 end;

//---------------------------------------------------------------------------
// DoOnUdpPktReceive - Fires when an application receives or sends UDP data.
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnUdpPktReceive(ThParam: Pointer; hLBHosts:   Pointer; Direction: Integer; Pid: DWORD; hPacket: Pointer; pData: Pointer; DataLength: DWORD);
 begin
   if Assigned(FOnUdpPktReceive) then FOnUdpPktReceive(Self, ThParam, hLBHosts, Direction, Pid, hPacket, pData, DataLength);
 end;

//---------------------------------------------------------------------------
// IntOnThreadBegin - OnThreadBegin event handler.
//---------------------------------------------------------------------------
procedure IntOnThreadBegin(Param: Pointer; var ThParam: Pointer); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnThreadBegin(ThParam);
 end;

//---------------------------------------------------------------------------
// DoOnThreadBegin - Tracks the creating of the internal component thread.
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnThreadBegin(var ThParam: Pointer);
 begin
   if Assigned(FOnThreadBegin) then FOnThreadBegin(Self, ThParam);
 end;

//---------------------------------------------------------------------------
// IntOnThreadEnd - OnThreadEnd event handler.
//---------------------------------------------------------------------------
procedure IntOnThreadEnd(Param: Pointer; ThParam: Pointer); stdcall;
 var
   pAdp : THNLBAdapter;
 begin
   pAdp := THNLBAdapter(Param);
   pAdp.DoOnThreadEnd(ThParam);
 end;

//---------------------------------------------------------------------------
// DoOnThreadEnd - Tracks the closing of the internal component thread.
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnThreadEnd(ThParam: Pointer);
 begin
   if Assigned(FOnThreadEnd) then FOnThreadEnd(Self, ThParam);
 end;

//---------------------------------------------------------------------------
// Create - Creates an HNLBAdapter object.
//---------------------------------------------------------------------------
constructor THNLBAdapter.Create();
 begin
   hAdp := LbAdpCreate();

   LbAdpSetOnPacketRecv   (hAdp, @IntOnPacketReceive, Self);
   LbAdpSetOnConnect      (hAdp, @IntOnConnect,       Self);
   LbAdpSetOnDisconnect   (hAdp, @IntOnDisconnect,    Self);
   LbAdpSetOnTcpPacketRecv(hAdp, @IntOnTcpPktReceive, Self);
   LbAdpSetOnUdpPacketRecv(hAdp, @IntOnUdpPktReceive, Self);
   LbAdpSetOnThreadBegin  (hAdp, @IntOnThreadBegin,   Self);
   LbAdpSetOnThreadEnd    (hAdp, @IntOnThreadEnd,     Self);
 end;

//---------------------------------------------------------------------------
// Destroy - Destroys the HNLBAdapter object.
//---------------------------------------------------------------------------
destructor THNLBAdapter.Destroy();
 begin
   LbAdpSetOnPacketRecv   (hAdp, nil, nil);
   LbAdpSetOnConnect      (hAdp, nil, nil);
   LbAdpSetOnDisconnect   (hAdp, nil, nil);
   LbAdpSetOnTcpPacketRecv(hAdp, nil, nil);
   LbAdpSetOnUdpPacketRecv(hAdp, nil, nil);
   LbAdpSetOnThreadBegin  (hAdp, nil, nil);
   LbAdpSetOnThreadEnd    (hAdp, nil, nil);

   LbAdpDestroy(hAdp);
 end;

//---------------------------------------------------------------------------
// Method - IsValid - Checks if the HNLBAdapter object has been created correctly.
//---------------------------------------------------------------------------
function THNLBAdapter.IsValid: BOOL;
 begin
   Result := (hAdp <> nil);
 end;

//---------------------------------------------------------------------------
// Method - OpenAdapter - Opens loopback adapter for TCP/UDP traffic capturing and tracking of TCP sessions.
//---------------------------------------------------------------------------
function THNLBAdapter.OpenAdapter: DWORD;
 begin
   Result := LbAdpOpenAdapter(hAdp);
 end;

//---------------------------------------------------------------------------
// Method - CloseAdapter - Closes the loopback adapter, stops receiving of the local traffic and sessions tracking. 
//---------------------------------------------------------------------------
function THNLBAdapter.CloseAdapter: DWORD;
 begin
   Result := LbAdpCloseAdapter(hAdp);
 end;

//---------------------------------------------------------------------------
// Method - GetOpenTime - Returns the time of the latest opening of the loopback adapter.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_OpenTime(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetOpenTime(hAdp, PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// Method - GetProcessNameByID - Returns the process name by the process identifier (PID).
//---------------------------------------------------------------------------
function THNLBAdapter.Get_ProcessNameByID(ProcessID : DWORD; Name : PChar; Size : Cardinal) : DWORD;
 begin
   Result := LbAdpGetProcessNameByID(ProcessID,Name,Size);
 end;

//---------------------------------------------------------------------------
// Method - GetProcessFileByID - Returns the exefile name by the process identifier (PID).
//---------------------------------------------------------------------------
function THNLBAdapter.Get_ProcessFileByID(ProcessID : DWORD; Name : PChar; Size : Cardinal) : DWORD;
 begin
   Result := LbAdpGetProcessFileByID(ProcessID,Name,Size);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpGetCaptureTcp - Get TCP traffic capture flag
//---------------------------------------------------------------------------
function THNLBAdapter.GetCaptureTcp() : BOOL;
 begin
   Result := LbAdpGetCaptureTcp(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpSetCaptureTcp - Change TCP traffic capture flag
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetCaptureTcp(bCaptureTcp : BOOL);
 begin
   LbAdpSetCaptureTcp(hAdp,bCaptureTcp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpGetCaptureUdp - Get UDP traffic capture flag
//---------------------------------------------------------------------------
function THNLBAdapter.GetCaptureUdp() : BOOL;
 begin
   Result := LbAdpGetCaptureUdp(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpSetCaptureUdp - Change UDP traffic capture flag
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetCaptureUdp(bCaptureUdp : BOOL);
 begin
   LbAdpSetCaptureUdp(hAdp,bCaptureUdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpGetUseTcpPortFilters - Return TCP ports filters using flag value
//---------------------------------------------------------------------------
function THNLBAdapter.GetUseTcpPortFilters() : BOOL;
 begin
   Result := LbAdpGetUseTcpPortFilters(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpSetUseTcpPortFilters - Change TCP ports filters using flag
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUseTcpPortFilters(bUseTcpPortFilters : BOOL);
 begin
   LbAdpSetUseTcpPortFilters(hAdp,bUseTcpPortFilters);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpGetUseUdpPortFilters - Return UDP ports filters using flag value
//---------------------------------------------------------------------------
function THNLBAdapter.GetUseUdpPortFilters() : BOOL;
 begin
   Result := LbAdpGetUseUdpPortFilters(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpSetUseUdpPortFilters - Change UDP ports filters using flag
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUseUdpPortFilters(bUseUdpPortFilters : BOOL);
 begin
   LbAdpSetUseUdpPortFilters(hAdp,bUseUdpPortFilters);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpAddFilterTcpPort - Add a TCP port filter
//---------------------------------------------------------------------------
procedure THNLBAdapter.AddFilterTcpPort(Port : WORD; PortType : DWORD);
 begin
   LbAdpAddFilterTcpPort(hAdp,Port,PortType);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpRemoveFilterTcpPort -  Remove a TCP port filter
//---------------------------------------------------------------------------
procedure THNLBAdapter.RemoveFilterTcpPort(Port : WORD);
 begin
   LbAdpRemoveFilterTcpPort(hAdp,Port);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpRemoveAllTcpPortFilters - Remove all TCP port filters
//---------------------------------------------------------------------------
procedure THNLBAdapter.RemoveAllTcpPortFilters();
 begin
   LbAdpRemoveAllTcpPortFilters(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpAddFilterUdpPort - Add a UDP port filter
//---------------------------------------------------------------------------
procedure THNLBAdapter.AddFilterUdpPort(Port : WORD; PortType : DWORD);
 begin
   LbAdpAddFilterUdpPort(hAdp,Port,PortType);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpRemoveFilterUdpPort - Remove a UDP port filter
//---------------------------------------------------------------------------
procedure THNLBAdapter.RemoveFilterUdpPort(Port : WORD);
 begin
   LbAdpRemoveFilterUdpPort(hAdp,Port);
 end;

//---------------------------------------------------------------------------
// v3.1 - LbAdpRemoveAllUdpPortFilters - Remove all UDP port filters
//---------------------------------------------------------------------------
procedure THNLBAdapter.RemoveAllUdpPortFilters();
 begin
   LbAdpRemoveAllUdpPortFilters(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - EthEmulation - Set Ethernet emulation mode using flag for HNLBAdapter object.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetEthEmulation(Value: BOOL);
 begin
   LbAdpSetEthEmulation(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - EthEmulation - Return Ethernet emulation mode using flag for HNLBAdapter object.
//---------------------------------------------------------------------------
function THNLBAdapter.GetEthEmulation: BOOL;
 begin
   Result := LbAdpGetEthEmulation(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - CalcCheckSum - Set IP/TCP/UDP checksums caculation flag for Ethernet emulation mode.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetCalcCheckSum(Value: BOOL);
 begin
   LbAdpSetCalcCheckSum(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - CalcCheckSum - Return IP/TCP/UDP checksums caculation flag for Ethernet emulation mode.
//---------------------------------------------------------------------------
function THNLBAdapter.GetCalcCheckSum: BOOL;
 begin
   Result := LbAdpGetCalcCheckSum(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - DoOnPacketReceive - Fire event handler OnPacketReceive
//---------------------------------------------------------------------------
procedure THNLBAdapter.DoOnPacketReceive(ThParam: Pointer; hPacket: Pointer; pPacketData: Pointer; IncPacketSize: DWORD);
 begin
   if Assigned(FOnPacketReceive) then FOnPacketReceive(Self,ThParam,hPacket,pPacketData,IncPacketSize);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - ReceiveQueue - Returns the handle of HNQueue object.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetReceiveQueue(Value: Pointer);
 begin
   LbAdpSetReceiveQueue(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - ReceiveQueue - Sets the handle of HNQueue object.
//---------------------------------------------------------------------------
function THNLBAdapter.GetReceiveQueue: Pointer;
 begin
   Result := LbAdpGetReceiveQueue(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - MaxThreadCount - Returns the maximal number of the threads allowed to be created for work with the loopback adapter.
//---------------------------------------------------------------------------
function THNLBAdapter.GetMaxThreadCount: DWORD;
 begin
   Result := LbAdpGetMaxThreadCount(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - ThreadCount - Sets the number of threads created for work with the loopback adapter.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetThreadCount(Value: DWORD);
 begin
   LbAdpSetThreadCount(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - ThreadCount - Returns the number of threads created for work with the loopback adapter.
//---------------------------------------------------------------------------
function THNLBAdapter.GetThreadCount: DWORD;
 begin
   Result := LbAdpGetThreadCount(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - Get_RecvCount - Returns the number of the packets received by the Packet Sniffer SDK internal driver from OS.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_RecvCount(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetRecvCount(hAdp,PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - Get_AcceptCount - Returns the number of the packets passed by the user-settable packet filter.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_AcceptCount(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetAcceptCount(hAdp,PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - Get_RejectCount - Returns the number of packets rejected by the user-settable packet filter.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_RejectCount(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetRejectCount(hAdp,PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - Get_ProcessCount - Returns the number of the packets transferred to the application.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_ProcessCount(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetProcessCount(hAdp,PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - Get_LostCount - Returns the number of the packets lost by the PSSDK internal driver.
//---------------------------------------------------------------------------
function THNLBAdapter.Get_LostCount(HiValue: PUINT): UINT;
 begin
   Result := LbAdpGetLostCount(hAdp,PDWORD(HiValue));
 end;

//---------------------------------------------------------------------------
// v3.2 - Method - UpdateUserStatistics - Updates the user-settable filter statistics synchronously.
//---------------------------------------------------------------------------
function THNLBAdapter.UpdateUserStatistics: DWORD;
 begin
   Result := LbAdpUpdateUserStatistics(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UserFilter - Sets the handle of HNUserFilter object.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUserFilter(Value: Pointer);
 begin
   LbAdpSetUserFilter(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UserFilter - Returns the handle of HNUserFilter object.
//---------------------------------------------------------------------------
function THNLBAdapter.GetUserFilter: Pointer;
 begin
   Result := LbAdpGetUserFilter(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UserFilterActive - Sets the status flag of the user-settable packet filter using.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUserFilterActive(Value: BOOL);
 begin
   LbAdpSetUserFilterActive(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UserFilterActive - Returns the status flag of the user-settable packet filter using.
//---------------------------------------------------------------------------
function THNLBAdapter.GetUserFilterActive: BOOL;
 begin
   Result := LbAdpGetUserFilterActive(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UseFastUserFilter - Sets the status flag of the FastBPF using.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUseFastUserFilter(Value: BOOL);
 begin
   LbAdpSetUseFastUserFilter(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UseFastUserFilter - Returns the status flag of the FastBPF using.
//---------------------------------------------------------------------------
function THNLBAdapter.GetUseFastUserFilter: BOOL;
 begin
   Result := LbAdpGetUseFastUserFilter(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UseHighPrecisionTime - Sets flag status of using High Precision Time.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetUseHighPrecisionTime(Value: BOOL);
 begin
   LbAdpSetUseHighPrecisionTime(hAdp,Value);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - UseHighPrecisionTime - Returns flag status of using High Precision Time.
//---------------------------------------------------------------------------
function THNLBAdapter.GetUseHighPrecisionTime: BOOL;
 begin
   Result := LbAdpGetUseHighPrecisionTime(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - PacketPool - Return the size of the packets pool which is used by PSSDK for transfering captured packets from the internal driver to application and back.
//---------------------------------------------------------------------------
function THNLBAdapter.GetPacketPool: DWORD;
 begin
   Result := LbAdpGetPacketPool(hAdp);
 end;

//---------------------------------------------------------------------------
// v3.2 - Property - PacketPool - Set the size of the packets pool which is used by PSSDK for transfering captured packets from the internal driver to application and back.
//---------------------------------------------------------------------------
procedure THNLBAdapter.SetPacketPool(Value: DWORD);
 begin
   LbAdpSetPacketPool(hAdp,Value);
 end;

end.
See also:HNLBAdapter, All wrappers in one ZIP archive