unit Chilkat.SshTunnel;

{
  Pascal wrapper for Chilkat SshTunnel.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TSshTunnel wraps CkSshTunnel via the C bridge layer. }
  TSshTunnel = class(TChilkatBase)
  private
    FOnAbortCheck: TChilkatAbortCheckEvent;
    FOnPercentDone: TChilkatPercentDoneEvent;
    FOnProgressInfo: TChilkatProgressInfoEvent;
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetAcceptLog: string;
    procedure SetAcceptLog(AValue: string);
    function  GetAcceptLogPath: string;
    procedure SetAcceptLogPath(AValue: string);
    function  GetConnectTimeoutMs: Integer;
    procedure SetConnectTimeoutMs(AValue: Integer);
    function  GetDestHostname: string;
    procedure SetDestHostname(AValue: string);
    function  GetDestPort: Integer;
    procedure SetDestPort(AValue: Integer);
    function  GetDynamicPortForwarding: Boolean;
    procedure SetDynamicPortForwarding(AValue: Boolean);
    function  GetHttpProxyAuthMethod: string;
    procedure SetHttpProxyAuthMethod(AValue: string);
    function  GetHttpProxyDomain: string;
    procedure SetHttpProxyDomain(AValue: string);
    function  GetHttpProxyHostname: string;
    procedure SetHttpProxyHostname(AValue: string);
    function  GetHttpProxyPassword: string;
    procedure SetHttpProxyPassword(AValue: string);
    function  GetHttpProxyPort: Integer;
    procedure SetHttpProxyPort(AValue: Integer);
    function  GetHttpProxyUsername: string;
    procedure SetHttpProxyUsername(AValue: string);
    function  GetIdleTimeoutMs: Integer;
    procedure SetIdleTimeoutMs(AValue: Integer);
    function  GetInboundSocksPassword: string;
    procedure SetInboundSocksPassword(AValue: string);
    function  GetInboundSocksUsername: string;
    procedure SetInboundSocksUsername(AValue: string);
    function  GetIsAccepting: Boolean;
    function  GetKeepAcceptLog: Boolean;
    procedure SetKeepAcceptLog(AValue: Boolean);
    function  GetKeepTunnelLog: Boolean;
    procedure SetKeepTunnelLog(AValue: Boolean);
    function  GetListenBindIpAddress: string;
    procedure SetListenBindIpAddress(AValue: string);
    function  GetListenPort: Integer;
    function  GetOutboundBindIpAddress: string;
    procedure SetOutboundBindIpAddress(AValue: string);
    function  GetOutboundBindPort: Integer;
    procedure SetOutboundBindPort(AValue: Integer);
    function  GetSoRcvBuf: Integer;
    procedure SetSoRcvBuf(AValue: Integer);
    function  GetSoSndBuf: Integer;
    procedure SetSoSndBuf(AValue: Integer);
    function  GetSocksHostname: string;
    procedure SetSocksHostname(AValue: string);
    function  GetSocksPassword: string;
    procedure SetSocksPassword(AValue: string);
    function  GetSocksPort: Integer;
    procedure SetSocksPort(AValue: Integer);
    function  GetSocksUsername: string;
    procedure SetSocksUsername(AValue: string);
    function  GetSocksVersion: Integer;
    procedure SetSocksVersion(AValue: Integer);
    function  GetTcpNoDelay: Boolean;
    procedure SetTcpNoDelay(AValue: Boolean);
    function  GetTunnelLog: string;
    procedure SetTunnelLog(AValue: string);
    function  GetTunnelLogPath: string;
    procedure SetTunnelLogPath(AValue: string);
    function  GetHostKeyFingerprint: string;
    function  GetAbortCurrent: Boolean;
    procedure SetAbortCurrent(AValue: Boolean);
    function  GetPreferIpv6: Boolean;
    procedure SetPreferIpv6(AValue: Boolean);
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
    function  GetClientIdentifier: string;
    procedure SetClientIdentifier(AValue: string);
    function  GetClientLogDir: string;
    procedure SetClientLogDir(AValue: string);
    function  GetEnableSecrets: Boolean;
    procedure SetEnableSecrets(AValue: Boolean);
    procedure SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
    procedure SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
    procedure SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property AcceptLog: string read GetAcceptLog write SetAcceptLog;
    property AcceptLogPath: string read GetAcceptLogPath write SetAcceptLogPath;
    property ConnectTimeoutMs: Integer read GetConnectTimeoutMs write SetConnectTimeoutMs;
    property DestHostname: string read GetDestHostname write SetDestHostname;
    property DestPort: Integer read GetDestPort write SetDestPort;
    property DynamicPortForwarding: Boolean read GetDynamicPortForwarding write SetDynamicPortForwarding;
    property HttpProxyAuthMethod: string read GetHttpProxyAuthMethod write SetHttpProxyAuthMethod;
    property HttpProxyDomain: string read GetHttpProxyDomain write SetHttpProxyDomain;
    property HttpProxyHostname: string read GetHttpProxyHostname write SetHttpProxyHostname;
    property HttpProxyPassword: string read GetHttpProxyPassword write SetHttpProxyPassword;
    property HttpProxyPort: Integer read GetHttpProxyPort write SetHttpProxyPort;
    property HttpProxyUsername: string read GetHttpProxyUsername write SetHttpProxyUsername;
    property IdleTimeoutMs: Integer read GetIdleTimeoutMs write SetIdleTimeoutMs;
    property InboundSocksPassword: string read GetInboundSocksPassword write SetInboundSocksPassword;
    property InboundSocksUsername: string read GetInboundSocksUsername write SetInboundSocksUsername;
    property IsAccepting: Boolean read GetIsAccepting;
    property KeepAcceptLog: Boolean read GetKeepAcceptLog write SetKeepAcceptLog;
    property KeepTunnelLog: Boolean read GetKeepTunnelLog write SetKeepTunnelLog;
    property ListenBindIpAddress: string read GetListenBindIpAddress write SetListenBindIpAddress;
    property ListenPort: Integer read GetListenPort;
    property OutboundBindIpAddress: string read GetOutboundBindIpAddress write SetOutboundBindIpAddress;
    property OutboundBindPort: Integer read GetOutboundBindPort write SetOutboundBindPort;
    property SoRcvBuf: Integer read GetSoRcvBuf write SetSoRcvBuf;
    property SoSndBuf: Integer read GetSoSndBuf write SetSoSndBuf;
    property SocksHostname: string read GetSocksHostname write SetSocksHostname;
    property SocksPassword: string read GetSocksPassword write SetSocksPassword;
    property SocksPort: Integer read GetSocksPort write SetSocksPort;
    property SocksUsername: string read GetSocksUsername write SetSocksUsername;
    property SocksVersion: Integer read GetSocksVersion write SetSocksVersion;
    property TcpNoDelay: Boolean read GetTcpNoDelay write SetTcpNoDelay;
    property TunnelLog: string read GetTunnelLog write SetTunnelLog;
    property TunnelLogPath: string read GetTunnelLogPath write SetTunnelLogPath;
    property HostKeyFingerprint: string read GetHostKeyFingerprint;
    property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;
    property PreferIpv6: Boolean read GetPreferIpv6 write SetPreferIpv6;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;
    property ClientIdentifier: string read GetClientIdentifier write SetClientIdentifier;
    property ClientLogDir: string read GetClientLogDir write SetClientLogDir;
    property EnableSecrets: Boolean read GetEnableSecrets write SetEnableSecrets;

    { Event callbacks.  Return True from OnAbortCheck / OnPercentDone
      to abort the running method.  Callbacks are invoked on the
      thread that called the Chilkat method.  The HeartbeatMs
      property controls the AbortCheck frequency. }
    property OnAbortCheck: TChilkatAbortCheckEvent read FOnAbortCheck write SetOnAbortCheck;
    property OnPercentDone: TChilkatPercentDoneEvent read FOnPercentDone write SetOnPercentDone;
    property OnProgressInfo: TChilkatProgressInfoEvent read FOnProgressInfo write SetOnProgressInfo;

    function  AuthenticatePk(const username: string; privateKey: TChilkatBase): Boolean;
    function  AuthenticatePw(const login: string; const password: string): Boolean;
    function  AuthenticatePwPk(const username: string; const password: string; privateKey: TChilkatBase): Boolean;
    function  BeginAccepting(listenPort: Integer): Boolean;
    function  CloseTunnel(waitForThreads: Boolean): Boolean;
    function  Connect(const hostname: string; port: Integer): Boolean;
    function  DisconnectAllClients(waitForThreads: Boolean): Boolean;
    function  StopAccepting(waitForThread: Boolean): Boolean;
    function  ConnectThroughSsh(ssh: TChilkatBase; const hostname: string; port: Integer): Boolean;
    function  IsSshConnected: Boolean;
    function  GetCurrentState: string;
    function  AuthenticateSecPw(login: TChilkatBase; password: TChilkatBase): Boolean;
    function  AuthenticateSecPwPk(username: TChilkatBase; password: TChilkatBase; privateKey: TChilkatBase): Boolean;
    function  StartKeyboardAuth(const login: string): string;
    function  ContinueKeyboardAuth(const response: string): string;
    function  SetAllowedAlgorithms(json: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkSshTunnel_Create  = function(): Pointer; cdecl;
  TCkSshTunnel_Dispose = procedure(handle: Pointer); cdecl;
  TCkBridgeAbortCheckCb   = function(userData: Pointer): Integer; cdecl;
  TCkBridgePercentDoneCb  = function(pctDone: Integer; userData: Pointer): Integer; cdecl;
  TCkBridgeProgressInfoCb = procedure(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
  TCkSshTunnel_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkSshTunnel_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkSshTunnel_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkSshTunnel_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_AcceptLog = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_AcceptLog = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_AcceptLogPath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_AcceptLogPath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_ConnectTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_ConnectTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_DestHostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_DestHostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_DestPort = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_DestPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_DynamicPortForwarding = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_DynamicPortForwarding = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_HttpProxyAuthMethod = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_HttpProxyAuthMethod = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_HttpProxyDomain = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_HttpProxyDomain = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_HttpProxyHostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_HttpProxyHostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_HttpProxyPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_HttpProxyPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_HttpProxyPort = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_HttpProxyPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_HttpProxyUsername = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_HttpProxyUsername = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_IdleTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_IdleTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_InboundSocksPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_InboundSocksPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_InboundSocksUsername = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_InboundSocksUsername = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_IsAccepting = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_get_KeepAcceptLog = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_KeepAcceptLog = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_KeepTunnelLog = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_KeepTunnelLog = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_ListenBindIpAddress = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_ListenBindIpAddress = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_ListenPort = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_get_OutboundBindIpAddress = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_OutboundBindIpAddress = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_OutboundBindPort = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_OutboundBindPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_SoRcvBuf = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_SoRcvBuf = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_SoSndBuf = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_SoSndBuf = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_SocksHostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_SocksHostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_SocksPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_SocksPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_SocksPort = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_SocksPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_SocksUsername = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_SocksUsername = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_SocksVersion = function(handle: Pointer): Integer; cdecl;
  TCkSshTunnel_put_SocksVersion = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSshTunnel_get_TcpNoDelay = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_TcpNoDelay = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_TunnelLog = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_TunnelLog = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_TunnelLogPath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_TunnelLogPath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_HostKeyFingerprint = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_get_AbortCurrent = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_AbortCurrent = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_PreferIpv6 = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_PreferIpv6 = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_ClientIdentifier = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_ClientIdentifier = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_ClientLogDir = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_put_ClientLogDir = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSshTunnel_get_EnableSecrets = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_put_EnableSecrets = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSshTunnel_AuthenticatePk = function(handle: Pointer; username: PAnsiChar; privateKey: Pointer): LongBool; cdecl;
  TCkSshTunnel_AuthenticatePw = function(handle: Pointer; login: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkSshTunnel_AuthenticatePwPk = function(handle: Pointer; username: PAnsiChar; password: PAnsiChar; privateKey: Pointer): LongBool; cdecl;
  TCkSshTunnel_BeginAccepting = function(handle: Pointer; listenPort: Integer): LongBool; cdecl;
  TCkSshTunnel_CloseTunnel = function(handle: Pointer; waitForThreads: LongBool): LongBool; cdecl;
  TCkSshTunnel_Connect = function(handle: Pointer; hostname: PAnsiChar; port: Integer): LongBool; cdecl;
  TCkSshTunnel_DisconnectAllClients = function(handle: Pointer; waitForThreads: LongBool): LongBool; cdecl;
  TCkSshTunnel_StopAccepting = function(handle: Pointer; waitForThread: LongBool): LongBool; cdecl;
  TCkSshTunnel_ConnectThroughSsh = function(handle: Pointer; ssh: Pointer; hostname: PAnsiChar; port: Integer): LongBool; cdecl;
  TCkSshTunnel_IsSshConnected = function(handle: Pointer): LongBool; cdecl;
  TCkSshTunnel_GetCurrentState = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSshTunnel_AuthenticateSecPw = function(handle: Pointer; login: Pointer; password: Pointer): LongBool; cdecl;
  TCkSshTunnel_AuthenticateSecPwPk = function(handle: Pointer; username: Pointer; password: Pointer; privateKey: Pointer): LongBool; cdecl;
  TCkSshTunnel_StartKeyboardAuth = function(handle: Pointer; login: PAnsiChar): PAnsiChar; cdecl;
  TCkSshTunnel_ContinueKeyboardAuth = function(handle: Pointer; response: PAnsiChar): PAnsiChar; cdecl;
  TCkSshTunnel_SetAllowedAlgorithms = function(handle: Pointer; json: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkSshTunnel_Create:  TCkSshTunnel_Create  = nil;
  CkSshTunnel_Dispose: TCkSshTunnel_Dispose = nil;
  CkSshTunnel_SetAbortCheckCallback:   TCkSshTunnel_SetAbortCheckCallback   = nil;
  CkSshTunnel_SetPercentDoneCallback:  TCkSshTunnel_SetPercentDoneCallback  = nil;
  CkSshTunnel_SetProgressInfoCallback: TCkSshTunnel_SetProgressInfoCallback = nil;
  CkSshTunnel_get_LastErrorHtml: TCkSshTunnel_get_LastErrorHtml = nil;
  CkSshTunnel_get_LastErrorText: TCkSshTunnel_get_LastErrorText = nil;
  CkSshTunnel_get_LastErrorXml: TCkSshTunnel_get_LastErrorXml = nil;
  CkSshTunnel_get_Version: TCkSshTunnel_get_Version = nil;
  CkSshTunnel_get_DebugLogFilePath: TCkSshTunnel_get_DebugLogFilePath = nil;
  CkSshTunnel_put_DebugLogFilePath: TCkSshTunnel_put_DebugLogFilePath = nil;
  CkSshTunnel_get_VerboseLogging: TCkSshTunnel_get_VerboseLogging = nil;
  CkSshTunnel_put_VerboseLogging: TCkSshTunnel_put_VerboseLogging = nil;
  CkSshTunnel_get_LastMethodSuccess: TCkSshTunnel_get_LastMethodSuccess = nil;
  CkSshTunnel_put_LastMethodSuccess: TCkSshTunnel_put_LastMethodSuccess = nil;
  CkSshTunnel_get_AcceptLog: TCkSshTunnel_get_AcceptLog = nil;
  CkSshTunnel_put_AcceptLog: TCkSshTunnel_put_AcceptLog = nil;
  CkSshTunnel_get_AcceptLogPath: TCkSshTunnel_get_AcceptLogPath = nil;
  CkSshTunnel_put_AcceptLogPath: TCkSshTunnel_put_AcceptLogPath = nil;
  CkSshTunnel_get_ConnectTimeoutMs: TCkSshTunnel_get_ConnectTimeoutMs = nil;
  CkSshTunnel_put_ConnectTimeoutMs: TCkSshTunnel_put_ConnectTimeoutMs = nil;
  CkSshTunnel_get_DestHostname: TCkSshTunnel_get_DestHostname = nil;
  CkSshTunnel_put_DestHostname: TCkSshTunnel_put_DestHostname = nil;
  CkSshTunnel_get_DestPort: TCkSshTunnel_get_DestPort = nil;
  CkSshTunnel_put_DestPort: TCkSshTunnel_put_DestPort = nil;
  CkSshTunnel_get_DynamicPortForwarding: TCkSshTunnel_get_DynamicPortForwarding = nil;
  CkSshTunnel_put_DynamicPortForwarding: TCkSshTunnel_put_DynamicPortForwarding = nil;
  CkSshTunnel_get_HttpProxyAuthMethod: TCkSshTunnel_get_HttpProxyAuthMethod = nil;
  CkSshTunnel_put_HttpProxyAuthMethod: TCkSshTunnel_put_HttpProxyAuthMethod = nil;
  CkSshTunnel_get_HttpProxyDomain: TCkSshTunnel_get_HttpProxyDomain = nil;
  CkSshTunnel_put_HttpProxyDomain: TCkSshTunnel_put_HttpProxyDomain = nil;
  CkSshTunnel_get_HttpProxyHostname: TCkSshTunnel_get_HttpProxyHostname = nil;
  CkSshTunnel_put_HttpProxyHostname: TCkSshTunnel_put_HttpProxyHostname = nil;
  CkSshTunnel_get_HttpProxyPassword: TCkSshTunnel_get_HttpProxyPassword = nil;
  CkSshTunnel_put_HttpProxyPassword: TCkSshTunnel_put_HttpProxyPassword = nil;
  CkSshTunnel_get_HttpProxyPort: TCkSshTunnel_get_HttpProxyPort = nil;
  CkSshTunnel_put_HttpProxyPort: TCkSshTunnel_put_HttpProxyPort = nil;
  CkSshTunnel_get_HttpProxyUsername: TCkSshTunnel_get_HttpProxyUsername = nil;
  CkSshTunnel_put_HttpProxyUsername: TCkSshTunnel_put_HttpProxyUsername = nil;
  CkSshTunnel_get_IdleTimeoutMs: TCkSshTunnel_get_IdleTimeoutMs = nil;
  CkSshTunnel_put_IdleTimeoutMs: TCkSshTunnel_put_IdleTimeoutMs = nil;
  CkSshTunnel_get_InboundSocksPassword: TCkSshTunnel_get_InboundSocksPassword = nil;
  CkSshTunnel_put_InboundSocksPassword: TCkSshTunnel_put_InboundSocksPassword = nil;
  CkSshTunnel_get_InboundSocksUsername: TCkSshTunnel_get_InboundSocksUsername = nil;
  CkSshTunnel_put_InboundSocksUsername: TCkSshTunnel_put_InboundSocksUsername = nil;
  CkSshTunnel_get_IsAccepting: TCkSshTunnel_get_IsAccepting = nil;
  CkSshTunnel_get_KeepAcceptLog: TCkSshTunnel_get_KeepAcceptLog = nil;
  CkSshTunnel_put_KeepAcceptLog: TCkSshTunnel_put_KeepAcceptLog = nil;
  CkSshTunnel_get_KeepTunnelLog: TCkSshTunnel_get_KeepTunnelLog = nil;
  CkSshTunnel_put_KeepTunnelLog: TCkSshTunnel_put_KeepTunnelLog = nil;
  CkSshTunnel_get_ListenBindIpAddress: TCkSshTunnel_get_ListenBindIpAddress = nil;
  CkSshTunnel_put_ListenBindIpAddress: TCkSshTunnel_put_ListenBindIpAddress = nil;
  CkSshTunnel_get_ListenPort: TCkSshTunnel_get_ListenPort = nil;
  CkSshTunnel_get_OutboundBindIpAddress: TCkSshTunnel_get_OutboundBindIpAddress = nil;
  CkSshTunnel_put_OutboundBindIpAddress: TCkSshTunnel_put_OutboundBindIpAddress = nil;
  CkSshTunnel_get_OutboundBindPort: TCkSshTunnel_get_OutboundBindPort = nil;
  CkSshTunnel_put_OutboundBindPort: TCkSshTunnel_put_OutboundBindPort = nil;
  CkSshTunnel_get_SoRcvBuf: TCkSshTunnel_get_SoRcvBuf = nil;
  CkSshTunnel_put_SoRcvBuf: TCkSshTunnel_put_SoRcvBuf = nil;
  CkSshTunnel_get_SoSndBuf: TCkSshTunnel_get_SoSndBuf = nil;
  CkSshTunnel_put_SoSndBuf: TCkSshTunnel_put_SoSndBuf = nil;
  CkSshTunnel_get_SocksHostname: TCkSshTunnel_get_SocksHostname = nil;
  CkSshTunnel_put_SocksHostname: TCkSshTunnel_put_SocksHostname = nil;
  CkSshTunnel_get_SocksPassword: TCkSshTunnel_get_SocksPassword = nil;
  CkSshTunnel_put_SocksPassword: TCkSshTunnel_put_SocksPassword = nil;
  CkSshTunnel_get_SocksPort: TCkSshTunnel_get_SocksPort = nil;
  CkSshTunnel_put_SocksPort: TCkSshTunnel_put_SocksPort = nil;
  CkSshTunnel_get_SocksUsername: TCkSshTunnel_get_SocksUsername = nil;
  CkSshTunnel_put_SocksUsername: TCkSshTunnel_put_SocksUsername = nil;
  CkSshTunnel_get_SocksVersion: TCkSshTunnel_get_SocksVersion = nil;
  CkSshTunnel_put_SocksVersion: TCkSshTunnel_put_SocksVersion = nil;
  CkSshTunnel_get_TcpNoDelay: TCkSshTunnel_get_TcpNoDelay = nil;
  CkSshTunnel_put_TcpNoDelay: TCkSshTunnel_put_TcpNoDelay = nil;
  CkSshTunnel_get_TunnelLog: TCkSshTunnel_get_TunnelLog = nil;
  CkSshTunnel_put_TunnelLog: TCkSshTunnel_put_TunnelLog = nil;
  CkSshTunnel_get_TunnelLogPath: TCkSshTunnel_get_TunnelLogPath = nil;
  CkSshTunnel_put_TunnelLogPath: TCkSshTunnel_put_TunnelLogPath = nil;
  CkSshTunnel_get_HostKeyFingerprint: TCkSshTunnel_get_HostKeyFingerprint = nil;
  CkSshTunnel_get_AbortCurrent: TCkSshTunnel_get_AbortCurrent = nil;
  CkSshTunnel_put_AbortCurrent: TCkSshTunnel_put_AbortCurrent = nil;
  CkSshTunnel_get_PreferIpv6: TCkSshTunnel_get_PreferIpv6 = nil;
  CkSshTunnel_put_PreferIpv6: TCkSshTunnel_put_PreferIpv6 = nil;
  CkSshTunnel_get_UncommonOptions: TCkSshTunnel_get_UncommonOptions = nil;
  CkSshTunnel_put_UncommonOptions: TCkSshTunnel_put_UncommonOptions = nil;
  CkSshTunnel_get_ClientIdentifier: TCkSshTunnel_get_ClientIdentifier = nil;
  CkSshTunnel_put_ClientIdentifier: TCkSshTunnel_put_ClientIdentifier = nil;
  CkSshTunnel_get_ClientLogDir: TCkSshTunnel_get_ClientLogDir = nil;
  CkSshTunnel_put_ClientLogDir: TCkSshTunnel_put_ClientLogDir = nil;
  CkSshTunnel_get_EnableSecrets: TCkSshTunnel_get_EnableSecrets = nil;
  CkSshTunnel_put_EnableSecrets: TCkSshTunnel_put_EnableSecrets = nil;
  CkSshTunnel_AuthenticatePk: TCkSshTunnel_AuthenticatePk = nil;
  CkSshTunnel_AuthenticatePw: TCkSshTunnel_AuthenticatePw = nil;
  CkSshTunnel_AuthenticatePwPk: TCkSshTunnel_AuthenticatePwPk = nil;
  CkSshTunnel_BeginAccepting: TCkSshTunnel_BeginAccepting = nil;
  CkSshTunnel_CloseTunnel: TCkSshTunnel_CloseTunnel = nil;
  CkSshTunnel_Connect: TCkSshTunnel_Connect = nil;
  CkSshTunnel_DisconnectAllClients: TCkSshTunnel_DisconnectAllClients = nil;
  CkSshTunnel_StopAccepting: TCkSshTunnel_StopAccepting = nil;
  CkSshTunnel_ConnectThroughSsh: TCkSshTunnel_ConnectThroughSsh = nil;
  CkSshTunnel_IsSshConnected: TCkSshTunnel_IsSshConnected = nil;
  CkSshTunnel_GetCurrentState: TCkSshTunnel_GetCurrentState = nil;
  CkSshTunnel_AuthenticateSecPw: TCkSshTunnel_AuthenticateSecPw = nil;
  CkSshTunnel_AuthenticateSecPwPk: TCkSshTunnel_AuthenticateSecPwPk = nil;
  CkSshTunnel_StartKeyboardAuth: TCkSshTunnel_StartKeyboardAuth = nil;
  CkSshTunnel_ContinueKeyboardAuth: TCkSshTunnel_ContinueKeyboardAuth = nil;
  CkSshTunnel_SetAllowedAlgorithms: TCkSshTunnel_SetAllowedAlgorithms = nil;

constructor TSshTunnel.Create;
begin
  inherited Create;
  FHandle := CkSshTunnel_Create();
end;

destructor TSshTunnel.Destroy;
begin
  if FHandle <> nil then
    CkSshTunnel_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

{ ---- Event callback thunks ---- }
{ Standalone cdecl functions registered with the C bridge.  The bridge
  passes back the userData pointer, which carries the Pascal object
  instance.  A non-zero return value aborts the running method. }

function TSshTunnel_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TSshTunnel;
begin
  Result := 0;
  obj := TSshTunnel(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

function TSshTunnel_PercentDoneThunk(pctDone: Integer; userData: Pointer): Integer; cdecl;
var
  obj: TSshTunnel;
begin
  Result := 0;
  obj := TSshTunnel(userData);
  if Assigned(obj) and Assigned(obj.FOnPercentDone) then
    if obj.FOnPercentDone(obj, pctDone) then Result := 1;
end;

procedure TSshTunnel_ProgressInfoThunk(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
var
  obj: TSshTunnel;
begin
  obj := TSshTunnel(userData);
  if Assigned(obj) and Assigned(obj.FOnProgressInfo) then
    obj.FOnProgressInfo(obj, CkToStr(name), CkToStr(value));
end;

procedure TSshTunnel.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkSshTunnel_SetAbortCheckCallback(FHandle, @TSshTunnel_AbortCheckThunk, Self)
  else
    CkSshTunnel_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TSshTunnel.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkSshTunnel_SetPercentDoneCallback(FHandle, @TSshTunnel_PercentDoneThunk, Self)
  else
    CkSshTunnel_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TSshTunnel.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkSshTunnel_SetProgressInfoCallback(FHandle, @TSshTunnel_ProgressInfoThunk, Self)
  else
    CkSshTunnel_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TSshTunnel.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkSshTunnel_get_LastErrorHtml(FHandle));
end;

function TSshTunnel.GetLastErrorText: string;
begin
  Result := CkToStr(CkSshTunnel_get_LastErrorText(FHandle));
end;

function TSshTunnel.GetLastErrorXml: string;
begin
  Result := CkToStr(CkSshTunnel_get_LastErrorXml(FHandle));
end;

function TSshTunnel.GetVersion: string;
begin
  Result := CkToStr(CkSshTunnel_get_Version(FHandle));
end;

function TSshTunnel.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkSshTunnel_get_DebugLogFilePath(FHandle));
end;

procedure TSshTunnel.SetDebugLogFilePath(AValue: string);
begin
  CkSshTunnel_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_VerboseLogging(FHandle));
end;

procedure TSshTunnel.SetVerboseLogging(AValue: Boolean);
begin
  CkSshTunnel_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_LastMethodSuccess(FHandle));
end;

procedure TSshTunnel.SetLastMethodSuccess(AValue: Boolean);
begin
  CkSshTunnel_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetAcceptLog: string;
begin
  Result := CkToStr(CkSshTunnel_get_AcceptLog(FHandle));
end;

procedure TSshTunnel.SetAcceptLog(AValue: string);
begin
  CkSshTunnel_put_AcceptLog(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetAcceptLogPath: string;
begin
  Result := CkToStr(CkSshTunnel_get_AcceptLogPath(FHandle));
end;

procedure TSshTunnel.SetAcceptLogPath(AValue: string);
begin
  CkSshTunnel_put_AcceptLogPath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetConnectTimeoutMs: Integer;
begin
  Result := CkSshTunnel_get_ConnectTimeoutMs(FHandle);
end;

procedure TSshTunnel.SetConnectTimeoutMs(AValue: Integer);
begin
  CkSshTunnel_put_ConnectTimeoutMs(FHandle, AValue);
end;

function TSshTunnel.GetDestHostname: string;
begin
  Result := CkToStr(CkSshTunnel_get_DestHostname(FHandle));
end;

procedure TSshTunnel.SetDestHostname(AValue: string);
begin
  CkSshTunnel_put_DestHostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetDestPort: Integer;
begin
  Result := CkSshTunnel_get_DestPort(FHandle);
end;

procedure TSshTunnel.SetDestPort(AValue: Integer);
begin
  CkSshTunnel_put_DestPort(FHandle, AValue);
end;

function TSshTunnel.GetDynamicPortForwarding: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_DynamicPortForwarding(FHandle));
end;

procedure TSshTunnel.SetDynamicPortForwarding(AValue: Boolean);
begin
  CkSshTunnel_put_DynamicPortForwarding(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetHttpProxyAuthMethod: string;
begin
  Result := CkToStr(CkSshTunnel_get_HttpProxyAuthMethod(FHandle));
end;

procedure TSshTunnel.SetHttpProxyAuthMethod(AValue: string);
begin
  CkSshTunnel_put_HttpProxyAuthMethod(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetHttpProxyDomain: string;
begin
  Result := CkToStr(CkSshTunnel_get_HttpProxyDomain(FHandle));
end;

procedure TSshTunnel.SetHttpProxyDomain(AValue: string);
begin
  CkSshTunnel_put_HttpProxyDomain(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetHttpProxyHostname: string;
begin
  Result := CkToStr(CkSshTunnel_get_HttpProxyHostname(FHandle));
end;

procedure TSshTunnel.SetHttpProxyHostname(AValue: string);
begin
  CkSshTunnel_put_HttpProxyHostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetHttpProxyPassword: string;
begin
  Result := CkToStr(CkSshTunnel_get_HttpProxyPassword(FHandle));
end;

procedure TSshTunnel.SetHttpProxyPassword(AValue: string);
begin
  CkSshTunnel_put_HttpProxyPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetHttpProxyPort: Integer;
begin
  Result := CkSshTunnel_get_HttpProxyPort(FHandle);
end;

procedure TSshTunnel.SetHttpProxyPort(AValue: Integer);
begin
  CkSshTunnel_put_HttpProxyPort(FHandle, AValue);
end;

function TSshTunnel.GetHttpProxyUsername: string;
begin
  Result := CkToStr(CkSshTunnel_get_HttpProxyUsername(FHandle));
end;

procedure TSshTunnel.SetHttpProxyUsername(AValue: string);
begin
  CkSshTunnel_put_HttpProxyUsername(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetIdleTimeoutMs: Integer;
begin
  Result := CkSshTunnel_get_IdleTimeoutMs(FHandle);
end;

procedure TSshTunnel.SetIdleTimeoutMs(AValue: Integer);
begin
  CkSshTunnel_put_IdleTimeoutMs(FHandle, AValue);
end;

function TSshTunnel.GetInboundSocksPassword: string;
begin
  Result := CkToStr(CkSshTunnel_get_InboundSocksPassword(FHandle));
end;

procedure TSshTunnel.SetInboundSocksPassword(AValue: string);
begin
  CkSshTunnel_put_InboundSocksPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetInboundSocksUsername: string;
begin
  Result := CkToStr(CkSshTunnel_get_InboundSocksUsername(FHandle));
end;

procedure TSshTunnel.SetInboundSocksUsername(AValue: string);
begin
  CkSshTunnel_put_InboundSocksUsername(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetIsAccepting: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_IsAccepting(FHandle));
end;

function TSshTunnel.GetKeepAcceptLog: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_KeepAcceptLog(FHandle));
end;

procedure TSshTunnel.SetKeepAcceptLog(AValue: Boolean);
begin
  CkSshTunnel_put_KeepAcceptLog(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetKeepTunnelLog: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_KeepTunnelLog(FHandle));
end;

procedure TSshTunnel.SetKeepTunnelLog(AValue: Boolean);
begin
  CkSshTunnel_put_KeepTunnelLog(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetListenBindIpAddress: string;
begin
  Result := CkToStr(CkSshTunnel_get_ListenBindIpAddress(FHandle));
end;

procedure TSshTunnel.SetListenBindIpAddress(AValue: string);
begin
  CkSshTunnel_put_ListenBindIpAddress(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetListenPort: Integer;
begin
  Result := CkSshTunnel_get_ListenPort(FHandle);
end;

function TSshTunnel.GetOutboundBindIpAddress: string;
begin
  Result := CkToStr(CkSshTunnel_get_OutboundBindIpAddress(FHandle));
end;

procedure TSshTunnel.SetOutboundBindIpAddress(AValue: string);
begin
  CkSshTunnel_put_OutboundBindIpAddress(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetOutboundBindPort: Integer;
begin
  Result := CkSshTunnel_get_OutboundBindPort(FHandle);
end;

procedure TSshTunnel.SetOutboundBindPort(AValue: Integer);
begin
  CkSshTunnel_put_OutboundBindPort(FHandle, AValue);
end;

function TSshTunnel.GetSoRcvBuf: Integer;
begin
  Result := CkSshTunnel_get_SoRcvBuf(FHandle);
end;

procedure TSshTunnel.SetSoRcvBuf(AValue: Integer);
begin
  CkSshTunnel_put_SoRcvBuf(FHandle, AValue);
end;

function TSshTunnel.GetSoSndBuf: Integer;
begin
  Result := CkSshTunnel_get_SoSndBuf(FHandle);
end;

procedure TSshTunnel.SetSoSndBuf(AValue: Integer);
begin
  CkSshTunnel_put_SoSndBuf(FHandle, AValue);
end;

function TSshTunnel.GetSocksHostname: string;
begin
  Result := CkToStr(CkSshTunnel_get_SocksHostname(FHandle));
end;

procedure TSshTunnel.SetSocksHostname(AValue: string);
begin
  CkSshTunnel_put_SocksHostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetSocksPassword: string;
begin
  Result := CkToStr(CkSshTunnel_get_SocksPassword(FHandle));
end;

procedure TSshTunnel.SetSocksPassword(AValue: string);
begin
  CkSshTunnel_put_SocksPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetSocksPort: Integer;
begin
  Result := CkSshTunnel_get_SocksPort(FHandle);
end;

procedure TSshTunnel.SetSocksPort(AValue: Integer);
begin
  CkSshTunnel_put_SocksPort(FHandle, AValue);
end;

function TSshTunnel.GetSocksUsername: string;
begin
  Result := CkToStr(CkSshTunnel_get_SocksUsername(FHandle));
end;

procedure TSshTunnel.SetSocksUsername(AValue: string);
begin
  CkSshTunnel_put_SocksUsername(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetSocksVersion: Integer;
begin
  Result := CkSshTunnel_get_SocksVersion(FHandle);
end;

procedure TSshTunnel.SetSocksVersion(AValue: Integer);
begin
  CkSshTunnel_put_SocksVersion(FHandle, AValue);
end;

function TSshTunnel.GetTcpNoDelay: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_TcpNoDelay(FHandle));
end;

procedure TSshTunnel.SetTcpNoDelay(AValue: Boolean);
begin
  CkSshTunnel_put_TcpNoDelay(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetTunnelLog: string;
begin
  Result := CkToStr(CkSshTunnel_get_TunnelLog(FHandle));
end;

procedure TSshTunnel.SetTunnelLog(AValue: string);
begin
  CkSshTunnel_put_TunnelLog(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetTunnelLogPath: string;
begin
  Result := CkToStr(CkSshTunnel_get_TunnelLogPath(FHandle));
end;

procedure TSshTunnel.SetTunnelLogPath(AValue: string);
begin
  CkSshTunnel_put_TunnelLogPath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetHostKeyFingerprint: string;
begin
  Result := CkToStr(CkSshTunnel_get_HostKeyFingerprint(FHandle));
end;

function TSshTunnel.GetAbortCurrent: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_AbortCurrent(FHandle));
end;

procedure TSshTunnel.SetAbortCurrent(AValue: Boolean);
begin
  CkSshTunnel_put_AbortCurrent(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetPreferIpv6: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_PreferIpv6(FHandle));
end;

procedure TSshTunnel.SetPreferIpv6(AValue: Boolean);
begin
  CkSshTunnel_put_PreferIpv6(FHandle, LongBool(AValue));
end;

function TSshTunnel.GetUncommonOptions: string;
begin
  Result := CkToStr(CkSshTunnel_get_UncommonOptions(FHandle));
end;

procedure TSshTunnel.SetUncommonOptions(AValue: string);
begin
  CkSshTunnel_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetClientIdentifier: string;
begin
  Result := CkToStr(CkSshTunnel_get_ClientIdentifier(FHandle));
end;

procedure TSshTunnel.SetClientIdentifier(AValue: string);
begin
  CkSshTunnel_put_ClientIdentifier(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetClientLogDir: string;
begin
  Result := CkToStr(CkSshTunnel_get_ClientLogDir(FHandle));
end;

procedure TSshTunnel.SetClientLogDir(AValue: string);
begin
  CkSshTunnel_put_ClientLogDir(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSshTunnel.GetEnableSecrets: Boolean;
begin
  Result := Boolean(CkSshTunnel_get_EnableSecrets(FHandle));
end;

procedure TSshTunnel.SetEnableSecrets(AValue: Boolean);
begin
  CkSshTunnel_put_EnableSecrets(FHandle, LongBool(AValue));
end;

function TSshTunnel.AuthenticatePk(const username: string; privateKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSshTunnel_AuthenticatePk(FHandle, PAnsiChar(StrToCk(username)), privateKey.Handle));
end;

function TSshTunnel.AuthenticatePw(const login: string; const password: string): Boolean;
begin
  Result := Boolean(CkSshTunnel_AuthenticatePw(FHandle, PAnsiChar(StrToCk(login)), PAnsiChar(StrToCk(password))));
end;

function TSshTunnel.AuthenticatePwPk(const username: string; const password: string; privateKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSshTunnel_AuthenticatePwPk(FHandle, PAnsiChar(StrToCk(username)), PAnsiChar(StrToCk(password)), privateKey.Handle));
end;

function TSshTunnel.BeginAccepting(listenPort: Integer): Boolean;
begin
  Result := Boolean(CkSshTunnel_BeginAccepting(FHandle, listenPort));
end;

function TSshTunnel.CloseTunnel(waitForThreads: Boolean): Boolean;
begin
  Result := Boolean(CkSshTunnel_CloseTunnel(FHandle, LongBool(waitForThreads)));
end;

function TSshTunnel.Connect(const hostname: string; port: Integer): Boolean;
begin
  Result := Boolean(CkSshTunnel_Connect(FHandle, PAnsiChar(StrToCk(hostname)), port));
end;

function TSshTunnel.DisconnectAllClients(waitForThreads: Boolean): Boolean;
begin
  Result := Boolean(CkSshTunnel_DisconnectAllClients(FHandle, LongBool(waitForThreads)));
end;

function TSshTunnel.StopAccepting(waitForThread: Boolean): Boolean;
begin
  Result := Boolean(CkSshTunnel_StopAccepting(FHandle, LongBool(waitForThread)));
end;

function TSshTunnel.ConnectThroughSsh(ssh: TChilkatBase; const hostname: string; port: Integer): Boolean;
begin
  Result := Boolean(CkSshTunnel_ConnectThroughSsh(FHandle, ssh.Handle, PAnsiChar(StrToCk(hostname)), port));
end;

function TSshTunnel.IsSshConnected: Boolean;
begin
  Result := Boolean(CkSshTunnel_IsSshConnected(FHandle));
end;

function TSshTunnel.GetCurrentState: string;
begin
  Result := CkToStr(CkSshTunnel_GetCurrentState(FHandle));
end;

function TSshTunnel.AuthenticateSecPw(login: TChilkatBase; password: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSshTunnel_AuthenticateSecPw(FHandle, login.Handle, password.Handle));
end;

function TSshTunnel.AuthenticateSecPwPk(username: TChilkatBase; password: TChilkatBase; privateKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSshTunnel_AuthenticateSecPwPk(FHandle, username.Handle, password.Handle, privateKey.Handle));
end;

function TSshTunnel.StartKeyboardAuth(const login: string): string;
begin
  Result := CkToStr(CkSshTunnel_StartKeyboardAuth(FHandle, PAnsiChar(StrToCk(login))));
end;

function TSshTunnel.ContinueKeyboardAuth(const response: string): string;
begin
  Result := CkToStr(CkSshTunnel_ContinueKeyboardAuth(FHandle, PAnsiChar(StrToCk(response))));
end;

function TSshTunnel.SetAllowedAlgorithms(json: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSshTunnel_SetAllowedAlgorithms(FHandle, json.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkSshTunnel_Create,  'CkSshTunnel_Create');
  Chilkat_GetProcedureAddress(CkSshTunnel_Dispose, 'CkSshTunnel_Dispose');
  Chilkat_GetProcedureAddress(CkSshTunnel_SetAbortCheckCallback, 'CkSshTunnel_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkSshTunnel_SetPercentDoneCallback, 'CkSshTunnel_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkSshTunnel_SetProgressInfoCallback, 'CkSshTunnel_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_LastErrorHtml, 'CkSshTunnel_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_LastErrorText, 'CkSshTunnel_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_LastErrorXml, 'CkSshTunnel_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_Version, 'CkSshTunnel_get_Version');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_DebugLogFilePath, 'CkSshTunnel_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_DebugLogFilePath, 'CkSshTunnel_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_VerboseLogging, 'CkSshTunnel_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_VerboseLogging, 'CkSshTunnel_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_LastMethodSuccess, 'CkSshTunnel_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_LastMethodSuccess, 'CkSshTunnel_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_AcceptLog, 'CkSshTunnel_get_AcceptLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_AcceptLog, 'CkSshTunnel_put_AcceptLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_AcceptLogPath, 'CkSshTunnel_get_AcceptLogPath');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_AcceptLogPath, 'CkSshTunnel_put_AcceptLogPath');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_ConnectTimeoutMs, 'CkSshTunnel_get_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_ConnectTimeoutMs, 'CkSshTunnel_put_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_DestHostname, 'CkSshTunnel_get_DestHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_DestHostname, 'CkSshTunnel_put_DestHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_DestPort, 'CkSshTunnel_get_DestPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_DestPort, 'CkSshTunnel_put_DestPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_DynamicPortForwarding, 'CkSshTunnel_get_DynamicPortForwarding');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_DynamicPortForwarding, 'CkSshTunnel_put_DynamicPortForwarding');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyAuthMethod, 'CkSshTunnel_get_HttpProxyAuthMethod');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyAuthMethod, 'CkSshTunnel_put_HttpProxyAuthMethod');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyDomain, 'CkSshTunnel_get_HttpProxyDomain');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyDomain, 'CkSshTunnel_put_HttpProxyDomain');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyHostname, 'CkSshTunnel_get_HttpProxyHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyHostname, 'CkSshTunnel_put_HttpProxyHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyPassword, 'CkSshTunnel_get_HttpProxyPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyPassword, 'CkSshTunnel_put_HttpProxyPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyPort, 'CkSshTunnel_get_HttpProxyPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyPort, 'CkSshTunnel_put_HttpProxyPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HttpProxyUsername, 'CkSshTunnel_get_HttpProxyUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_HttpProxyUsername, 'CkSshTunnel_put_HttpProxyUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_IdleTimeoutMs, 'CkSshTunnel_get_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_IdleTimeoutMs, 'CkSshTunnel_put_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_InboundSocksPassword, 'CkSshTunnel_get_InboundSocksPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_InboundSocksPassword, 'CkSshTunnel_put_InboundSocksPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_InboundSocksUsername, 'CkSshTunnel_get_InboundSocksUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_InboundSocksUsername, 'CkSshTunnel_put_InboundSocksUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_IsAccepting, 'CkSshTunnel_get_IsAccepting');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_KeepAcceptLog, 'CkSshTunnel_get_KeepAcceptLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_KeepAcceptLog, 'CkSshTunnel_put_KeepAcceptLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_KeepTunnelLog, 'CkSshTunnel_get_KeepTunnelLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_KeepTunnelLog, 'CkSshTunnel_put_KeepTunnelLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_ListenBindIpAddress, 'CkSshTunnel_get_ListenBindIpAddress');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_ListenBindIpAddress, 'CkSshTunnel_put_ListenBindIpAddress');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_ListenPort, 'CkSshTunnel_get_ListenPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_OutboundBindIpAddress, 'CkSshTunnel_get_OutboundBindIpAddress');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_OutboundBindIpAddress, 'CkSshTunnel_put_OutboundBindIpAddress');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_OutboundBindPort, 'CkSshTunnel_get_OutboundBindPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_OutboundBindPort, 'CkSshTunnel_put_OutboundBindPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SoRcvBuf, 'CkSshTunnel_get_SoRcvBuf');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SoRcvBuf, 'CkSshTunnel_put_SoRcvBuf');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SoSndBuf, 'CkSshTunnel_get_SoSndBuf');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SoSndBuf, 'CkSshTunnel_put_SoSndBuf');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SocksHostname, 'CkSshTunnel_get_SocksHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SocksHostname, 'CkSshTunnel_put_SocksHostname');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SocksPassword, 'CkSshTunnel_get_SocksPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SocksPassword, 'CkSshTunnel_put_SocksPassword');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SocksPort, 'CkSshTunnel_get_SocksPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SocksPort, 'CkSshTunnel_put_SocksPort');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SocksUsername, 'CkSshTunnel_get_SocksUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SocksUsername, 'CkSshTunnel_put_SocksUsername');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_SocksVersion, 'CkSshTunnel_get_SocksVersion');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_SocksVersion, 'CkSshTunnel_put_SocksVersion');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_TcpNoDelay, 'CkSshTunnel_get_TcpNoDelay');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_TcpNoDelay, 'CkSshTunnel_put_TcpNoDelay');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_TunnelLog, 'CkSshTunnel_get_TunnelLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_TunnelLog, 'CkSshTunnel_put_TunnelLog');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_TunnelLogPath, 'CkSshTunnel_get_TunnelLogPath');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_TunnelLogPath, 'CkSshTunnel_put_TunnelLogPath');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_HostKeyFingerprint, 'CkSshTunnel_get_HostKeyFingerprint');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_AbortCurrent, 'CkSshTunnel_get_AbortCurrent');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_AbortCurrent, 'CkSshTunnel_put_AbortCurrent');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_PreferIpv6, 'CkSshTunnel_get_PreferIpv6');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_PreferIpv6, 'CkSshTunnel_put_PreferIpv6');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_UncommonOptions, 'CkSshTunnel_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_UncommonOptions, 'CkSshTunnel_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_ClientIdentifier, 'CkSshTunnel_get_ClientIdentifier');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_ClientIdentifier, 'CkSshTunnel_put_ClientIdentifier');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_ClientLogDir, 'CkSshTunnel_get_ClientLogDir');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_ClientLogDir, 'CkSshTunnel_put_ClientLogDir');
  Chilkat_GetProcedureAddress(CkSshTunnel_get_EnableSecrets, 'CkSshTunnel_get_EnableSecrets');
  Chilkat_GetProcedureAddress(CkSshTunnel_put_EnableSecrets, 'CkSshTunnel_put_EnableSecrets');
  Chilkat_GetProcedureAddress(CkSshTunnel_AuthenticatePk, 'CkSshTunnel_AuthenticatePk');
  Chilkat_GetProcedureAddress(CkSshTunnel_AuthenticatePw, 'CkSshTunnel_AuthenticatePw');
  Chilkat_GetProcedureAddress(CkSshTunnel_AuthenticatePwPk, 'CkSshTunnel_AuthenticatePwPk');
  Chilkat_GetProcedureAddress(CkSshTunnel_BeginAccepting, 'CkSshTunnel_BeginAccepting');
  Chilkat_GetProcedureAddress(CkSshTunnel_CloseTunnel, 'CkSshTunnel_CloseTunnel');
  Chilkat_GetProcedureAddress(CkSshTunnel_Connect, 'CkSshTunnel_Connect');
  Chilkat_GetProcedureAddress(CkSshTunnel_DisconnectAllClients, 'CkSshTunnel_DisconnectAllClients');
  Chilkat_GetProcedureAddress(CkSshTunnel_StopAccepting, 'CkSshTunnel_StopAccepting');
  Chilkat_GetProcedureAddress(CkSshTunnel_ConnectThroughSsh, 'CkSshTunnel_ConnectThroughSsh');
  Chilkat_GetProcedureAddress(CkSshTunnel_IsSshConnected, 'CkSshTunnel_IsSshConnected');
  Chilkat_GetProcedureAddress(CkSshTunnel_GetCurrentState, 'CkSshTunnel_GetCurrentState');
  Chilkat_GetProcedureAddress(CkSshTunnel_AuthenticateSecPw, 'CkSshTunnel_AuthenticateSecPw');
  Chilkat_GetProcedureAddress(CkSshTunnel_AuthenticateSecPwPk, 'CkSshTunnel_AuthenticateSecPwPk');
  Chilkat_GetProcedureAddress(CkSshTunnel_StartKeyboardAuth, 'CkSshTunnel_StartKeyboardAuth');
  Chilkat_GetProcedureAddress(CkSshTunnel_ContinueKeyboardAuth, 'CkSshTunnel_ContinueKeyboardAuth');
  Chilkat_GetProcedureAddress(CkSshTunnel_SetAllowedAlgorithms, 'CkSshTunnel_SetAllowedAlgorithms');

end.
