1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-07 08:02:56 +03:00

include: indentation fixes

This commit is contained in:
Viktor Szakats
2023-04-10 23:08:22 +00:00
committed by Viktor Szakats
parent 0924632fa0
commit 504026262d
3 changed files with 136 additions and 124 deletions

View File

@@ -289,22 +289,24 @@ typedef struct _LIBSSH2_SK_SIG_INFO {
/* 'publickey' authentication callback */ /* 'publickey' authentication callback */
#define LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC(name) \ #define LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC(name) \
int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, \ int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, \
const unsigned char *data, size_t data_len, void **abstract) const unsigned char *data, size_t data_len, void **abstract)
/* 'keyboard-interactive' authentication callback */ /* 'keyboard-interactive' authentication callback */
#define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \ #define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \
void name_(const char *name, int name_len, const char *instruction, \ void name_(const char *name, int name_len, const char *instruction, \
int instruction_len, int num_prompts, \ int instruction_len, int num_prompts, \
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, \ const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, \
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, void **abstract) LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, void **abstract)
/* SK authentication callback */ /* SK authentication callback */
#define LIBSSH2_USERAUTH_SK_SIGN_FUNC(name) \ #define LIBSSH2_USERAUTH_SK_SIGN_FUNC(name) \
int name(LIBSSH2_SESSION *session, LIBSSH2_SK_SIG_INFO *sig_info, \ int name(LIBSSH2_SESSION *session, LIBSSH2_SK_SIG_INFO *sig_info, \
const unsigned char *data, size_t data_len, int algorithm, uint8_t flags, \ const unsigned char *data, size_t data_len, \
const char *application, const unsigned char *key_handle, size_t handle_len, \ int algorithm, uint8_t flags, \
void **abstract) const char *application, const unsigned char *key_handle, \
size_t handle_len, \
void **abstract)
/* Flags for SK authentication */ /* Flags for SK authentication */
#define LIBSSH2_SK_PRESENCE_REQUIRED 0x01 #define LIBSSH2_SK_PRESENCE_REQUIRED 0x01
@@ -312,34 +314,36 @@ void **abstract)
/* Callbacks for special SSH packets */ /* Callbacks for special SSH packets */
#define LIBSSH2_IGNORE_FUNC(name) \ #define LIBSSH2_IGNORE_FUNC(name) \
void name(LIBSSH2_SESSION *session, const char *message, int message_len, \ void name(LIBSSH2_SESSION *session, const char *message, int message_len, \
void **abstract) void **abstract)
#define LIBSSH2_DEBUG_FUNC(name) \ #define LIBSSH2_DEBUG_FUNC(name) \
void name(LIBSSH2_SESSION *session, int always_display, const char *message, \ void name(LIBSSH2_SESSION *session, int always_display, \
int message_len, const char *language, int language_len, \ const char *message, int message_len, \
void **abstract) const char *language, int language_len, \
void **abstract)
#define LIBSSH2_DISCONNECT_FUNC(name) \ #define LIBSSH2_DISCONNECT_FUNC(name) \
void name(LIBSSH2_SESSION *session, int reason, const char *message, \ void name(LIBSSH2_SESSION *session, int reason, \
int message_len, const char *language, int language_len, \ const char *message, int message_len, \
void **abstract) const char *language, int language_len, \
void **abstract)
#define LIBSSH2_PASSWD_CHANGEREQ_FUNC(name) \ #define LIBSSH2_PASSWD_CHANGEREQ_FUNC(name) \
void name(LIBSSH2_SESSION *session, char **newpw, int *newpw_len, \ void name(LIBSSH2_SESSION *session, char **newpw, int *newpw_len, \
void **abstract) void **abstract)
#define LIBSSH2_MACERROR_FUNC(name) \ #define LIBSSH2_MACERROR_FUNC(name) \
int name(LIBSSH2_SESSION *session, const char *packet, int packet_len, \ int name(LIBSSH2_SESSION *session, const char *packet, int packet_len, \
void **abstract) void **abstract)
#define LIBSSH2_X11_OPEN_FUNC(name) \ #define LIBSSH2_X11_OPEN_FUNC(name) \
void name(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel, \ void name(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel, \
const char *shost, int sport, void **abstract) const char *shost, int sport, void **abstract)
#define LIBSSH2_CHANNEL_CLOSE_FUNC(name) \ #define LIBSSH2_CHANNEL_CLOSE_FUNC(name) \
void name(LIBSSH2_SESSION *session, void **session_abstract, \ void name(LIBSSH2_SESSION *session, void **session_abstract, \
LIBSSH2_CHANNEL *channel, void **channel_abstract) LIBSSH2_CHANNEL *channel, void **channel_abstract)
/* I/O callbacks */ /* I/O callbacks */
#define LIBSSH2_RECV_FUNC(name) \ #define LIBSSH2_RECV_FUNC(name) \
@@ -618,8 +622,8 @@ LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session,
const char *description, const char *description,
const char *lang); const char *lang);
#define libssh2_session_disconnect(session, description) \ #define libssh2_session_disconnect(session, description) \
libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, \ libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, \
(description), "") (description), "")
LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session);
@@ -662,12 +666,13 @@ libssh2_userauth_password_ex(LIBSSH2_SESSION *session,
const char *password, const char *password,
unsigned int password_len, unsigned int password_len,
LIBSSH2_PASSWD_CHANGEREQ_FUNC LIBSSH2_PASSWD_CHANGEREQ_FUNC
((*passwd_change_cb))); ((*passwd_change_cb)));
#define libssh2_userauth_password(session, username, password) \ #define libssh2_userauth_password(session, username, password) \
libssh2_userauth_password_ex((session), (username), \ libssh2_userauth_password_ex((session), (username), \
(unsigned int)strlen(username), \ (unsigned int)strlen(username), \
(password), (unsigned int)strlen(password), NULL) (password), (unsigned int)strlen(password), \
NULL)
LIBSSH2_API int LIBSSH2_API int
libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
@@ -677,11 +682,11 @@ libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
const char *privatekey, const char *privatekey,
const char *passphrase); const char *passphrase);
#define libssh2_userauth_publickey_fromfile(session, username, publickey, \ #define libssh2_userauth_publickey_fromfile(session, username, publickey, \
privatekey, passphrase) \ privatekey, passphrase) \
libssh2_userauth_publickey_fromfile_ex((session), (username), \ libssh2_userauth_publickey_fromfile_ex((session), (username), \
(unsigned int)strlen(username), \ (unsigned int)strlen(username), \
(publickey), \ (publickey), \
(privatekey), (passphrase)) (privatekey), (passphrase))
LIBSSH2_API int LIBSSH2_API int
@@ -690,7 +695,7 @@ libssh2_userauth_publickey(LIBSSH2_SESSION *session,
const unsigned char *pubkeydata, const unsigned char *pubkeydata,
size_t pubkeydata_len, size_t pubkeydata_len,
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC
((*sign_callback)), ((*sign_callback)),
void **abstract); void **abstract);
LIBSSH2_API int LIBSSH2_API int
@@ -705,16 +710,16 @@ libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session,
const char *local_username, const char *local_username,
unsigned int local_username_len); unsigned int local_username_len);
#define libssh2_userauth_hostbased_fromfile(session, username, publickey, \ #define libssh2_userauth_hostbased_fromfile(session, username, publickey, \
privatekey, passphrase, hostname) \ privatekey, passphrase, hostname) \
libssh2_userauth_hostbased_fromfile_ex((session), (username), \ libssh2_userauth_hostbased_fromfile_ex((session), (username), \
(unsigned int)strlen(username), \ (unsigned int)strlen(username), \
(publickey), \ (publickey), \
(privatekey), (passphrase), \ (privatekey), (passphrase), \
(hostname), \ (hostname), \
(unsigned int)strlen(hostname), \ (unsigned int)strlen(hostname), \
(username), \ (username), \
(unsigned int)strlen(username)) (unsigned int)strlen(username))
LIBSSH2_API int LIBSSH2_API int
libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session,
@@ -736,12 +741,12 @@ LIBSSH2_API int
libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION* session, libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION* session,
const char *username, const char *username,
unsigned int username_len, unsigned int username_len,
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC( LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC
(*response_callback))); ((*response_callback)));
#define libssh2_userauth_keyboard_interactive(session, username, \ #define libssh2_userauth_keyboard_interactive(session, username, \
response_callback) \ response_callback) \
libssh2_userauth_keyboard_interactive_ex((session), (username), \ libssh2_userauth_keyboard_interactive_ex((session), (username), \
(unsigned int)strlen(username), \ (unsigned int)strlen(username), \
(response_callback)) (response_callback))
@@ -753,7 +758,7 @@ libssh2_userauth_publickey_sk(LIBSSH2_SESSION *session,
size_t privatekeydata_len, size_t privatekeydata_len,
const char *passphrase, const char *passphrase,
LIBSSH2_USERAUTH_SK_SIGN_FUNC LIBSSH2_USERAUTH_SK_SIGN_FUNC
((*sign_callback)), ((*sign_callback)),
void **abstract); void **abstract);
LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds,
@@ -781,15 +786,15 @@ libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type,
const char *message, unsigned int message_len); const char *message, unsigned int message_len);
#define libssh2_channel_open_session(session) \ #define libssh2_channel_open_session(session) \
libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \ libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \
LIBSSH2_CHANNEL_WINDOW_DEFAULT, \ LIBSSH2_CHANNEL_WINDOW_DEFAULT, \
LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0) LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0)
LIBSSH2_API LIBSSH2_CHANNEL * LIBSSH2_API LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host,
int port, const char *shost, int sport); int port, const char *shost, int sport);
#define libssh2_channel_direct_tcpip(session, host, port) \ #define libssh2_channel_direct_tcpip(session, host, port) \
libssh2_channel_direct_tcpip_ex((session), (host), (port), "127.0.0.1", 22) libssh2_channel_direct_tcpip_ex((session), (host), (port), "127.0.0.1", 22)
LIBSSH2_API LIBSSH2_CHANNEL * LIBSSH2_API LIBSSH2_CHANNEL *
libssh2_channel_direct_streamlocal_ex(LIBSSH2_SESSION * session, libssh2_channel_direct_streamlocal_ex(LIBSSH2_SESSION * session,
@@ -801,7 +806,7 @@ libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host,
int port, int *bound_port, int port, int *bound_port,
int queue_maxsize); int queue_maxsize);
#define libssh2_channel_forward_listen(session, port) \ #define libssh2_channel_forward_listen(session, port) \
libssh2_channel_forward_listen_ex((session), NULL, (port), NULL, 16) libssh2_channel_forward_listen_ex((session), NULL, (port), NULL, 16)
LIBSSH2_API int libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); LIBSSH2_API int libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
@@ -842,7 +847,7 @@ LIBSSH2_API int libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel,
int width_px, int width_px,
int height_px); int height_px);
#define libssh2_channel_request_pty_size(channel, width, height) \ #define libssh2_channel_request_pty_size(channel, width, height) \
libssh2_channel_request_pty_size_ex((channel), (width), (height), 0, 0) libssh2_channel_request_pty_size_ex((channel), (width), (height), 0, 0)
LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel,
int single_connection, int single_connection,
@@ -850,7 +855,7 @@ LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel,
const char *auth_cookie, const char *auth_cookie,
int screen_number); int screen_number);
#define libssh2_channel_x11_req(channel, screen_number) \ #define libssh2_channel_x11_req(channel, screen_number) \
libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number)) libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number))
LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *request, const char *request,
@@ -858,23 +863,25 @@ LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *message, const char *message,
unsigned int message_len); unsigned int message_len);
#define libssh2_channel_shell(channel) \ #define libssh2_channel_shell(channel) \
libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, \ libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, \
NULL, 0) NULL, 0)
#define libssh2_channel_exec(channel, command) \ #define libssh2_channel_exec(channel, command) \
libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, \ libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, \
(command), (unsigned int)strlen(command)) (command), (unsigned int)strlen(command))
#define libssh2_channel_subsystem(channel, subsystem) \ #define libssh2_channel_subsystem(channel, subsystem) \
libssh2_channel_process_startup((channel), "subsystem", \ libssh2_channel_process_startup((channel), "subsystem", \
sizeof("subsystem") - 1, (subsystem), \ sizeof("subsystem") - 1, (subsystem), \
(unsigned int)strlen(subsystem)) (unsigned int)strlen(subsystem))
LIBSSH2_API ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, LIBSSH2_API ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel,
int stream_id, char *buf, int stream_id, char *buf,
size_t buflen); size_t buflen);
#define libssh2_channel_read(channel, buf, buflen) \ #define libssh2_channel_read(channel, buf, buflen) \
libssh2_channel_read_ex((channel), 0, (buf), (buflen)) libssh2_channel_read_ex((channel), 0, \
(buf), (buflen))
#define libssh2_channel_read_stderr(channel, buf, buflen) \ #define libssh2_channel_read_stderr(channel, buf, buflen) \
libssh2_channel_read_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen)) libssh2_channel_read_ex((channel), SSH_EXTENDED_DATA_STDERR, \
(buf), (buflen))
LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel,
int extended); int extended);
@@ -884,9 +891,9 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
unsigned long *read_avail, unsigned long *read_avail,
unsigned long *window_size_initial); unsigned long *window_size_initial);
#define libssh2_channel_window_read(channel) \ #define libssh2_channel_window_read(channel) \
libssh2_channel_window_read_ex((channel), NULL, NULL) libssh2_channel_window_read_ex((channel), NULL, NULL)
/* libssh2_channel_receive_window_adjust is DEPRECATED, do not use! */ /* libssh2_channel_receive_window_adjust() is DEPRECATED, do not use! */
LIBSSH2_API unsigned long LIBSSH2_API unsigned long
libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel,
unsigned long adjustment, unsigned long adjustment,
@@ -903,16 +910,17 @@ LIBSSH2_API ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel,
size_t buflen); size_t buflen);
#define libssh2_channel_write(channel, buf, buflen) \ #define libssh2_channel_write(channel, buf, buflen) \
libssh2_channel_write_ex((channel), 0, (buf), (buflen)) libssh2_channel_write_ex((channel), 0, \
#define libssh2_channel_write_stderr(channel, buf, buflen) \ (buf), (buflen))
libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, \ #define libssh2_channel_write_stderr(channel, buf, buflen) \
libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, \
(buf), (buflen)) (buf), (buflen))
LIBSSH2_API unsigned long LIBSSH2_API unsigned long
libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel, libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
unsigned long *window_size_initial); unsigned long *window_size_initial);
#define libssh2_channel_window_write(channel) \ #define libssh2_channel_window_write(channel) \
libssh2_channel_window_write_ex((channel), NULL) libssh2_channel_window_write_ex((channel), NULL)
LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session, LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session,
int blocking); int blocking);
@@ -929,7 +937,7 @@ LIBSSH2_API void libssh2_session_set_read_timeout(LIBSSH2_SESSION* session,
long timeout); long timeout);
LIBSSH2_API long libssh2_session_get_read_timeout(LIBSSH2_SESSION* session); LIBSSH2_API long libssh2_session_get_read_timeout(LIBSSH2_SESSION* session);
/* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */ /* libssh2_channel_handle_extended_data() is DEPRECATED, do not use! */
LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
int ignore_mode); int ignore_mode);
LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
@@ -943,9 +951,8 @@ LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
* (FIFO) from the standard data channel * (FIFO) from the standard data channel
*/ */
/* DEPRECATED */ /* DEPRECATED */
#define libssh2_channel_ignore_extended_data(channel, ignore) \ #define libssh2_channel_ignore_extended_data(channel, ignore) \
libssh2_channel_handle_extended_data((channel), \ libssh2_channel_handle_extended_data((channel), (ignore) ? \
(ignore) ? \
LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \ LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \
LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL) LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL)
@@ -955,7 +962,7 @@ LIBSSH2_API int libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel,
int streamid); int streamid);
#define libssh2_channel_flush(channel) libssh2_channel_flush_ex((channel), 0) #define libssh2_channel_flush(channel) libssh2_channel_flush_ex((channel), 0)
#define libssh2_channel_flush_stderr(channel) \ #define libssh2_channel_flush_stderr(channel) \
libssh2_channel_flush_ex((channel), SSH_EXTENDED_DATA_STDERR) libssh2_channel_flush_ex((channel), SSH_EXTENDED_DATA_STDERR)
LIBSSH2_API int libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel); LIBSSH2_API int libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel);
LIBSSH2_API int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL* channel, LIBSSH2_API int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL* channel,
@@ -976,7 +983,7 @@ LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel);
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session,
const char *path, const char *path,
struct stat *sb); struct stat *sb);
/* Use libssh2_scp_recv2 for large (> 2GB) file support on windows */ /* Use libssh2_scp_recv2() for large (> 2GB) file support on windows */
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session, LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session,
const char *path, const char *path,
libssh2_struct_stat *sb); libssh2_struct_stat *sb);
@@ -989,7 +996,7 @@ libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
libssh2_int64_t size, time_t mtime, time_t atime); libssh2_int64_t size, time_t mtime, time_t atime);
#define libssh2_scp_send(session, path, mode, size) \ #define libssh2_scp_send(session, path, mode, size) \
libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0) libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
unsigned int *dest_len, unsigned int *dest_len,
@@ -1023,7 +1030,7 @@ struct libssh2_knownhost {
}; };
/* /*
* libssh2_knownhost_init * libssh2_knownhost_init()
* *
* Init a collection of known hosts. Returns the pointer to a collection. * Init a collection of known hosts. Returns the pointer to a collection.
* *
@@ -1032,7 +1039,7 @@ LIBSSH2_API LIBSSH2_KNOWNHOSTS *
libssh2_knownhost_init(LIBSSH2_SESSION *session); libssh2_knownhost_init(LIBSSH2_SESSION *session);
/* /*
* libssh2_knownhost_add * libssh2_knownhost_add()
* *
* Add a host and its associated key to the collection of known hosts. * Add a host and its associated key to the collection of known hosts.
* *
@@ -1084,7 +1091,7 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost **store); struct libssh2_knownhost **store);
/* /*
* libssh2_knownhost_addc * libssh2_knownhost_addc()
* *
* Add a host and its associated key to the collection of known hosts. * Add a host and its associated key to the collection of known hosts.
* *
@@ -1102,8 +1109,8 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
* If 'sha1' is selected as type, the salt must be provided to the salt * If 'sha1' is selected as type, the salt must be provided to the salt
* argument. This too base64 encoded. * argument. This too base64 encoded.
* *
* The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. If * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files.
* a custom type is used, salt is ignored and you must provide the host * 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. * 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 * The keylen parameter may be omitted (zero) if the key is provided as a
@@ -1119,7 +1126,7 @@ libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost **store); struct libssh2_knownhost **store);
/* /*
* libssh2_knownhost_check * libssh2_knownhost_check()
* *
* Check a host and its associated key against the collection of known hosts. * Check a host and its associated key against the collection of known hosts.
* *
@@ -1158,7 +1165,7 @@ libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost **knownhost); struct libssh2_knownhost **knownhost);
/* /*
* libssh2_knownhost_del * libssh2_knownhost_del()
* *
* Remove a host from the collection of known hosts. The 'entry' struct is * Remove a host from the collection of known hosts. The 'entry' struct is
* retrieved by a call to libssh2_knownhost_check(). * retrieved by a call to libssh2_knownhost_check().
@@ -1169,7 +1176,7 @@ libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost *entry); struct libssh2_knownhost *entry);
/* /*
* libssh2_knownhost_free * libssh2_knownhost_free()
* *
* Free an entire collection of known hosts. * Free an entire collection of known hosts.
* *
@@ -1190,7 +1197,7 @@ libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts,
const char *line, size_t len, int type); const char *line, size_t len, int type);
/* /*
* libssh2_knownhost_readfile * libssh2_knownhost_readfile()
* *
* Add hosts+key pairs from a given file. * Add hosts+key pairs from a given file.
* *
@@ -1226,7 +1233,7 @@ libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
int type); int type);
/* /*
* libssh2_knownhost_writefile * libssh2_knownhost_writefile()
* *
* Write hosts+key pairs to a given file. * Write hosts+key pairs to a given file.
* *
@@ -1266,7 +1273,7 @@ struct libssh2_agent_publickey {
}; };
/* /*
* libssh2_agent_init * libssh2_agent_init()
* *
* Init an ssh-agent handle. Returns the pointer to the handle. * Init an ssh-agent handle. Returns the pointer to the handle.
* *
@@ -1308,8 +1315,8 @@ libssh2_agent_list_identities(LIBSSH2_AGENT *agent);
*/ */
LIBSSH2_API int LIBSSH2_API int
libssh2_agent_get_identity(LIBSSH2_AGENT *agent, libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey **store, struct libssh2_agent_publickey **store,
struct libssh2_agent_publickey *prev); struct libssh2_agent_publickey *prev);
/* /*
* libssh2_agent_userauth() * libssh2_agent_userauth()
@@ -1320,8 +1327,8 @@ libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
*/ */
LIBSSH2_API int LIBSSH2_API int
libssh2_agent_userauth(LIBSSH2_AGENT *agent, libssh2_agent_userauth(LIBSSH2_AGENT *agent,
const char *username, const char *username,
struct libssh2_agent_publickey *identity); struct libssh2_agent_publickey *identity);
/* /*
* libssh2_agent_disconnect() * libssh2_agent_disconnect()
@@ -1394,15 +1401,15 @@ LIBSSH2_API int libssh2_keepalive_send(LIBSSH2_SESSION *session,
enabled enabled
*/ */
LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask); LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask);
#define LIBSSH2_TRACE_TRANS (1<<1) #define LIBSSH2_TRACE_TRANS (1<<1)
#define LIBSSH2_TRACE_KEX (1<<2) #define LIBSSH2_TRACE_KEX (1<<2)
#define LIBSSH2_TRACE_AUTH (1<<3) #define LIBSSH2_TRACE_AUTH (1<<3)
#define LIBSSH2_TRACE_CONN (1<<4) #define LIBSSH2_TRACE_CONN (1<<4)
#define LIBSSH2_TRACE_SCP (1<<5) #define LIBSSH2_TRACE_SCP (1<<5)
#define LIBSSH2_TRACE_SFTP (1<<6) #define LIBSSH2_TRACE_SFTP (1<<6)
#define LIBSSH2_TRACE_ERROR (1<<7) #define LIBSSH2_TRACE_ERROR (1<<7)
#define LIBSSH2_TRACE_PUBLICKEY (1<<8) #define LIBSSH2_TRACE_PUBLICKEY (1<<8)
#define LIBSSH2_TRACE_SOCKET (1<<9) #define LIBSSH2_TRACE_SOCKET (1<<9)
typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*, typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*,
void *, void *,

View File

@@ -72,9 +72,9 @@ typedef struct _libssh2_publickey_list {
/* Generally use the first macro here, but if both name and value are string /* Generally use the first macro here, but if both name and value are string
literals, you can use _fast() to take advantage of preprocessing */ literals, you can use _fast() to take advantage of preprocessing */
#define libssh2_publickey_attribute(name, value, mandatory) \ #define libssh2_publickey_attribute(name, value, mandatory) \
{ (name), strlen(name), (value), strlen(value), (mandatory) }, { (name), strlen(name), (value), strlen(value), (mandatory) },
#define libssh2_publickey_attribute_fast(name, value, mandatory) \ #define libssh2_publickey_attribute_fast(name, value, mandatory) \
{ (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) }, { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) },
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -92,10 +92,12 @@ libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey,
unsigned long blob_len, char overwrite, unsigned long blob_len, char overwrite,
unsigned long num_attrs, unsigned long num_attrs,
const libssh2_publickey_attribute attrs[]); const libssh2_publickey_attribute attrs[]);
#define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \ #define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \
num_attrs, attrs) \ num_attrs, attrs) \
libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \ libssh2_publickey_add_ex((pkey), \
(overwrite), (num_attrs), (attrs)) (name), strlen(name), \
(blob), (blob_len), \
(overwrite), (num_attrs), (attrs))
LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey, LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey,
const unsigned char *name, const unsigned char *name,
@@ -103,7 +105,9 @@ LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey,
const unsigned char *blob, const unsigned char *blob,
unsigned long blob_len); unsigned long blob_len);
#define libssh2_publickey_remove(pkey, name, blob, blob_len) \ #define libssh2_publickey_remove(pkey, name, blob, blob_len) \
libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len)) libssh2_publickey_remove_ex((pkey), \
(name), strlen(name), \
(blob), (blob_len))
LIBSSH2_API int LIBSSH2_API int
libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey, libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey,
@@ -119,4 +123,4 @@ LIBSSH2_API int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey);
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* ifndef: LIBSSH2_PUBLICKEY_H */ #endif /* LIBSSH2_PUBLICKEY_H */

View File

@@ -165,19 +165,19 @@ struct _LIBSSH2_SFTP_STATVFS {
/* macros to check for specific file types, added in 1.2.5 */ /* macros to check for specific file types, added in 1.2.5 */
#define LIBSSH2_SFTP_S_ISLNK(m) \ #define LIBSSH2_SFTP_S_ISLNK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFLNK) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFLNK)
#define LIBSSH2_SFTP_S_ISREG(m) \ #define LIBSSH2_SFTP_S_ISREG(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFREG) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFREG)
#define LIBSSH2_SFTP_S_ISDIR(m) \ #define LIBSSH2_SFTP_S_ISDIR(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFDIR) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFDIR)
#define LIBSSH2_SFTP_S_ISCHR(m) \ #define LIBSSH2_SFTP_S_ISCHR(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFCHR) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFCHR)
#define LIBSSH2_SFTP_S_ISBLK(m) \ #define LIBSSH2_SFTP_S_ISBLK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFBLK) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFBLK)
#define LIBSSH2_SFTP_S_ISFIFO(m) \ #define LIBSSH2_SFTP_S_ISFIFO(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFIFO) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFIFO)
#define LIBSSH2_SFTP_S_ISSOCK(m) \ #define LIBSSH2_SFTP_S_ISSOCK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK) (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK)
/* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open()) /* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open())
* Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */ * Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */
@@ -230,13 +230,14 @@ libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp,
unsigned int filename_len, unsigned int filename_len,
unsigned long flags, unsigned long flags,
long mode, int open_type); long mode, int open_type);
#define libssh2_sftp_open(sftp, filename, flags, mode) \ #define libssh2_sftp_open(sftp, filename, flags, mode) \
libssh2_sftp_open_ex((sftp), \ libssh2_sftp_open_ex((sftp), \
(filename), (unsigned int)strlen(filename), \ (filename), (unsigned int)strlen(filename), \
(flags), (mode), LIBSSH2_SFTP_OPENFILE) (flags), (mode), LIBSSH2_SFTP_OPENFILE)
#define libssh2_sftp_opendir(sftp, path) \ #define libssh2_sftp_opendir(sftp, path) \
libssh2_sftp_open_ex((sftp), (path), (unsigned int)strlen(path), 0, 0, \ libssh2_sftp_open_ex((sftp), \
LIBSSH2_SFTP_OPENDIR) (path), (unsigned int)strlen(path), \
0, 0, LIBSSH2_SFTP_OPENDIR)
LIBSSH2_API ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_API ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle,
char *buffer, size_t buffer_maxlen); char *buffer, size_t buffer_maxlen);
@@ -246,7 +247,7 @@ LIBSSH2_API int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, \
char *longentry, char *longentry,
size_t longentry_maxlen, size_t longentry_maxlen,
LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_SFTP_ATTRIBUTES *attrs);
#define libssh2_sftp_readdir(handle, buffer, buffer_maxlen, attrs) \ #define libssh2_sftp_readdir(handle, buffer, buffer_maxlen, attrs) \
libssh2_sftp_readdir_ex((handle), (buffer), (buffer_maxlen), NULL, 0, \ libssh2_sftp_readdir_ex((handle), (buffer), (buffer_maxlen), NULL, 0, \
(attrs)) (attrs))