diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-31 19:13:48 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-31 19:13:48 +0300 |
commit | a5b576429205ffa3c9397614ea31363b31944e79 (patch) | |
tree | f5b92958748d66556f0f6af0b313ce42d8ad8903 /libs/libssh2/include | |
parent | 4ce9ed24b5fabd39d82aaf81147377f3906dec3b (diff) |
libssh2: update to 1.11
Diffstat (limited to 'libs/libssh2/include')
-rw-r--r-- | libs/libssh2/include/libssh2.h | 89 | ||||
-rw-r--r-- | libs/libssh2/include/libssh2_sftp.h | 2 |
2 files changed, 71 insertions, 20 deletions
diff --git a/libs/libssh2/include/libssh2.h b/libs/libssh2/include/libssh2.h index fb760dd2fb..8bc8a1380e 100644 --- a/libs/libssh2/include/libssh2.h +++ b/libs/libssh2/include/libssh2.h @@ -90,11 +90,7 @@ extern "C" { #endif -#if defined(_WIN32) || defined(WIN32) -#define LIBSSH2_WIN32 -#endif - -#ifdef LIBSSH2_WIN32 +#ifdef _WIN32 # include <basetsd.h> # include <winsock2.h> #endif @@ -106,8 +102,8 @@ extern "C" { /* Allow alternate API prefix from CFLAGS or calling app */ #ifndef LIBSSH2_API -# ifdef LIBSSH2_WIN32 -# if defined(LIBSSH2_EXPORTS) || defined(DLL_EXPORT) || defined(_WINDLL) +# ifdef _WIN32 +# if defined(LIBSSH2_EXPORTS) || defined(_WINDLL) # ifdef LIBSSH2_LIBRARY # define LIBSSH2_API __declspec(dllexport) # else @@ -116,9 +112,9 @@ extern "C" { # else # define LIBSSH2_API # endif -# else /* !LIBSSH2_WIN32 */ +# else /* !_WIN32 */ # define LIBSSH2_API -# endif /* LIBSSH2_WIN32 */ +# endif /* _WIN32 */ #endif /* LIBSSH2_API */ #ifdef HAVE_SYS_UIO_H @@ -144,13 +140,44 @@ typedef unsigned long long libssh2_uint64_t; typedef long long libssh2_int64_t; #endif -#ifdef LIBSSH2_WIN32 +#ifdef _WIN32 typedef SOCKET libssh2_socket_t; #define LIBSSH2_INVALID_SOCKET INVALID_SOCKET -#else /* !LIBSSH2_WIN32 */ +#define LIBSSH2_SOCKET_CLOSE(s) closesocket(s) +#else /* !_WIN32 */ typedef int libssh2_socket_t; #define LIBSSH2_INVALID_SOCKET -1 -#endif /* LIBSSH2_WIN32 */ +#define LIBSSH2_SOCKET_CLOSE(s) close(s) +#endif /* _WIN32 */ + +/* Compile-time deprecation macros */ +#if !defined(LIBSSH2_DISABLE_DEPRECATION) && !defined(LIBSSH2_LIBRARY) +# if defined(_MSC_VER) +# if _MSC_VER >= 1400 +# define LIBSSH2_DEPRECATED(version, message) \ + __declspec(deprecated("since libssh2 " # version ". " message)) +# elif _MSC_VER >= 1310 +# define LIBSSH2_DEPRECATED(version, message) \ + __declspec(deprecated) +# endif +# elif defined(__GNUC__) && !defined(__INTEL_COMPILER) +# if (defined(__clang__) && __clang_major__ >= 3) || \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +# define LIBSSH2_DEPRECATED(version, message) \ + __attribute__((deprecated("since libssh2 " # version ". " message))) +# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define LIBSSH2_DEPRECATED(version, message) \ + __attribute__((deprecated)) +# endif +# elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x5130 +# define LIBSSH2_DEPRECATED(version, message) \ + __attribute__((deprecated)) +# endif +#endif + +#ifndef LIBSSH2_DEPRECATED +#define LIBSSH2_DEPRECATED(version, message) +#endif /* * Determine whether there is small or large file support on windows. @@ -176,7 +203,7 @@ typedef int libssh2_socket_t; # undef LIBSSH2_USE_WIN32_LARGE_FILES #endif -#if defined(LIBSSH2_WIN32) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) && \ +#if defined(_WIN32) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) && \ !defined(LIBSSH2_USE_WIN32_SMALL_FILES) # define LIBSSH2_USE_WIN32_SMALL_FILES #endif @@ -283,6 +310,7 @@ typedef struct _LIBSSH2_SK_SIG_INFO { const unsigned char *data, size_t data_len, void **abstract) /* 'keyboard-interactive' authentication callback */ +/* FIXME: name_len, instruction_len -> size_t, num_prompts -> unsigned int? */ #define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \ void name_(const char *name, int name_len, const char *instruction, \ int instruction_len, int num_prompts, \ @@ -302,6 +330,8 @@ typedef struct _LIBSSH2_SK_SIG_INFO { #define LIBSSH2_SK_PRESENCE_REQUIRED 0x01 #define LIBSSH2_SK_VERIFICATION_REQUIRED 0x04 +/* FIXME: update lengths to size_t (or ssize_t): */ + /* Callbacks for special SSH packets */ #define LIBSSH2_IGNORE_FUNC(name) \ void name(LIBSSH2_SESSION *session, const char *message, int message_len, \ @@ -557,6 +587,9 @@ typedef struct _LIBSSH2_POLLFD { #define LIBSSH2_ERROR_RANDGEN -49 #define LIBSSH2_ERROR_MISSING_USERAUTH_BANNER -50 #define LIBSSH2_ERROR_ALGO_UNSUPPORTED -51 +#define LIBSSH2_ERROR_MAC_FAILURE -52 +#define LIBSSH2_ERROR_HASH_INIT -53 +#define LIBSSH2_ERROR_HASH_CALC -54 /* this is a define to provide the old (<= 1.2.7) name */ #define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV @@ -617,14 +650,25 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), 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); +#ifndef LIBSSH2_NO_DEPRECATED +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); +#endif LIBSSH2_API int libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t sock); LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, @@ -911,12 +955,13 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel, #define libssh2_channel_window_read(channel) \ libssh2_channel_window_read_ex((channel), NULL, NULL) -/* libssh2_channel_receive_window_adjust() is DEPRECATED, do not use! */ +#ifndef LIBSSH2_NO_DEPRECATED +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); - +#endif LIBSSH2_API int libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel, unsigned long adjustment, @@ -955,12 +1000,15 @@ 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_channel_handle_extended_data() is DEPRECATED, do not use! */ +#ifndef LIBSSH2_NO_DEPRECATED +LIBSSH2_DEPRECATED(1.1.0, "libssh2_channel_handle_extended_data2()") LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); +#endif LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, int ignore_mode); +#ifndef LIBSSH2_NO_DEPRECATED /* libssh2_channel_ignore_extended_data() is defined below for BC with version * 0.1 * @@ -968,11 +1016,12 @@ LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read * (FIFO) from the standard data channel */ -/* DEPRECATED */ +/* DEPRECATED since 0.3.0. Use libssh2_channel_handle_extended_data2(). */ #define libssh2_channel_ignore_extended_data(channel, ignore) \ libssh2_channel_handle_extended_data((channel), (ignore) ? \ LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \ LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL) +#endif #define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA -1 #define LIBSSH2_CHANNEL_FLUSH_ALL -2 @@ -997,10 +1046,12 @@ 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_scp_recv is DEPRECATED, do not use! */ +#ifndef LIBSSH2_NO_DEPRECATED +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); +#endif /* Use libssh2_scp_recv2() for large (> 2GB) file support on windows */ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, @@ -1420,7 +1471,7 @@ libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent); */ LIBSSH2_API void libssh2_keepalive_config(LIBSSH2_SESSION *session, int want_reply, - unsigned interval); + unsigned int interval); /* * libssh2_keepalive_send() diff --git a/libs/libssh2/include/libssh2_sftp.h b/libs/libssh2/include/libssh2_sftp.h index 8b41f1d7f1..9d7a8fbb66 100644 --- a/libs/libssh2/include/libssh2_sftp.h +++ b/libs/libssh2/include/libssh2_sftp.h @@ -42,7 +42,7 @@ #include "libssh2.h" -#ifndef LIBSSH2_WIN32 +#ifndef _WIN32 #include <unistd.h> #endif |