unit Chilkat.Ssh;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TSsh wraps CkSsh via the C bridge layer. }
  TSsh = 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  GetAuthFailReason: Integer;
    function  GetCaretControl: Boolean;
    procedure SetCaretControl(AValue: Boolean);
    function  GetChannelOpenFailCode: Integer;
    function  GetChannelOpenFailReason: string;
    function  GetClientIdentifier: string;
    procedure SetClientIdentifier(AValue: string);
    function  GetClientIpAddress: string;
    procedure SetClientIpAddress(AValue: string);
    function  GetConnectTimeoutMs: Integer;
    procedure SetConnectTimeoutMs(AValue: Integer);
    function  GetDisconnectCode: Integer;
    function  GetDisconnectReason: string;
    function  GetForceCipher: string;
    procedure SetForceCipher(AValue: string);
    function  GetHeartbeatMs: Integer;
    procedure SetHeartbeatMs(AValue: Integer);
    function  GetHostKeyAlg: string;
    procedure SetHostKeyAlg(AValue: string);
    function  GetHostKeyFingerprint: string;
    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  GetIsConnected: Boolean;
    function  GetKeepSessionLog: Boolean;
    procedure SetKeepSessionLog(AValue: Boolean);
    function  GetMaxPacketSize: Integer;
    procedure SetMaxPacketSize(AValue: Integer);
    function  GetNumOpenChannels: Integer;
    function  GetPasswordChangeRequested: Boolean;
    function  GetPreferIpv6: Boolean;
    procedure SetPreferIpv6(AValue: Boolean);
    function  GetReadTimeoutMs: Integer;
    procedure SetReadTimeoutMs(AValue: Integer);
    function  GetReqExecCharset: string;
    procedure SetReqExecCharset(AValue: string);
    function  GetSessionLog: string;
    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  GetStderrToStdout: Boolean;
    procedure SetStderrToStdout(AValue: Boolean);
    function  GetTcpNoDelay: Boolean;
    procedure SetTcpNoDelay(AValue: Boolean);
    function  GetUserAuthBanner: string;
    procedure SetUserAuthBanner(AValue: string);
    function  GetEnableCompression: Boolean;
    procedure SetEnableCompression(AValue: Boolean);
    function  GetAbortCurrent: Boolean;
    procedure SetAbortCurrent(AValue: Boolean);
    function  GetStripColorCodes: Boolean;
    procedure SetStripColorCodes(AValue: Boolean);
    function  GetServerIdentifier: string;
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
    function  GetClientPort: Integer;
    procedure SetClientPort(AValue: Integer);
    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 AuthFailReason: Integer read GetAuthFailReason;
    property CaretControl: Boolean read GetCaretControl write SetCaretControl;
    property ChannelOpenFailCode: Integer read GetChannelOpenFailCode;
    property ChannelOpenFailReason: string read GetChannelOpenFailReason;
    property ClientIdentifier: string read GetClientIdentifier write SetClientIdentifier;
    property ClientIpAddress: string read GetClientIpAddress write SetClientIpAddress;
    property ConnectTimeoutMs: Integer read GetConnectTimeoutMs write SetConnectTimeoutMs;
    property DisconnectCode: Integer read GetDisconnectCode;
    property DisconnectReason: string read GetDisconnectReason;
    property ForceCipher: string read GetForceCipher write SetForceCipher;
    property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;
    property HostKeyAlg: string read GetHostKeyAlg write SetHostKeyAlg;
    property HostKeyFingerprint: string read GetHostKeyFingerprint;
    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 IsConnected: Boolean read GetIsConnected;
    property KeepSessionLog: Boolean read GetKeepSessionLog write SetKeepSessionLog;
    property MaxPacketSize: Integer read GetMaxPacketSize write SetMaxPacketSize;
    property NumOpenChannels: Integer read GetNumOpenChannels;
    property PasswordChangeRequested: Boolean read GetPasswordChangeRequested;
    property PreferIpv6: Boolean read GetPreferIpv6 write SetPreferIpv6;
    property ReadTimeoutMs: Integer read GetReadTimeoutMs write SetReadTimeoutMs;
    property ReqExecCharset: string read GetReqExecCharset write SetReqExecCharset;
    property SessionLog: string read GetSessionLog;
    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 StderrToStdout: Boolean read GetStderrToStdout write SetStderrToStdout;
    property TcpNoDelay: Boolean read GetTcpNoDelay write SetTcpNoDelay;
    property UserAuthBanner: string read GetUserAuthBanner write SetUserAuthBanner;
    property EnableCompression: Boolean read GetEnableCompression write SetEnableCompression;
    property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;
    property StripColorCodes: Boolean read GetStripColorCodes write SetStripColorCodes;
    property ServerIdentifier: string read GetServerIdentifier;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;
    property ClientPort: Integer read GetClientPort write SetClientPort;
    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  ChannelIsOpen(channelNum: Integer): Boolean;
    function  ChannelPoll(channelNum: Integer; pollTimeoutMs: Integer): Integer;
    function  ChannelRead(channelNum: Integer): Integer;
    function  ChannelReadAndPoll(channelNum: Integer; pollTimeoutMs: Integer): Integer;
    function  ChannelReadAndPoll2(channelNum: Integer; pollTimeoutMs: Integer; maxNumBytes: Integer): Integer;
    function  ChannelReceiveToClose(channelNum: Integer): Boolean;
    function  ChannelReceiveUntilMatch(channelNum: Integer; const matchPattern: string; const charset: string; caseSensitive: Boolean): Boolean;
    function  ChannelReceiveUntilMatchN(channelNum: Integer; matchPatterns: TChilkatBase; const charset: string; caseSensitive: Boolean): Boolean;
    function  ChannelReceivedClose(channelNum: Integer): Boolean;
    function  ChannelReceivedEof(channelNum: Integer): Boolean;
    function  ChannelReceivedExitStatus(channelNum: Integer): Boolean;
    procedure ChannelRelease(channelNum: Integer);
    function  ChannelSendClose(channelNum: Integer): Boolean;
    function  ChannelSendEof(channelNum: Integer): Boolean;
    function  ChannelSendString(channelNum: Integer; const textData: string; const charset: string): Boolean;
    function  CheckConnection: Boolean;
    procedure ClearTtyModes;
    function  Connect(const domainName: string; port: Integer): Boolean;
    function  ConnectThroughSsh(ssh: TChilkatBase; const hostname: string; port: Integer): Boolean;
    function  ContinueKeyboardAuth(const response: string): string;
    procedure Disconnect;
    function  GetChannelExitStatus(channelNum: Integer): Integer;
    function  GetChannelNumber(index: Integer): Integer;
    function  GetChannelType(index: Integer): string;
    function  GetReceivedNumBytes(channelNum: Integer): Integer;
    function  GetReceivedStderrText(channelNum: Integer; const charset: string): string;
    function  GetReceivedText(channelNum: Integer; const charset: string): string;
    function  GetReceivedTextS(channelNum: Integer; const substr: string; const charset: string): string;
    function  OpenCustomChannel(const channelType: string): Integer;
    function  OpenDirectTcpIpChannel(const targetHostname: string; targetPort: Integer): Integer;
    function  OpenSessionChannel: Integer;
    function  PeekReceivedText(channelNum: Integer; const charset: string): string;
    function  ReKey: Boolean;
    function  SendIgnore: Boolean;
    function  SendReqExec(channelNum: Integer; const commandLine: string): Boolean;
    function  SendReqPty(channelNum: Integer; const termType: string; widthInChars: Integer; heightInChars: Integer; widthInPixels: Integer; heightInPixels: Integer): Boolean;
    function  SendReqSetEnv(channelNum: Integer; const name: string; const value: string): Boolean;
    function  SendReqShell(channelNum: Integer): Boolean;
    function  SendReqSignal(channelNum: Integer; const signalName: string): Boolean;
    function  SendReqSubsystem(channelNum: Integer; const subsystemName: string): Boolean;
    function  SendReqWindowChange(channelNum: Integer; widthInChars: Integer; heightInRows: Integer; pixWidth: Integer; pixHeight: Integer): Boolean;
    function  SendReqX11Forwarding(channelNum: Integer; singleConnection: Boolean; const authProt: string; const authCookie: string; screenNum: Integer): Boolean;
    function  SendReqXonXoff(channelNum: Integer; clientCanDo: Boolean): Boolean;
    function  SetTtyMode(const ttyName: string; ttyValue: Integer): Boolean;
    function  StartKeyboardAuth(const login: string): string;
    function  WaitForChannelMessage(pollTimeoutMs: Integer): Integer;
    function  QuickCommand(const command: string; const charset: string): string;
    function  QuickShell: Integer;
    function  QuickCmdSend(const command: string): Integer;
    function  QuickCmdCheck(pollTimeoutMs: Integer): Integer;
    function  AuthenticateSecPw(login: TChilkatBase; password: TChilkatBase): Boolean;
    function  AuthenticateSecPwPk(username: TChilkatBase; password: TChilkatBase; privateKey: TChilkatBase): Boolean;
    function  GetAuthMethods: string;
    function  GetHostKeyFP(const hashAlg: string; includeKeyType: Boolean; includeHashName: Boolean): string;
    function  SetAllowedAlgorithms(json: TChilkatBase): Boolean;
    procedure GetLastJsonData(json: TChilkatBase);
    function  GetReceivedSb(channelNum: Integer; const charset: string; sb: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkSsh_Create  = function(): Pointer; cdecl;
  TCkSsh_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;
  TCkSsh_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkSsh_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkSsh_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkSsh_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_AuthFailReason = function(handle: Pointer): Integer; cdecl;
  TCkSsh_get_CaretControl = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_CaretControl = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_ChannelOpenFailCode = function(handle: Pointer): Integer; cdecl;
  TCkSsh_get_ChannelOpenFailReason = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_ClientIdentifier = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_ClientIdentifier = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_ClientIpAddress = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_ClientIpAddress = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_ConnectTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_ConnectTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_DisconnectCode = function(handle: Pointer): Integer; cdecl;
  TCkSsh_get_DisconnectReason = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_ForceCipher = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_ForceCipher = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HeartbeatMs = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_HeartbeatMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_HostKeyAlg = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HostKeyAlg = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HostKeyFingerprint = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_HttpProxyAuthMethod = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HttpProxyAuthMethod = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HttpProxyDomain = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HttpProxyDomain = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HttpProxyHostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HttpProxyHostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HttpProxyPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HttpProxyPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_HttpProxyPort = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_HttpProxyPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_HttpProxyUsername = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_HttpProxyUsername = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_IdleTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_IdleTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_IsConnected = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_get_KeepSessionLog = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_KeepSessionLog = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_MaxPacketSize = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_MaxPacketSize = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_NumOpenChannels = function(handle: Pointer): Integer; cdecl;
  TCkSsh_get_PasswordChangeRequested = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_get_PreferIpv6 = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_PreferIpv6 = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_ReadTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_ReadTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_ReqExecCharset = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_ReqExecCharset = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_SessionLog = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_SoRcvBuf = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_SoRcvBuf = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_SoSndBuf = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_SoSndBuf = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_SocksHostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_SocksHostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_SocksPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_SocksPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_SocksPort = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_SocksPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_SocksUsername = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_SocksUsername = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_SocksVersion = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_SocksVersion = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_StderrToStdout = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_StderrToStdout = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_TcpNoDelay = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_TcpNoDelay = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_UserAuthBanner = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_UserAuthBanner = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_EnableCompression = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_EnableCompression = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_AbortCurrent = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_AbortCurrent = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_StripColorCodes = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_StripColorCodes = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_get_ServerIdentifier = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSsh_get_ClientPort = function(handle: Pointer): Integer; cdecl;
  TCkSsh_put_ClientPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkSsh_get_EnableSecrets = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_put_EnableSecrets = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSsh_AuthenticatePk = function(handle: Pointer; username: PAnsiChar; privateKey: Pointer): LongBool; cdecl;
  TCkSsh_AuthenticatePw = function(handle: Pointer; login: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkSsh_AuthenticatePwPk = function(handle: Pointer; username: PAnsiChar; password: PAnsiChar; privateKey: Pointer): LongBool; cdecl;
  TCkSsh_ChannelIsOpen = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelPoll = function(handle: Pointer; channelNum: Integer; pollTimeoutMs: Integer): Integer; cdecl;
  TCkSsh_ChannelRead = function(handle: Pointer; channelNum: Integer): Integer; cdecl;
  TCkSsh_ChannelReadAndPoll = function(handle: Pointer; channelNum: Integer; pollTimeoutMs: Integer): Integer; cdecl;
  TCkSsh_ChannelReadAndPoll2 = function(handle: Pointer; channelNum: Integer; pollTimeoutMs: Integer; maxNumBytes: Integer): Integer; cdecl;
  TCkSsh_ChannelReceiveToClose = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelReceiveUntilMatch = function(handle: Pointer; channelNum: Integer; matchPattern: PAnsiChar; charset: PAnsiChar; caseSensitive: LongBool): LongBool; cdecl;
  TCkSsh_ChannelReceiveUntilMatchN = function(handle: Pointer; channelNum: Integer; matchPatterns: Pointer; charset: PAnsiChar; caseSensitive: LongBool): LongBool; cdecl;
  TCkSsh_ChannelReceivedClose = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelReceivedEof = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelReceivedExitStatus = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelRelease = procedure(handle: Pointer; channelNum: Integer); cdecl;
  TCkSsh_ChannelSendClose = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelSendEof = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_ChannelSendString = function(handle: Pointer; channelNum: Integer; textData: PAnsiChar; charset: PAnsiChar): LongBool; cdecl;
  TCkSsh_CheckConnection = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_ClearTtyModes = procedure(handle: Pointer); cdecl;
  TCkSsh_Connect = function(handle: Pointer; domainName: PAnsiChar; port: Integer): LongBool; cdecl;
  TCkSsh_ConnectThroughSsh = function(handle: Pointer; ssh: Pointer; hostname: PAnsiChar; port: Integer): LongBool; cdecl;
  TCkSsh_ContinueKeyboardAuth = function(handle: Pointer; response: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_Disconnect = procedure(handle: Pointer); cdecl;
  TCkSsh_GetChannelExitStatus = function(handle: Pointer; channelNum: Integer): Integer; cdecl;
  TCkSsh_GetChannelNumber = function(handle: Pointer; index: Integer): Integer; cdecl;
  TCkSsh_GetChannelType = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkSsh_GetReceivedNumBytes = function(handle: Pointer; channelNum: Integer): Integer; cdecl;
  TCkSsh_GetReceivedStderrText = function(handle: Pointer; channelNum: Integer; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_GetReceivedText = function(handle: Pointer; channelNum: Integer; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_GetReceivedTextS = function(handle: Pointer; channelNum: Integer; substr: PAnsiChar; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_OpenCustomChannel = function(handle: Pointer; channelType: PAnsiChar): Integer; cdecl;
  TCkSsh_OpenDirectTcpIpChannel = function(handle: Pointer; targetHostname: PAnsiChar; targetPort: Integer): Integer; cdecl;
  TCkSsh_OpenSessionChannel = function(handle: Pointer): Integer; cdecl;
  TCkSsh_PeekReceivedText = function(handle: Pointer; channelNum: Integer; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_ReKey = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_SendIgnore = function(handle: Pointer): LongBool; cdecl;
  TCkSsh_SendReqExec = function(handle: Pointer; channelNum: Integer; commandLine: PAnsiChar): LongBool; cdecl;
  TCkSsh_SendReqPty = function(handle: Pointer; channelNum: Integer; termType: PAnsiChar; widthInChars: Integer; heightInChars: Integer; widthInPixels: Integer; heightInPixels: Integer): LongBool; cdecl;
  TCkSsh_SendReqSetEnv = function(handle: Pointer; channelNum: Integer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkSsh_SendReqShell = function(handle: Pointer; channelNum: Integer): LongBool; cdecl;
  TCkSsh_SendReqSignal = function(handle: Pointer; channelNum: Integer; signalName: PAnsiChar): LongBool; cdecl;
  TCkSsh_SendReqSubsystem = function(handle: Pointer; channelNum: Integer; subsystemName: PAnsiChar): LongBool; cdecl;
  TCkSsh_SendReqWindowChange = function(handle: Pointer; channelNum: Integer; widthInChars: Integer; heightInRows: Integer; pixWidth: Integer; pixHeight: Integer): LongBool; cdecl;
  TCkSsh_SendReqX11Forwarding = function(handle: Pointer; channelNum: Integer; singleConnection: LongBool; authProt: PAnsiChar; authCookie: PAnsiChar; screenNum: Integer): LongBool; cdecl;
  TCkSsh_SendReqXonXoff = function(handle: Pointer; channelNum: Integer; clientCanDo: LongBool): LongBool; cdecl;
  TCkSsh_SetTtyMode = function(handle: Pointer; ttyName: PAnsiChar; ttyValue: Integer): LongBool; cdecl;
  TCkSsh_StartKeyboardAuth = function(handle: Pointer; login: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_WaitForChannelMessage = function(handle: Pointer; pollTimeoutMs: Integer): Integer; cdecl;
  TCkSsh_QuickCommand = function(handle: Pointer; command: PAnsiChar; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkSsh_QuickShell = function(handle: Pointer): Integer; cdecl;
  TCkSsh_QuickCmdSend = function(handle: Pointer; command: PAnsiChar): Integer; cdecl;
  TCkSsh_QuickCmdCheck = function(handle: Pointer; pollTimeoutMs: Integer): Integer; cdecl;
  TCkSsh_AuthenticateSecPw = function(handle: Pointer; login: Pointer; password: Pointer): LongBool; cdecl;
  TCkSsh_AuthenticateSecPwPk = function(handle: Pointer; username: Pointer; password: Pointer; privateKey: Pointer): LongBool; cdecl;
  TCkSsh_GetAuthMethods = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSsh_GetHostKeyFP = function(handle: Pointer; hashAlg: PAnsiChar; includeKeyType: LongBool; includeHashName: LongBool): PAnsiChar; cdecl;
  TCkSsh_SetAllowedAlgorithms = function(handle: Pointer; json: Pointer): LongBool; cdecl;
  TCkSsh_GetLastJsonData = procedure(handle: Pointer; json: Pointer); cdecl;
  TCkSsh_GetReceivedSb = function(handle: Pointer; channelNum: Integer; charset: PAnsiChar; sb: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkSsh_Create:  TCkSsh_Create  = nil;
  CkSsh_Dispose: TCkSsh_Dispose = nil;
  CkSsh_SetAbortCheckCallback:   TCkSsh_SetAbortCheckCallback   = nil;
  CkSsh_SetPercentDoneCallback:  TCkSsh_SetPercentDoneCallback  = nil;
  CkSsh_SetProgressInfoCallback: TCkSsh_SetProgressInfoCallback = nil;
  CkSsh_get_LastErrorHtml: TCkSsh_get_LastErrorHtml = nil;
  CkSsh_get_LastErrorText: TCkSsh_get_LastErrorText = nil;
  CkSsh_get_LastErrorXml: TCkSsh_get_LastErrorXml = nil;
  CkSsh_get_Version: TCkSsh_get_Version = nil;
  CkSsh_get_DebugLogFilePath: TCkSsh_get_DebugLogFilePath = nil;
  CkSsh_put_DebugLogFilePath: TCkSsh_put_DebugLogFilePath = nil;
  CkSsh_get_VerboseLogging: TCkSsh_get_VerboseLogging = nil;
  CkSsh_put_VerboseLogging: TCkSsh_put_VerboseLogging = nil;
  CkSsh_get_LastMethodSuccess: TCkSsh_get_LastMethodSuccess = nil;
  CkSsh_put_LastMethodSuccess: TCkSsh_put_LastMethodSuccess = nil;
  CkSsh_get_AuthFailReason: TCkSsh_get_AuthFailReason = nil;
  CkSsh_get_CaretControl: TCkSsh_get_CaretControl = nil;
  CkSsh_put_CaretControl: TCkSsh_put_CaretControl = nil;
  CkSsh_get_ChannelOpenFailCode: TCkSsh_get_ChannelOpenFailCode = nil;
  CkSsh_get_ChannelOpenFailReason: TCkSsh_get_ChannelOpenFailReason = nil;
  CkSsh_get_ClientIdentifier: TCkSsh_get_ClientIdentifier = nil;
  CkSsh_put_ClientIdentifier: TCkSsh_put_ClientIdentifier = nil;
  CkSsh_get_ClientIpAddress: TCkSsh_get_ClientIpAddress = nil;
  CkSsh_put_ClientIpAddress: TCkSsh_put_ClientIpAddress = nil;
  CkSsh_get_ConnectTimeoutMs: TCkSsh_get_ConnectTimeoutMs = nil;
  CkSsh_put_ConnectTimeoutMs: TCkSsh_put_ConnectTimeoutMs = nil;
  CkSsh_get_DisconnectCode: TCkSsh_get_DisconnectCode = nil;
  CkSsh_get_DisconnectReason: TCkSsh_get_DisconnectReason = nil;
  CkSsh_get_ForceCipher: TCkSsh_get_ForceCipher = nil;
  CkSsh_put_ForceCipher: TCkSsh_put_ForceCipher = nil;
  CkSsh_get_HeartbeatMs: TCkSsh_get_HeartbeatMs = nil;
  CkSsh_put_HeartbeatMs: TCkSsh_put_HeartbeatMs = nil;
  CkSsh_get_HostKeyAlg: TCkSsh_get_HostKeyAlg = nil;
  CkSsh_put_HostKeyAlg: TCkSsh_put_HostKeyAlg = nil;
  CkSsh_get_HostKeyFingerprint: TCkSsh_get_HostKeyFingerprint = nil;
  CkSsh_get_HttpProxyAuthMethod: TCkSsh_get_HttpProxyAuthMethod = nil;
  CkSsh_put_HttpProxyAuthMethod: TCkSsh_put_HttpProxyAuthMethod = nil;
  CkSsh_get_HttpProxyDomain: TCkSsh_get_HttpProxyDomain = nil;
  CkSsh_put_HttpProxyDomain: TCkSsh_put_HttpProxyDomain = nil;
  CkSsh_get_HttpProxyHostname: TCkSsh_get_HttpProxyHostname = nil;
  CkSsh_put_HttpProxyHostname: TCkSsh_put_HttpProxyHostname = nil;
  CkSsh_get_HttpProxyPassword: TCkSsh_get_HttpProxyPassword = nil;
  CkSsh_put_HttpProxyPassword: TCkSsh_put_HttpProxyPassword = nil;
  CkSsh_get_HttpProxyPort: TCkSsh_get_HttpProxyPort = nil;
  CkSsh_put_HttpProxyPort: TCkSsh_put_HttpProxyPort = nil;
  CkSsh_get_HttpProxyUsername: TCkSsh_get_HttpProxyUsername = nil;
  CkSsh_put_HttpProxyUsername: TCkSsh_put_HttpProxyUsername = nil;
  CkSsh_get_IdleTimeoutMs: TCkSsh_get_IdleTimeoutMs = nil;
  CkSsh_put_IdleTimeoutMs: TCkSsh_put_IdleTimeoutMs = nil;
  CkSsh_get_IsConnected: TCkSsh_get_IsConnected = nil;
  CkSsh_get_KeepSessionLog: TCkSsh_get_KeepSessionLog = nil;
  CkSsh_put_KeepSessionLog: TCkSsh_put_KeepSessionLog = nil;
  CkSsh_get_MaxPacketSize: TCkSsh_get_MaxPacketSize = nil;
  CkSsh_put_MaxPacketSize: TCkSsh_put_MaxPacketSize = nil;
  CkSsh_get_NumOpenChannels: TCkSsh_get_NumOpenChannels = nil;
  CkSsh_get_PasswordChangeRequested: TCkSsh_get_PasswordChangeRequested = nil;
  CkSsh_get_PreferIpv6: TCkSsh_get_PreferIpv6 = nil;
  CkSsh_put_PreferIpv6: TCkSsh_put_PreferIpv6 = nil;
  CkSsh_get_ReadTimeoutMs: TCkSsh_get_ReadTimeoutMs = nil;
  CkSsh_put_ReadTimeoutMs: TCkSsh_put_ReadTimeoutMs = nil;
  CkSsh_get_ReqExecCharset: TCkSsh_get_ReqExecCharset = nil;
  CkSsh_put_ReqExecCharset: TCkSsh_put_ReqExecCharset = nil;
  CkSsh_get_SessionLog: TCkSsh_get_SessionLog = nil;
  CkSsh_get_SoRcvBuf: TCkSsh_get_SoRcvBuf = nil;
  CkSsh_put_SoRcvBuf: TCkSsh_put_SoRcvBuf = nil;
  CkSsh_get_SoSndBuf: TCkSsh_get_SoSndBuf = nil;
  CkSsh_put_SoSndBuf: TCkSsh_put_SoSndBuf = nil;
  CkSsh_get_SocksHostname: TCkSsh_get_SocksHostname = nil;
  CkSsh_put_SocksHostname: TCkSsh_put_SocksHostname = nil;
  CkSsh_get_SocksPassword: TCkSsh_get_SocksPassword = nil;
  CkSsh_put_SocksPassword: TCkSsh_put_SocksPassword = nil;
  CkSsh_get_SocksPort: TCkSsh_get_SocksPort = nil;
  CkSsh_put_SocksPort: TCkSsh_put_SocksPort = nil;
  CkSsh_get_SocksUsername: TCkSsh_get_SocksUsername = nil;
  CkSsh_put_SocksUsername: TCkSsh_put_SocksUsername = nil;
  CkSsh_get_SocksVersion: TCkSsh_get_SocksVersion = nil;
  CkSsh_put_SocksVersion: TCkSsh_put_SocksVersion = nil;
  CkSsh_get_StderrToStdout: TCkSsh_get_StderrToStdout = nil;
  CkSsh_put_StderrToStdout: TCkSsh_put_StderrToStdout = nil;
  CkSsh_get_TcpNoDelay: TCkSsh_get_TcpNoDelay = nil;
  CkSsh_put_TcpNoDelay: TCkSsh_put_TcpNoDelay = nil;
  CkSsh_get_UserAuthBanner: TCkSsh_get_UserAuthBanner = nil;
  CkSsh_put_UserAuthBanner: TCkSsh_put_UserAuthBanner = nil;
  CkSsh_get_EnableCompression: TCkSsh_get_EnableCompression = nil;
  CkSsh_put_EnableCompression: TCkSsh_put_EnableCompression = nil;
  CkSsh_get_AbortCurrent: TCkSsh_get_AbortCurrent = nil;
  CkSsh_put_AbortCurrent: TCkSsh_put_AbortCurrent = nil;
  CkSsh_get_StripColorCodes: TCkSsh_get_StripColorCodes = nil;
  CkSsh_put_StripColorCodes: TCkSsh_put_StripColorCodes = nil;
  CkSsh_get_ServerIdentifier: TCkSsh_get_ServerIdentifier = nil;
  CkSsh_get_UncommonOptions: TCkSsh_get_UncommonOptions = nil;
  CkSsh_put_UncommonOptions: TCkSsh_put_UncommonOptions = nil;
  CkSsh_get_ClientPort: TCkSsh_get_ClientPort = nil;
  CkSsh_put_ClientPort: TCkSsh_put_ClientPort = nil;
  CkSsh_get_EnableSecrets: TCkSsh_get_EnableSecrets = nil;
  CkSsh_put_EnableSecrets: TCkSsh_put_EnableSecrets = nil;
  CkSsh_AuthenticatePk: TCkSsh_AuthenticatePk = nil;
  CkSsh_AuthenticatePw: TCkSsh_AuthenticatePw = nil;
  CkSsh_AuthenticatePwPk: TCkSsh_AuthenticatePwPk = nil;
  CkSsh_ChannelIsOpen: TCkSsh_ChannelIsOpen = nil;
  CkSsh_ChannelPoll: TCkSsh_ChannelPoll = nil;
  CkSsh_ChannelRead: TCkSsh_ChannelRead = nil;
  CkSsh_ChannelReadAndPoll: TCkSsh_ChannelReadAndPoll = nil;
  CkSsh_ChannelReadAndPoll2: TCkSsh_ChannelReadAndPoll2 = nil;
  CkSsh_ChannelReceiveToClose: TCkSsh_ChannelReceiveToClose = nil;
  CkSsh_ChannelReceiveUntilMatch: TCkSsh_ChannelReceiveUntilMatch = nil;
  CkSsh_ChannelReceiveUntilMatchN: TCkSsh_ChannelReceiveUntilMatchN = nil;
  CkSsh_ChannelReceivedClose: TCkSsh_ChannelReceivedClose = nil;
  CkSsh_ChannelReceivedEof: TCkSsh_ChannelReceivedEof = nil;
  CkSsh_ChannelReceivedExitStatus: TCkSsh_ChannelReceivedExitStatus = nil;
  CkSsh_ChannelRelease: TCkSsh_ChannelRelease = nil;
  CkSsh_ChannelSendClose: TCkSsh_ChannelSendClose = nil;
  CkSsh_ChannelSendEof: TCkSsh_ChannelSendEof = nil;
  CkSsh_ChannelSendString: TCkSsh_ChannelSendString = nil;
  CkSsh_CheckConnection: TCkSsh_CheckConnection = nil;
  CkSsh_ClearTtyModes: TCkSsh_ClearTtyModes = nil;
  CkSsh_Connect: TCkSsh_Connect = nil;
  CkSsh_ConnectThroughSsh: TCkSsh_ConnectThroughSsh = nil;
  CkSsh_ContinueKeyboardAuth: TCkSsh_ContinueKeyboardAuth = nil;
  CkSsh_Disconnect: TCkSsh_Disconnect = nil;
  CkSsh_GetChannelExitStatus: TCkSsh_GetChannelExitStatus = nil;
  CkSsh_GetChannelNumber: TCkSsh_GetChannelNumber = nil;
  CkSsh_GetChannelType: TCkSsh_GetChannelType = nil;
  CkSsh_GetReceivedNumBytes: TCkSsh_GetReceivedNumBytes = nil;
  CkSsh_GetReceivedStderrText: TCkSsh_GetReceivedStderrText = nil;
  CkSsh_GetReceivedText: TCkSsh_GetReceivedText = nil;
  CkSsh_GetReceivedTextS: TCkSsh_GetReceivedTextS = nil;
  CkSsh_OpenCustomChannel: TCkSsh_OpenCustomChannel = nil;
  CkSsh_OpenDirectTcpIpChannel: TCkSsh_OpenDirectTcpIpChannel = nil;
  CkSsh_OpenSessionChannel: TCkSsh_OpenSessionChannel = nil;
  CkSsh_PeekReceivedText: TCkSsh_PeekReceivedText = nil;
  CkSsh_ReKey: TCkSsh_ReKey = nil;
  CkSsh_SendIgnore: TCkSsh_SendIgnore = nil;
  CkSsh_SendReqExec: TCkSsh_SendReqExec = nil;
  CkSsh_SendReqPty: TCkSsh_SendReqPty = nil;
  CkSsh_SendReqSetEnv: TCkSsh_SendReqSetEnv = nil;
  CkSsh_SendReqShell: TCkSsh_SendReqShell = nil;
  CkSsh_SendReqSignal: TCkSsh_SendReqSignal = nil;
  CkSsh_SendReqSubsystem: TCkSsh_SendReqSubsystem = nil;
  CkSsh_SendReqWindowChange: TCkSsh_SendReqWindowChange = nil;
  CkSsh_SendReqX11Forwarding: TCkSsh_SendReqX11Forwarding = nil;
  CkSsh_SendReqXonXoff: TCkSsh_SendReqXonXoff = nil;
  CkSsh_SetTtyMode: TCkSsh_SetTtyMode = nil;
  CkSsh_StartKeyboardAuth: TCkSsh_StartKeyboardAuth = nil;
  CkSsh_WaitForChannelMessage: TCkSsh_WaitForChannelMessage = nil;
  CkSsh_QuickCommand: TCkSsh_QuickCommand = nil;
  CkSsh_QuickShell: TCkSsh_QuickShell = nil;
  CkSsh_QuickCmdSend: TCkSsh_QuickCmdSend = nil;
  CkSsh_QuickCmdCheck: TCkSsh_QuickCmdCheck = nil;
  CkSsh_AuthenticateSecPw: TCkSsh_AuthenticateSecPw = nil;
  CkSsh_AuthenticateSecPwPk: TCkSsh_AuthenticateSecPwPk = nil;
  CkSsh_GetAuthMethods: TCkSsh_GetAuthMethods = nil;
  CkSsh_GetHostKeyFP: TCkSsh_GetHostKeyFP = nil;
  CkSsh_SetAllowedAlgorithms: TCkSsh_SetAllowedAlgorithms = nil;
  CkSsh_GetLastJsonData: TCkSsh_GetLastJsonData = nil;
  CkSsh_GetReceivedSb: TCkSsh_GetReceivedSb = nil;

constructor TSsh.Create;
begin
  inherited Create;
  FHandle := CkSsh_Create();
end;

destructor TSsh.Destroy;
begin
  if FHandle <> nil then
    CkSsh_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 TSsh_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TSsh;
begin
  Result := 0;
  obj := TSsh(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

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

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

procedure TSsh.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkSsh_SetAbortCheckCallback(FHandle, @TSsh_AbortCheckThunk, Self)
  else
    CkSsh_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TSsh.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkSsh_SetPercentDoneCallback(FHandle, @TSsh_PercentDoneThunk, Self)
  else
    CkSsh_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TSsh.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkSsh_SetProgressInfoCallback(FHandle, @TSsh_ProgressInfoThunk, Self)
  else
    CkSsh_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TSsh.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkSsh_get_LastErrorHtml(FHandle));
end;

function TSsh.GetLastErrorText: string;
begin
  Result := CkToStr(CkSsh_get_LastErrorText(FHandle));
end;

function TSsh.GetLastErrorXml: string;
begin
  Result := CkToStr(CkSsh_get_LastErrorXml(FHandle));
end;

function TSsh.GetVersion: string;
begin
  Result := CkToStr(CkSsh_get_Version(FHandle));
end;

function TSsh.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkSsh_get_DebugLogFilePath(FHandle));
end;

procedure TSsh.SetDebugLogFilePath(AValue: string);
begin
  CkSsh_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkSsh_get_VerboseLogging(FHandle));
end;

procedure TSsh.SetVerboseLogging(AValue: Boolean);
begin
  CkSsh_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TSsh.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkSsh_get_LastMethodSuccess(FHandle));
end;

procedure TSsh.SetLastMethodSuccess(AValue: Boolean);
begin
  CkSsh_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TSsh.GetAuthFailReason: Integer;
begin
  Result := CkSsh_get_AuthFailReason(FHandle);
end;

function TSsh.GetCaretControl: Boolean;
begin
  Result := Boolean(CkSsh_get_CaretControl(FHandle));
end;

procedure TSsh.SetCaretControl(AValue: Boolean);
begin
  CkSsh_put_CaretControl(FHandle, LongBool(AValue));
end;

function TSsh.GetChannelOpenFailCode: Integer;
begin
  Result := CkSsh_get_ChannelOpenFailCode(FHandle);
end;

function TSsh.GetChannelOpenFailReason: string;
begin
  Result := CkToStr(CkSsh_get_ChannelOpenFailReason(FHandle));
end;

function TSsh.GetClientIdentifier: string;
begin
  Result := CkToStr(CkSsh_get_ClientIdentifier(FHandle));
end;

procedure TSsh.SetClientIdentifier(AValue: string);
begin
  CkSsh_put_ClientIdentifier(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetClientIpAddress: string;
begin
  Result := CkToStr(CkSsh_get_ClientIpAddress(FHandle));
end;

procedure TSsh.SetClientIpAddress(AValue: string);
begin
  CkSsh_put_ClientIpAddress(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetConnectTimeoutMs: Integer;
begin
  Result := CkSsh_get_ConnectTimeoutMs(FHandle);
end;

procedure TSsh.SetConnectTimeoutMs(AValue: Integer);
begin
  CkSsh_put_ConnectTimeoutMs(FHandle, AValue);
end;

function TSsh.GetDisconnectCode: Integer;
begin
  Result := CkSsh_get_DisconnectCode(FHandle);
end;

function TSsh.GetDisconnectReason: string;
begin
  Result := CkToStr(CkSsh_get_DisconnectReason(FHandle));
end;

function TSsh.GetForceCipher: string;
begin
  Result := CkToStr(CkSsh_get_ForceCipher(FHandle));
end;

procedure TSsh.SetForceCipher(AValue: string);
begin
  CkSsh_put_ForceCipher(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHeartbeatMs: Integer;
begin
  Result := CkSsh_get_HeartbeatMs(FHandle);
end;

procedure TSsh.SetHeartbeatMs(AValue: Integer);
begin
  CkSsh_put_HeartbeatMs(FHandle, AValue);
end;

function TSsh.GetHostKeyAlg: string;
begin
  Result := CkToStr(CkSsh_get_HostKeyAlg(FHandle));
end;

procedure TSsh.SetHostKeyAlg(AValue: string);
begin
  CkSsh_put_HostKeyAlg(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHostKeyFingerprint: string;
begin
  Result := CkToStr(CkSsh_get_HostKeyFingerprint(FHandle));
end;

function TSsh.GetHttpProxyAuthMethod: string;
begin
  Result := CkToStr(CkSsh_get_HttpProxyAuthMethod(FHandle));
end;

procedure TSsh.SetHttpProxyAuthMethod(AValue: string);
begin
  CkSsh_put_HttpProxyAuthMethod(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHttpProxyDomain: string;
begin
  Result := CkToStr(CkSsh_get_HttpProxyDomain(FHandle));
end;

procedure TSsh.SetHttpProxyDomain(AValue: string);
begin
  CkSsh_put_HttpProxyDomain(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHttpProxyHostname: string;
begin
  Result := CkToStr(CkSsh_get_HttpProxyHostname(FHandle));
end;

procedure TSsh.SetHttpProxyHostname(AValue: string);
begin
  CkSsh_put_HttpProxyHostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHttpProxyPassword: string;
begin
  Result := CkToStr(CkSsh_get_HttpProxyPassword(FHandle));
end;

procedure TSsh.SetHttpProxyPassword(AValue: string);
begin
  CkSsh_put_HttpProxyPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetHttpProxyPort: Integer;
begin
  Result := CkSsh_get_HttpProxyPort(FHandle);
end;

procedure TSsh.SetHttpProxyPort(AValue: Integer);
begin
  CkSsh_put_HttpProxyPort(FHandle, AValue);
end;

function TSsh.GetHttpProxyUsername: string;
begin
  Result := CkToStr(CkSsh_get_HttpProxyUsername(FHandle));
end;

procedure TSsh.SetHttpProxyUsername(AValue: string);
begin
  CkSsh_put_HttpProxyUsername(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetIdleTimeoutMs: Integer;
begin
  Result := CkSsh_get_IdleTimeoutMs(FHandle);
end;

procedure TSsh.SetIdleTimeoutMs(AValue: Integer);
begin
  CkSsh_put_IdleTimeoutMs(FHandle, AValue);
end;

function TSsh.GetIsConnected: Boolean;
begin
  Result := Boolean(CkSsh_get_IsConnected(FHandle));
end;

function TSsh.GetKeepSessionLog: Boolean;
begin
  Result := Boolean(CkSsh_get_KeepSessionLog(FHandle));
end;

procedure TSsh.SetKeepSessionLog(AValue: Boolean);
begin
  CkSsh_put_KeepSessionLog(FHandle, LongBool(AValue));
end;

function TSsh.GetMaxPacketSize: Integer;
begin
  Result := CkSsh_get_MaxPacketSize(FHandle);
end;

procedure TSsh.SetMaxPacketSize(AValue: Integer);
begin
  CkSsh_put_MaxPacketSize(FHandle, AValue);
end;

function TSsh.GetNumOpenChannels: Integer;
begin
  Result := CkSsh_get_NumOpenChannels(FHandle);
end;

function TSsh.GetPasswordChangeRequested: Boolean;
begin
  Result := Boolean(CkSsh_get_PasswordChangeRequested(FHandle));
end;

function TSsh.GetPreferIpv6: Boolean;
begin
  Result := Boolean(CkSsh_get_PreferIpv6(FHandle));
end;

procedure TSsh.SetPreferIpv6(AValue: Boolean);
begin
  CkSsh_put_PreferIpv6(FHandle, LongBool(AValue));
end;

function TSsh.GetReadTimeoutMs: Integer;
begin
  Result := CkSsh_get_ReadTimeoutMs(FHandle);
end;

procedure TSsh.SetReadTimeoutMs(AValue: Integer);
begin
  CkSsh_put_ReadTimeoutMs(FHandle, AValue);
end;

function TSsh.GetReqExecCharset: string;
begin
  Result := CkToStr(CkSsh_get_ReqExecCharset(FHandle));
end;

procedure TSsh.SetReqExecCharset(AValue: string);
begin
  CkSsh_put_ReqExecCharset(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetSessionLog: string;
begin
  Result := CkToStr(CkSsh_get_SessionLog(FHandle));
end;

function TSsh.GetSoRcvBuf: Integer;
begin
  Result := CkSsh_get_SoRcvBuf(FHandle);
end;

procedure TSsh.SetSoRcvBuf(AValue: Integer);
begin
  CkSsh_put_SoRcvBuf(FHandle, AValue);
end;

function TSsh.GetSoSndBuf: Integer;
begin
  Result := CkSsh_get_SoSndBuf(FHandle);
end;

procedure TSsh.SetSoSndBuf(AValue: Integer);
begin
  CkSsh_put_SoSndBuf(FHandle, AValue);
end;

function TSsh.GetSocksHostname: string;
begin
  Result := CkToStr(CkSsh_get_SocksHostname(FHandle));
end;

procedure TSsh.SetSocksHostname(AValue: string);
begin
  CkSsh_put_SocksHostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetSocksPassword: string;
begin
  Result := CkToStr(CkSsh_get_SocksPassword(FHandle));
end;

procedure TSsh.SetSocksPassword(AValue: string);
begin
  CkSsh_put_SocksPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetSocksPort: Integer;
begin
  Result := CkSsh_get_SocksPort(FHandle);
end;

procedure TSsh.SetSocksPort(AValue: Integer);
begin
  CkSsh_put_SocksPort(FHandle, AValue);
end;

function TSsh.GetSocksUsername: string;
begin
  Result := CkToStr(CkSsh_get_SocksUsername(FHandle));
end;

procedure TSsh.SetSocksUsername(AValue: string);
begin
  CkSsh_put_SocksUsername(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetSocksVersion: Integer;
begin
  Result := CkSsh_get_SocksVersion(FHandle);
end;

procedure TSsh.SetSocksVersion(AValue: Integer);
begin
  CkSsh_put_SocksVersion(FHandle, AValue);
end;

function TSsh.GetStderrToStdout: Boolean;
begin
  Result := Boolean(CkSsh_get_StderrToStdout(FHandle));
end;

procedure TSsh.SetStderrToStdout(AValue: Boolean);
begin
  CkSsh_put_StderrToStdout(FHandle, LongBool(AValue));
end;

function TSsh.GetTcpNoDelay: Boolean;
begin
  Result := Boolean(CkSsh_get_TcpNoDelay(FHandle));
end;

procedure TSsh.SetTcpNoDelay(AValue: Boolean);
begin
  CkSsh_put_TcpNoDelay(FHandle, LongBool(AValue));
end;

function TSsh.GetUserAuthBanner: string;
begin
  Result := CkToStr(CkSsh_get_UserAuthBanner(FHandle));
end;

procedure TSsh.SetUserAuthBanner(AValue: string);
begin
  CkSsh_put_UserAuthBanner(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetEnableCompression: Boolean;
begin
  Result := Boolean(CkSsh_get_EnableCompression(FHandle));
end;

procedure TSsh.SetEnableCompression(AValue: Boolean);
begin
  CkSsh_put_EnableCompression(FHandle, LongBool(AValue));
end;

function TSsh.GetAbortCurrent: Boolean;
begin
  Result := Boolean(CkSsh_get_AbortCurrent(FHandle));
end;

procedure TSsh.SetAbortCurrent(AValue: Boolean);
begin
  CkSsh_put_AbortCurrent(FHandle, LongBool(AValue));
end;

function TSsh.GetStripColorCodes: Boolean;
begin
  Result := Boolean(CkSsh_get_StripColorCodes(FHandle));
end;

procedure TSsh.SetStripColorCodes(AValue: Boolean);
begin
  CkSsh_put_StripColorCodes(FHandle, LongBool(AValue));
end;

function TSsh.GetServerIdentifier: string;
begin
  Result := CkToStr(CkSsh_get_ServerIdentifier(FHandle));
end;

function TSsh.GetUncommonOptions: string;
begin
  Result := CkToStr(CkSsh_get_UncommonOptions(FHandle));
end;

procedure TSsh.SetUncommonOptions(AValue: string);
begin
  CkSsh_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSsh.GetClientPort: Integer;
begin
  Result := CkSsh_get_ClientPort(FHandle);
end;

procedure TSsh.SetClientPort(AValue: Integer);
begin
  CkSsh_put_ClientPort(FHandle, AValue);
end;

function TSsh.GetEnableSecrets: Boolean;
begin
  Result := Boolean(CkSsh_get_EnableSecrets(FHandle));
end;

procedure TSsh.SetEnableSecrets(AValue: Boolean);
begin
  CkSsh_put_EnableSecrets(FHandle, LongBool(AValue));
end;

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

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

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

function TSsh.ChannelIsOpen(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelIsOpen(FHandle, channelNum));
end;

function TSsh.ChannelPoll(channelNum: Integer; pollTimeoutMs: Integer): Integer;
begin
  Result := CkSsh_ChannelPoll(FHandle, channelNum, pollTimeoutMs);
end;

function TSsh.ChannelRead(channelNum: Integer): Integer;
begin
  Result := CkSsh_ChannelRead(FHandle, channelNum);
end;

function TSsh.ChannelReadAndPoll(channelNum: Integer; pollTimeoutMs: Integer): Integer;
begin
  Result := CkSsh_ChannelReadAndPoll(FHandle, channelNum, pollTimeoutMs);
end;

function TSsh.ChannelReadAndPoll2(channelNum: Integer; pollTimeoutMs: Integer; maxNumBytes: Integer): Integer;
begin
  Result := CkSsh_ChannelReadAndPoll2(FHandle, channelNum, pollTimeoutMs, maxNumBytes);
end;

function TSsh.ChannelReceiveToClose(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceiveToClose(FHandle, channelNum));
end;

function TSsh.ChannelReceiveUntilMatch(channelNum: Integer; const matchPattern: string; const charset: string; caseSensitive: Boolean): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceiveUntilMatch(FHandle, channelNum, PAnsiChar(StrToCk(matchPattern)), PAnsiChar(StrToCk(charset)), LongBool(caseSensitive)));
end;

function TSsh.ChannelReceiveUntilMatchN(channelNum: Integer; matchPatterns: TChilkatBase; const charset: string; caseSensitive: Boolean): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceiveUntilMatchN(FHandle, channelNum, matchPatterns.Handle, PAnsiChar(StrToCk(charset)), LongBool(caseSensitive)));
end;

function TSsh.ChannelReceivedClose(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceivedClose(FHandle, channelNum));
end;

function TSsh.ChannelReceivedEof(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceivedEof(FHandle, channelNum));
end;

function TSsh.ChannelReceivedExitStatus(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelReceivedExitStatus(FHandle, channelNum));
end;

procedure TSsh.ChannelRelease(channelNum: Integer);
begin
  CkSsh_ChannelRelease(FHandle, channelNum);
end;

function TSsh.ChannelSendClose(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelSendClose(FHandle, channelNum));
end;

function TSsh.ChannelSendEof(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_ChannelSendEof(FHandle, channelNum));
end;

function TSsh.ChannelSendString(channelNum: Integer; const textData: string; const charset: string): Boolean;
begin
  Result := Boolean(CkSsh_ChannelSendString(FHandle, channelNum, PAnsiChar(StrToCk(textData)), PAnsiChar(StrToCk(charset))));
end;

function TSsh.CheckConnection: Boolean;
begin
  Result := Boolean(CkSsh_CheckConnection(FHandle));
end;

procedure TSsh.ClearTtyModes;
begin
  CkSsh_ClearTtyModes(FHandle);
end;

function TSsh.Connect(const domainName: string; port: Integer): Boolean;
begin
  Result := Boolean(CkSsh_Connect(FHandle, PAnsiChar(StrToCk(domainName)), port));
end;

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

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

procedure TSsh.Disconnect;
begin
  CkSsh_Disconnect(FHandle);
end;

function TSsh.GetChannelExitStatus(channelNum: Integer): Integer;
begin
  Result := CkSsh_GetChannelExitStatus(FHandle, channelNum);
end;

function TSsh.GetChannelNumber(index: Integer): Integer;
begin
  Result := CkSsh_GetChannelNumber(FHandle, index);
end;

function TSsh.GetChannelType(index: Integer): string;
begin
  Result := CkToStr(CkSsh_GetChannelType(FHandle, index));
end;

function TSsh.GetReceivedNumBytes(channelNum: Integer): Integer;
begin
  Result := CkSsh_GetReceivedNumBytes(FHandle, channelNum);
end;

function TSsh.GetReceivedStderrText(channelNum: Integer; const charset: string): string;
begin
  Result := CkToStr(CkSsh_GetReceivedStderrText(FHandle, channelNum, PAnsiChar(StrToCk(charset))));
end;

function TSsh.GetReceivedText(channelNum: Integer; const charset: string): string;
begin
  Result := CkToStr(CkSsh_GetReceivedText(FHandle, channelNum, PAnsiChar(StrToCk(charset))));
end;

function TSsh.GetReceivedTextS(channelNum: Integer; const substr: string; const charset: string): string;
begin
  Result := CkToStr(CkSsh_GetReceivedTextS(FHandle, channelNum, PAnsiChar(StrToCk(substr)), PAnsiChar(StrToCk(charset))));
end;

function TSsh.OpenCustomChannel(const channelType: string): Integer;
begin
  Result := CkSsh_OpenCustomChannel(FHandle, PAnsiChar(StrToCk(channelType)));
end;

function TSsh.OpenDirectTcpIpChannel(const targetHostname: string; targetPort: Integer): Integer;
begin
  Result := CkSsh_OpenDirectTcpIpChannel(FHandle, PAnsiChar(StrToCk(targetHostname)), targetPort);
end;

function TSsh.OpenSessionChannel: Integer;
begin
  Result := CkSsh_OpenSessionChannel(FHandle);
end;

function TSsh.PeekReceivedText(channelNum: Integer; const charset: string): string;
begin
  Result := CkToStr(CkSsh_PeekReceivedText(FHandle, channelNum, PAnsiChar(StrToCk(charset))));
end;

function TSsh.ReKey: Boolean;
begin
  Result := Boolean(CkSsh_ReKey(FHandle));
end;

function TSsh.SendIgnore: Boolean;
begin
  Result := Boolean(CkSsh_SendIgnore(FHandle));
end;

function TSsh.SendReqExec(channelNum: Integer; const commandLine: string): Boolean;
begin
  Result := Boolean(CkSsh_SendReqExec(FHandle, channelNum, PAnsiChar(StrToCk(commandLine))));
end;

function TSsh.SendReqPty(channelNum: Integer; const termType: string; widthInChars: Integer; heightInChars: Integer; widthInPixels: Integer; heightInPixels: Integer): Boolean;
begin
  Result := Boolean(CkSsh_SendReqPty(FHandle, channelNum, PAnsiChar(StrToCk(termType)), widthInChars, heightInChars, widthInPixels, heightInPixels));
end;

function TSsh.SendReqSetEnv(channelNum: Integer; const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkSsh_SendReqSetEnv(FHandle, channelNum, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function TSsh.SendReqShell(channelNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_SendReqShell(FHandle, channelNum));
end;

function TSsh.SendReqSignal(channelNum: Integer; const signalName: string): Boolean;
begin
  Result := Boolean(CkSsh_SendReqSignal(FHandle, channelNum, PAnsiChar(StrToCk(signalName))));
end;

function TSsh.SendReqSubsystem(channelNum: Integer; const subsystemName: string): Boolean;
begin
  Result := Boolean(CkSsh_SendReqSubsystem(FHandle, channelNum, PAnsiChar(StrToCk(subsystemName))));
end;

function TSsh.SendReqWindowChange(channelNum: Integer; widthInChars: Integer; heightInRows: Integer; pixWidth: Integer; pixHeight: Integer): Boolean;
begin
  Result := Boolean(CkSsh_SendReqWindowChange(FHandle, channelNum, widthInChars, heightInRows, pixWidth, pixHeight));
end;

function TSsh.SendReqX11Forwarding(channelNum: Integer; singleConnection: Boolean; const authProt: string; const authCookie: string; screenNum: Integer): Boolean;
begin
  Result := Boolean(CkSsh_SendReqX11Forwarding(FHandle, channelNum, LongBool(singleConnection), PAnsiChar(StrToCk(authProt)), PAnsiChar(StrToCk(authCookie)), screenNum));
end;

function TSsh.SendReqXonXoff(channelNum: Integer; clientCanDo: Boolean): Boolean;
begin
  Result := Boolean(CkSsh_SendReqXonXoff(FHandle, channelNum, LongBool(clientCanDo)));
end;

function TSsh.SetTtyMode(const ttyName: string; ttyValue: Integer): Boolean;
begin
  Result := Boolean(CkSsh_SetTtyMode(FHandle, PAnsiChar(StrToCk(ttyName)), ttyValue));
end;

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

function TSsh.WaitForChannelMessage(pollTimeoutMs: Integer): Integer;
begin
  Result := CkSsh_WaitForChannelMessage(FHandle, pollTimeoutMs);
end;

function TSsh.QuickCommand(const command: string; const charset: string): string;
begin
  Result := CkToStr(CkSsh_QuickCommand(FHandle, PAnsiChar(StrToCk(command)), PAnsiChar(StrToCk(charset))));
end;

function TSsh.QuickShell: Integer;
begin
  Result := CkSsh_QuickShell(FHandle);
end;

function TSsh.QuickCmdSend(const command: string): Integer;
begin
  Result := CkSsh_QuickCmdSend(FHandle, PAnsiChar(StrToCk(command)));
end;

function TSsh.QuickCmdCheck(pollTimeoutMs: Integer): Integer;
begin
  Result := CkSsh_QuickCmdCheck(FHandle, pollTimeoutMs);
end;

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

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

function TSsh.GetAuthMethods: string;
begin
  Result := CkToStr(CkSsh_GetAuthMethods(FHandle));
end;

function TSsh.GetHostKeyFP(const hashAlg: string; includeKeyType: Boolean; includeHashName: Boolean): string;
begin
  Result := CkToStr(CkSsh_GetHostKeyFP(FHandle, PAnsiChar(StrToCk(hashAlg)), LongBool(includeKeyType), LongBool(includeHashName)));
end;

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

procedure TSsh.GetLastJsonData(json: TChilkatBase);
begin
  CkSsh_GetLastJsonData(FHandle, json.Handle);
end;

function TSsh.GetReceivedSb(channelNum: Integer; const charset: string; sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSsh_GetReceivedSb(FHandle, channelNum, PAnsiChar(StrToCk(charset)), sb.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkSsh_Create,  'CkSsh_Create');
  Chilkat_GetProcedureAddress(CkSsh_Dispose, 'CkSsh_Dispose');
  Chilkat_GetProcedureAddress(CkSsh_SetAbortCheckCallback, 'CkSsh_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkSsh_SetPercentDoneCallback, 'CkSsh_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkSsh_SetProgressInfoCallback, 'CkSsh_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkSsh_get_LastErrorHtml, 'CkSsh_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkSsh_get_LastErrorText, 'CkSsh_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkSsh_get_LastErrorXml, 'CkSsh_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkSsh_get_Version, 'CkSsh_get_Version');
  Chilkat_GetProcedureAddress(CkSsh_get_DebugLogFilePath, 'CkSsh_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSsh_put_DebugLogFilePath, 'CkSsh_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSsh_get_VerboseLogging, 'CkSsh_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSsh_put_VerboseLogging, 'CkSsh_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSsh_get_LastMethodSuccess, 'CkSsh_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSsh_put_LastMethodSuccess, 'CkSsh_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSsh_get_AuthFailReason, 'CkSsh_get_AuthFailReason');
  Chilkat_GetProcedureAddress(CkSsh_get_CaretControl, 'CkSsh_get_CaretControl');
  Chilkat_GetProcedureAddress(CkSsh_put_CaretControl, 'CkSsh_put_CaretControl');
  Chilkat_GetProcedureAddress(CkSsh_get_ChannelOpenFailCode, 'CkSsh_get_ChannelOpenFailCode');
  Chilkat_GetProcedureAddress(CkSsh_get_ChannelOpenFailReason, 'CkSsh_get_ChannelOpenFailReason');
  Chilkat_GetProcedureAddress(CkSsh_get_ClientIdentifier, 'CkSsh_get_ClientIdentifier');
  Chilkat_GetProcedureAddress(CkSsh_put_ClientIdentifier, 'CkSsh_put_ClientIdentifier');
  Chilkat_GetProcedureAddress(CkSsh_get_ClientIpAddress, 'CkSsh_get_ClientIpAddress');
  Chilkat_GetProcedureAddress(CkSsh_put_ClientIpAddress, 'CkSsh_put_ClientIpAddress');
  Chilkat_GetProcedureAddress(CkSsh_get_ConnectTimeoutMs, 'CkSsh_get_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_put_ConnectTimeoutMs, 'CkSsh_put_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_get_DisconnectCode, 'CkSsh_get_DisconnectCode');
  Chilkat_GetProcedureAddress(CkSsh_get_DisconnectReason, 'CkSsh_get_DisconnectReason');
  Chilkat_GetProcedureAddress(CkSsh_get_ForceCipher, 'CkSsh_get_ForceCipher');
  Chilkat_GetProcedureAddress(CkSsh_put_ForceCipher, 'CkSsh_put_ForceCipher');
  Chilkat_GetProcedureAddress(CkSsh_get_HeartbeatMs, 'CkSsh_get_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkSsh_put_HeartbeatMs, 'CkSsh_put_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkSsh_get_HostKeyAlg, 'CkSsh_get_HostKeyAlg');
  Chilkat_GetProcedureAddress(CkSsh_put_HostKeyAlg, 'CkSsh_put_HostKeyAlg');
  Chilkat_GetProcedureAddress(CkSsh_get_HostKeyFingerprint, 'CkSsh_get_HostKeyFingerprint');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyAuthMethod, 'CkSsh_get_HttpProxyAuthMethod');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyAuthMethod, 'CkSsh_put_HttpProxyAuthMethod');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyDomain, 'CkSsh_get_HttpProxyDomain');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyDomain, 'CkSsh_put_HttpProxyDomain');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyHostname, 'CkSsh_get_HttpProxyHostname');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyHostname, 'CkSsh_put_HttpProxyHostname');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyPassword, 'CkSsh_get_HttpProxyPassword');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyPassword, 'CkSsh_put_HttpProxyPassword');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyPort, 'CkSsh_get_HttpProxyPort');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyPort, 'CkSsh_put_HttpProxyPort');
  Chilkat_GetProcedureAddress(CkSsh_get_HttpProxyUsername, 'CkSsh_get_HttpProxyUsername');
  Chilkat_GetProcedureAddress(CkSsh_put_HttpProxyUsername, 'CkSsh_put_HttpProxyUsername');
  Chilkat_GetProcedureAddress(CkSsh_get_IdleTimeoutMs, 'CkSsh_get_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_put_IdleTimeoutMs, 'CkSsh_put_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_get_IsConnected, 'CkSsh_get_IsConnected');
  Chilkat_GetProcedureAddress(CkSsh_get_KeepSessionLog, 'CkSsh_get_KeepSessionLog');
  Chilkat_GetProcedureAddress(CkSsh_put_KeepSessionLog, 'CkSsh_put_KeepSessionLog');
  Chilkat_GetProcedureAddress(CkSsh_get_MaxPacketSize, 'CkSsh_get_MaxPacketSize');
  Chilkat_GetProcedureAddress(CkSsh_put_MaxPacketSize, 'CkSsh_put_MaxPacketSize');
  Chilkat_GetProcedureAddress(CkSsh_get_NumOpenChannels, 'CkSsh_get_NumOpenChannels');
  Chilkat_GetProcedureAddress(CkSsh_get_PasswordChangeRequested, 'CkSsh_get_PasswordChangeRequested');
  Chilkat_GetProcedureAddress(CkSsh_get_PreferIpv6, 'CkSsh_get_PreferIpv6');
  Chilkat_GetProcedureAddress(CkSsh_put_PreferIpv6, 'CkSsh_put_PreferIpv6');
  Chilkat_GetProcedureAddress(CkSsh_get_ReadTimeoutMs, 'CkSsh_get_ReadTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_put_ReadTimeoutMs, 'CkSsh_put_ReadTimeoutMs');
  Chilkat_GetProcedureAddress(CkSsh_get_ReqExecCharset, 'CkSsh_get_ReqExecCharset');
  Chilkat_GetProcedureAddress(CkSsh_put_ReqExecCharset, 'CkSsh_put_ReqExecCharset');
  Chilkat_GetProcedureAddress(CkSsh_get_SessionLog, 'CkSsh_get_SessionLog');
  Chilkat_GetProcedureAddress(CkSsh_get_SoRcvBuf, 'CkSsh_get_SoRcvBuf');
  Chilkat_GetProcedureAddress(CkSsh_put_SoRcvBuf, 'CkSsh_put_SoRcvBuf');
  Chilkat_GetProcedureAddress(CkSsh_get_SoSndBuf, 'CkSsh_get_SoSndBuf');
  Chilkat_GetProcedureAddress(CkSsh_put_SoSndBuf, 'CkSsh_put_SoSndBuf');
  Chilkat_GetProcedureAddress(CkSsh_get_SocksHostname, 'CkSsh_get_SocksHostname');
  Chilkat_GetProcedureAddress(CkSsh_put_SocksHostname, 'CkSsh_put_SocksHostname');
  Chilkat_GetProcedureAddress(CkSsh_get_SocksPassword, 'CkSsh_get_SocksPassword');
  Chilkat_GetProcedureAddress(CkSsh_put_SocksPassword, 'CkSsh_put_SocksPassword');
  Chilkat_GetProcedureAddress(CkSsh_get_SocksPort, 'CkSsh_get_SocksPort');
  Chilkat_GetProcedureAddress(CkSsh_put_SocksPort, 'CkSsh_put_SocksPort');
  Chilkat_GetProcedureAddress(CkSsh_get_SocksUsername, 'CkSsh_get_SocksUsername');
  Chilkat_GetProcedureAddress(CkSsh_put_SocksUsername, 'CkSsh_put_SocksUsername');
  Chilkat_GetProcedureAddress(CkSsh_get_SocksVersion, 'CkSsh_get_SocksVersion');
  Chilkat_GetProcedureAddress(CkSsh_put_SocksVersion, 'CkSsh_put_SocksVersion');
  Chilkat_GetProcedureAddress(CkSsh_get_StderrToStdout, 'CkSsh_get_StderrToStdout');
  Chilkat_GetProcedureAddress(CkSsh_put_StderrToStdout, 'CkSsh_put_StderrToStdout');
  Chilkat_GetProcedureAddress(CkSsh_get_TcpNoDelay, 'CkSsh_get_TcpNoDelay');
  Chilkat_GetProcedureAddress(CkSsh_put_TcpNoDelay, 'CkSsh_put_TcpNoDelay');
  Chilkat_GetProcedureAddress(CkSsh_get_UserAuthBanner, 'CkSsh_get_UserAuthBanner');
  Chilkat_GetProcedureAddress(CkSsh_put_UserAuthBanner, 'CkSsh_put_UserAuthBanner');
  Chilkat_GetProcedureAddress(CkSsh_get_EnableCompression, 'CkSsh_get_EnableCompression');
  Chilkat_GetProcedureAddress(CkSsh_put_EnableCompression, 'CkSsh_put_EnableCompression');
  Chilkat_GetProcedureAddress(CkSsh_get_AbortCurrent, 'CkSsh_get_AbortCurrent');
  Chilkat_GetProcedureAddress(CkSsh_put_AbortCurrent, 'CkSsh_put_AbortCurrent');
  Chilkat_GetProcedureAddress(CkSsh_get_StripColorCodes, 'CkSsh_get_StripColorCodes');
  Chilkat_GetProcedureAddress(CkSsh_put_StripColorCodes, 'CkSsh_put_StripColorCodes');
  Chilkat_GetProcedureAddress(CkSsh_get_ServerIdentifier, 'CkSsh_get_ServerIdentifier');
  Chilkat_GetProcedureAddress(CkSsh_get_UncommonOptions, 'CkSsh_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkSsh_put_UncommonOptions, 'CkSsh_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkSsh_get_ClientPort, 'CkSsh_get_ClientPort');
  Chilkat_GetProcedureAddress(CkSsh_put_ClientPort, 'CkSsh_put_ClientPort');
  Chilkat_GetProcedureAddress(CkSsh_get_EnableSecrets, 'CkSsh_get_EnableSecrets');
  Chilkat_GetProcedureAddress(CkSsh_put_EnableSecrets, 'CkSsh_put_EnableSecrets');
  Chilkat_GetProcedureAddress(CkSsh_AuthenticatePk, 'CkSsh_AuthenticatePk');
  Chilkat_GetProcedureAddress(CkSsh_AuthenticatePw, 'CkSsh_AuthenticatePw');
  Chilkat_GetProcedureAddress(CkSsh_AuthenticatePwPk, 'CkSsh_AuthenticatePwPk');
  Chilkat_GetProcedureAddress(CkSsh_ChannelIsOpen, 'CkSsh_ChannelIsOpen');
  Chilkat_GetProcedureAddress(CkSsh_ChannelPoll, 'CkSsh_ChannelPoll');
  Chilkat_GetProcedureAddress(CkSsh_ChannelRead, 'CkSsh_ChannelRead');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReadAndPoll, 'CkSsh_ChannelReadAndPoll');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReadAndPoll2, 'CkSsh_ChannelReadAndPoll2');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceiveToClose, 'CkSsh_ChannelReceiveToClose');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceiveUntilMatch, 'CkSsh_ChannelReceiveUntilMatch');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceiveUntilMatchN, 'CkSsh_ChannelReceiveUntilMatchN');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceivedClose, 'CkSsh_ChannelReceivedClose');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceivedEof, 'CkSsh_ChannelReceivedEof');
  Chilkat_GetProcedureAddress(CkSsh_ChannelReceivedExitStatus, 'CkSsh_ChannelReceivedExitStatus');
  Chilkat_GetProcedureAddress(CkSsh_ChannelRelease, 'CkSsh_ChannelRelease');
  Chilkat_GetProcedureAddress(CkSsh_ChannelSendClose, 'CkSsh_ChannelSendClose');
  Chilkat_GetProcedureAddress(CkSsh_ChannelSendEof, 'CkSsh_ChannelSendEof');
  Chilkat_GetProcedureAddress(CkSsh_ChannelSendString, 'CkSsh_ChannelSendString');
  Chilkat_GetProcedureAddress(CkSsh_CheckConnection, 'CkSsh_CheckConnection');
  Chilkat_GetProcedureAddress(CkSsh_ClearTtyModes, 'CkSsh_ClearTtyModes');
  Chilkat_GetProcedureAddress(CkSsh_Connect, 'CkSsh_Connect');
  Chilkat_GetProcedureAddress(CkSsh_ConnectThroughSsh, 'CkSsh_ConnectThroughSsh');
  Chilkat_GetProcedureAddress(CkSsh_ContinueKeyboardAuth, 'CkSsh_ContinueKeyboardAuth');
  Chilkat_GetProcedureAddress(CkSsh_Disconnect, 'CkSsh_Disconnect');
  Chilkat_GetProcedureAddress(CkSsh_GetChannelExitStatus, 'CkSsh_GetChannelExitStatus');
  Chilkat_GetProcedureAddress(CkSsh_GetChannelNumber, 'CkSsh_GetChannelNumber');
  Chilkat_GetProcedureAddress(CkSsh_GetChannelType, 'CkSsh_GetChannelType');
  Chilkat_GetProcedureAddress(CkSsh_GetReceivedNumBytes, 'CkSsh_GetReceivedNumBytes');
  Chilkat_GetProcedureAddress(CkSsh_GetReceivedStderrText, 'CkSsh_GetReceivedStderrText');
  Chilkat_GetProcedureAddress(CkSsh_GetReceivedText, 'CkSsh_GetReceivedText');
  Chilkat_GetProcedureAddress(CkSsh_GetReceivedTextS, 'CkSsh_GetReceivedTextS');
  Chilkat_GetProcedureAddress(CkSsh_OpenCustomChannel, 'CkSsh_OpenCustomChannel');
  Chilkat_GetProcedureAddress(CkSsh_OpenDirectTcpIpChannel, 'CkSsh_OpenDirectTcpIpChannel');
  Chilkat_GetProcedureAddress(CkSsh_OpenSessionChannel, 'CkSsh_OpenSessionChannel');
  Chilkat_GetProcedureAddress(CkSsh_PeekReceivedText, 'CkSsh_PeekReceivedText');
  Chilkat_GetProcedureAddress(CkSsh_ReKey, 'CkSsh_ReKey');
  Chilkat_GetProcedureAddress(CkSsh_SendIgnore, 'CkSsh_SendIgnore');
  Chilkat_GetProcedureAddress(CkSsh_SendReqExec, 'CkSsh_SendReqExec');
  Chilkat_GetProcedureAddress(CkSsh_SendReqPty, 'CkSsh_SendReqPty');
  Chilkat_GetProcedureAddress(CkSsh_SendReqSetEnv, 'CkSsh_SendReqSetEnv');
  Chilkat_GetProcedureAddress(CkSsh_SendReqShell, 'CkSsh_SendReqShell');
  Chilkat_GetProcedureAddress(CkSsh_SendReqSignal, 'CkSsh_SendReqSignal');
  Chilkat_GetProcedureAddress(CkSsh_SendReqSubsystem, 'CkSsh_SendReqSubsystem');
  Chilkat_GetProcedureAddress(CkSsh_SendReqWindowChange, 'CkSsh_SendReqWindowChange');
  Chilkat_GetProcedureAddress(CkSsh_SendReqX11Forwarding, 'CkSsh_SendReqX11Forwarding');
  Chilkat_GetProcedureAddress(CkSsh_SendReqXonXoff, 'CkSsh_SendReqXonXoff');
  Chilkat_GetProcedureAddress(CkSsh_SetTtyMode, 'CkSsh_SetTtyMode');
  Chilkat_GetProcedureAddress(CkSsh_StartKeyboardAuth, 'CkSsh_StartKeyboardAuth');
  Chilkat_GetProcedureAddress(CkSsh_WaitForChannelMessage, 'CkSsh_WaitForChannelMessage');
  Chilkat_GetProcedureAddress(CkSsh_QuickCommand, 'CkSsh_QuickCommand');
  Chilkat_GetProcedureAddress(CkSsh_QuickShell, 'CkSsh_QuickShell');
  Chilkat_GetProcedureAddress(CkSsh_QuickCmdSend, 'CkSsh_QuickCmdSend');
  Chilkat_GetProcedureAddress(CkSsh_QuickCmdCheck, 'CkSsh_QuickCmdCheck');
  Chilkat_GetProcedureAddress(CkSsh_AuthenticateSecPw, 'CkSsh_AuthenticateSecPw');
  Chilkat_GetProcedureAddress(CkSsh_AuthenticateSecPwPk, 'CkSsh_AuthenticateSecPwPk');
  Chilkat_GetProcedureAddress(CkSsh_GetAuthMethods, 'CkSsh_GetAuthMethods');
  Chilkat_GetProcedureAddress(CkSsh_GetHostKeyFP, 'CkSsh_GetHostKeyFP');
  Chilkat_GetProcedureAddress(CkSsh_SetAllowedAlgorithms, 'CkSsh_SetAllowedAlgorithms');
  Chilkat_GetProcedureAddress(CkSsh_GetLastJsonData, 'CkSsh_GetLastJsonData');
  Chilkat_GetProcedureAddress(CkSsh_GetReceivedSb, 'CkSsh_GetReceivedSb');

end.
