Buckets:
| /* Copyright (C) Sara Golemon <sarag@libssh2.org> | |
| * Copyright (C) Daniel Stenberg | |
| * Copyright (C) Simon Josefsson <simon@josefsson.org> | |
| * 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 | |
| */ | |
| /* We use underscore instead of dash when appending DEV 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. */ | |
| /* The numeric version number is also available "in parts" by using these | |
| defines: */ | |
| /* This is the numeric version of the libssh2 version number, meant for easier | |
| parsing and comparisons 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. | |
| */ | |
| /* | |
| * This is the date and time when the full source package was created. The | |
| * timestamp is not stored in the source code repo, 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" | |
| */ | |
| extern "C" { | |
| /* Allow alternate API prefix from CFLAGS or calling app */ | |
| typedef unsigned char uint8_t; | |
| typedef unsigned short int uint16_t; | |
| typedef unsigned int uint32_t; | |
| typedef __int32 int32_t; | |
| typedef __int64 int64_t; | |
| typedef unsigned __int64 uint64_t; | |
| typedef unsigned __int64 libssh2_uint64_t; | |
| typedef __int64 libssh2_int64_t; | |
| typedef SSIZE_T ssize_t; | |
| typedef unsigned long long libssh2_uint64_t; | |
| typedef long long libssh2_int64_t; | |
| typedef SOCKET libssh2_socket_t; | |
| typedef int libssh2_socket_t; | |
| /* Compile-time deprecation macros */ | |
| /* | |
| * Determine whether there is small or large file support on windows. | |
| */ | |
| /* | |
| * Large file (>2Gb) support using WIN32 functions. | |
| */ | |
| typedef struct _stati64 libssh2_struct_stat; | |
| typedef __int64 libssh2_struct_stat_size; | |
| /* | |
| * Small file (<2Gb) support using WIN32 functions. | |
| */ | |
| typedef struct _stat libssh2_struct_stat; | |
| typedef off_t libssh2_struct_stat_size; | |
| /* We have to roll our own format here because %z is a C99-ism we don't | |
| have. */ | |
| typedef struct stat libssh2_struct_stat; | |
| typedef off_t libssh2_struct_stat_size; | |
| /* Part of every banner, user specified or not */ | |
| /* Defaults for pty requests */ | |
| /* 1/4 second */ | |
| /* 0.25 * 120 == 30 seconds */ | |
| /* Maximum size to allow a payload to compress to, plays it safe by falling | |
| short of spec limits */ | |
| /* Maximum size to allow a payload to deccompress to, plays it safe by | |
| allowing more than spec requires */ | |
| /* Maximum size for an inbound compressed payload, plays it safe by | |
| overshooting spec limits */ | |
| /* Malloc callbacks */ | |
| typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT | |
| { | |
| unsigned char *text; | |
| size_t length; | |
| unsigned char echo; | |
| } LIBSSH2_USERAUTH_KBDINT_PROMPT; | |
| typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE | |
| { | |
| char *text; | |
| unsigned int length; /* FIXME: change type to size_t */ | |
| } LIBSSH2_USERAUTH_KBDINT_RESPONSE; | |
| typedef struct _LIBSSH2_SK_SIG_INFO { | |
| uint8_t flags; | |
| uint32_t counter; | |
| unsigned char *sig_r; | |
| size_t sig_r_len; | |
| unsigned char *sig_s; | |
| size_t sig_s_len; | |
| } LIBSSH2_SK_SIG_INFO; | |
| /* 'publickey' authentication callback */ | |
| /* 'keyboard-interactive' authentication callback */ | |
| /* FIXME: name_len, instruction_len -> size_t, num_prompts -> unsigned int? */ | |
| /* SK authentication callback */ | |
| /* Flags for SK authentication */ | |
| /* FIXME: update lengths to size_t (or ssize_t): */ | |
| /* Callbacks for special SSH packets */ | |
| /* I/O callbacks */ | |
| /* libssh2_session_callback_set() constants */ | |
| /* libssh2_session_method_pref() constants */ | |
| /* flags */ | |
| typedef struct _LIBSSH2_SESSION LIBSSH2_SESSION; | |
| typedef struct _LIBSSH2_CHANNEL LIBSSH2_CHANNEL; | |
| typedef struct _LIBSSH2_LISTENER LIBSSH2_LISTENER; | |
| typedef struct _LIBSSH2_KNOWNHOSTS LIBSSH2_KNOWNHOSTS; | |
| typedef struct _LIBSSH2_AGENT LIBSSH2_AGENT; | |
| /* SK signature callback */ | |
| typedef struct _LIBSSH2_PRIVKEY_SK { | |
| int algorithm; | |
| uint8_t flags; | |
| const char *application; | |
| const unsigned char *key_handle; | |
| size_t handle_len; | |
| LIBSSH2_USERAUTH_SK_SIGN_FUNC((*sign_callback)); | |
| void **orig_abstract; | |
| } LIBSSH2_PRIVKEY_SK; | |
| int | |
| libssh2_sign_sk(LIBSSH2_SESSION *session, | |
| unsigned char **sig, | |
| size_t *sig_len, | |
| const unsigned char *data, | |
| size_t data_len, | |
| void **abstract); | |
| typedef struct _LIBSSH2_POLLFD { | |
| unsigned char type; /* LIBSSH2_POLLFD_* below */ | |
| union { | |
| libssh2_socket_t socket; /* File descriptors -- examined with | |
| system select() call */ | |
| LIBSSH2_CHANNEL *channel; /* Examined by checking internal state */ | |
| LIBSSH2_LISTENER *listener; /* Read polls only -- are inbound | |
| connections waiting to be accepted? */ | |
| } fd; | |
| unsigned long events; /* Requested Events */ | |
| unsigned long revents; /* Returned Events */ | |
| } LIBSSH2_POLLFD; | |
| /* Poll FD Descriptor Types */ | |
| /* 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 */ | |
| /* revents only */ | |
| /* Block Direction Types */ | |
| /* Hash Types */ | |
| /* Hostkey Types */ | |
| /* Disconnect Codes (defined by SSH protocol) */ | |
| /* Error Codes (defined by libssh2) */ | |
| /* The library once used -1 as a generic error return value on numerous places | |
| through the code, which subsequently was converted to | |
| LIBSSH2_ERROR_SOCKET_NONE uses over time. As this is a generic error code, | |
| the goal is to never ever return this code but instead make sure that a | |
| more accurate and descriptive error code is used. */ | |
| /* this is a define to provide the old (<= 1.2.7) name */ | |
| /* Global API */ | |
| /* | |
| * 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. | |
| */ | |
| LIBSSH2_API int libssh2_init(int flags); | |
| /* | |
| * libssh2_exit() | |
| * | |
| * Exit the libssh2 functions and free's all memory used internal. | |
| */ | |
| LIBSSH2_API void libssh2_exit(void); | |
| /* | |
| * libssh2_free() | |
| * | |
| * Deallocate memory allocated by earlier call to libssh2 functions. | |
| */ | |
| LIBSSH2_API void libssh2_free(LIBSSH2_SESSION *session, void *ptr); | |
| /* | |
| * 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 error code) on failure. | |
| * | |
| * NOTE: on success, algs must be deallocated (by calling libssh2_free) when | |
| * not needed anymore | |
| */ | |
| LIBSSH2_API int libssh2_session_supported_algs(LIBSSH2_SESSION* session, | |
| int method_type, | |
| const char ***algs); | |
| /* Session API */ | |
| LIBSSH2_API LIBSSH2_SESSION * | |
| libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), | |
| LIBSSH2_FREE_FUNC((*my_free)), | |
| LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract); | |
| LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session); | |
| typedef void (libssh2_cb_generic)(void); | |
| LIBSSH2_API libssh2_cb_generic * | |
| libssh2_session_callback_set2(LIBSSH2_SESSION *session, int cbtype, | |
| libssh2_cb_generic *callback); | |
| LIBSSH2_DEPRECATED(1.11.1, "Use libssh2_session_callback_set2()") | |
| LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session, | |
| int cbtype, void *callback); | |
| LIBSSH2_API int libssh2_session_banner_set(LIBSSH2_SESSION *session, | |
| const char *banner); | |
| LIBSSH2_DEPRECATED(1.4.0, "Use libssh2_session_banner_set()") | |
| LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, | |
| const char *banner); | |
| LIBSSH2_DEPRECATED(1.2.8, "Use libssh2_session_handshake()") | |
| LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int sock); | |
| LIBSSH2_API int libssh2_session_handshake(LIBSSH2_SESSION *session, | |
| libssh2_socket_t sock); | |
| LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, | |
| int reason, | |
| const char *description, | |
| const char *lang); | |
| LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session); | |
| LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, | |
| int hash_type); | |
| LIBSSH2_API const char *libssh2_session_hostkey(LIBSSH2_SESSION *session, | |
| size_t *len, int *type); | |
| LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, | |
| int method_type, | |
| const char *prefs); | |
| LIBSSH2_API const char *libssh2_session_methods(LIBSSH2_SESSION *session, | |
| int method_type); | |
| LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session, | |
| char **errmsg, | |
| int *errmsg_len, int want_buf); | |
| LIBSSH2_API int libssh2_session_last_errno(LIBSSH2_SESSION *session); | |
| LIBSSH2_API int libssh2_session_set_last_error(LIBSSH2_SESSION* session, | |
| int errcode, | |
| const char *errmsg); | |
| LIBSSH2_API int libssh2_session_block_directions(LIBSSH2_SESSION *session); | |
| LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, | |
| int value); | |
| LIBSSH2_API const char *libssh2_session_banner_get(LIBSSH2_SESSION *session); | |
| /* Userauth API */ | |
| LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session, | |
| const char *username, | |
| unsigned int username_len); | |
| LIBSSH2_API int libssh2_userauth_banner(LIBSSH2_SESSION *session, | |
| char **banner); | |
| LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session); | |
| LIBSSH2_API int | |
| libssh2_userauth_password_ex(LIBSSH2_SESSION *session, | |
| const char *username, | |
| unsigned int username_len, | |
| const char *password, | |
| unsigned int password_len, | |
| LIBSSH2_PASSWD_CHANGEREQ_FUNC | |
| ((*passwd_change_cb))); | |
| LIBSSH2_API int | |
| libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, | |
| const char *username, | |
| unsigned int username_len, | |
| const char *publickey, | |
| const char *privatekey, | |
| const char *passphrase); | |
| LIBSSH2_API int | |
| libssh2_userauth_publickey(LIBSSH2_SESSION *session, | |
| const char *username, | |
| const unsigned char *pubkeydata, | |
| size_t pubkeydata_len, | |
| LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC | |
| ((*sign_callback)), | |
| void **abstract); | |
| LIBSSH2_API int | |
| libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, | |
| const char *username, | |
| unsigned int username_len, | |
| const char *publickey, | |
| const char *privatekey, | |
| const char *passphrase, | |
| const char *hostname, | |
| unsigned int hostname_len, | |
| const char *local_username, | |
| unsigned int local_username_len); | |
| LIBSSH2_API int | |
| libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, | |
| const char *username, | |
| size_t username_len, | |
| const char *publickeyfiledata, | |
| size_t publickeyfiledata_len, | |
| const char *privatekeyfiledata, | |
| size_t privatekeyfiledata_len, | |
| const char *passphrase); | |
| /* | |
| * 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 invocation. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION* session, | |
| const char *username, | |
| unsigned int username_len, | |
| LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC | |
| ((*response_callback))); | |
| LIBSSH2_API int | |
| libssh2_userauth_publickey_sk(LIBSSH2_SESSION *session, | |
| const char *username, | |
| size_t username_len, | |
| const unsigned char *pubkeydata, | |
| size_t pubkeydata_len, | |
| const char *privatekeydata, | |
| size_t privatekeydata_len, | |
| const char *passphrase, | |
| LIBSSH2_USERAUTH_SK_SIGN_FUNC | |
| ((*sign_callback)), | |
| void **abstract); | |
| LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, | |
| long timeout); | |
| /* Channel API */ | |
| /* Extended Data Handling */ | |
| /* Returned by any function that would block during a read/write operation */ | |
| LIBSSH2_API LIBSSH2_CHANNEL * | |
| libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, | |
| unsigned int channel_type_len, | |
| unsigned int window_size, unsigned int packet_size, | |
| const char *message, unsigned int message_len); | |
| LIBSSH2_API LIBSSH2_CHANNEL * | |
| libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, | |
| int port, const char *shost, int sport); | |
| LIBSSH2_API LIBSSH2_CHANNEL * | |
| libssh2_channel_direct_streamlocal_ex(LIBSSH2_SESSION * session, | |
| const char *socket_path, | |
| const char *shost, int sport); | |
| LIBSSH2_API LIBSSH2_LISTENER * | |
| libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host, | |
| int port, int *bound_port, | |
| int queue_maxsize); | |
| LIBSSH2_API int libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); | |
| LIBSSH2_API LIBSSH2_CHANNEL * | |
| libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener); | |
| LIBSSH2_API int libssh2_channel_setenv_ex(LIBSSH2_CHANNEL *channel, | |
| const char *varname, | |
| unsigned int varname_len, | |
| const char *value, | |
| unsigned int value_len); | |
| LIBSSH2_API int libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel, | |
| const char *term, | |
| unsigned int term_len, | |
| const char *modes, | |
| unsigned int modes_len, | |
| int width, int height, | |
| int width_px, int height_px); | |
| LIBSSH2_API int libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel, | |
| int width, int height, | |
| int width_px, | |
| int height_px); | |
| LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, | |
| int single_connection, | |
| const char *auth_proto, | |
| const char *auth_cookie, | |
| int screen_number); | |
| LIBSSH2_API int libssh2_channel_signal_ex(LIBSSH2_CHANNEL *channel, | |
| const char *signame, | |
| size_t signame_len); | |
| LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, | |
| const char *request, | |
| unsigned int request_len, | |
| const char *message, | |
| unsigned int message_len); | |
| LIBSSH2_API ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, | |
| int stream_id, char *buf, | |
| size_t buflen); | |
| LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, | |
| int extended); | |
| LIBSSH2_API unsigned long | |
| libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel, | |
| unsigned long *read_avail, | |
| unsigned long *window_size_initial); | |
| LIBSSH2_DEPRECATED(1.1.0, "Use libssh2_channel_receive_window_adjust2()") | |
| LIBSSH2_API unsigned long | |
| libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, | |
| unsigned long adjustment, | |
| unsigned char force); | |
| LIBSSH2_API int | |
| libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel, | |
| unsigned long adjustment, | |
| unsigned char force, | |
| unsigned int *storewindow); | |
| LIBSSH2_API ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, | |
| int stream_id, const char *buf, | |
| size_t buflen); | |
| LIBSSH2_API unsigned long | |
| libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel, | |
| unsigned long *window_size_initial); | |
| LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session, | |
| int blocking); | |
| LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session); | |
| LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, | |
| int blocking); | |
| LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session, | |
| long timeout); | |
| LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session); | |
| LIBSSH2_API void libssh2_session_set_read_timeout(LIBSSH2_SESSION* session, | |
| long timeout); | |
| LIBSSH2_API long libssh2_session_get_read_timeout(LIBSSH2_SESSION* session); | |
| LIBSSH2_DEPRECATED(1.1.0, "libssh2_channel_handle_extended_data2()") | |
| LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, | |
| int ignore_mode); | |
| LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, | |
| int ignore_mode); | |
| /* libssh2_channel_ignore_extended_data() is defined below for BC with version | |
| * 0.1 | |
| * | |
| * Future uses should use libssh2_channel_handle_extended_data() directly if | |
| * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read | |
| * (FIFO) from the standard data channel | |
| */ | |
| /* DEPRECATED since 0.3.0. Use libssh2_channel_handle_extended_data2(). */ | |
| LIBSSH2_API int libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel, | |
| int streamid); | |
| LIBSSH2_API int libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel); | |
| LIBSSH2_API int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL* channel, | |
| char **exitsignal, | |
| size_t *exitsignal_len, | |
| char **errmsg, | |
| size_t *errmsg_len, | |
| char **langtag, | |
| size_t *langtag_len); | |
| LIBSSH2_API int libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_wait_closed(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel); | |
| LIBSSH2_DEPRECATED(1.7.0, "Use libssh2_scp_recv2()") | |
| LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, | |
| const char *path, | |
| struct stat *sb); | |
| /* Use libssh2_scp_recv2() for large (> 2GB) file support on windows */ | |
| LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session, | |
| const char *path, | |
| libssh2_struct_stat *sb); | |
| LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, | |
| const char *path, int mode, | |
| size_t size, long mtime, | |
| long atime); | |
| LIBSSH2_API LIBSSH2_CHANNEL * | |
| libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode, | |
| libssh2_int64_t size, time_t mtime, time_t atime); | |
| /* DEPRECATED */ | |
| LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, | |
| unsigned int *dest_len, | |
| const char *src, unsigned int src_len); | |
| LIBSSH2_API | |
| const char *libssh2_version(int req_version_num); | |
| typedef enum { | |
| libssh2_no_crypto = 0, | |
| libssh2_openssl, | |
| libssh2_gcrypt, | |
| libssh2_mbedtls, | |
| libssh2_wincng, | |
| libssh2_os400qc3 | |
| } libssh2_crypto_engine_t; | |
| LIBSSH2_API | |
| libssh2_crypto_engine_t libssh2_crypto_engine(void); | |
| struct libssh2_knownhost { | |
| unsigned int magic; /* magic stored by the library */ | |
| void *node; /* handle to the internal representation of this host */ | |
| char *name; /* this is NULL if no plain text host name exists */ | |
| char *key; /* key in base64/printable format */ | |
| int typemask; | |
| }; | |
| /* | |
| * libssh2_knownhost_init() | |
| * | |
| * Init a collection of known hosts. Returns the pointer to a collection. | |
| * | |
| */ | |
| LIBSSH2_API LIBSSH2_KNOWNHOSTS * | |
| libssh2_knownhost_init(LIBSSH2_SESSION *session); | |
| /* | |
| * libssh2_knownhost_add() | |
| * | |
| * Add a host and its associated key to the collection of known hosts. | |
| * | |
| * The 'type' argument specifies on what format the given host and keys are: | |
| * | |
| * plain - ascii "hostname.domain.tld" | |
| * sha1 - SHA1(<salt> <host>) base64-encoded! | |
| * custom - another hash | |
| * | |
| * If 'sha1' is selected as type, the salt must be provided to the salt | |
| * argument. This too base64 encoded. | |
| * | |
| * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. If | |
| * a custom type is used, salt is ignored and you must provide the host | |
| * pre-hashed when checking for it in the libssh2_knownhost_check() function. | |
| * | |
| * The keylen parameter may be omitted (zero) if the key is provided as a | |
| * NULL-terminated base64-encoded string. | |
| */ | |
| /* host format (2 bits) */ | |
| /* key format (2 bits) */ | |
| /* type of key (4 bits) */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *host, | |
| const char *salt, | |
| const char *key, size_t keylen, int typemask, | |
| struct libssh2_knownhost **store); | |
| /* | |
| * libssh2_knownhost_addc() | |
| * | |
| * Add a host and its associated key to the collection of known hosts. | |
| * | |
| * Takes a comment argument that may be NULL. A NULL comment indicates | |
| * there is no comment and the entry will end directly after the key | |
| * when written out to a file. An empty string "" comment will indicate an | |
| * empty comment which will cause a single space to be written after the key. | |
| * | |
| * The 'type' argument specifies on what format the given host and keys are: | |
| * | |
| * plain - ascii "hostname.domain.tld" | |
| * sha1 - SHA1(<salt> <host>) base64-encoded! | |
| * custom - another hash | |
| * | |
| * If 'sha1' is selected as type, the salt must be provided to the salt | |
| * argument. This too base64 encoded. | |
| * | |
| * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. | |
| * If a custom type is used, salt is ignored and you must provide the host | |
| * pre-hashed when checking for it in the libssh2_knownhost_check() function. | |
| * | |
| * The keylen parameter may be omitted (zero) if the key is provided as a | |
| * NULL-terminated base64-encoded string. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *host, | |
| const char *salt, | |
| const char *key, size_t keylen, | |
| const char *comment, size_t commentlen, int typemask, | |
| struct libssh2_knownhost **store); | |
| /* | |
| * libssh2_knownhost_check() | |
| * | |
| * Check a host and its associated key against the collection of known hosts. | |
| * | |
| * The type is the type/format of the given host name. | |
| * | |
| * plain - ascii "hostname.domain.tld" | |
| * custom - prehashed base64 encoded. Note that this cannot use any salts. | |
| * | |
| * | |
| * 'knownhost' may be set to NULL if you don't care about that info. | |
| * | |
| * Returns: | |
| * | |
| * LIBSSH2_KNOWNHOST_CHECK_* values, see below | |
| * | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *host, const char *key, size_t keylen, | |
| int typemask, | |
| struct libssh2_knownhost **knownhost); | |
| /* this function is identital to the above one, but also takes a port | |
| argument that allows libssh2 to do a better check */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *host, int port, | |
| const char *key, size_t keylen, | |
| int typemask, | |
| struct libssh2_knownhost **knownhost); | |
| /* | |
| * libssh2_knownhost_del() | |
| * | |
| * Remove a host from the collection of known hosts. The 'entry' struct is | |
| * retrieved by a call to libssh2_knownhost_check(). | |
| * | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts, | |
| struct libssh2_knownhost *entry); | |
| /* | |
| * libssh2_knownhost_free() | |
| * | |
| * Free an entire collection of known hosts. | |
| * | |
| */ | |
| LIBSSH2_API void | |
| libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts); | |
| /* | |
| * libssh2_knownhost_readline() | |
| * | |
| * Pass in a line of a file of 'type'. It makes libssh2 read this line. | |
| * | |
| * LIBSSH2_KNOWNHOST_FILE_OPENSSH is the only supported type. | |
| * | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *line, size_t len, int type); | |
| /* | |
| * libssh2_knownhost_readfile() | |
| * | |
| * Add hosts+key pairs from a given file. | |
| * | |
| * Returns a negative value for error or number of successfully added hosts. | |
| * | |
| * This implementation currently only knows one 'type' (openssh), all others | |
| * are reserved for future use. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *filename, int type); | |
| /* | |
| * libssh2_knownhost_writeline() | |
| * | |
| * Ask libssh2 to convert a known host to an output line for storage. | |
| * | |
| * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given | |
| * output buffer is too small to hold the desired output. | |
| * | |
| * This implementation currently only knows one 'type' (openssh), all others | |
| * are reserved for future use. | |
| * | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, | |
| struct libssh2_knownhost *known, | |
| char *buffer, size_t buflen, | |
| size_t *outlen, /* the amount of written data */ | |
| int type); | |
| /* | |
| * libssh2_knownhost_writefile() | |
| * | |
| * Write hosts+key pairs to a given file. | |
| * | |
| * This implementation currently only knows one 'type' (openssh), all others | |
| * are reserved for future use. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts, | |
| const char *filename, int type); | |
| /* | |
| * libssh2_knownhost_get() | |
| * | |
| * Traverse the internal list of known hosts. Pass NULL to 'prev' to get | |
| * the first one. Or pass a pointer to the previously returned one to get the | |
| * next. | |
| * | |
| * Returns: | |
| * 0 if a fine host was stored in 'store' | |
| * 1 if end of hosts | |
| * [negative] on errors | |
| */ | |
| LIBSSH2_API int | |
| libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts, | |
| struct libssh2_knownhost **store, | |
| struct libssh2_knownhost *prev); | |
| struct libssh2_agent_publickey { | |
| unsigned int magic; /* magic stored by the library */ | |
| void *node; /* handle to the internal representation of key */ | |
| unsigned char *blob; /* public key blob */ | |
| size_t blob_len; /* length of the public key blob */ | |
| char *comment; /* comment in printable format */ | |
| }; | |
| /* | |
| * libssh2_agent_init() | |
| * | |
| * Init an ssh-agent handle. Returns the pointer to the handle. | |
| * | |
| */ | |
| LIBSSH2_API LIBSSH2_AGENT * | |
| libssh2_agent_init(LIBSSH2_SESSION *session); | |
| /* | |
| * libssh2_agent_connect() | |
| * | |
| * Connect to an ssh-agent. | |
| * | |
| * Returns 0 if succeeded, or a negative value for error. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_connect(LIBSSH2_AGENT *agent); | |
| /* | |
| * libssh2_agent_list_identities() | |
| * | |
| * Request an ssh-agent to list identities. | |
| * | |
| * Returns 0 if succeeded, or a negative value for error. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_list_identities(LIBSSH2_AGENT *agent); | |
| /* | |
| * libssh2_agent_get_identity() | |
| * | |
| * Traverse the internal list of public keys. Pass NULL to 'prev' to get | |
| * the first one. Or pass a pointer to the previously returned one to get the | |
| * next. | |
| * | |
| * Returns: | |
| * 0 if a fine public key was stored in 'store' | |
| * 1 if end of public keys | |
| * [negative] on errors | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_get_identity(LIBSSH2_AGENT *agent, | |
| struct libssh2_agent_publickey **store, | |
| struct libssh2_agent_publickey *prev); | |
| /* | |
| * libssh2_agent_userauth() | |
| * | |
| * Do publickey user authentication with the help of ssh-agent. | |
| * | |
| * Returns 0 if succeeded, or a negative value for error. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_userauth(LIBSSH2_AGENT *agent, | |
| const char *username, | |
| struct libssh2_agent_publickey *identity); | |
| /* | |
| * libssh2_agent_sign() | |
| * | |
| * Sign a payload using a system-installed ssh-agent. | |
| * | |
| * Returns 0 if succeeded, or a negative value for error. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_sign(LIBSSH2_AGENT *agent, | |
| struct libssh2_agent_publickey *identity, | |
| unsigned char **sig, | |
| size_t *s_len, | |
| const unsigned char *data, | |
| size_t d_len, | |
| const char *method, | |
| unsigned int method_len); | |
| /* | |
| * libssh2_agent_disconnect() | |
| * | |
| * Close a connection to an ssh-agent. | |
| * | |
| * Returns 0 if succeeded, or a negative value for error. | |
| */ | |
| LIBSSH2_API int | |
| libssh2_agent_disconnect(LIBSSH2_AGENT *agent); | |
| /* | |
| * libssh2_agent_free() | |
| * | |
| * Free an ssh-agent handle. This function also frees the internal | |
| * collection of public keys. | |
| */ | |
| LIBSSH2_API void | |
| libssh2_agent_free(LIBSSH2_AGENT *agent); | |
| /* | |
| * libssh2_agent_set_identity_path() | |
| * | |
| * Allows a custom agent identity socket path beyond SSH_AUTH_SOCK env | |
| * | |
| */ | |
| LIBSSH2_API void | |
| libssh2_agent_set_identity_path(LIBSSH2_AGENT *agent, | |
| const char *path); | |
| /* | |
| * libssh2_agent_get_identity_path() | |
| * | |
| * Returns the custom agent identity socket path if set | |
| * | |
| */ | |
| LIBSSH2_API const char * | |
| libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent); | |
| /* | |
| * libssh2_keepalive_config() | |
| * | |
| * Set how often keepalive messages should be sent. WANT_REPLY | |
| * indicates whether the keepalive messages should request a response | |
| * from the server. INTERVAL is number of seconds that can pass | |
| * without any I/O, use 0 (the default) to disable keepalives. To | |
| * avoid some busy-loop corner-cases, if you specify an interval of 1 | |
| * it will be treated as 2. | |
| * | |
| * Note that non-blocking applications are responsible for sending the | |
| * keepalive messages using libssh2_keepalive_send(). | |
| */ | |
| LIBSSH2_API void libssh2_keepalive_config(LIBSSH2_SESSION *session, | |
| int want_reply, | |
| unsigned int interval); | |
| /* | |
| * libssh2_keepalive_send() | |
| * | |
| * Send a keepalive message if needed. SECONDS_TO_NEXT indicates how | |
| * many seconds you can sleep after this call before you need to call | |
| * it again. Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on | |
| * I/O errors. | |
| */ | |
| LIBSSH2_API int libssh2_keepalive_send(LIBSSH2_SESSION *session, | |
| int *seconds_to_next); | |
| /* NOTE NOTE NOTE | |
| libssh2_trace() has no function in builds that aren't built with debug | |
| enabled | |
| */ | |
| LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask); | |
| typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*, | |
| void *, | |
| const char *, | |
| size_t); | |
| LIBSSH2_API int libssh2_trace_sethandler(LIBSSH2_SESSION *session, | |
| void *context, | |
| libssh2_trace_handler_func callback); | |
| } /* extern "C" */ | |
Xet Storage Details
- Size:
- 60.7 kB
- Xet hash:
- c6111c21cb7b9832441ebfc85fdb7fbe060b2e0bc33f7c8236d8f6a200519ab9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.