1 module libssh.c_bindings.libssh; 2 3 import libssh.c_bindings.ctypes; 4 5 /* libssh version macros */ 6 enum auto SSH_VERSION_INT(alias a, alias b, alias c) = (a << 16 | b << 8 | c); 7 enum auto SSH_VERSION_DOT(alias a, alias b, alias c) = 8 a.stringof ~ "." ~ b.stringof ~ "." ~ c.stringof; 9 enum auto SSH_VERSION(alias a, alias b, alias c) = SSH_VERSION_DOT!(a, b, c); 10 11 /* libssh version */ 12 enum auto LIBSSH_VERSION_MAJOR = 0; 13 enum auto LIBSSH_VERSION_MINOR = 7; 14 enum auto LIBSSH_VERSION_MICRO = 3; 15 16 enum auto LIBSSH_VERSION_INT = SSH_VERSION_INT!( 17 LIBSSH_VERSION_MAJOR, 18 LIBSSH_VERSION_MINOR, 19 LIBSSH_VERSION_MICRO); 20 enum auto LIBSSH_VERSION = SSH_VERSION!( 21 LIBSSH_VERSION_MAJOR, 22 LIBSSH_VERSION_MINOR, 23 LIBSSH_VERSION_MICRO); 24 25 struct ssh_counter_struct { 26 ulong in_bytes; 27 ulong out_bytes; 28 ulong in_packets; 29 ulong out_packets; 30 } 31 alias ssh_counter = ssh_counter_struct*; 32 33 struct ssh_agent_struct { } 34 struct ssh_buffer_struct { } 35 struct ssh_channel_struct { } 36 struct ssh_message_struct { } 37 struct ssh_pcap_file_struct { } 38 struct ssh_key_struct { } 39 struct ssh_scp_struct { } 40 struct ssh_session_struct { } 41 struct ssh_string_struct { } 42 struct ssh_event_struct { } 43 alias ssh_agent = ssh_agent_struct*; 44 alias ssh_buffer = ssh_buffer_struct*; 45 alias ssh_channel = ssh_channel_struct*; 46 alias ssh_message = ssh_message_struct*; 47 alias ssh_pcap_file = ssh_pcap_file_struct*; 48 alias ssh_key = ssh_key_struct*; 49 alias ssh_scp = ssh_scp_struct*; 50 alias ssh_session = ssh_session_struct*; 51 alias ssh_string = ssh_string_struct*; 52 alias ssh_event = ssh_event_struct*; 53 alias ssh_gssapi_creds = void*; 54 55 /* Socket type */ 56 // From std.socket 57 version(Windows) { 58 import std.socket; 59 alias socket_t = SOCKET; 60 } else version(Posix) { 61 alias socket_t = int; 62 } else { 63 static assert(0); 64 } 65 66 enum socket_t SSH_INVALID_SOCKET = cast(socket_t) -1; 67 68 /* the offsets of methods */ 69 enum ssh_kex_types_e { 70 SSH_KEX=0, 71 SSH_HOSTKEYS, 72 SSH_CRYPT_C_S, 73 SSH_CRYPT_S_C, 74 SSH_MAC_C_S, 75 SSH_MAC_S_C, 76 SSH_COMP_C_S, 77 SSH_COMP_S_C, 78 SSH_LANG_C_S, 79 SSH_LANG_S_C, 80 } 81 82 enum auto SSH_CRYPT = 2; 83 enum auto SSH_MAC = 3; 84 enum auto SSH_COMP = 4; 85 enum auto SSH_LANG = 5; 86 87 enum ssh_auth_e { 88 SSH_AUTH_SUCCESS=0, 89 SSH_AUTH_DENIED, 90 SSH_AUTH_PARTIAL, 91 SSH_AUTH_INFO, 92 SSH_AUTH_AGAIN, 93 SSH_AUTH_ERROR=-1 94 }; 95 96 /* auth flags */ 97 enum auto SSH_AUTH_METHOD_UNKNOWN = 0; 98 enum auto SSH_AUTH_METHOD_NONE = 0x0001; 99 enum auto SSH_AUTH_METHOD_PASSWORD = 0x0002; 100 enum auto SSH_AUTH_METHOD_PUBLICKEY = 0x0004; 101 enum auto SSH_AUTH_METHOD_HOSTBASED = 0x0008; 102 enum auto SSH_AUTH_METHOD_INTERACTIVE = 0x0010; 103 enum auto SSH_AUTH_METHOD_GSSAPI_MIC = 0x0020; 104 105 /* messages */ 106 enum ssh_requests_e { 107 SSH_REQUEST_AUTH=1, 108 SSH_REQUEST_CHANNEL_OPEN, 109 SSH_REQUEST_CHANNEL, 110 SSH_REQUEST_SERVICE, 111 SSH_REQUEST_GLOBAL 112 }; 113 114 enum ssh_channel_type_e { 115 SSH_CHANNEL_UNKNOWN=0, 116 SSH_CHANNEL_SESSION, 117 SSH_CHANNEL_DIRECT_TCPIP, 118 SSH_CHANNEL_FORWARDED_TCPIP, 119 SSH_CHANNEL_X11 120 }; 121 122 enum ssh_channel_requests_e { 123 SSH_CHANNEL_REQUEST_UNKNOWN=0, 124 SSH_CHANNEL_REQUEST_PTY, 125 SSH_CHANNEL_REQUEST_EXEC, 126 SSH_CHANNEL_REQUEST_SHELL, 127 SSH_CHANNEL_REQUEST_ENV, 128 SSH_CHANNEL_REQUEST_SUBSYSTEM, 129 SSH_CHANNEL_REQUEST_WINDOW_CHANGE, 130 SSH_CHANNEL_REQUEST_X11 131 }; 132 133 enum ssh_global_requests_e { 134 SSH_GLOBAL_REQUEST_UNKNOWN=0, 135 SSH_GLOBAL_REQUEST_TCPIP_FORWARD, 136 SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD, 137 }; 138 139 enum ssh_publickey_state_e { 140 SSH_PUBLICKEY_STATE_ERROR=-1, 141 SSH_PUBLICKEY_STATE_NONE=0, 142 SSH_PUBLICKEY_STATE_VALID=1, 143 SSH_PUBLICKEY_STATE_WRONG=2 144 }; 145 146 /* Status flags */ 147 /** Socket is closed */ 148 enum auto SSH_CLOSED = 0x01; 149 /** Reading to socket won't block */ 150 enum auto SSH_READ_PENDING = 0x02; 151 /** Session was closed due to an error */ 152 enum auto SSH_CLOSED_ERROR = 0x04; 153 /** Output buffer not empty */ 154 enum auto SSH_WRITE_PENDING = 0x08; 155 156 enum ssh_server_known_e { 157 SSH_SERVER_ERROR=-1, 158 SSH_SERVER_NOT_KNOWN=0, 159 SSH_SERVER_KNOWN_OK, 160 SSH_SERVER_KNOWN_CHANGED, 161 SSH_SERVER_FOUND_OTHER, 162 SSH_SERVER_FILE_NOT_FOUND 163 }; 164 165 enum auto MD5_DIGEST_LEN = 16; 166 167 /* errors */ 168 169 enum ssh_error_types_e { 170 SSH_NO_ERROR=0, 171 SSH_REQUEST_DENIED, 172 SSH_FATAL, 173 SSH_EINTR 174 }; 175 176 /* some types for keys */ 177 enum ssh_keytypes_e{ 178 SSH_KEYTYPE_UNKNOWN=0, 179 SSH_KEYTYPE_DSS=1, 180 SSH_KEYTYPE_RSA, 181 SSH_KEYTYPE_RSA1, 182 SSH_KEYTYPE_ECDSA, 183 SSH_KEYTYPE_ED25519 184 }; 185 186 enum ssh_keycmp_e { 187 SSH_KEY_CMP_PUBLIC = 0, 188 SSH_KEY_CMP_PRIVATE 189 }; 190 191 /* Error return codes */ 192 enum auto SSH_OK = 0; /* No error */ 193 enum auto SSH_ERROR = -1; /* Error of some kind */ 194 enum auto SSH_AGAIN = -2; /* The nonblocking call must be repeated */ 195 enum auto SSH_EOF = -127; /* We have already a eof */ 196 197 /** 198 * @addtogroup libssh_log 199 * 200 * @{ 201 */ 202 203 enum { 204 /** No logging at all 205 */ 206 SSH_LOG_NOLOG=0, 207 /** Only warnings 208 */ 209 SSH_LOG_WARNING, 210 /** High level protocol information 211 */ 212 SSH_LOG_PROTOCOL, 213 /** Lower level protocol infomations, packet level 214 */ 215 SSH_LOG_PACKET, 216 /** Every function path 217 */ 218 SSH_LOG_FUNCTIONS 219 }; 220 /** @} */ 221 enum auto SSH_LOG_RARE = SSH_LOG_WARNING; 222 223 /** 224 * @name Logging levels 225 * 226 * @brief Debug levels for logging. 227 * @{ 228 */ 229 230 /** No logging at all */ 231 enum auto SSH_LOG_NONE = 0; 232 /** Show only warnings */ 233 enum auto SSH_LOG_WARN = 1; 234 /** Get some information what's going on */ 235 enum auto SSH_LOG_INFO = 2; 236 /** Get detailed debuging information **/ 237 enum auto SSH_LOG_DEBUG = 3; 238 /** Get trace output, packet information, ... */ 239 enum auto SSH_LOG_TRACE = 4; 240 241 /** @} */ 242 243 enum ssh_options_e { 244 SSH_OPTIONS_HOST, 245 SSH_OPTIONS_PORT, 246 SSH_OPTIONS_PORT_STR, 247 SSH_OPTIONS_FD, 248 SSH_OPTIONS_USER, 249 SSH_OPTIONS_SSH_DIR, 250 SSH_OPTIONS_IDENTITY, 251 SSH_OPTIONS_ADD_IDENTITY, 252 SSH_OPTIONS_KNOWNHOSTS, 253 SSH_OPTIONS_TIMEOUT, 254 SSH_OPTIONS_TIMEOUT_USEC, 255 SSH_OPTIONS_SSH1, 256 SSH_OPTIONS_SSH2, 257 SSH_OPTIONS_LOG_VERBOSITY, 258 SSH_OPTIONS_LOG_VERBOSITY_STR, 259 SSH_OPTIONS_CIPHERS_C_S, 260 SSH_OPTIONS_CIPHERS_S_C, 261 SSH_OPTIONS_COMPRESSION_C_S, 262 SSH_OPTIONS_COMPRESSION_S_C, 263 SSH_OPTIONS_PROXYCOMMAND, 264 SSH_OPTIONS_BINDADDR, 265 SSH_OPTIONS_STRICTHOSTKEYCHECK, 266 SSH_OPTIONS_COMPRESSION, 267 SSH_OPTIONS_COMPRESSION_LEVEL, 268 SSH_OPTIONS_KEY_EXCHANGE, 269 SSH_OPTIONS_HOSTKEYS, 270 SSH_OPTIONS_GSSAPI_SERVER_IDENTITY, 271 SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY, 272 SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, 273 SSH_OPTIONS_HMAC_C_S, 274 SSH_OPTIONS_HMAC_S_C, 275 }; 276 277 enum { 278 /** Code is going to write/create remote files */ 279 SSH_SCP_WRITE, 280 /** Code is going to read remote files */ 281 SSH_SCP_READ, 282 SSH_SCP_RECURSIVE=0x10 283 }; 284 285 enum ssh_scp_request_types { 286 /** A new directory is going to be pulled */ 287 SSH_SCP_REQUEST_NEWDIR=1, 288 /** A new file is going to be pulled */ 289 SSH_SCP_REQUEST_NEWFILE, 290 /** End of requests */ 291 SSH_SCP_REQUEST_EOF, 292 /** End of directory */ 293 SSH_SCP_REQUEST_ENDDIR, 294 /** Warning received */ 295 SSH_SCP_REQUEST_WARNING 296 }; 297 298 extern (C) { 299 int ssh_blocking_flush(ssh_session session, int timeout); 300 ssh_channel ssh_channel_accept_x11(ssh_channel channel, int timeout_ms); 301 int ssh_channel_change_pty_size(ssh_channel channel,int cols,int rows); 302 int ssh_channel_close(ssh_channel channel); 303 void ssh_channel_free(ssh_channel channel); 304 int ssh_channel_get_exit_status(ssh_channel channel); 305 ssh_session ssh_channel_get_session(ssh_channel channel); 306 int ssh_channel_is_closed(ssh_channel channel); 307 int ssh_channel_is_eof(ssh_channel channel); 308 int ssh_channel_is_open(ssh_channel channel); 309 ssh_channel ssh_channel_new(ssh_session session); 310 int ssh_channel_open_auth_agent(ssh_channel channel); 311 int ssh_channel_open_forward(ssh_channel channel, const char *remotehost, 312 int remoteport, const char *sourcehost, int localport); 313 int ssh_channel_open_session(ssh_channel channel); 314 int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port); 315 int ssh_channel_poll(ssh_channel channel, int is_stderr); 316 int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr); 317 int ssh_channel_read(ssh_channel channel, void *dest, uint count, int is_stderr); 318 int ssh_channel_read_timeout(ssh_channel channel, void *dest, uint count, int is_stderr, 319 int timeout_ms); 320 int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint count, 321 int is_stderr); 322 int ssh_channel_request_env(ssh_channel channel, const char *name, const char *value); 323 int ssh_channel_request_exec(ssh_channel channel, const char *cmd); 324 int ssh_channel_request_pty(ssh_channel channel); 325 int ssh_channel_request_pty_size(ssh_channel channel, const char *term, 326 int cols, int rows); 327 int ssh_channel_request_shell(ssh_channel channel); 328 int ssh_channel_request_send_signal(ssh_channel channel, const char *signum); 329 int ssh_channel_request_sftp(ssh_channel channel); 330 int ssh_channel_request_subsystem(ssh_channel channel, const char *subsystem); 331 int ssh_channel_request_x11(ssh_channel channel, int single_connection, const char *protocol, 332 const char *cookie, int screen_number); 333 int ssh_channel_send_eof(ssh_channel channel); 334 int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, 335 timeval* timeout); 336 void ssh_channel_set_blocking(ssh_channel channel, int blocking); 337 void ssh_channel_set_counter(ssh_channel channel, 338 ssh_counter counter); 339 int ssh_channel_write(ssh_channel channel, const void *data, uint len); 340 uint ssh_channel_window_size(ssh_channel channel); 341 342 char *ssh_basename (const char *path); 343 void ssh_clean_pubkey_hash(ubyte **hash); 344 int ssh_connect(ssh_session session); 345 const(char)* ssh_copyright(); 346 void ssh_disconnect(ssh_session session); 347 char *ssh_dirname (const char *path); 348 int ssh_finalize(); 349 350 /* REVERSE PORT FORWARDING */ 351 ssh_channel ssh_channel_accept_forward(ssh_session session, 352 int timeout_ms, 353 int *destination_port); 354 int ssh_channel_cancel_forward(ssh_session session, 355 const char *address, 356 int port); 357 int ssh_channel_listen_forward(ssh_session session, 358 const char *address, 359 int port, 360 int *bound_port); 361 362 void ssh_free(ssh_session session); 363 const(char) *ssh_get_disconnect_message(ssh_session session); 364 const(char) *ssh_get_error(void *error); 365 int ssh_get_error_code(void *error); 366 socket_t ssh_get_fd(ssh_session session); 367 char *ssh_get_hexa(const ubyte* what, size_t len); 368 char *ssh_get_issue_banner(ssh_session session); 369 int ssh_get_openssh_version(ssh_session session); 370 371 int ssh_get_publickey(ssh_session session, ssh_key *key); 372 373 enum ssh_publickey_hash_type { 374 SSH_PUBLICKEY_HASH_SHA1, 375 SSH_PUBLICKEY_HASH_MD5 376 }; 377 378 int ssh_get_publickey_hash(const ssh_key key, ssh_publickey_hash_type type, 379 ubyte **hash, size_t *hlen); 380 381 /* DEPRECATED FUNCTIONS */ 382 deprecated int ssh_get_pubkey_hash(ssh_session session, ubyte **hash); 383 deprecated ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms); 384 deprecated int ssh_forward_cancel(ssh_session session, const char *address, int port); 385 deprecated int ssh_forward_listen(ssh_session session, const char *address, int port, 386 int *bound_port); 387 388 int ssh_get_random(void *where,int len,int strong); 389 int ssh_get_version(ssh_session session); 390 int ssh_get_status(ssh_session session); 391 int ssh_get_poll_flags(ssh_session session); 392 int ssh_init(); 393 int ssh_is_blocking(ssh_session session); 394 int ssh_is_connected(ssh_session session); 395 int ssh_is_server_known(ssh_session session); 396 bool is_ssh_initialized(); 397 398 /* LOGGING */ 399 int ssh_set_log_level(int level); 400 int ssh_get_log_level(); 401 void *ssh_get_log_userdata(); 402 int ssh_set_log_userdata(void *data); 403 void _ssh_log(int verbosity, const char *function_, const char *format, ...); 404 /* legacy */ 405 deprecated void ssh_log(ssh_session session, int prioriry, const char *format, ...); 406 407 ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg); 408 int ssh_message_channel_request_reply_success(ssh_message msg); 409 void ssh_message_free(ssh_message msg); 410 ssh_message ssh_message_get(ssh_session session); 411 int ssh_message_subtype(ssh_message msg); 412 int ssh_message_type(ssh_message msg); 413 int ssh_mkdir (const char *pathname, mode_t mode); 414 ssh_session ssh_new(); 415 416 int ssh_options_copy(ssh_session src, ssh_session *dest); 417 int ssh_options_getopt(ssh_session session, int *argcptr, char **argv); 418 int ssh_options_parse_config(ssh_session session, const char *filename); 419 int ssh_options_set(ssh_session session, ssh_options_e type, 420 const void *value); 421 int ssh_options_get(ssh_session session, ssh_options_e type, 422 char **value); 423 int ssh_options_get_port(ssh_session session, uint * port_target); 424 int ssh_pcap_file_close(ssh_pcap_file pcap); 425 void ssh_pcap_file_free(ssh_pcap_file pcap); 426 ssh_pcap_file ssh_pcap_file_new(); 427 int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename); 428 429 /** 430 * @brief SSH authentication callback. 431 * 432 * @param prompt Prompt to be displayed. 433 * @param buf Buffer to save the password. You should null-terminate it. 434 * @param len Length of the buffer. 435 * @param echo Enable or disable the echo of what you type. 436 * @param verify Should the password be verified? 437 * @param userdata Userdata to be passed to the callback function. Useful 438 * for GUI applications. 439 * 440 * @return 0 on success, < 0 on error. 441 */ 442 alias ssh_auth_callback = extern(C) int function(const char *prompt, char *buf, size_t len, 443 int echo, int verify, void *userdata); 444 445 ssh_key ssh_key_new(); 446 void ssh_key_free (ssh_key key); 447 ssh_keytypes_e ssh_key_type(const ssh_key key); 448 const(char) *ssh_key_type_to_char(ssh_keytypes_e type); 449 ssh_keytypes_e ssh_key_type_from_name(const char *name); 450 int ssh_key_is_public(const ssh_key k); 451 int ssh_key_is_private(const ssh_key k); 452 int ssh_key_cmp(const ssh_key k1, 453 const ssh_key k2, 454 ssh_keycmp_e what); 455 456 int ssh_pki_generate(ssh_keytypes_e type, int parameter, 457 ssh_key *pkey); 458 int ssh_pki_import_privkey_base64(const char *b64_key, 459 const char *passphrase, 460 ssh_auth_callback auth_fn, 461 void *auth_data, 462 ssh_key *pkey); 463 int ssh_pki_import_privkey_file(const char *filename, 464 const char *passphrase, 465 ssh_auth_callback auth_fn, 466 void *auth_data, 467 ssh_key *pkey); 468 int ssh_pki_export_privkey_file(const ssh_key privkey, 469 const char *passphrase, 470 ssh_auth_callback auth_fn, 471 void *auth_data, 472 const char *filename); 473 474 int ssh_pki_import_pubkey_base64(const char *b64_key, 475 ssh_keytypes_e type, 476 ssh_key *pkey); 477 int ssh_pki_import_pubkey_file(const char *filename, 478 ssh_key *pkey); 479 480 int ssh_pki_export_privkey_to_pubkey(const ssh_key privkey, 481 ssh_key *pkey); 482 int ssh_pki_export_pubkey_base64(const ssh_key key, 483 char **b64_key); 484 int ssh_pki_export_pubkey_file(const ssh_key key, 485 const char *filename); 486 487 const(char) *ssh_pki_key_ecdsa_name(const ssh_key key); 488 489 void ssh_print_hexa(const char *descr, const ubyte *what, size_t len); 490 int ssh_send_ignore (ssh_session session, const char *data); 491 int ssh_send_debug (ssh_session session, const char *message, int always_display); 492 void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds); 493 int ssh_scp_accept_request(ssh_scp scp); 494 int ssh_scp_close(ssh_scp scp); 495 int ssh_scp_deny_request(ssh_scp scp, const char *reason); 496 void ssh_scp_free(ssh_scp scp); 497 int ssh_scp_init(ssh_scp scp); 498 int ssh_scp_leave_directory(ssh_scp scp); 499 ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location); 500 int ssh_scp_pull_request(ssh_scp scp); 501 int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode); 502 int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int perms); 503 int ssh_scp_push_file64(ssh_scp scp, const char *filename, ulong size, int perms); 504 int ssh_scp_read(ssh_scp scp, void *buffer, size_t size); 505 const(char) *ssh_scp_request_get_filename(ssh_scp scp); 506 int ssh_scp_request_get_permissions(ssh_scp scp); 507 size_t ssh_scp_request_get_size(ssh_scp scp); 508 ulong ssh_scp_request_get_size64(ssh_scp scp); 509 const(char) *ssh_scp_request_get_warning(ssh_scp scp); 510 int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len); 511 int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd, 512 fd_set *readfds, timeval *timeout); 513 int ssh_service_request(ssh_session session, const char *service); 514 int ssh_set_agent_channel(ssh_session session, ssh_channel channel); 515 int ssh_set_agent_socket(ssh_session session, socket_t fd); 516 void ssh_set_blocking(ssh_session session, int blocking); 517 void ssh_set_counters(ssh_session session, ssh_counter scounter, 518 ssh_counter rcounter); 519 void ssh_set_fd_except(ssh_session session); 520 void ssh_set_fd_toread(ssh_session session); 521 void ssh_set_fd_towrite(ssh_session session); 522 void ssh_silent_disconnect(ssh_session session); 523 int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile); 524 525 /* USERAUTH */ 526 int ssh_userauth_none(ssh_session session, const char *username); 527 int ssh_userauth_list(ssh_session session, const char *username); 528 int ssh_userauth_try_publickey(ssh_session session, 529 const char *username, 530 const ssh_key pubkey); 531 int ssh_userauth_publickey(ssh_session session, 532 const char *username, 533 const ssh_key privkey); 534 535 version(Windows) { } else { 536 int ssh_userauth_agent(ssh_session session, 537 const char *username); 538 } 539 540 int ssh_userauth_publickey_auto(ssh_session session, 541 const char *username, 542 const char *passphrase); 543 int ssh_userauth_password(ssh_session session, 544 const char *username, 545 const char *password); 546 547 int ssh_userauth_kbdint(ssh_session session, const char *user, const char *submethods); 548 const(char) *ssh_userauth_kbdint_getinstruction(ssh_session session); 549 const(char) *ssh_userauth_kbdint_getname(ssh_session session); 550 int ssh_userauth_kbdint_getnprompts(ssh_session session); 551 const(char) *ssh_userauth_kbdint_getprompt(ssh_session session, uint i, char *echo); 552 int ssh_userauth_kbdint_getnanswers(ssh_session session); 553 const(char) *ssh_userauth_kbdint_getanswer(ssh_session session, uint i); 554 int ssh_userauth_kbdint_setanswer(ssh_session session, uint i, 555 const char *answer); 556 int ssh_userauth_gssapi(ssh_session session); 557 const(char) *ssh_version(int req_version); 558 int ssh_write_knownhost(ssh_session session); 559 560 void ssh_string_burn(ssh_string str); 561 ssh_string ssh_string_copy(ssh_string str); 562 void *ssh_string_data(ssh_string str); 563 int ssh_string_fill(ssh_string str, const void *data, size_t len); 564 void ssh_string_free(ssh_string str); 565 ssh_string ssh_string_from_char(const char *what); 566 size_t ssh_string_len(ssh_string str); 567 ssh_string ssh_string_new(size_t size); 568 const(char) *ssh_string_get_char(ssh_string str); 569 char *ssh_string_to_char(ssh_string str); 570 void ssh_string_free_char(char *s); 571 572 int ssh_getpass(const char *prompt, char *buf, size_t len, int echo, 573 int verify); 574 575 576 alias ssh_event_callback = extern(C) int function(socket_t fd, int revents, void *userdata); 577 578 ssh_event ssh_event_new(); 579 int ssh_event_add_fd(ssh_event event, socket_t fd, short events, 580 ssh_event_callback cb, void *userdata); 581 int ssh_event_add_session(ssh_event event, ssh_session session); 582 int ssh_event_dopoll(ssh_event event, int timeout); 583 int ssh_event_remove_fd(ssh_event event, socket_t fd); 584 int ssh_event_remove_session(ssh_event event, ssh_session session); 585 void ssh_event_free(ssh_event event); 586 const(char)* ssh_get_clientbanner(ssh_session session); 587 const(char)* ssh_get_serverbanner(ssh_session session); 588 const(char)* ssh_get_kex_algo(ssh_session session); 589 const(char)* ssh_get_cipher_in(ssh_session session); 590 const(char)* ssh_get_cipher_out(ssh_session session); 591 const(char)* ssh_get_hmac_in(ssh_session session); 592 const(char)* ssh_get_hmac_out(ssh_session session); 593 }