-
Notifications
You must be signed in to change notification settings - Fork 33
/
libssh2.pas
3429 lines (3166 loc) · 140 KB
/
libssh2.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{ libssh2.pas } //# version: 2024.0114.1600
{ **
* Delphi/Pascal Wrapper around the library "libssh2"
* Base repository:
* https://bitbucket.org/ZeljkoMarjanovic/libssh2-delphi
* Contributors:
* https://bitbucket.org/jeroenp/libssh2-delphi
* https://github.com/pult/libssh2_delphi/
* https://bitbucket.org/VadimLV/libssh2_delphi
* }
unit libssh2;
//#
//# **zm ** translated to pascal
//#
//# libssh2.h # https://github.com/libssh2/libssh2/blob/master/include/libssh2.h
//# # 2024.0110: https://github.com/libssh2/libssh2/commit/2ed9eb92f385da7bc7a2d072694e01fd674cbf34
(*
* Copyright (C) Sara Golemon <[email protected]>
* Copyright (C) Daniel Stenberg
* Copyright (C) Simon Josefsson <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the copyright holder nor the names
* of any other contributors may be used to endorse or
* promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* SPDX-License-Identifier: BSD-3-Clause
*)
{$i libssh2.inc}
{$UNDEF _TEST_}
{$UNDEF _TEST_LIBSSH2_} { no change }
//#TEST:
{$if defined(_IDE_) and defined(_DEBUG_) and defined(_TEST_)}
{$DEFINE _TEST_LIBSSH2_} //# optional: testing some wrappers for "test_libssh2_*"
{$ifend}
//#TEST.
(*{$IFDEF MSWINDOWS}
{$IFDEF WIN32}
{$HPPEMIT ''}
{$HPPEMIT '#pragma link "libssh2.lib"'}
{$HPPEMIT ''}
{$ENDIF}
{$IFDEF WIN64}
{$HPPEMIT ''}
{$HPPEMIT '#pragma link "libssh2.a"'}
{$HPPEMIT ''}
{$ENDIF}
{$ENDIF}//*)
interface
uses
{$IFDEF allow_hvdll}
HVDll, //# alternative for: external '%dll_name%' name '%function_name%' delayed
{$ENDIF}
{$IFDEF MSWINDOWS}
{$if defined(WIN32) or defined(WIN64)}
Windows,
{$else}
Wintypes, WinProcs,
{$ifend}
{$ENDIF}
WinSock,
//-{$IFDEF MSWINDOWS}
//-Winsock2, {$DEFINE _WINSOCK2_}
//-{$ENDIF MSWINDOWS}
SysUtils
{$if (not declared(uHVDll)) and (not defined(allow_delayed))}
,Classes
{$ifend}
;
const
libssh2_name = 'libssh2'
{$IFDEF MSWINDOWS}
{$IFDEF WIN64}
+ '-x64' // optional: win64: "libssh2-x64.dll" win32: "libssh2.dll"
{$ENDIF}
+ '.dll' // optional
{$ELSE !MSWINDOWS}
{$IFDEF LINUX}
+ '.so'
{$ELSE}
{$IFDEF BSD}
+ '.dylib'
{$ENDIF}
{$ENDIF !LINUX}
{$ENDIF !MSWINDOWS}
;
LIBSSH2_NULL = nil; // "C" NULL
{$if not declared(sLineBreak)}
sLineBreak =
{$IFDEF POSIX}
AnsiChar(#10)
{$ELSE}
AnsiChar(#13)+AnsiChar(#10)
{$ENDIF}
;
{$ifend}
type
{$if (not declared(uHVDll)) and (not defined(allow_delayed))}
ELibSSH2 = class(Exception);
{$ifend}
libssh2_uint64_t = UInt64;
libssh2_int64_t = Int64;
uint32_t = UInt;
ssize_t = Integer;
{$EXTERNALSYM time_t}
time_t = ULong;
libssh2_socket_t = {Winsock.}TSocket;
(*{$IFDEF FPC}
libssh2_socket_t = ptruint;
{$ELSE}
{$IFDEF WIN64}
libssh2_socket_t = UINT_PTR;
{$ELSE}
u_int = Cardinal;
libssh2_socket_t = u_int;
{$ENDIF}
{$ENDIF}*)
TLibssh2Socket = libssh2_socket_t;
const
LIBSSH2_UNIT_VER = 202401141600;
//# format time : yyyymmddhhnn #
{$EXTERNALSYM LIBSSH2_UNIT_VER}
(*
//# Sample for checking:
//# <sample>
//#
{$ifndef fpc}{$warn comparison_true off}{$endif}
{$if (not declared(LIBSSH2_UNIT_VER)) or (LIBSSH2_UNIT_VER < 202401141600)}
{$ifndef fpc}{$warn message_directive on}{$endif}
{$MESSAGE WARN 'Please use latest "libssh2.pas" from "https://github.com/pult/libssh2_delphi/"'}
// or :
//{$MESSAGE FATAL 'Please use latest "libssh2.pas" from "https://github.com/pult/libssh2_delphi/"'}
{$ifend}{$warnings on}
//#
//# <\sample>
//*)
const
{+// We use underscore instead of dash when appending CVS in dev versions just }
{-to make the BANNER define (used by src/session.c) be a valid SSH }
{-banner. Release versions have no appended strings and may of course not }
{=have dashes either. }
_LIBSSH2_VERSION = '1.8.1'; //#DEV: '1.11.1'
{+// The numeric version number is also available "in parts" by using these }
{=defines: }
LIBSSH2_VERSION_MAJOR = 1;
LIBSSH2_VERSION_MINOR = 8; // #DEV: 11
LIBSSH2_VERSION_PATCH = 1;
SHA_DIGEST_LENGTH = 20;
MD5_DIGEST_LENGTH = 16;
{+// This is the numeric version of the libssh2 version number, meant for easier }
{-parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will }
{-always follow this syntax: }
{-0xXXYYZZ }
{-Where XX, YY and ZZ are the main version, release and patch numbers in }
{-hexadecimal (using 8 bits each). All three numbers are always represented }
{-using two digits. 1.2 would appear as "0x010200" while version 9.11.7 }
{-appears as "0x090b07". }
{-This 6-digit (24 bits) hexadecimal number does not show pre-release number, }
{-and it is always a greater number in a more recent release. It makes }
{-comparisons with greater than and less than work. }
{= }
LIBSSH2_VERSION_NUM = $010801; //#DEV: $010b01
{+// }
{-* This is the date and time when the full source package was created. The }
{-* timestamp is not stored in CVS, as the timestamp is properly set in the }
{-* tarballs by the maketgz script. }
{-* }
{-* The format of the date should follow this template: }
{-* }
{-* "Mon Feb 12 11:35:33 UTC 2007" }
{= }
LIBSSH2_TIMESTAMP = '_DEV';
{+// Part of every banner, user specified or not*/ }
LIBSSH2_SSH_BANNER = 'SSH-2.0-libssh2_' + _LIBSSH2_VERSION + LIBSSH2_TIMESTAMP;
{+// We*could* add a comment here if we so chose*/ }
LIBSSH2_SSH_DEFAULT_BANNER = LIBSSH2_SSH_BANNER;
LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF = LIBSSH2_SSH_DEFAULT_BANNER + sLineBreak;
{+// Default generate and safe prime sizes for diffie-hellman-group-exchange-sha1*/ }
LIBSSH2_DH_GEX_MINGROUP = 1024 {$if defined(FPC) or (CompilerVersion >= 18.50)} deprecated{$ifend};
LIBSSH2_DH_GEX_OPTGROUP = 1536 {$if defined(FPC) or (CompilerVersion >= 18.50)} deprecated{$ifend};
LIBSSH2_DH_GEX_MAXGROUP = 2048 {$if defined(FPC) or (CompilerVersion >= 18.50)} deprecated{$ifend};
{+// Defaults for pty requests*/ }
LIBSSH2_TERM_WIDTH = 80;
LIBSSH2_TERM_HEIGHT = 24;
LIBSSH2_TERM_WIDTH_PX = 0;
LIBSSH2_TERM_HEIGHT_PX = 0;
{+// 1/4 second*/ }
LIBSSH2_SOCKET_POLL_UDELAY = 250000;
{+// 0.25* 120 == 30 seconds*/ }
LIBSSH2_SOCKET_POLL_MAXLOOPS = 120;
{+// Maximum size to allow a payload to compress to, plays it safe by falling }
{=short of spec limits }
LIBSSH2_PACKET_MAXCOMP = 32000;
{+// Maximum size to allow a payload to deccompress to, plays it safe by }
{=allowing more than spec requires }
LIBSSH2_PACKET_MAXDECOMP = 40000;
{+// Maximum size for an inbound compressed payload, plays it safe by }
{=overshooting spec limits }
LIBSSH2_PACKET_MAXPAYLOAD = 40000;
{+// Malloc callbacks*/ }
// ovo je vec definisano u ssh2_priv alloc, realloc, free
type
_LIBSSH2_SESSION = record end;
_LIBSSH2_CHANNEL = record end;
_LIBSSH2_LISTENER = record end;
_LIBSSH2_KNOWNHOSTS = record end;
_LIBSSH2_AGENT = record end;
LIBSSH2_SESSION = _LIBSSH2_SESSION;
LIBSSH2_CHANNEL = _LIBSSH2_CHANNEL;
LIBSSH2_LISTENER = _LIBSSH2_LISTENER;
LIBSSH2_KNOWNHOSTS = _LIBSSH2_KNOWNHOSTS;
LIBSSH2_AGENT = _LIBSSH2_AGENT;
PLIBSSH2_SESSION = ^LIBSSH2_SESSION;
PLIBSSH2_CHANNEL = ^LIBSSH2_CHANNEL;
PLIBSSH2_LISTENER = ^LIBSSH2_LISTENER;
PLIBSSH2_KNOWNHOSTS = ^LIBSSH2_KNOWNHOSTS;
PLIBSSH2_AGENT = ^LIBSSH2_AGENT;
{$EXTERNALSYM SIZE_T}
SIZE_T = UINT;
PSIZE_T = ^SIZE_T;
_LIBSSH2_USERAUTH_KBDINT_PROMPT = record
text: PAnsiChar;
length: SIZE_T;
echo: Byte;
end;
LIBSSH2_USERAUTH_KBDINT_PROMPT = _LIBSSH2_USERAUTH_KBDINT_PROMPT;
PLIBSSH2_USERAUTH_KBDINT_PROMPT = ^LIBSSH2_USERAUTH_KBDINT_PROMPT;
_LIBSSH2_USERAUTH_KBDINT_RESPONSE = record
text: PAnsiChar;
length: UInt;
end;
LIBSSH2_USERAUTH_KBDINT_RESPONSE = _LIBSSH2_USERAUTH_KBDINT_RESPONSE;
_LIBSSH2_SK_SIG_INFO = record
flags: Byte;
counter: UInt;
sig_r: PAnsiChar;
sig_r_len: SIZE_T;
sig_s: PAnsiChar;
sig_s_len: SIZE_T;
end;
LIBSSH2_SK_SIG_INFO = _LIBSSH2_SK_SIG_INFO;
PLIBSSH2_SK_SIG_INFO = ^LIBSSH2_SK_SIG_INFO;
{/* 'publickey' authentication callback */}
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC = function(
session: PLIBSSH2_SESSION; var sig: PByte; sig_len: size_t;
const data: PByte; data_len: size_t; abstract: Pointer): Integer; cdecl;
{+// 'keyboard-interactive' authentication callback*/ }
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC = procedure (const name: PAnsiChar;
name_len: Integer;
const instruction: PAnsiChar;
instruction_len: Integer;
num_prompts: Integer;
const prompts: PLIBSSH2_USERAUTH_KBDINT_PROMPT;
var responses: LIBSSH2_USERAUTH_KBDINT_RESPONSE;
abstract: Pointer); cdecl;
{+// SK authentication callback */ }
LIBSSH2_USERAUTH_SK_SIGN_FUNC = function(session: PLIBSSH2_SESSION;
sig_info: PLIBSSH2_SK_SIG_INFO;
const data: PByte; data_len: SIZE_T;
algorithm: Integer; flags: Byte; const application: PAnsiChar;
const key_handle: PByte; handle_len: SIZE_T; abstract: Pointer
): Integer; cdecl;
const
///* Flags for SK authentication */
LIBSSH2_SK_PRESENCE_REQUIRED = 1;
LIBSSH2_SK_VERIFICATION_REQUIRED = 4;
type
{+// Callbacks for special SSH packets*/ }
LIBSSH2_IGNORE_FUNC = procedure (session: PLIBSSH2_SESSION;
const message: PAnsiChar;
message_len: Integer;
abstract: Pointer); cdecl;
LIBSSH2_DEBUG_FUNC = procedure (session: PLIBSSH2_SESSION;
always_display: Integer;
const message: PAnsiChar;
message_len: Integer;
const language: PAnsiChar;
language_len: Integer;
abstract: Pointer); cdecl;
LIBSSH2_DISCONNECT_FUNC = procedure(session: PLIBSSH2_SESSION;
reason: Integer;
const message: PAnsiChar;
message_len: Integer;
const language: PAnsiChar;
language_len: Integer;
abstract: Pointer); cdecl;
LIBSSH2_PASSWD_CHANGEREQ_FUNC = procedure(session: PLIBSSH2_SESSION;
var newpw: PAnsiChar;
var newpw_len: Integer;
abstract: Pointer); cdecl;
LIBSSH2_MACERROR_FUNC = function (session: PLIBSSH2_SESSION;
const packet: PAnsiChar;
packet_len: Integer;
abstract: Pointer): Integer; cdecl;
LIBSSH2_X11_OPEN_FUNC = procedure (session: PLIBSSH2_SESSION;
channel: PLIBSSH2_CHANNEL;
const shost: PAnsiChar;
sport: Integer;
abstract: Pointer); cdecl;
LIBSSH2_AUTHAGENT_FUNC = procedure (session: PLIBSSH2_SESSION;
channel: PLIBSSH2_CHANNEL; abstract: Pointer); cdecl;
LIBSSH2_ADD_IDENTITIES_FUNC = procedure (session: PLIBSSH2_SESSION;
buffer: Pointer; const agent_path: PAnsiChar;
abstract: Pointer); cdecl;
LIBSSH2_AUTHAGENT_SIGN_FUNC = function(session: PLIBSSH2_SESSION;
const blob: PByte; blen: UINT;
const data: PByte; dlen: UINT;
var signature: PByte; sigLen: UINT;
const agentPath: PAnsiChar;
abstract: Pointer): Integer; cdecl;
LIBSSH2_CHANNEL_CLOSE_FUNC = procedure (session: PLIBSSH2_SESSION;
var session_abstract: Pointer;
channel: PLIBSSH2_CHANNEL;
var channel_abstract: Pointer); cdecl;
{/* I/O callbacks */}
LIBSSH2_RECV_FUNC = function (socket: libssh2_socket_t;
buffer: Pointer; length: size_t;
flags: Integer; abstract: Pointer): ssize_t; cdecl;
LIBSSH2_SEND_FUNC = function (socket: libssh2_socket_t;
const buffer: Pointer; length: size_t;
flags: Integer; abstract: Pointer): ssize_t; cdecl;
const
{+// libssh2_session_callback_set() constants*/ }
LIBSSH2_CALLBACK_IGNORE = 0;
LIBSSH2_CALLBACK_DEBUG = 1;
LIBSSH2_CALLBACK_DISCONNECT = 2;
LIBSSH2_CALLBACK_MACERROR = 3;
LIBSSH2_CALLBACK_X11 = 4;
LIBSSH2_CALLBACK_SEND = 5;
LIBSSH2_CALLBACK_RECV = 6;
LIBSSH2_CALLBACK_AUTHAGENT = 7;
LIBSSH2_CALLBACK_AUTHAGENT_IDENTITIES = 8;
LIBSSH2_CALLBACK_AUTHAGENT_SIGN = 9;
{+// libssh2_session_method_pref() constants*/ }
LIBSSH2_METHOD_KEX = 0;
LIBSSH2_METHOD_HOSTKEY = 1;
LIBSSH2_METHOD_CRYPT_CS = 2;
LIBSSH2_METHOD_CRYPT_SC = 3;
LIBSSH2_METHOD_MAC_CS = 4;
LIBSSH2_METHOD_MAC_SC = 5;
LIBSSH2_METHOD_COMP_CS = 6;
LIBSSH2_METHOD_COMP_SC = 7;
LIBSSH2_METHOD_LANG_CS = 8;
LIBSSH2_METHOD_LANG_SC = 9;
LIBSSH2_METHOD_SIGN_ALGO = 10;
{+// session.flags bits*/ }
LIBSSH2_FLAG_SIGPIPE = 1;
LIBSSH2_FLAG_COMPRESS = 2;
LIBSSH2_FLAG_QUOTE_PATHS = 3;
{+// SK signature callback */ }
type
_LIBSSH2_PRIVKEY_SK = record
algorithm: Integer;
flags: Byte;
application: PAnsiChar;
key_handle: PByte;
handle_len: SIZE_T;
sign_callback: LIBSSH2_USERAUTH_SK_SIGN_FUNC;
orig_abstract: Pointer;
end;
LIBSSH2_PRIVKEY_SK = _LIBSSH2_PRIVKEY_SK;
PLIBSSH2_PRIVKEY_SK = ^LIBSSH2_PRIVKEY_SK;
procedure LIBSSH2_SOCKET_CLOSE(s: TSocket); {$ifdef allow_inline}inline;{$endif}
type
t_libssh2_sign_sk = function(session: PLIBSSH2_SESSION;
var sig: PByte; sig_len: SIZE_T;
const data: PByte; data_len: SIZE_T;
abstract: Pointer): Integer; cdecl;
{$if not declared(uHVDll)}
{$ifndef allow_delayed}
var _libssh2_sign_sk: t_libssh2_sign_sk;
{$endif}
function libssh2_sign_sk(session: PLIBSSH2_SESSION;
var sig: PByte; sig_len: SIZE_T;
const data: PByte; data_len: SIZE_T;
abstract: Pointer): Integer; cdecl;
{$else}
var libssh2_sign_sk: t_libssh2_sign_sk;
{$ifend}
type
PLIBSSH2_POLLFD = ^_LIBSSH2_POLLFD;
_LIBSSH2_POLLFD = record
_type: Byte;
{= LIBSSH2_POLLFD_* below }
socket: Integer;
{= File descriptors -- examined with system select() call }
channel: PLIBSSH2_CHANNEL;
{= Examined by checking internal state }
listener: PLIBSSH2_LISTENER;
{- Read polls only -- are inbound }
{=connections waiting to be accepted? }
end;
LIBSSH2_POLLFD = _LIBSSH2_POLLFD;
{= Requested Events }
{= Returned Events }
const
{+// Poll FD Descriptor Types*/ }
LIBSSH2_POLLFD_SOCKET = 1;
LIBSSH2_POLLFD_CHANNEL = 2;
LIBSSH2_POLLFD_LISTENER = 3;
{+// Note: Win32 Doesn't actually have a poll() implementation, so some of these }
{=values are faked with select() data }
{+// Poll FD events/revents -- Match sys/poll.h where possible*/ }
LIBSSH2_POLLFD_POLLIN = $0001; {/* Data available to be read or}
LIBSSH2_POLLFD_POLLPRI = $0002; {/* Priority data available to
be read -- Socket only */}
LIBSSH2_POLLFD_POLLEXT = $0002; {/* Extended data available to be read -- Channel only */}
LIBSSH2_POLLFD_POLLOUT = $0004; {/* Can may be written -- Socket/Channel */}
LIBSSH2_POLLFD_POLLERR = $0008; {/* Error Condition -- Socket*/}
LIBSSH2_POLLFD_POLLHUP = $0010; {/* HangUp/EOF -- Socket*/}
LIBSSH2_POLLFD_SESSION_CLOSED = $0010; {/* Session Disconnect*/}
LIBSSH2_POLLFD_POLLNVAL = $0020; {/* Invalid request -- Socket Only */}
LIBSSH2_POLLFD_POLLEX = $0040; {/* Exception Condition -- Socket/Win32 */}
LIBSSH2_POLLFD_CHANNEL_CLOSED = $0080; {/* Channel Disconnect */}
LIBSSH2_POLLFD_LISTENER_CLOSED = $0080; {/* Listener Disconnect*/}
HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION = 1;
{+// Block Direction Types*/ }
LIBSSH2_SESSION_BLOCK_INBOUND = $0001;
LIBSSH2_SESSION_BLOCK_OUTBOUND = $0002;
{+// Hash Types*/ }
LIBSSH2_HOSTKEY_HASH_MD5 = 1;
LIBSSH2_HOSTKEY_HASH_SHA1 = 2;
LIBSSH2_HOSTKEY_HASH_SHA256 = 3;
{+// Hostkey Types */ }
LIBSSH2_HOSTKEY_TYPE_UNKNOWN = 0;
LIBSSH2_HOSTKEY_TYPE_RSA = 1;
LIBSSH2_HOSTKEY_TYPE_DSS = 2;
LIBSSH2_HOSTKEY_TYPE_ECDSA_256 = 3;
LIBSSH2_HOSTKEY_TYPE_ECDSA_384 = 4;
LIBSSH2_HOSTKEY_TYPE_ECDSA_521 = 5;
LIBSSH2_HOSTKEY_TYPE_ED25519 = 6;
{+// Disconnect Codes (defined by SSH protocol)*/ }
SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT = 1;
SSH_DISCONNECT_PROTOCOL_ERROR = 2;
SSH_DISCONNECT_KEY_EXCHANGE_FAILED = 3;
SSH_DISCONNECT_RESERVED = 4;
SSH_DISCONNECT_MAC_ERROR = 5;
SSH_DISCONNECT_COMPRESSION_ERROR = 6;
SSH_DISCONNECT_SERVICE_NOT_AVAILABLE = 7;
SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED = 8;
SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE = 9;
SSH_DISCONNECT_CONNECTION_LOST = 10;
SSH_DISCONNECT_BY_APPLICATION = 11;
SSH_DISCONNECT_TOO_MANY_CONNECTIONS = 12;
SSH_DISCONNECT_AUTH_CANCELLED_BY_USER = 13;
SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14;
SSH_DISCONNECT_ILLEGAL_USER_NAME = 15;
{+// Error Codes (defined by libssh2)*/ }
LIBSSH2_ERROR_NONE = 0;
LIBSSH2_ERROR_SOCKET_NONE = -1;
LIBSSH2_ERROR_BANNER_RECV = -2;
LIBSSH2_ERROR_BANNER_NONE = LIBSSH2_ERROR_BANNER_RECV;
LIBSSH2_ERROR_BANNER_SEND = -3;
LIBSSH2_ERROR_INVALID_MAC = -4;
LIBSSH2_ERROR_KEX_FAILURE = -5;
LIBSSH2_ERROR_ALLOC = -6;
LIBSSH2_ERROR_SOCKET_SEND = -7;
LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE = -8;
LIBSSH2_ERROR_TIMEOUT = -9;
LIBSSH2_ERROR_HOSTKEY_INIT = -10;
LIBSSH2_ERROR_HOSTKEY_SIGN = -11;
LIBSSH2_ERROR_DECRYPT = -12;
LIBSSH2_ERROR_SOCKET_DISCONNECT = -13;
LIBSSH2_ERROR_PROTO = -14;
LIBSSH2_ERROR_PASSWORD_EXPIRED = -15;
LIBSSH2_ERROR_FILE = -16;
LIBSSH2_ERROR_METHOD_NONE = -17;
LIBSSH2_ERROR_AUTHENTICATION_FAILED = -18;
LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED = LIBSSH2_ERROR_AUTHENTICATION_FAILED;
LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED = -19;
LIBSSH2_ERROR_CHANNEL_OUTOFORDER = -20;
LIBSSH2_ERROR_CHANNEL_FAILURE = -21;
LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED = -22;
LIBSSH2_ERROR_CHANNEL_UNKNOWN = -23;
LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED = -24;
LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED = -25;
LIBSSH2_ERROR_CHANNEL_CLOSED = -26;
LIBSSH2_ERROR_CHANNEL_EOF_SENT = -27;
LIBSSH2_ERROR_SCP_PROTOCOL = -28;
LIBSSH2_ERROR_ZLIB = -29;
LIBSSH2_ERROR_SOCKET_TIMEOUT = -30;
LIBSSH2_ERROR_SFTP_PROTOCOL = -31;
LIBSSH2_ERROR_REQUEST_DENIED = -32;
LIBSSH2_ERROR_METHOD_NOT_SUPPORTED = -33;
LIBSSH2_ERROR_INVAL = -34;
LIBSSH2_ERROR_INVALID_POLL_TYPE = -35;
LIBSSH2_ERROR_PUBLICKEY_PROTOCOL = -36;
LIBSSH2_ERROR_EAGAIN = -37;
LIBSSH2_ERROR_BUFFER_TOO_SMALL = -38;
LIBSSH2_ERROR_BAD_USE = -39;
LIBSSH2_ERROR_COMPRESS = -40;
LIBSSH2_ERROR_OUT_OF_BOUNDARY = -41;
LIBSSH2_ERROR_AGENT_PROTOCOL = -42;
LIBSSH2_ERROR_SOCKET_RECV = -43;
LIBSSH2_ERROR_ENCRYPT = -44;
LIBSSH2_ERROR_BAD_SOCKET = -45;
LIBSSH2_ERROR_KNOWN_HOSTS = -46;
LIBSSH2_ERROR_CHANNEL_WINDOW_FULL = -47;
LIBSSH2_ERROR_KEYFILE_AUTH_FAILED = -48;
LIBSSH2_ERROR_RANDGEN = -49;
LIBSSH2_ERROR_MISSING_USERAUTH_BANNER = -50;
LIBSSH2_ERROR_ALGO_UNSUPPORTED = -51;
LIBSSH2_ERROR_MAC_FAILURE = -52;
LIBSSH2_ERROR_HASH_INIT = -53;
{+// Global API*/}
LIBSSH2_INIT_NO_CRYPTO = $0001;
{/*
* libssh2_init()
*
* Initialize the libssh2 functions. This typically initialize the
* crypto library. It uses a global state, and is not thread safe --
* you must make sure this function is not called concurrently.
*
* Flags can be:
* 0: Normal initialize
* LIBSSH2_INIT_NO_CRYPTO: Do not initialize the crypto library (ie.
* OPENSSL_add_cipher_algoritms() for OpenSSL
*
* Returns 0 if succeeded, or a negative value for error.
*/}
{$if not declared(uHVDll)}
function libssh2_init(flags: Integer): Integer; cdecl;
{$else}
var libssh2_init: function(flags: Integer): Integer; cdecl;
{$ifend}
{/*
* libssh2_exit()
*
* Exit the libssh2 functions and free's all memory used internal.
*/}
{$if not declared(uHVDll)}
procedure libssh2_exit; cdecl;
{$else}
var libssh2_exit: procedure; cdecl;
{$ifend}
type
// abstract je void**, tako da pazite!!!!
LIBSSH2_ALLOC_FUNC = function(count: UINT; abstract: Pointer): Pointer; cdecl;
LIBSSH2_REALLOC_FUNC = function(ptr: Pointer; count: UINT; abstract: Pointer): Pointer; cdecl;
LIBSSH2_FREE_FUNC = procedure(ptr: Pointer; abstract: Pointer); cdecl;
{/*
* libssh2_free()
*
* Deallocate memory allocated by earlier call to libssh2 functions.
*/}
{$if not declared(uHVDll)}
procedure libssh2_free(session: PLIBSSH2_SESSION; ptr: Pointer); cdecl;
{$else}
var libssh2_free: procedure(session: PLIBSSH2_SESSION; ptr: Pointer); cdecl;
{$ifend}
{/*
* libssh2_session_supported_algs()
*
* Fills algs with a list of supported acryptographic algorithms. Returns a
* non-negative number (number of supported algorithms) on success or a
* negative number (an eror code) on failure.
*
* NOTE: on success, algs must be deallocated (by calling libssh2_free) when
* not needed anymore
*/}
{$if not declared(uHVDll)}
function libssh2_session_supported_algs(session: PLIBSSH2_SESSION;
method_type: Integer;
var algs: PPAnsiChar): Integer; cdecl;
{$else}
var libssh2_session_supported_algs: function(session: PLIBSSH2_SESSION;
method_type: Integer;
var algs: PPAnsiChar): Integer; cdecl;
{$ifend}
{+// Session API*/ }
{$if not declared(uHVDll)}
function libssh2_session_init_ex(my_alloc: LIBSSH2_ALLOC_FUNC;
my_free: LIBSSH2_FREE_FUNC;
my_realloc: LIBSSH2_REALLOC_FUNC;
abstract: Pointer): PLIBSSH2_SESSION; cdecl;
{$else}
var libssh2_session_init_ex: function(my_alloc: LIBSSH2_ALLOC_FUNC;
my_free: LIBSSH2_FREE_FUNC;
my_realloc: LIBSSH2_REALLOC_FUNC;
abstract: Pointer): PLIBSSH2_SESSION; cdecl;
{$ifend}
function libssh2_session_init: PLIBSSH2_SESSION; {$ifdef allow_inline}inline;{$endif}
//#TEST:
{$IFDEF _TEST_LIBSSH2_}
const C_TEST_LIBSSH2 = True;
{$IFDEF MSWINDOWS}
type
t_libssh2_session_init_ex = function (my_alloc: LIBSSH2_ALLOC_FUNC;
my_free: LIBSSH2_FREE_FUNC;
my_realloc: LIBSSH2_REALLOC_FUNC;
abstract: Pointer): PLIBSSH2_SESSION; cdecl;
var _test_libssh2_session_init_ex: t_libssh2_session_init_ex;
function test_libssh2_session_init_ex(my_alloc: LIBSSH2_ALLOC_FUNC;
my_free: LIBSSH2_FREE_FUNC;
my_realloc: LIBSSH2_REALLOC_FUNC;
abstract: Pointer): PLIBSSH2_SESSION; cdecl;
{$ENDIF MSWINDOWS}
{$ENDIF _TEST_LIBSSH2_}
//#TEST.
{$if not declared(uHVDll)}
function libssh2_session_abstract(session: PLIBSSH2_SESSION): Pointer; cdecl;
{$else}
var libssh2_session_abstract: function(session: PLIBSSH2_SESSION): Pointer; cdecl;
{$ifend}
type
libssh2_cb_generic = procedure cdecl;
t_libssh2_session_callback_set2 = function(session: PLIBSSH2_SESSION;
callback: libssh2_cb_generic): libssh2_cb_generic; cdecl;
{$if not declared(uHVDll)}
{$ifndef allow_delayed}
var _libssh2_session_callback_set2: t_libssh2_session_callback_set2;
{$endif}
function libssh2_session_callback_set2(session: PLIBSSH2_SESSION;
callback: libssh2_cb_generic): libssh2_cb_generic; cdecl;
{$else}
var libssh2_session_callback_set2: t_libssh2_session_callback_set2;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_callback_set(session: PLIBSSH2_SESSION;
cbtype: Integer;
callback: Pointer): Pointer; cdecl;
{$else}
var libssh2_session_callback_set: function(session: PLIBSSH2_SESSION;
cbtype: Integer;
callback: Pointer): Pointer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_banner_set(session: PLIBSSH2_SESSION;
const banner: PAnsiChar): Integer; cdecl;
{$else}
var libssh2_session_banner_set: function(session: PLIBSSH2_SESSION;
const banner: PAnsiChar): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_banner_set(session: PLIBSSH2_SESSION;
const banner: PAnsiChar): Integer; cdecl;
// {$if defined(FPC) or (CompilerVersion >= 24.00)}
// deprecated 'Starting in libssh2 version 1.4.0 this function is considered deprecated. Use libssh2_session_banner_set instead';
// {$ifend}
{$else}
var libssh2_banner_set: function(session: PLIBSSH2_SESSION;
const banner: PAnsiChar): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_banner_get(session: PLIBSSH2_SESSION): PAnsiChar; cdecl;
{$else}
var libssh2_session_banner_get: function(session: PLIBSSH2_SESSION): PAnsiChar; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_handshake(session: PLIBSSH2_SESSION;
sock: TLibssh2Socket): Integer; cdecl;
{$else}
var libssh2_session_handshake: function(session: PLIBSSH2_SESSION;
sock: TLibssh2Socket): Integer; cdecl;
{$ifend}
// deprecated:
//{$if not declared(uHVDll)}
//function libssh2_session_startup(session: PLIBSSH2_SESSION;
// sock: Integer): Integer; cdecl;
// {$if defined(FPC) or (CompilerVersion >= 24.00)}
// deprecated 'Starting in libssh2 version 1.2.8 this function is considered deprecated. Use libssh2_session_handshake instead';
// {$ifend}
//{$else}
//var libssh2_session_startup: function(session: PLIBSSH2_SESSION;
// sock: Integer): Integer; cdecl;
//{$ifend}
function libssh2_session_startup(session: PLIBSSH2_SESSION;
sock: TLibssh2Socket): Integer; cdecl;
//{$if defined(FPC) or (CompilerVersion >= 24.00)}
//deprecated 'Starting in libssh2 version 1.2.8 this function is considered deprecated. Use libssh2_session_handshake instead';
//{$ifend}
// deprecated.
{$if not declared(uHVDll)}
function libssh2_session_disconnect_ex(session: PLIBSSH2_SESSION;
reason: Integer;
const description: PAnsiChar;
const lang: PAnsiChar): Integer; cdecl;
{$else}
var libssh2_session_disconnect_ex: function(session: PLIBSSH2_SESSION;
reason: Integer;
const description: PAnsiChar;
const lang: PAnsiChar): Integer; cdecl;
{$ifend}
function libssh2_session_disconnect(session: PLIBSSH2_SESSION;
const description: PAnsiChar): Integer; {$ifdef allow_inline}inline;{$endif}
{$if not declared(uHVDll)}
function libssh2_session_free(session: PLIBSSH2_SESSION): Integer; cdecl;
{$else}
var libssh2_session_free: function(session: PLIBSSH2_SESSION): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_hostkey_hash(session: PLIBSSH2_SESSION;
hash_type: Integer): PAnsiChar; cdecl;
{$else}
var libssh2_hostkey_hash: function(session: PLIBSSH2_SESSION;
hash_type: Integer): PAnsiChar; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_hostkey(session: PLIBSSH2_SESSION;
var len: size_t;
var _type: Integer): PAnsiChar; cdecl;
{$else}
var libssh2_session_hostkey: function(session: PLIBSSH2_SESSION;
var len: size_t;
var _type: Integer): PAnsiChar; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_method_pref(session: PLIBSSH2_SESSION;
method_type: Integer;
const prefs: PAnsiChar): Integer; cdecl;
{$else}
var libssh2_session_method_pref: function(session: PLIBSSH2_SESSION;
method_type: Integer;
const prefs: PAnsiChar): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_methods(session: PLIBSSH2_SESSION;
method_type: Integer): PAnsiChar; cdecl;
{$else}
var libssh2_session_methods: function(session: PLIBSSH2_SESSION;
method_type: Integer): PAnsiChar; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_last_error(session: PLIBSSH2_SESSION;
var errmsg: PAnsiChar;
var errmsg_len: Integer;
want_buf: Integer): Integer; cdecl;
{$else}
var libssh2_session_last_error: function(session: PLIBSSH2_SESSION;
var errmsg: PAnsiChar;
var errmsg_len: Integer;
want_buf: Integer): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_last_errno(session: PLIBSSH2_SESSION): Integer; cdecl;
{$else}
var libssh2_session_last_errno: function(session: PLIBSSH2_SESSION): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_block_directions(session: PLIBSSH2_SESSION): Integer; cdecl;
{$else}
var libssh2_session_block_directions: function(session: PLIBSSH2_SESSION): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_session_flag(session: PLIBSSH2_SESSION;
flag: Integer;
value: Integer): Integer; cdecl;
{$else}
var libssh2_session_flag: function(session: PLIBSSH2_SESSION;
flag: Integer;
value: Integer): Integer; cdecl;
{$ifend}
{+// Userauth API*/ }
{$if not declared(uHVDll)}
function libssh2_userauth_list(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: UINT): PAnsiChar; cdecl;
{$else}
var libssh2_userauth_list: function(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: UINT): PAnsiChar; cdecl;
{$ifend}
type
t_libssh2_userauth_banner = function(session: PLIBSSH2_SESSION; var newpw: PAnsiChar): Integer; cdecl;
{$if not declared(uHVDll)}
{$ifndef allow_delayed}
var _libssh2_userauth_banner: t_libssh2_userauth_banner;
{$endif}
function libssh2_userauth_banner(session: PLIBSSH2_SESSION; var newpw: PAnsiChar): Integer; cdecl;
{$else}
var libssh2_userauth_banner: t_libssh2_userauth_banner;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_userauth_authenticated(session: PLIBSSH2_SESSION): Integer; cdecl;
{$else}
var libssh2_userauth_authenticated: function(session: PLIBSSH2_SESSION): Integer; cdecl;
{$ifend}
{$if not declared(uHVDll)}
function libssh2_userauth_password_ex(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const password: PAnsiChar;
password_len: Uint;
passwd_change_cb: LIBSSH2_PASSWD_CHANGEREQ_FUNC): Integer; cdecl;
{$else}
var libssh2_userauth_password_ex: function(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const password: PAnsiChar;
password_len: Uint;
passwd_change_cb: LIBSSH2_PASSWD_CHANGEREQ_FUNC): Integer; cdecl;
{$ifend}
function libssh2_userauth_password(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
const password: PAnsiChar): Integer; {$ifdef allow_inline}inline;{$endif}
{$if not declared(uHVDll)}
function libssh2_userauth_publickey_fromfile_ex(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar): Integer; cdecl;
{$else}
var libssh2_userauth_publickey_fromfile_ex: function(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar): Integer; cdecl;
{$ifend}
function libssh2_userauth_publickey_fromfile(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar): Integer; {$ifdef allow_inline}inline;{$endif}
{$if not declared(uHVDll)}
function libssh2_userauth_hostbased_fromfile_ex(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar;
const hostname: PAnsiChar;
hostname_len: UInt;
local_username: PAnsiChar;
local_username_len: UInt): Integer; cdecl;
{$else}
var libssh2_userauth_hostbased_fromfile_ex: function(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: Uint;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar;
const hostname: PAnsiChar;
hostname_len: UInt;
local_username: PAnsiChar;
local_username_len: UInt): Integer; cdecl;
{$ifend}
function libssh2_userauth_hostbased_fromfile(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
const publickey: PAnsiChar;
const privatekey: PAnsiChar;
const passphrase: PAnsiChar;
const hostname: PAnsiChar): Integer; {$ifdef allow_inline}inline;{$endif}
{+// }
{-* response_callback is provided with filled by library prompts array, }
{-* but client must allocate and fill individual responses. Responses }
{-* array is already allocated. Responses data will be freed by libssh2 }
{-* after callback return, but before subsequent callback invokation. }
{= }
{$if not declared(uHVDll)}
function libssh2_userauth_keyboard_interactive_ex(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: UInt;
response_callback: LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC): Integer; cdecl;
{$else}
var libssh2_userauth_keyboard_interactive_ex: function(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
username_len: UInt;
response_callback: LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC): Integer; cdecl;
{$ifend}
function libssh2_userauth_keyboard_interactive(session: PLIBSSH2_SESSION;
const username: PAnsiChar;
response_callback: LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC): Integer; {$ifdef allow_inline}inline;{$endif}
type
t_libssh2_userauth_publickey_sk = function(session: PLIBSSH2_SESSION;
const username: PAnsiChar; username_len: SIZE_T;
const pubkeydata: PByte; pubkeydata_len: SIZE_T;
const privatekeydata: PAnsiChar; privatekeydata_len: SIZE_T;
const passphrase: PAnsiChar;
callback: LIBSSH2_USERAUTH_SK_SIGN_FUNC;
abstract: Pointer): Integer; cdecl;