00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _LIBSSH_H
00022 #define _LIBSSH_H
00023
00024 #if defined _WIN32 || defined __CYGWIN__
00025 #ifdef LIBSSH_STATIC
00026 #define LIBSSH_API
00027 #else
00028 #ifdef LIBSSH_EXPORTS
00029 #ifdef __GNUC__
00030 #define LIBSSH_API __attribute__((dllexport))
00031 #else
00032 #define LIBSSH_API __declspec(dllexport)
00033 #endif
00034 #else
00035 #ifdef __GNUC__
00036 #define LIBSSH_API __attribute__((dllimport))
00037 #else
00038 #define LIBSSH_API __declspec(dllimport)
00039 #endif
00040 #endif
00041 #endif
00042 #else
00043 #if __GNUC__ >= 4 && !defined(__OS2__)
00044 #define LIBSSH_API __attribute__((visibility("default")))
00045 #else
00046 #define LIBSSH_API
00047 #endif
00048 #endif
00049
00050 #ifdef _MSC_VER
00051
00052 typedef int int32_t;
00053 typedef unsigned int uint32_t;
00054 typedef unsigned short uint16_t;
00055 typedef unsigned char uint8_t;
00056 typedef unsigned long long uint64_t;
00057 typedef int mode_t;
00058 #else
00059 #include <unistd.h>
00060 #include <inttypes.h>
00061 #endif
00062
00063 #ifdef _WIN32
00064 #include <winsock2.h>
00065 #else
00066 #include <sys/select.h>
00067 #include <netdb.h>
00068 #endif
00069
00070 #define SSH_STRINGIFY(s) SSH_TOSTRING(s)
00071 #define SSH_TOSTRING(s) #s
00072
00073
00074 #define SSH_VERSION_INT(a, b, c) ((a) << 16 | (b) << 8 | (c))
00075 #define SSH_VERSION_DOT(a, b, c) a ##.## b ##.## c
00076 #define SSH_VERSION(a, b, c) SSH_VERSION_DOT(a, b, c)
00077
00078
00079 #define LIBSSH_VERSION_MAJOR 0
00080 #define LIBSSH_VERSION_MINOR 6
00081 #define LIBSSH_VERSION_MICRO 5
00082
00083 #define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
00084 LIBSSH_VERSION_MINOR, \
00085 LIBSSH_VERSION_MICRO)
00086 #define LIBSSH_VERSION SSH_VERSION(LIBSSH_VERSION_MAJOR, \
00087 LIBSSH_VERSION_MINOR, \
00088 LIBSSH_VERSION_MICRO)
00089
00090
00091 #ifdef __GNUC__
00092 #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
00093 #else
00094 #define PRINTF_ATTRIBUTE(a,b)
00095 #endif
00096
00097 #ifdef __GNUC__
00098 #define SSH_DEPRECATED __attribute__ ((deprecated))
00099 #else
00100 #define SSH_DEPRECATED
00101 #endif
00102
00103 #ifdef __cplusplus
00104 extern "C" {
00105 #endif
00106
00107
00108 typedef struct ssh_agent_struct* ssh_agent;
00109 typedef struct ssh_buffer_struct* ssh_buffer;
00110 typedef struct ssh_channel_struct* ssh_channel;
00111 typedef struct ssh_message_struct* ssh_message;
00112 typedef struct ssh_pcap_file_struct* ssh_pcap_file;
00113 typedef struct ssh_key_struct* ssh_key;
00114 typedef struct ssh_scp_struct* ssh_scp;
00115 typedef struct ssh_session_struct* ssh_session;
00116 typedef struct ssh_string_struct* ssh_string;
00117 typedef struct ssh_event_struct* ssh_event;
00118 typedef void* ssh_gssapi_creds;
00119
00120
00121 #ifdef _WIN32
00122 #ifndef socket_t
00123 typedef SOCKET socket_t;
00124 #endif
00125 #else
00126 #ifndef socket_t
00127 typedef int socket_t;
00128 #endif
00129 #endif
00130
00131 #define SSH_INVALID_SOCKET ((socket_t) -1)
00132
00133
00134 enum ssh_kex_types_e {
00135 SSH_KEX=0,
00136 SSH_HOSTKEYS,
00137 SSH_CRYPT_C_S,
00138 SSH_CRYPT_S_C,
00139 SSH_MAC_C_S,
00140 SSH_MAC_S_C,
00141 SSH_COMP_C_S,
00142 SSH_COMP_S_C,
00143 SSH_LANG_C_S,
00144 SSH_LANG_S_C
00145 };
00146
00147 #define SSH_CRYPT 2
00148 #define SSH_MAC 3
00149 #define SSH_COMP 4
00150 #define SSH_LANG 5
00151
00152 enum ssh_auth_e {
00153 SSH_AUTH_SUCCESS=0,
00154 SSH_AUTH_DENIED,
00155 SSH_AUTH_PARTIAL,
00156 SSH_AUTH_INFO,
00157 SSH_AUTH_AGAIN,
00158 SSH_AUTH_ERROR=-1
00159 };
00160
00161
00162 #define SSH_AUTH_METHOD_UNKNOWN 0
00163 #define SSH_AUTH_METHOD_NONE 0x0001
00164 #define SSH_AUTH_METHOD_PASSWORD 0x0002
00165 #define SSH_AUTH_METHOD_PUBLICKEY 0x0004
00166 #define SSH_AUTH_METHOD_HOSTBASED 0x0008
00167 #define SSH_AUTH_METHOD_INTERACTIVE 0x0010
00168 #define SSH_AUTH_METHOD_GSSAPI_MIC 0x0020
00169
00170
00171 enum ssh_requests_e {
00172 SSH_REQUEST_AUTH=1,
00173 SSH_REQUEST_CHANNEL_OPEN,
00174 SSH_REQUEST_CHANNEL,
00175 SSH_REQUEST_SERVICE,
00176 SSH_REQUEST_GLOBAL
00177 };
00178
00179 enum ssh_channel_type_e {
00180 SSH_CHANNEL_UNKNOWN=0,
00181 SSH_CHANNEL_SESSION,
00182 SSH_CHANNEL_DIRECT_TCPIP,
00183 SSH_CHANNEL_FORWARDED_TCPIP,
00184 SSH_CHANNEL_X11
00185 };
00186
00187 enum ssh_channel_requests_e {
00188 SSH_CHANNEL_REQUEST_UNKNOWN=0,
00189 SSH_CHANNEL_REQUEST_PTY,
00190 SSH_CHANNEL_REQUEST_EXEC,
00191 SSH_CHANNEL_REQUEST_SHELL,
00192 SSH_CHANNEL_REQUEST_ENV,
00193 SSH_CHANNEL_REQUEST_SUBSYSTEM,
00194 SSH_CHANNEL_REQUEST_WINDOW_CHANGE,
00195 SSH_CHANNEL_REQUEST_X11
00196 };
00197
00198 enum ssh_global_requests_e {
00199 SSH_GLOBAL_REQUEST_UNKNOWN=0,
00200 SSH_GLOBAL_REQUEST_TCPIP_FORWARD,
00201 SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD,
00202 };
00203
00204 enum ssh_publickey_state_e {
00205 SSH_PUBLICKEY_STATE_ERROR=-1,
00206 SSH_PUBLICKEY_STATE_NONE=0,
00207 SSH_PUBLICKEY_STATE_VALID=1,
00208 SSH_PUBLICKEY_STATE_WRONG=2
00209 };
00210
00211
00213 #define SSH_CLOSED 0x01
00214
00215 #define SSH_READ_PENDING 0x02
00216
00217 #define SSH_CLOSED_ERROR 0x04
00218
00219 #define SSH_WRITE_PENDING 0x08
00220
00221 enum ssh_server_known_e {
00222 SSH_SERVER_ERROR=-1,
00223 SSH_SERVER_NOT_KNOWN=0,
00224 SSH_SERVER_KNOWN_OK,
00225 SSH_SERVER_KNOWN_CHANGED,
00226 SSH_SERVER_FOUND_OTHER,
00227 SSH_SERVER_FILE_NOT_FOUND
00228 };
00229
00230 #ifndef MD5_DIGEST_LEN
00231 #define MD5_DIGEST_LEN 16
00232 #endif
00233
00234
00235 enum ssh_error_types_e {
00236 SSH_NO_ERROR=0,
00237 SSH_REQUEST_DENIED,
00238 SSH_FATAL,
00239 SSH_EINTR
00240 };
00241
00242
00243 enum ssh_keytypes_e{
00244 SSH_KEYTYPE_UNKNOWN=0,
00245 SSH_KEYTYPE_DSS=1,
00246 SSH_KEYTYPE_RSA,
00247 SSH_KEYTYPE_RSA1,
00248 SSH_KEYTYPE_ECDSA
00249 };
00250
00251 enum ssh_keycmp_e {
00252 SSH_KEY_CMP_PUBLIC = 0,
00253 SSH_KEY_CMP_PRIVATE
00254 };
00255
00256
00257 #define SSH_OK 0
00258 #define SSH_ERROR -1
00259 #define SSH_AGAIN -2
00260 #define SSH_EOF -127
00261
00268 enum {
00271 SSH_LOG_NOLOG=0,
00274 SSH_LOG_WARNING,
00277 SSH_LOG_PROTOCOL,
00280 SSH_LOG_PACKET,
00283 SSH_LOG_FUNCTIONS
00284 };
00286 #define SSH_LOG_RARE SSH_LOG_WARNING
00287
00296 #define SSH_LOG_NONE 0
00297
00298 #define SSH_LOG_WARN 1
00299
00300 #define SSH_LOG_INFO 2
00301
00302 #define SSH_LOG_DEBUG 3
00303
00304 #define SSH_LOG_TRACE 4
00305
00308 enum ssh_options_e {
00309 SSH_OPTIONS_HOST,
00310 SSH_OPTIONS_PORT,
00311 SSH_OPTIONS_PORT_STR,
00312 SSH_OPTIONS_FD,
00313 SSH_OPTIONS_USER,
00314 SSH_OPTIONS_SSH_DIR,
00315 SSH_OPTIONS_IDENTITY,
00316 SSH_OPTIONS_ADD_IDENTITY,
00317 SSH_OPTIONS_KNOWNHOSTS,
00318 SSH_OPTIONS_TIMEOUT,
00319 SSH_OPTIONS_TIMEOUT_USEC,
00320 SSH_OPTIONS_SSH1,
00321 SSH_OPTIONS_SSH2,
00322 SSH_OPTIONS_LOG_VERBOSITY,
00323 SSH_OPTIONS_LOG_VERBOSITY_STR,
00324 SSH_OPTIONS_CIPHERS_C_S,
00325 SSH_OPTIONS_CIPHERS_S_C,
00326 SSH_OPTIONS_COMPRESSION_C_S,
00327 SSH_OPTIONS_COMPRESSION_S_C,
00328 SSH_OPTIONS_PROXYCOMMAND,
00329 SSH_OPTIONS_BINDADDR,
00330 SSH_OPTIONS_STRICTHOSTKEYCHECK,
00331 SSH_OPTIONS_COMPRESSION,
00332 SSH_OPTIONS_COMPRESSION_LEVEL,
00333 SSH_OPTIONS_KEY_EXCHANGE,
00334 SSH_OPTIONS_HOSTKEYS,
00335 SSH_OPTIONS_GSSAPI_SERVER_IDENTITY,
00336 SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY,
00337 SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS,
00338 };
00339
00340 enum {
00342 SSH_SCP_WRITE,
00344 SSH_SCP_READ,
00345 SSH_SCP_RECURSIVE=0x10
00346 };
00347
00348 enum ssh_scp_request_types {
00350 SSH_SCP_REQUEST_NEWDIR=1,
00352 SSH_SCP_REQUEST_NEWFILE,
00354 SSH_SCP_REQUEST_EOF,
00356 SSH_SCP_REQUEST_ENDDIR,
00358 SSH_SCP_REQUEST_WARNING
00359 };
00360
00361 LIBSSH_API int ssh_blocking_flush(ssh_session session, int timeout);
00362 LIBSSH_API ssh_channel ssh_channel_accept_x11(ssh_channel channel, int timeout_ms);
00363 LIBSSH_API int ssh_channel_change_pty_size(ssh_channel channel,int cols,int rows);
00364 LIBSSH_API int ssh_channel_close(ssh_channel channel);
00365 LIBSSH_API void ssh_channel_free(ssh_channel channel);
00366 LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
00367 LIBSSH_API ssh_session ssh_channel_get_session(ssh_channel channel);
00368 LIBSSH_API int ssh_channel_is_closed(ssh_channel channel);
00369 LIBSSH_API int ssh_channel_is_eof(ssh_channel channel);
00370 LIBSSH_API int ssh_channel_is_open(ssh_channel channel);
00371 LIBSSH_API ssh_channel ssh_channel_new(ssh_session session);
00372 LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
00373 LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
00374 int remoteport, const char *sourcehost, int localport);
00375 LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
00376 LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
00377 LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
00378 LIBSSH_API int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr);
00379 LIBSSH_API int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
00380 LIBSSH_API int ssh_channel_read_timeout(ssh_channel channel, void *dest, uint32_t count, int is_stderr, int timeout_ms);
00381 LIBSSH_API int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
00382 int is_stderr);
00383 LIBSSH_API int ssh_channel_request_env(ssh_channel channel, const char *name, const char *value);
00384 LIBSSH_API int ssh_channel_request_exec(ssh_channel channel, const char *cmd);
00385 LIBSSH_API int ssh_channel_request_pty(ssh_channel channel);
00386 LIBSSH_API int ssh_channel_request_pty_size(ssh_channel channel, const char *term,
00387 int cols, int rows);
00388 LIBSSH_API int ssh_channel_request_shell(ssh_channel channel);
00389 LIBSSH_API int ssh_channel_request_send_signal(ssh_channel channel, const char *signum);
00390 LIBSSH_API int ssh_channel_request_sftp(ssh_channel channel);
00391 LIBSSH_API int ssh_channel_request_subsystem(ssh_channel channel, const char *subsystem);
00392 LIBSSH_API int ssh_channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
00393 const char *cookie, int screen_number);
00394 LIBSSH_API int ssh_channel_send_eof(ssh_channel channel);
00395 LIBSSH_API int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
00396 timeval * timeout);
00397 LIBSSH_API void ssh_channel_set_blocking(ssh_channel channel, int blocking);
00398 LIBSSH_API int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len);
00399 LIBSSH_API uint32_t ssh_channel_window_size(ssh_channel channel);
00400
00401 LIBSSH_API char *ssh_basename (const char *path);
00402 LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
00403 LIBSSH_API int ssh_connect(ssh_session session);
00404 LIBSSH_API const char *ssh_copyright(void);
00405 LIBSSH_API void ssh_disconnect(ssh_session session);
00406 LIBSSH_API char *ssh_dirname (const char *path);
00407 LIBSSH_API int ssh_finalize(void);
00408 LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms);
00409 LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session, int timeout_ms, int *destination_port);
00410 LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
00411 LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
00412 LIBSSH_API void ssh_free(ssh_session session);
00413 LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
00414 LIBSSH_API const char *ssh_get_error(void *error);
00415 LIBSSH_API int ssh_get_error_code(void *error);
00416 LIBSSH_API socket_t ssh_get_fd(ssh_session session);
00417 LIBSSH_API char *ssh_get_hexa(const unsigned char *what, size_t len);
00418 LIBSSH_API char *ssh_get_issue_banner(ssh_session session);
00419 LIBSSH_API int ssh_get_openssh_version(ssh_session session);
00420
00421 LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
00422
00423 enum ssh_publickey_hash_type {
00424 SSH_PUBLICKEY_HASH_SHA1,
00425 SSH_PUBLICKEY_HASH_MD5
00426 };
00427 LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
00428 enum ssh_publickey_hash_type type,
00429 unsigned char **hash,
00430 size_t *hlen);
00431
00432 SSH_DEPRECATED LIBSSH_API int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash);
00433
00434 LIBSSH_API int ssh_get_random(void *where,int len,int strong);
00435 LIBSSH_API int ssh_get_version(ssh_session session);
00436 LIBSSH_API int ssh_get_status(ssh_session session);
00437 LIBSSH_API int ssh_get_poll_flags(ssh_session session);
00438 LIBSSH_API int ssh_init(void);
00439 LIBSSH_API int ssh_is_blocking(ssh_session session);
00440 LIBSSH_API int ssh_is_connected(ssh_session session);
00441 LIBSSH_API int ssh_is_server_known(ssh_session session);
00442
00443
00444 LIBSSH_API int ssh_set_log_level(int level);
00445 LIBSSH_API int ssh_get_log_level(void);
00446 LIBSSH_API void *ssh_get_log_userdata(void);
00447 LIBSSH_API int ssh_set_log_userdata(void *data);
00448 LIBSSH_API void _ssh_log(int verbosity,
00449 const char *function,
00450 const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
00451
00452
00453 SSH_DEPRECATED LIBSSH_API void ssh_log(ssh_session session,
00454 int prioriry,
00455 const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
00456
00457 LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
00458 LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
00459 LIBSSH_API void ssh_message_free(ssh_message msg);
00460 LIBSSH_API ssh_message ssh_message_get(ssh_session session);
00461 LIBSSH_API int ssh_message_subtype(ssh_message msg);
00462 LIBSSH_API int ssh_message_type(ssh_message msg);
00463 LIBSSH_API int ssh_mkdir (const char *pathname, mode_t mode);
00464 LIBSSH_API ssh_session ssh_new(void);
00465
00466 LIBSSH_API int ssh_options_copy(ssh_session src, ssh_session *dest);
00467 LIBSSH_API int ssh_options_getopt(ssh_session session, int *argcptr, char **argv);
00468 LIBSSH_API int ssh_options_parse_config(ssh_session session, const char *filename);
00469 LIBSSH_API int ssh_options_set(ssh_session session, enum ssh_options_e type,
00470 const void *value);
00471 LIBSSH_API int ssh_options_get(ssh_session session, enum ssh_options_e type,
00472 char **value);
00473 LIBSSH_API int ssh_options_get_port(ssh_session session, unsigned int * port_target);
00474 LIBSSH_API int ssh_pcap_file_close(ssh_pcap_file pcap);
00475 LIBSSH_API void ssh_pcap_file_free(ssh_pcap_file pcap);
00476 LIBSSH_API ssh_pcap_file ssh_pcap_file_new(void);
00477 LIBSSH_API int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename);
00478
00492 typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
00493 int echo, int verify, void *userdata);
00494
00495 LIBSSH_API ssh_key ssh_key_new(void);
00496 LIBSSH_API void ssh_key_free (ssh_key key);
00497 LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key);
00498 LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
00499 LIBSSH_API enum ssh_keytypes_e ssh_key_type_from_name(const char *name);
00500 LIBSSH_API int ssh_key_is_public(const ssh_key k);
00501 LIBSSH_API int ssh_key_is_private(const ssh_key k);
00502 LIBSSH_API int ssh_key_cmp(const ssh_key k1,
00503 const ssh_key k2,
00504 enum ssh_keycmp_e what);
00505
00506 LIBSSH_API int ssh_pki_generate(enum ssh_keytypes_e type, int parameter,
00507 ssh_key *pkey);
00508 LIBSSH_API int ssh_pki_import_privkey_base64(const char *b64_key,
00509 const char *passphrase,
00510 ssh_auth_callback auth_fn,
00511 void *auth_data,
00512 ssh_key *pkey);
00513 LIBSSH_API int ssh_pki_import_privkey_file(const char *filename,
00514 const char *passphrase,
00515 ssh_auth_callback auth_fn,
00516 void *auth_data,
00517 ssh_key *pkey);
00518 LIBSSH_API int ssh_pki_export_privkey_file(const ssh_key privkey,
00519 const char *passphrase,
00520 ssh_auth_callback auth_fn,
00521 void *auth_data,
00522 const char *filename);
00523
00524 LIBSSH_API int ssh_pki_import_pubkey_base64(const char *b64_key,
00525 enum ssh_keytypes_e type,
00526 ssh_key *pkey);
00527 LIBSSH_API int ssh_pki_import_pubkey_file(const char *filename,
00528 ssh_key *pkey);
00529
00530 LIBSSH_API int ssh_pki_export_privkey_to_pubkey(const ssh_key privkey,
00531 ssh_key *pkey);
00532 LIBSSH_API int ssh_pki_export_pubkey_base64(const ssh_key key,
00533 char **b64_key);
00534 LIBSSH_API int ssh_pki_export_pubkey_file(const ssh_key key,
00535 const char *filename);
00536
00537 LIBSSH_API const char *ssh_pki_key_ecdsa_name(const ssh_key key);
00538
00539 LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
00540 LIBSSH_API int ssh_send_ignore (ssh_session session, const char *data);
00541 LIBSSH_API int ssh_send_debug (ssh_session session, const char *message, int always_display);
00542 LIBSSH_API void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds);
00543 LIBSSH_API int ssh_scp_accept_request(ssh_scp scp);
00544 LIBSSH_API int ssh_scp_close(ssh_scp scp);
00545 LIBSSH_API int ssh_scp_deny_request(ssh_scp scp, const char *reason);
00546 LIBSSH_API void ssh_scp_free(ssh_scp scp);
00547 LIBSSH_API int ssh_scp_init(ssh_scp scp);
00548 LIBSSH_API int ssh_scp_leave_directory(ssh_scp scp);
00549 LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
00550 LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);
00551 LIBSSH_API int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode);
00552 LIBSSH_API int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int perms);
00553 LIBSSH_API int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size, int perms);
00554 LIBSSH_API int ssh_scp_read(ssh_scp scp, void *buffer, size_t size);
00555 LIBSSH_API const char *ssh_scp_request_get_filename(ssh_scp scp);
00556 LIBSSH_API int ssh_scp_request_get_permissions(ssh_scp scp);
00557 LIBSSH_API size_t ssh_scp_request_get_size(ssh_scp scp);
00558 LIBSSH_API uint64_t ssh_scp_request_get_size64(ssh_scp scp);
00559 LIBSSH_API const char *ssh_scp_request_get_warning(ssh_scp scp);
00560 LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
00561 LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
00562 fd_set *readfds, struct timeval *timeout);
00563 LIBSSH_API int ssh_service_request(ssh_session session, const char *service);
00564 LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel);
00565 LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
00566 LIBSSH_API void ssh_set_fd_except(ssh_session session);
00567 LIBSSH_API void ssh_set_fd_toread(ssh_session session);
00568 LIBSSH_API void ssh_set_fd_towrite(ssh_session session);
00569 LIBSSH_API void ssh_silent_disconnect(ssh_session session);
00570 LIBSSH_API int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile);
00571
00572
00573 LIBSSH_API int ssh_userauth_none(ssh_session session, const char *username);
00574 LIBSSH_API int ssh_userauth_list(ssh_session session, const char *username);
00575 LIBSSH_API int ssh_userauth_try_publickey(ssh_session session,
00576 const char *username,
00577 const ssh_key pubkey);
00578 LIBSSH_API int ssh_userauth_publickey(ssh_session session,
00579 const char *username,
00580 const ssh_key privkey);
00581 #ifndef _WIN32
00582 LIBSSH_API int ssh_userauth_agent(ssh_session session,
00583 const char *username);
00584 #endif
00585 LIBSSH_API int ssh_userauth_publickey_auto(ssh_session session,
00586 const char *username,
00587 const char *passphrase);
00588 LIBSSH_API int ssh_userauth_password(ssh_session session,
00589 const char *username,
00590 const char *password);
00591
00592 LIBSSH_API int ssh_userauth_kbdint(ssh_session session, const char *user, const char *submethods);
00593 LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(ssh_session session);
00594 LIBSSH_API const char *ssh_userauth_kbdint_getname(ssh_session session);
00595 LIBSSH_API int ssh_userauth_kbdint_getnprompts(ssh_session session);
00596 LIBSSH_API const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i, char *echo);
00597 LIBSSH_API int ssh_userauth_kbdint_getnanswers(ssh_session session);
00598 LIBSSH_API const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i);
00599 LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
00600 const char *answer);
00601 LIBSSH_API int ssh_userauth_gssapi(ssh_session session);
00602 LIBSSH_API const char *ssh_version(int req_version);
00603 LIBSSH_API int ssh_write_knownhost(ssh_session session);
00604
00605 LIBSSH_API void ssh_string_burn(ssh_string str);
00606 LIBSSH_API ssh_string ssh_string_copy(ssh_string str);
00607 LIBSSH_API void *ssh_string_data(ssh_string str);
00608 LIBSSH_API int ssh_string_fill(ssh_string str, const void *data, size_t len);
00609 LIBSSH_API void ssh_string_free(ssh_string str);
00610 LIBSSH_API ssh_string ssh_string_from_char(const char *what);
00611 LIBSSH_API size_t ssh_string_len(ssh_string str);
00612 LIBSSH_API ssh_string ssh_string_new(size_t size);
00613 LIBSSH_API const char *ssh_string_get_char(ssh_string str);
00614 LIBSSH_API char *ssh_string_to_char(ssh_string str);
00615 LIBSSH_API void ssh_string_free_char(char *s);
00616
00617 LIBSSH_API int ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
00618 int verify);
00619
00620
00621 typedef int (*ssh_event_callback)(socket_t fd, int revents, void *userdata);
00622
00623 LIBSSH_API ssh_event ssh_event_new(void);
00624 LIBSSH_API int ssh_event_add_fd(ssh_event event, socket_t fd, short events,
00625 ssh_event_callback cb, void *userdata);
00626 LIBSSH_API int ssh_event_add_session(ssh_event event, ssh_session session);
00627 LIBSSH_API int ssh_event_dopoll(ssh_event event, int timeout);
00628 LIBSSH_API int ssh_event_remove_fd(ssh_event event, socket_t fd);
00629 LIBSSH_API int ssh_event_remove_session(ssh_event event, ssh_session session);
00630 LIBSSH_API void ssh_event_free(ssh_event event);
00631 LIBSSH_API const char* ssh_get_clientbanner(ssh_session session);
00632 LIBSSH_API const char* ssh_get_serverbanner(ssh_session session);
00633 LIBSSH_API const char* ssh_get_cipher_in(ssh_session session);
00634 LIBSSH_API const char* ssh_get_cipher_out(ssh_session session);
00635
00636 #ifndef LIBSSH_LEGACY_0_4
00637 #include "libssh/legacy.h"
00638 #endif
00639
00640 #ifdef __cplusplus
00641 }
00642 #endif
00643 #endif
00644