mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-05 20:55:47 +03:00
style: make includes and examples code style strict
make travis and the makefile rule verify them too Closes #334
This commit is contained in:
@@ -213,7 +213,8 @@ typedef off_t libssh2_struct_stat_size;
|
||||
|
||||
#ifndef LIBSSH2_STRUCT_STAT_SIZE_FORMAT
|
||||
# ifdef __VMS
|
||||
/* We have to roll our own format here because %z is a C99-ism we don't have. */
|
||||
/* We have to roll our own format here because %z is a C99-ism we don't
|
||||
have. */
|
||||
# if __USE_OFF64_T || __USING_STD_STAT
|
||||
# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%Ld"
|
||||
# else
|
||||
@@ -229,11 +230,11 @@ typedef off_t libssh2_struct_stat_size;
|
||||
/* Part of every banner, user specified or not */
|
||||
#define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION
|
||||
|
||||
/* We *could* add a comment here if we so chose */
|
||||
#define LIBSSH2_SSH_DEFAULT_BANNER LIBSSH2_SSH_BANNER
|
||||
#define LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF LIBSSH2_SSH_DEFAULT_BANNER "\r\n"
|
||||
#define LIBSSH2_SSH_DEFAULT_BANNER LIBSSH2_SSH_BANNER
|
||||
#define LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF LIBSSH2_SSH_DEFAULT_BANNER "\r\n"
|
||||
|
||||
/* Default generate and safe prime sizes for diffie-hellman-group-exchange-sha1 */
|
||||
/* Default generate and safe prime sizes for
|
||||
diffie-hellman-group-exchange-sha1 */
|
||||
#define LIBSSH2_DH_GEX_MINGROUP 1024
|
||||
#define LIBSSH2_DH_GEX_OPTGROUP 1536
|
||||
#define LIBSSH2_DH_GEX_MAXGROUP 2048
|
||||
@@ -269,14 +270,14 @@ typedef off_t libssh2_struct_stat_size;
|
||||
|
||||
typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT
|
||||
{
|
||||
char* text;
|
||||
char *text;
|
||||
unsigned int length;
|
||||
unsigned char echo;
|
||||
} LIBSSH2_USERAUTH_KBDINT_PROMPT;
|
||||
|
||||
typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
|
||||
{
|
||||
char* text;
|
||||
char *text;
|
||||
unsigned int length;
|
||||
} LIBSSH2_USERAUTH_KBDINT_RESPONSE;
|
||||
|
||||
@@ -287,10 +288,10 @@ typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
|
||||
|
||||
/* 'keyboard-interactive' authentication callback */
|
||||
#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, \
|
||||
const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts, \
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses, void **abstract)
|
||||
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, \
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, void **abstract)
|
||||
|
||||
/* Callbacks for special SSH packets */
|
||||
#define LIBSSH2_IGNORE_FUNC(name) \
|
||||
@@ -324,12 +325,14 @@ typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
|
||||
LIBSSH2_CHANNEL *channel, void **channel_abstract)
|
||||
|
||||
/* I/O callbacks */
|
||||
#define LIBSSH2_RECV_FUNC(name) ssize_t name(libssh2_socket_t socket, \
|
||||
void *buffer, size_t length, \
|
||||
int flags, void **abstract)
|
||||
#define LIBSSH2_SEND_FUNC(name) ssize_t name(libssh2_socket_t socket, \
|
||||
const void *buffer, size_t length,\
|
||||
int flags, void **abstract)
|
||||
#define LIBSSH2_RECV_FUNC(name) \
|
||||
ssize_t name(libssh2_socket_t socket, \
|
||||
void *buffer, size_t length, \
|
||||
int flags, void **abstract)
|
||||
#define LIBSSH2_SEND_FUNC(name) \
|
||||
ssize_t name(libssh2_socket_t socket, \
|
||||
const void *buffer, size_t length, \
|
||||
int flags, void **abstract)
|
||||
|
||||
/* libssh2_session_callback_set() constants */
|
||||
#define LIBSSH2_CALLBACK_IGNORE 0
|
||||
@@ -468,7 +471,8 @@ typedef struct _LIBSSH2_POLLFD {
|
||||
#define LIBSSH2_ERROR_FILE -16
|
||||
#define LIBSSH2_ERROR_METHOD_NONE -17
|
||||
#define LIBSSH2_ERROR_AUTHENTICATION_FAILED -18
|
||||
#define LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED LIBSSH2_ERROR_AUTHENTICATION_FAILED
|
||||
#define LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED \
|
||||
LIBSSH2_ERROR_AUTHENTICATION_FAILED
|
||||
#define LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED -19
|
||||
#define LIBSSH2_ERROR_CHANNEL_OUTOFORDER -20
|
||||
#define LIBSSH2_ERROR_CHANNEL_FAILURE -21
|
||||
@@ -548,7 +552,7 @@ LIBSSH2_API void libssh2_free(LIBSSH2_SESSION *session, void *ptr);
|
||||
*/
|
||||
LIBSSH2_API int libssh2_session_supported_algs(LIBSSH2_SESSION* session,
|
||||
int method_type,
|
||||
const char*** algs);
|
||||
const char ***algs);
|
||||
|
||||
/* Session API */
|
||||
LIBSSH2_API LIBSSH2_SESSION *
|
||||
@@ -596,7 +600,7 @@ LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session,
|
||||
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);
|
||||
const char *errmsg);
|
||||
LIBSSH2_API int libssh2_session_block_directions(LIBSSH2_SESSION *session);
|
||||
|
||||
LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag,
|
||||
@@ -609,12 +613,14 @@ LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session,
|
||||
unsigned int username_len);
|
||||
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_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)));
|
||||
|
||||
#define libssh2_userauth_password(session, username, password) \
|
||||
libssh2_userauth_password_ex((session), (username), \
|
||||
@@ -641,7 +647,8 @@ libssh2_userauth_publickey(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const unsigned char *pubkeydata,
|
||||
size_t pubkeydata_len,
|
||||
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)),
|
||||
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC
|
||||
((*sign_callback)),
|
||||
void **abstract);
|
||||
|
||||
LIBSSH2_API int
|
||||
@@ -733,7 +740,8 @@ libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host,
|
||||
|
||||
LIBSSH2_API LIBSSH2_LISTENER *
|
||||
libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host,
|
||||
int port, int *bound_port, int queue_maxsize);
|
||||
int port, int *bound_port,
|
||||
int queue_maxsize);
|
||||
#define libssh2_channel_forward_listen(session, port) \
|
||||
libssh2_channel_forward_listen_ex((session), NULL, (port), NULL, 16)
|
||||
|
||||
@@ -764,15 +772,17 @@ LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel,
|
||||
libssh2_channel_request_pty_ex((channel), (term), \
|
||||
(unsigned int)strlen(term), \
|
||||
NULL, 0, \
|
||||
LIBSSH2_TERM_WIDTH, LIBSSH2_TERM_HEIGHT, \
|
||||
LIBSSH2_TERM_WIDTH_PX, LIBSSH2_TERM_HEIGHT_PX)
|
||||
LIBSSH2_TERM_WIDTH, \
|
||||
LIBSSH2_TERM_HEIGHT, \
|
||||
LIBSSH2_TERM_WIDTH_PX, \
|
||||
LIBSSH2_TERM_HEIGHT_PX)
|
||||
|
||||
LIBSSH2_API int libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel,
|
||||
int width, int height,
|
||||
int width_px,
|
||||
int height_px);
|
||||
#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,
|
||||
int single_connection,
|
||||
@@ -834,8 +844,9 @@ LIBSSH2_API ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel,
|
||||
|
||||
#define libssh2_channel_write(channel, buf, buflen) \
|
||||
libssh2_channel_write_ex((channel), 0, (buf), (buflen))
|
||||
#define libssh2_channel_write_stderr(channel, buf, buflen) \
|
||||
libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
|
||||
#define libssh2_channel_write_stderr(channel, buf, buflen) \
|
||||
libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, \
|
||||
(buf), (buflen))
|
||||
|
||||
LIBSSH2_API unsigned long
|
||||
libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
|
||||
@@ -872,7 +883,7 @@ LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
|
||||
libssh2_channel_handle_extended_data((channel), \
|
||||
(ignore) ? \
|
||||
LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \
|
||||
LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL )
|
||||
LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL)
|
||||
|
||||
#define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA -1
|
||||
#define LIBSSH2_CHANNEL_FLUSH_ALL -2
|
||||
@@ -1268,9 +1279,9 @@ libssh2_agent_free(LIBSSH2_AGENT *agent);
|
||||
* 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 interval);
|
||||
LIBSSH2_API void libssh2_keepalive_config(LIBSSH2_SESSION *session,
|
||||
int want_reply,
|
||||
unsigned interval);
|
||||
|
||||
/*
|
||||
* libssh2_keepalive_send()
|
||||
@@ -1280,8 +1291,8 @@ LIBSSH2_API void libssh2_keepalive_config (LIBSSH2_SESSION *session,
|
||||
* 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);
|
||||
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
|
||||
@@ -1299,11 +1310,11 @@ LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask);
|
||||
#define LIBSSH2_TRACE_SOCKET (1<<9)
|
||||
|
||||
typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*,
|
||||
void*,
|
||||
void *,
|
||||
const char *,
|
||||
size_t);
|
||||
LIBSSH2_API int libssh2_trace_sethandler(LIBSSH2_SESSION *session,
|
||||
void* context,
|
||||
void *context,
|
||||
libssh2_trace_handler_func callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user