Packet Sniffer SDK DLL Edition

HNLBHosts wrapper for Delphi

 Previous Next

File: HNLBHosts.pas

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

unit HNLBHosts;

interface

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

type
  //---------------------------------------------------------------------------
  // Class THNLBHosts
  //---------------------------------------------------------------------------
  THNLBHosts = class
  private
    hHst  : Pointer;

  private
    function  GetAddrType:   DWORD;
    function  GetLocalIPv4:  DWORD;
    function  GetRemoteIPv4: DWORD;
    function  GetLocalPort:  WORD;
    function  GetRemotePort: WORD;

  protected
  public
    constructor Create();
    destructor  Destroy(); override;

    property  AddrType:   DWORD read GetAddrType;
    property  LocalIPv4:  DWORD read GetLocalIPv4;
    property  RemoteIPv4: DWORD read GetRemoteIPv4;
    property  LocalPort:  WORD  read GetLocalPort;
    property  RemotePort: WORD  read GetRemotePort;

    property  Handle: Pointer read hHst write hHst;

  public
    function IsValid: BOOL;

  published
  end;

implementation

{$INCLUDE 'HNPsSdkFun.pas'}

//---------------------------------------------------------------------------
// Create - Constructor
//---------------------------------------------------------------------------
constructor THNLBHosts.Create();
 begin
   hHst := nil;
 end;

//---------------------------------------------------------------------------
// Destroy - Destructor
//---------------------------------------------------------------------------
destructor THNLBHosts.Destroy();
 begin
   
 end;

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

//---------------------------------------------------------------------------
// Property - AddrType - Returns the address type, defined in the HNLBHosts object.
//---------------------------------------------------------------------------
function THNLBHosts.GetAddrType(): DWORD;
 begin
   Result := LbHstGetAddrType(hHst);
 end;

//---------------------------------------------------------------------------
// Property - LocalIPv4 - Returns the IPv4 address of the local host, participating in TCP session.
//---------------------------------------------------------------------------
function THNLBHosts.GetLocalIPv4(): DWORD;
 begin
   Result := LbHstGetLocalIPv4(hHst);
 end;

//---------------------------------------------------------------------------
// Property - RemoteIPv4 - Returns the IPv4 address of the remote host, participating in TCP session.
//---------------------------------------------------------------------------
function THNLBHosts.GetRemoteIPv4(): DWORD;
 begin
   Result := LbHstGetRemoteIPv4(hHst);
 end;

//---------------------------------------------------------------------------
// Property - LocalPort - Returns the port number of the local host, participating in TCP session.
//---------------------------------------------------------------------------
function THNLBHosts.GetLocalPort(): WORD;
 begin
   Result := LbHstGetLocalPort(hHst);
 end;

//---------------------------------------------------------------------------
// Property - RemotePort - Returns the port number of the remote host, participating in TCP session.
//---------------------------------------------------------------------------
function THNLBHosts.GetRemotePort(): WORD;
 begin
   Result := LbHstGetRemotePort(hHst);
 end;

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