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 7
00081 #define LIBSSH_VERSION_MICRO 0
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 struct ssh_counter_struct {
00108 uint64_t in_bytes;
00109 uint64_t out_bytes;
00110 uint64_t in_packets;
00111 uint64_t out_packets;
00112 };
00113 typedef struct ssh_counter_struct *ssh_counter;
00114
00115 typedef struct ssh_agent_struct* ssh_agent;
00116 typedef struct ssh_buffer_struct* ssh_buffer;
00117 typedef struct ssh_channel_struct* ssh_channel;
00118 typedef struct ssh_message_struct* ssh_message;
00119 typedef struct ssh_pcap_file_struct* ssh_pcap_file;
00120 typedef struct ssh_key_struct* ssh_key;
00121 typedef struct ssh_scp_struct* ssh_scp;
00122 typedef struct ssh_session_struct* ssh_session;
00123 typedef struct ssh_string_struct* ssh_string;
00124 typedef struct ssh_event_struct* ssh_event;
00125 typedef void* ssh_gssapi_creds;
00126
00127
00128 #ifdef _WIN32
00129 #ifndef socket_t
00130 typedef SOCKET socket_t;
00131 #endif
00132 #else
00133 #ifndef socket_t
00134 typedef int socket_t;
00135 #endif
00136 #endif
00137
00138 #define SSH_INVALID_SOCKET ((socket_t) -1)
00139
00140
00141 enum ssh_kex_types_e {
00142 SSH_KEX=0,
00143 SSH_HOSTKEYS,
00144 SSH_CRYPT_C_S,
00145 SSH_CRYPT_S_C,
00146 SSH_MAC_C_S,
00147 SSH_MAC_S_C,
00148 SSH_COMP_C_S,
00149 SSH_COMP_S_C,
00150 SSH_LANG_C_S,
00151 SSH_LANG_S_C
00152 };
00153
00154 #define SSH_CRYPT 2
00155 #define SSH_MAC 3
00156 #define SSH_COMP 4
00157 #define SSH_LANG 5
00158
00159 enum ssh_auth_e {
00160 SSH_AUTH_SUCCESS=0,
00161 SSH_AUTH_DENIED,
00162 SSH_AUTH_PARTIAL,
00163 SSH_AUTH_INFO,
00164 SSH_AUTH_AGAIN,
00165 SSH_AUTH_ERROR=-1
00166 };
00167
00168
00169 #define SSH_AUTH_METHOD_UNKNOWN 0
00170 #define SSH_AUTH_METHOD_NONE 0x0001
00171 #define SSH_AUTH_METHOD_PASSWORD 0x0002
00172 #define SSH_AUTH_METHOD_PUBLICKEY 0x0004
00173 #define SSH_AUTH_METHOD_HOSTBASED 0x0008
00174 #define SSH_AUTH_METHOD_INTERACTIVE 0x0010
00175 #define SSH_AUTH_METHOD_GSSAPI_MIC 0x0020
00176
00177
00178 enum ssh_requests_e {
00179 SSH_REQUEST_AUTH=1,
00180 SSH_REQUEST_CHANNEL_OPEN,
00181 SSH_REQUEST_CHANNEL,
00182 SSH_REQUEST_SERVICE,
00183 SSH_REQUEST_GLOBAL
00184 };
00185
00186 enum ssh_channel_type_e {
00187 SSH_CHANNEL_UNKNOWN=0,
00188 SSH_CHANNEL_SESSION,
00189 SSH_CHANNEL_DIRECT_TCPIP,
00190 SSH_CHANNEL_FORWARDED_TCPIP,
00191 SSH_CHANNEL_X11
00192 };
00193
00194 enum ssh_channel_requests_e {
00195 SSH_CHANNEL_REQUEST_UNKNOWN=0,
00196 SSH_CHANNEL_REQUEST_PTY,
00197 SSH_CHANNEL_REQUEST_EXEC,
00198 SSH_CHANNEL_REQUEST_SHELL,
00199 SSH_CHANNEL_REQUEST_ENV,
00200 SSH_CHANNEL_REQUEST_SUBSYSTEM,
00201 SSH_CHANNEL_REQUEST_WINDOW_CHANGE,
00202 SSH_CHANNEL_REQUEST_X11
00203 };
00204
00205 enum ssh_global_requests_e {
00206 SSH_GLOBAL_REQUEST_UNKNOWN=0,
00207 SSH_GLOBAL_REQUEST_TCPIP_FORWARD,
00208 SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD,
00209 };
00210
00211 enum ssh_publickey_state_e {
00212 SSH_PUBLICKEY_STATE_ERROR=-1,
00213 SSH_PUBLICKEY_STATE_NONE=0,
00214 SSH_PUBLICKEY_STATE_VALID=1,
00215 SSH_PUBLICKEY_STATE_WRONG=2
00216 };
00217
00218
00220 #define SSH_CLOSED 0x01
00221
00222 #define SSH_READ_PENDING 0x02
00223
00224 #define SSH_CLOSED_ERROR 0x04
00225
00226 #define SSH_WRITE_PENDING 0x08
00227
00228 enum ssh_server_known_e {
00229 SSH_SERVER_ERROR=-1,
00230 SSH_SERVER_NOT_KNOWN=0,
00231 SSH_SERVER_KNOWN_OK,
00232 SSH_SERVER_KNOWN_CHANGED,
00233 SSH_SERVER_FOUND_OTHER,
00234 SSH_SERVER_FILE_NOT_FOUND
00235 };
00236
00237 #ifndef MD5_DIGEST_LEN
00238 #define MD5_DIGEST_LEN 16
00239 #endif
00240
00241
00242 enum ssh_error_types_e {
00243 SSH_NO_ERROR=0,
00244 SSH_REQUEST_DENIED,
00245 SSH_FATAL,
00246 SSH_EINTR
00247 };
00248
00249
00250 enum ssh_keytypes_e{
00251 SSH_KEYTYPE_UNKNOWN=0,
00252 SSH_KEYTYPE_DSS=1,
00253 SSH_KEYTYPE_RSA,
00254 SSH_KEYTYPE_RSA1,
00255 SSH_KEYTYPE_ECDSA,
00256 SSH_KEYTYPE_ED25519
00257 };
00258
00259 enum ssh_keycmp_e {
00260 SSH_KEY_CMP_PUBLIC = 0,
00261 SSH_KEY_CMP_PRIVATE
00262 };
00263
00264
00265 #define SSH_OK 0
00266 #define SSH_ERROR -1
00267 #define SSH_AGAIN -2
00268 #define SSH_EOF -127
00269
00276 enum {
00279 SSH_LOG_NOLOG=0,
00282 SSH_LOG_WARNING,
00285 SSH_LOG_PROTOCOL,
00288 SSH_LOG_PACKET,
00291 SSH_LOG_FUNCTIONS
00292 };
00294 #define SSH_LOG_RARE SSH_LOG_WARNING
00295
00304 #define SSH_LOG_NONE 0
00305
00306 #define SSH_LOG_WARN 1
00307
00308 #define SSH_LOG_INFO 2
00309
00310 #define SSH_LOG_DEBUG 3
00311
00312 #define SSH_LOG_TRACE 4
00313
00316 enum ssh_options_e {
00317 SSH_OPTIONS_HOST,
00318 SSH_OPTIONS_PORT,
00319 SSH_OPTIONS_PORT_STR,
00320 SSH_OPTIONS_FD,
00321 SSH_OPTIONS_USER,
00322 SSH_OPTIONS_SSH_DIR,
00323 SSH_OPTIONS_IDENTITY,
00324 SSH_OPTIONS_ADD_IDENTITY,
00325 SSH_OPTIONS_KNOWNHOSTS,
00326 SSH_OPTIONS_TIMEOUT,
00327 SSH_OPTIONS_TIMEOUT_USEC,
00328 SSH_OPTIONS_SSH1,
00329 SSH_OPTIONS_SSH2,
00330 SSH_OPTIONS_LOG_VERBOSITY,
00331 SSH_OPTIONS_LOG_VERBOSITY_STR,
00332 SSH_OPTIONS_CIPHERS_C_S,
00333 SSH_OPTIONS_CIPHERS_S_C,
00334 SSH_OPTIONS_COMPRESSION_C_S,
00335 SSH_OPTIONS_COMPRESSION_S_C,
00336 SSH_OPTIONS_PROXYCOMMAND,
00337 SSH_OPTIONS_BINDADDR,
00338 SSH_OPTIONS_STRICTHOSTKEYCHECK,
00339 SSH_OPTIONS_COMPRESSION,
00340 SSH_OPTIONS_COMPRESSION_LEVEL,
00341 SSH_OPTIONS_KEY_EXCHANGE,
00342 SSH_OPTIONS_HOSTKEYS,
00343 SSH_OPTIONS_GSSAPI_SERVER_IDENTITY,
00344 SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY,
00345 SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS,
00346 SSH_OPTIONS_HMAC_C_S,
00347 SSH_OPTIONS_HMAC_S_C,
00348 };
00349
00350 enum {
00352 SSH_SCP_WRITE,
00354 SSH_SCP_READ,
00355 SSH_SCP_RECURSIVE=0x10
00356 };
00357
00358 enum ssh_scp_request_types {
00360 SSH_SCP_REQUEST_NEWDIR=1,
00362 SSH_SCP_REQUEST_NEWFILE,
00364 SSH_SCP_REQUEST_EOF,
00366 SSH_SCP_REQUEST_ENDDIR,
00368 SSH_SCP_REQUEST_WARNING
00369 };
00370
00371 LIBSSH_API int ssh_blocking_flush(ssh_session session, int timeout);
00372 LIBSSH_API ssh_channel ssh_channel_accept_x11(ssh_channel channel, int timeout_ms);
00373 LIBSSH_API int ssh_channel_change_pty_size(ssh_channel channel,int cols,int rows);
00374 LIBSSH_API int ssh_channel_close(ssh_channel channel);
00375 LIBSSH_API void ssh_channel_free(ssh_channel channel);
00376 LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
00377 LIBSSH_API ssh_session ssh_channel_get_session(ssh_channel channel);
00378 LIBSSH_API int ssh_channel_is_closed(ssh_channel channel);
00379 LIBSSH_API int ssh_channel_is_eof(ssh_channel channel);
00380 LIBSSH_API int ssh_channel_is_open(ssh_channel channel);
00381 LIBSSH_API ssh_channel ssh_channel_new(ssh_session session);
00382 LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
00383 LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
00384 int remoteport, const char *sourcehost, int localport);
00385 LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
00386 LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
00387 LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
00388 LIBSSH_API int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr);
00389 LIBSSH_API int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
00390 LIBSSH_API int ssh_channel_read_timeout(ssh_channel channel, void *dest, uint32_t count, int is_stderr, int timeout_ms);
00391 LIBSSH_API int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
00392 int is_stderr);
00393 LIBSSH_API int ssh_channel_request_env(ssh_channel channel, const char *name, const char *value);
00394 LIBSSH_API int ssh_channel_request_exec(ssh_channel channel, const char *cmd);
00395 LIBSSH_API int ssh_channel_request_pty(ssh_channel channel);
00396 LIBSSH_API int ssh_channel_request_pty_size(ssh_channel channel, const char *term,
00397 int cols, int rows);
00398 LIBSSH_API int ssh_channel_request_shell(ssh_channel channel);
00399 LIBSSH_API int ssh_channel_request_send_signal(ssh_channel channel, const char *signum);
00400 LIBSSH_API int ssh_channel_request_sftp(ssh_channel channel);
00401 LIBSSH_API int ssh_channel_request_subsystem(ssh_channel channel, const char *subsystem);
00402 LIBSSH_API int ssh_channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
00403 const char *cookie, int screen_number);
00404 LIBSSH_API int ssh_channel_send_eof(ssh_channel channel);
00405 LIBSSH_API int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
00406 timeval * timeout);
00407 LIBSSH_API void ssh_channel_set_blocking(ssh_channel channel, int blocking);
00408 LIBSSH_API void ssh_channel_set_counter(ssh_channel channel,
00409 ssh_counter counter);
00410 LIBSSH_API int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len);
00411 LIBSSH_API uint32_t ssh_channel_window_size(ssh_channel channel);
00412
00413 LIBSSH_API char *ssh_basename (const char *path);
00414 LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
00415 LIBSSH_API int ssh_connect(ssh_session session);
00416 LIBSSH_API const char *ssh_copyright(void);
00417 LIBSSH_API void ssh_disconnect(ssh_session session);
00418 LIBSSH_API char *ssh_dirname (const char *path);
00419 LIBSSH_API int ssh_finalize(void);
00420
00421
00422 LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session,
00423 int timeout_ms,
00424 int *destination_port);
00425 LIBSSH_API int ssh_channel_cancel_forward(ssh_session session,
00426 const char *address,
00427 int port);
00428 LIBSSH_API int ssh_channel_listen_forward(ssh_session session,
00429 const char *address,
00430 int port,
00431 int *bound_port);
00432
00433 LIBSSH_API void ssh_free(ssh_session session);
00434 LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
00435 LIBSSH_API const char *ssh_get_error(void *error);
00436 LIBSSH_API int ssh_get_error_code(void *error);
00437 LIBSSH_API socket_t ssh_get_fd(ssh_session session);
00438 LIBSSH_API char *ssh_get_hexa(const unsigned char *what, size_t len);
00439 LIBSSH_API char *ssh_get_issue_banner(ssh_session session);
00440 LIBSSH_API int ssh_get_openssh_version(ssh_session session);
00441
00442 LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
00443
00444 enum ssh_publickey_hash_type {
00445 SSH_PUBLICKEY_HASH_SHA1,
00446 SSH_PUBLICKEY_HASH_MD5
00447 };
00448 LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
00449 enum ssh_publickey_hash_type type,
00450 unsigned char **hash,
00451 size_t *hlen);
00452
00453
00454 SSH_DEPRECATED LIBSSH_API int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash);
00455 SSH_DEPRECATED LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms);
00456 SSH_DEPRECATED LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
00457 SSH_DEPRECATED LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
00458
00459
00460 LIBSSH_API int ssh_get_random(void *where,int len,int strong);
00461 LIBSSH_API int ssh_get_version(ssh_session session);
00462 LIBSSH_API int ssh_get_status(ssh_session session);
00463 LIBSSH_API int ssh_get_poll_flags(ssh_session session);
00464 LIBSSH_API int ssh_init(void);
00465 LIBSSH_API int ssh_is_blocking(ssh_session session);
00466 LIBSSH_API int ssh_is_connected(ssh_session session);
00467 LIBSSH_API int ssh_is_server_known(ssh_session session);
00468
00469
00470 LIBSSH_API int ssh_set_log_level(int level);
00471 LIBSSH_API int ssh_get_log_level(void);
00472 LIBSSH_API void *ssh_get_log_userdata(void);
00473 LIBSSH_API int ssh_set_log_userdata(void *data);
00474 LIBSSH_API void _ssh_log(int verbosity,
00475 const char *function,
00476 const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
00477
00478
00479 SSH_DEPRECATED LIBSSH_API void ssh_log(ssh_session session,
00480 int prioriry,
00481 const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
00482
00483 LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
00484 LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
00485 LIBSSH_API void ssh_message_free(ssh_message msg);
00486 LIBSSH_API ssh_message ssh_message_get(ssh_session session);
00487 LIBSSH_API int ssh_message_subtype(ssh_message msg);
00488 LIBSSH_API int ssh_message_type(ssh_message msg);
00489 LIBSSH_API int ssh_mkdir (const char *pathname, mode_t mode);
00490 LIBSSH_API ssh_session ssh_new(void);
00491
00492 LIBSSH_API int ssh_options_copy(ssh_session src, ssh_session *dest);
00493 LIBSSH_API int ssh_options_getopt(ssh_session session, int *argcptr, char **argv);
00494 LIBSSH_API int ssh_options_parse_config(ssh_session session, const char *filename);
00495 LIBSSH_API int ssh_options_set(ssh_session session, enum ssh_options_e type,
00496 const void *value);
00497 LIBSSH_API int ssh_options_get(ssh_session session, enum ssh_options_e type,
00498 char **value);
00499 LIBSSH_API int ssh_options_get_port(ssh_session session, unsigned int * port_target);
00500 LIBSSH_API int ssh_pcap_file_close(ssh_pcap_file pcap);
00501 LIBSSH_API void ssh_pcap_file_free(ssh_pcap_file pcap);
00502 LIBSSH_API ssh_pcap_file ssh_pcap_file_new(void);
00503 LIBSSH_API int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename);
00504
00518 typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
00519 int echo, int verify, void *userdata);
00520
00521 LIBSSH_API ssh_key ssh_key_new(void);
00522 LIBSSH_API void ssh_key_free (ssh_key key);
00523 LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key);
00524 LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
00525 LIBSSH_API enum ssh_keytypes_e ssh_key_type_from_name(const char *name);
00526 LIBSSH_API int ssh_key_is_public(const ssh_key k);
00527 LIBSSH_API int ssh_key_is_private(const ssh_key k);
00528 LIBSSH_API int ssh_key_cmp(const ssh_key k1,
00529 const ssh_key k2,
00530 enum ssh_keycmp_e what);
00531
00532 LIBSSH_API int ssh_pki_generate(enum ssh_keytypes_e type, int parameter,
00533 ssh_key *pkey);
00534 LIBSSH_API int ssh_pki_import_privkey_base64(const char *b64_key,
00535 const char *passphrase,
00536 ssh_auth_callback auth_fn,
00537 void *auth_data,
00538 ssh_key *pkey);
00539 LIBSSH_API int ssh_pki_import_privkey_file(const char *filename,
00540 const char *passphrase,
00541 ssh_auth_callback auth_fn,
00542 void *auth_data,
00543 ssh_key *pkey);
00544 LIBSSH_API int ssh_pki_export_privkey_file(const ssh_key privkey,
00545 const char *passphrase,
00546 ssh_auth_callback auth_fn,
00547 void *auth_data,
00548 const char *filename);
00549
00550 LIBSSH_API int ssh_pki_import_pubkey_base64(const char *b64_key,
00551 enum ssh_keytypes_e type,
00552 ssh_key *pkey);
00553 LIBSSH_API int ssh_pki_import_pubkey_file(const char *filename,
00554 ssh_key *pkey);
00555
00556 LIBSSH_API int ssh_pki_export_privkey_to_pubkey(const ssh_key privkey,
00557 ssh_key *pkey);
00558 LIBSSH_API int ssh_pki_export_pubkey_base64(const ssh_key key,
00559 char **b64_key);
00560 LIBSSH_API int ssh_pki_export_pubkey_file(const ssh_key key,
00561 const char *filename);
00562
00563 LIBSSH_API const char *ssh_pki_key_ecdsa_name(const ssh_key key);
00564
00565 LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
00566 LIBSSH_API int ssh_send_ignore (ssh_session session, const char *data);
00567 LIBSSH_API int ssh_send_debug (ssh_session session, const char *message, int always_display);
00568 LIBSSH_API void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds);
00569 LIBSSH_API int ssh_scp_accept_request(ssh_scp scp);
00570 LIBSSH_API int ssh_scp_close(ssh_scp scp);
00571 LIBSSH_API int ssh_scp_deny_request(ssh_scp scp, const char *reason);
00572 LIBSSH_API void ssh_scp_free(ssh_scp scp);
00573 LIBSSH_API int ssh_scp_init(ssh_scp scp);
00574 LIBSSH_API int ssh_scp_leave_directory(ssh_scp scp);
00575 LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
00576 LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);
00577 LIBSSH_API int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode);
00578 LIBSSH_API int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int perms);
00579 LIBSSH_API int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size, int perms);
00580 LIBSSH_API int ssh_scp_read(ssh_scp scp, void *buffer, size_t size);
00581 LIBSSH_API const char *ssh_scp_request_get_filename(ssh_scp scp);
00582 LIBSSH_API int ssh_scp_request_get_permissions(ssh_scp scp);
00583 LIBSSH_API size_t ssh_scp_request_get_size(ssh_scp scp);
00584 LIBSSH_API uint64_t ssh_scp_request_get_size64(ssh_scp scp);
00585 LIBSSH_API const char *ssh_scp_request_get_warning(ssh_scp scp);
00586 LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
00587 LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
00588 fd_set *readfds, struct timeval *timeout);
00589 LIBSSH_API int ssh_service_request(ssh_session session, const char *service);
00590 LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel);
00591 LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
00592 LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter,
00593 ssh_counter rcounter);
00594 LIBSSH_API void ssh_set_fd_except(ssh_session session);
00595 LIBSSH_API void ssh_set_fd_toread(ssh_session session);
00596 LIBSSH_API void ssh_set_fd_towrite(ssh_session session);
00597 LIBSSH_API void ssh_silent_disconnect(ssh_session session);
00598 LIBSSH_API int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile);
00599
00600
00601 LIBSSH_API int ssh_userauth_none(ssh_session session, const char *username);
00602 LIBSSH_API int ssh_userauth_list(ssh_session session, const char *username);
00603 LIBSSH_API int ssh_userauth_try_publickey(ssh_session session,
00604 const char *username,
00605 const ssh_key pubkey);
00606 LIBSSH_API int ssh_userauth_publickey(ssh_session session,
00607 const char *username,
00608 const ssh_key privkey);
00609 #ifndef _WIN32
00610 LIBSSH_API int ssh_userauth_agent(ssh_session session,
00611 const char *username);
00612 #endif
00613 LIBSSH_API int ssh_userauth_publickey_auto(ssh_session session,
00614 const char *username,
00615 const char *passphrase);
00616 LIBSSH_API int ssh_userauth_password(ssh_session session,
00617 const char *username,
00618 const char *password);
00619
00620 LIBSSH_API int ssh_userauth_kbdint(ssh_session session, const char *user, const char *submethods);
00621 LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(ssh_session session);
00622 LIBSSH_API const char *ssh_userauth_kbdint_getname(ssh_session session);
00623 LIBSSH_API int ssh_userauth_kbdint_getnprompts(ssh_session session);
00624 LIBSSH_API const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i, char *echo);
00625 LIBSSH_API int ssh_userauth_kbdint_getnanswers(ssh_session session);
00626 LIBSSH_API const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i);
00627 LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
00628 const char *answer);
00629 LIBSSH_API int ssh_userauth_gssapi(ssh_session session);
00630 LIBSSH_API const char *ssh_version(int req_version);
00631 LIBSSH_API int ssh_write_knownhost(ssh_session session);
00632
00633 LIBSSH_API void ssh_string_burn(ssh_string str);
00634 LIBSSH_API ssh_string ssh_string_copy(ssh_string str);
00635 LIBSSH_API void *ssh_string_data(ssh_string str);
00636 LIBSSH_API int ssh_string_fill(ssh_string str, const void *data, size_t len);
00637 LIBSSH_API void ssh_string_free(ssh_string str);
00638 LIBSSH_API ssh_string ssh_string_from_char(const char *what);
00639 LIBSSH_API size_t ssh_string_len(ssh_string str);
00640 LIBSSH_API ssh_string ssh_string_new(size_t size);
00641 LIBSSH_API const char *ssh_string_get_char(ssh_string str);
00642 LIBSSH_API char *ssh_string_to_char(ssh_string str);
00643 LIBSSH_API void ssh_string_free_char(char *s);
00644
00645 LIBSSH_API int ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
00646 int verify);
00647
00648
00649 typedef int (*ssh_event_callback)(socket_t fd, int revents, void *userdata);
00650
00651 LIBSSH_API ssh_event ssh_event_new(void);
00652 LIBSSH_API int ssh_event_add_fd(ssh_event event, socket_t fd, short events,
00653 ssh_event_callback cb, void *userdata);
00654 LIBSSH_API int ssh_event_add_session(ssh_event event, ssh_session session);
00655 LIBSSH_API int ssh_event_dopoll(ssh_event event, int timeout);
00656 LIBSSH_API int ssh_event_remove_fd(ssh_event event, socket_t fd);
00657 LIBSSH_API int ssh_event_remove_session(ssh_event event, ssh_session session);
00658 LIBSSH_API void ssh_event_free(ssh_event event);
00659 LIBSSH_API const char* ssh_get_clientbanner(ssh_session session);
00660 LIBSSH_API const char* ssh_get_serverbanner(ssh_session session);
00661 LIBSSH_API const char* ssh_get_kex_algo(ssh_session session);
00662 LIBSSH_API const char* ssh_get_cipher_in(ssh_session session);
00663 LIBSSH_API const char* ssh_get_cipher_out(ssh_session session);
00664 LIBSSH_API const char* ssh_get_hmac_in(ssh_session session);
00665 LIBSSH_API const char* ssh_get_hmac_out(ssh_session session);
00666
00667 #ifndef LIBSSH_LEGACY_0_4
00668 #include "libssh/legacy.h"
00669 #endif
00670
00671 #ifdef __cplusplus
00672 }
00673 #endif
00674 #endif
00675