Improve doxygen documentation

Signed-off-by: Nikhil V <nikhilgreyshines@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Nikhil V
2025-12-06 10:51:35 +05:30
committed by Jakub Jelen
parent f8d943afda
commit 4feb0dd79d
10 changed files with 1121 additions and 663 deletions

View File

@@ -220,36 +220,41 @@ typedef struct ssh_callbacks_struct *ssh_callbacks;
* @param user User that wants to authenticate
* @param password Password used for authentication
* @param userdata Userdata to be passed to the callback function.
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
* @returns SSH_AUTH_DENIED Authentication failed.
* @returns `SSH_AUTH_SUCCESS` Authentication is accepted.
* @returns `SSH_AUTH_PARTIAL` Partial authentication, more authentication means
* are needed.
* @returns `SSH_AUTH_DENIED` Authentication failed.
*/
typedef int (*ssh_auth_password_callback) (ssh_session session, const char *user, const char *password,
void *userdata);
/**
* @brief SSH authentication callback. Tries to authenticates user with the "none" method
* which is anonymous or passwordless.
* @brief SSH authentication callback. Tries to authenticates user with the
* "none" method which is anonymous or passwordless.
* @param session Current session handler
* @param user User that wants to authenticate
* @param userdata Userdata to be passed to the callback function.
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
* @returns SSH_AUTH_DENIED Authentication failed.
* @returns `SSH_AUTH_SUCCESS` Authentication is accepted.
* @returns `SSH_AUTH_PARTIAL` Partial authentication, more authentication means
* are needed.
* @returns `SSH_AUTH_DENIED` Authentication failed.
*/
typedef int (*ssh_auth_none_callback) (ssh_session session, const char *user, void *userdata);
/**
* @brief SSH authentication callback. Tries to authenticates user with the "gssapi-with-mic" method
* @brief SSH authentication callback. Tries to authenticates user with the
* "gssapi-with-mic" method
* @param session Current session handler
* @param user Username of the user (can be spoofed)
* @param principal Authenticated principal of the user, including realm.
* @param userdata Userdata to be passed to the callback function.
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
* @returns SSH_AUTH_DENIED Authentication failed.
* @warning Implementations should verify that parameter user matches in some way the principal.
* user and principal can be different. Only the latter is guaranteed to be safe.
* @returns `SSH_AUTH_SUCCESS` Authentication is accepted.
* @returns `SSH_AUTH_PARTIAL` Partial authentication, more authentication means
* are needed.
* @returns `SSH_AUTH_DENIED` Authentication failed.
* @warning Implementations should verify that parameter user matches in some
* way the principal. user and principal can be different. Only the latter is
* guaranteed to be safe.
*/
typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *user, const char *principal,
void *userdata);
@@ -259,18 +264,18 @@ typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *us
* @param session Current session handler
* @param user User that wants to authenticate
* @param pubkey public key used for authentication
* @param signature_state SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe),
* SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
* replied with a SSH_AUTH_DENIED.
* @param signature_state `SSH_PUBLICKEY_STATE_NONE` if the key is not signed
* (simple public key probe), `SSH_PUBLICKEY_STATE_VALID` if the signature is
* valid. Others values should be replied with a `SSH_AUTH_DENIED`.
* @param userdata Userdata to be passed to the callback function.
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
* @returns SSH_AUTH_DENIED Authentication failed.
* @returns `SSH_AUTH_SUCCESS` Authentication is accepted.
* @returns `SSH_AUTH_PARTIAL` Partial authentication, more authentication means
* are needed.
* @returns `SSH_AUTH_DENIED` Authentication failed.
*/
typedef int (*ssh_auth_pubkey_callback) (ssh_session session, const char *user, struct ssh_key_struct *pubkey,
char signature_state, void *userdata);
/**
* @brief Handles an SSH service request
* @param session current session handler
@@ -291,7 +296,7 @@ typedef int (*ssh_service_request_callback) (ssh_session session, const char *se
*/
typedef ssh_channel (*ssh_channel_open_request_session_callback) (ssh_session session, void *userdata);
/**
/**
* @brief handle the beginning of a GSSAPI authentication, server side.
* Callback should select the oid and also acquire the server credential.
* @param session current session handler
@@ -312,23 +317,23 @@ typedef ssh_string (*ssh_gssapi_select_oid_callback) (ssh_session session, const
* @param[in] input_token input token provided by client
* @param[out] output_token output of the gssapi accept_sec_context method,
* NULL after completion.
* @returns SSH_OK if the token was generated correctly or accept_sec_context
* @returns `SSH_OK` if the token was generated correctly or accept_sec_context
* returned GSS_S_COMPLETE
* @returns SSH_ERROR in case of error
* @returns `SSH_ERROR` in case of error
* @warning It is not necessary to fill this callback in if libssh is linked
* with libgssapi.
*/
typedef int (*ssh_gssapi_accept_sec_ctx_callback) (ssh_session session,
ssh_string input_token, ssh_string *output_token, void *userdata);
/**
/**
* @brief Verify and authenticates a MIC, server side.
* @param session current session handler
* @param[in] mic input mic to be verified provided by client
* @param[in] mic_buffer buffer of data to be signed.
* @param[in] mic_buffer_size size of mic_buffer
* @returns SSH_OK if the MIC was authenticated correctly
* @returns SSH_ERROR in case of error
* @returns `SSH_OK` if the MIC was authenticated correctly
* @returns `SSH_ERROR` in case of error
* @warning It is not necessary to fill this callback in if libssh is linked
* with libgssapi.
*/
@@ -404,7 +409,7 @@ struct ssh_server_callbacks_struct {
/** This function will be called when a gssapi token comes in.
*/
ssh_gssapi_accept_sec_ctx_callback gssapi_accept_sec_ctx_function;
/* This function will be called when a MIC needs to be verified.
/** This function will be called when a MIC needs to be verified.
*/
ssh_gssapi_verify_mic_callback gssapi_verify_mic_function;
/**
@@ -438,7 +443,7 @@ typedef struct ssh_server_callbacks_struct *ssh_server_callbacks;
*
* @param cb The callback structure itself.
*
* @return SSH_OK on success, SSH_ERROR on error.
* @return `SSH_OK` on success, `SSH_ERROR` on error.
*/
LIBSSH_API int ssh_set_server_callbacks(ssh_session session, ssh_server_callbacks cb);
@@ -569,14 +574,17 @@ typedef struct ssh_socket_callbacks_struct *ssh_socket_callbacks;
} \
} while(0)
/** @brief Prototype for a packet callback, to be called when a new packet arrives
/** @brief Prototype for a packet callback, to be called when a new packet
* arrives
* @param session The current session of the packet
* @param type packet type (see ssh2.h)
* @param packet buffer containing the packet, excluding size, type and padding fields
* @param packet buffer containing the packet, excluding size, type and padding
* fields
* @param user user argument to the callback
* and are called each time a packet shows up
* @returns SSH_PACKET_USED Packet was parsed and used
* @returns SSH_PACKET_NOT_USED Packet was not used or understood, processing must continue
* @returns `SSH_PACKET_USED` Packet was parsed and used
* @returns `SSH_PACKET_NOT_USED` Packet was not used or understood, processing
* must continue
*/
typedef int (*ssh_packet_callback) (ssh_session session, uint8_t type, ssh_buffer packet, void *user);
@@ -635,7 +643,7 @@ typedef struct ssh_packet_callbacks_struct *ssh_packet_callbacks;
*
* @param cb The callback structure itself.
*
* @return SSH_OK on success, SSH_ERROR on error.
* @return `SSH_OK` on success, `SSH_ERROR` on error.
*/
LIBSSH_API int ssh_set_callbacks(ssh_session session, ssh_callbacks cb);
@@ -987,7 +995,7 @@ typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
*
* @param cb The callback structure itself.
*
* @return SSH_OK on success, SSH_ERROR on error.
* @return `SSH_OK` on success, `SSH_ERROR` on error.
* @warning this function will not replace existing callbacks but set the
* new one atop of them.
*/
@@ -1006,7 +1014,7 @@ LIBSSH_API int ssh_set_channel_callbacks(ssh_channel channel,
*
* @param cb The callback structure itself.
*
* @return SSH_OK on success, SSH_ERROR on error.
* @return `SSH_OK` on success, `SSH_ERROR` on error.
*
* @see ssh_set_channel_callbacks
*/
@@ -1023,7 +1031,7 @@ LIBSSH_API int ssh_add_channel_callbacks(ssh_channel channel,
*
* @param cb The callback structure to remove
*
* @returns SSH_OK on success, SSH_ERROR on error.
* @returns `SSH_OK` on success, `SSH_ERROR` on error.
*/
LIBSSH_API int ssh_remove_channel_callbacks(ssh_channel channel,
ssh_channel_callbacks cb);
@@ -1056,7 +1064,7 @@ struct ssh_threads_callbacks_struct {
* @param[in] cb A pointer to a ssh_threads_callbacks_struct structure, which
* contains the different callbacks to be set.
*
* @returns Always returns SSH_OK.
* @returns Always returns `SSH_OK`.
*
* @see ssh_threads_callbacks_struct
* @see SSH_THREADS_PTHREAD

View File

@@ -30,23 +30,27 @@
*/
/** @internal
* @brief Length of an ED25519 public key in bytes.
* @brief ED25519 public key.
* Ed25519 public key consist of 32 bytes.
*/
#define ED25519_PK_LEN 32
/** @internal
* @brief Length of an ED25519 private key in bytes.
* @brief ED25519 secret key.
* Ed25519 secret key consist of 64 bytes.
*/
#define ED25519_SK_LEN 64
/** @internal
* @brief Length of an ED25519 signature in bytes.
* @brief ED25519 signature.
* Ed25519 signatures consist of 64 bytes.
*/
#define ED25519_SIG_LEN 64
/** @internal
* @brief ED25519 public key.
* The public key consists of 32 bytes and can be used for key exchanges.
* The public key consists of 32 bytes and can be used for signature
* verification.
*/
typedef uint8_t ed25519_pubkey[ED25519_PK_LEN];

View File

@@ -455,44 +455,9 @@ enum ssh_connector_flags_e {
SSH_CONNECTOR_BOTH = 3
};
/**
* @brief Flushes the output buffer of the session, blocking until the buffer is empty or the timeout is reached
*
* @param[in] session The ssh session.
* @param[in] timeout Timeout (milliseconds)
*
* @return SSH_OK on success (0), SSH_ERROR on error (-1).
*/
LIBSSH_API int ssh_blocking_flush(ssh_session session, int timeout);
/**
* @brief Accept an X11 connection from the server.
*
* @param[in] channel The channel .
* @param[in] timeout_ms Timeout (milliseconds).
*
* @return A new X11 channel, or NULL on error.
*/
LIBSSH_API ssh_channel ssh_channel_accept_x11(ssh_channel channel, int timeout_ms);
/**
* @brief Change the size of the terminal .
*
* @param[in] channel The channel .
* @param[in] cols Number of columns.
* @param[in] rows Number of rows.
*
* @return SSH_OK on success (0), SSH_ERROR on error(-1).
*/
LIBSSH_API int ssh_channel_change_pty_size(ssh_channel channel,int cols,int rows);
/**
* @brief Closes a channel.
*
* @param[in] channel The channel.
*
* @return SSH_OK on success(0), SSH_ERROR on error(-1).
*/
LIBSSH_API int ssh_channel_close(ssh_channel channel);
#define SSH_CHANNEL_FREE(x) \
do { \
@@ -501,129 +466,23 @@ LIBSSH_API int ssh_channel_close(ssh_channel channel);
(x) = NULL; \
} \
} while (0)
/**
* @brief Frees a channel.
*
* @param[in] channel The channel.
*/
LIBSSH_API void ssh_channel_free(ssh_channel channel);
/**
* @brief Get the exit status of a channel .
*
* @param[in] channel The channel .
* @param[out] pexit_code the exit code (can be NULL).
* @param[out] pexit_signal the exit signal string (can be NULL).
* @param[out] pcore_dumped the core dump flag (can be NULL).
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_get_exit_state(ssh_channel channel,
uint32_t *pexit_code,
char **pexit_signal,
int *pcore_dumped);
SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
/**
* @brief Used to get the session .
*
* @param[in] channel The channel .
*
* @return The ssh session.
*/
LIBSSH_API ssh_session ssh_channel_get_session(ssh_channel channel);
/**
* @brief Check if the channel is closed.
*
* @param[in] channel The channel .
*
* @return 1 if the channel is closed, 0 otherwise.
*/
LIBSSH_API int ssh_channel_is_closed(ssh_channel channel);
/**
* @brief Check if the remote host has sent an EOF (End Of File).
*
* @param[in] channel The channel .
*
* @return 1 if EOF has been received, 0 otherwise.
*/
LIBSSH_API int ssh_channel_is_eof(ssh_channel channel);
/**
* @brief Check if the channel is open.
*
* @param[in] channel The channel .
*
* @return 1 if the channel is open, 0 otherwise.
*/
LIBSSH_API int ssh_channel_is_open(ssh_channel channel);
/**
* @brief Create a new channel.
*
* @param[in] session The ssh session to use.
*
* @return a new channel, or NULL on error.
*/
LIBSSH_API ssh_channel ssh_channel_new(ssh_session session);
/**
* @brief Open an authentication agent forwarding channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
/**
* @brief Open a TCP/IP forwarding channel.
*
* @param[in] channel The channel .
* @param[in] remotehost The remote host that connect to.
* @param[in] remoteport The remote port that connect to.
* @param[in] sourcehost The source host from which to connect.
* @param[in] localport The source port from which to connect.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport);
/**
* @brief Open a Unix domain socket forwarding channel.
*
* @param[in] channel The channel .
* @param[in] remotepath The remote path of the socket.
* @param[in] sourcehost The source host from which to connect.
* @param[in] localport The source port from which to connect.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_open_forward_unix(ssh_channel channel, const char *remotepath,
const char *sourcehost, int localport);
/**
* @brief Open a session channel .
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
/**
* @brief Open an X11 channel.
*
* @param[in] channel The channel .
* @param[in] orig_addr The source address .
* @param[in] orig_port The source port.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
LIBSSH_API int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr);
@@ -631,287 +490,48 @@ LIBSSH_API int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count,
LIBSSH_API int ssh_channel_read_timeout(ssh_channel channel, void *dest, uint32_t count, int is_stderr, int timeout_ms);
LIBSSH_API int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
int is_stderr);
/**
* @brief Set an environment variable on the channel.
*
* @param[in] channel The channel .
* @param[in] name The name of the variable.
* @param[in] value The value to set.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_env(ssh_channel channel, const char *name, const char *value);
/**
* @brief Run a command on the channel.
*
* @param[in] channel The channel .
* @param[in] cmd The command to run.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_exec(ssh_channel channel, const char *cmd);
/**
* @brief Request a PTY (pseudo-terminal) on the channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_pty(ssh_channel channel);
/**
* @brief Request a PTY (pseudo-terminal) size on the channel.
*
* @param[in] channel The channel .
* @param[in] term The terminal type .
* @param[in] cols The number of columns.
* @param[in] rows The number of rows.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_pty_size(ssh_channel channel, const char *term,
int cols, int rows);
/**
* @brief Request a PTY (pseudo-terminal) size and modes on the channel.
*
* @param[in] channel The channel .
* @param[in] term The terminal type.
* @param[in] cols The number of columns.
* @param[in] rows The number of rows.
* @param[in] modes The encoded terminal modes.
* @param[in] modes_len The length of the modes data.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_pty_size_modes(ssh_channel channel, const char *term,
int cols, int rows, const unsigned char* modes, size_t modes_len);
/**
* @brief Request a shell on the channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_shell(ssh_channel channel);
/**
* @brief Send a signal to the channel.
*
* @param[in] channel The channel .
* @param[in] signum The signal name .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_send_signal(ssh_channel channel, const char *signum);
/**
* @brief Send a break signal to the channel.
*
* @param[in] channel The channel .
* @param[in] length The length of the break in ms.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_send_break(ssh_channel channel, uint32_t length);
/**
* @brief Request the SFTP subsystem on the channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_sftp(ssh_channel channel);
/**
* @brief Request a subsystem on the channel.
*
* @param[in] channel The channel .
* @param[in] subsystem The subsystem name.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_subsystem(ssh_channel channel, const char *subsystem);
LIBSSH_API int ssh_channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
const char *cookie, int screen_number);
/**
* @brief Request agent forwarding on the channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_request_auth_agent(ssh_channel channel);
/**
* @brief Send EOF (End Of File) to the channel.
*
* @param[in] channel The channel .
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_send_eof(ssh_channel channel);
/**
* @brief Set the channel to blocking or non-blocking mode.
*
* @param[in] channel The channel .
* @param[in] blocking Set to 1 for blocking, 0 for non-blocking.
*/
LIBSSH_API void ssh_channel_set_blocking(ssh_channel channel, int blocking);
/**
* @brief Set the counter structure for the channel.
*
* @param[in] channel The channel .
* @param[in] counter The counter to update.
*/
LIBSSH_API void ssh_channel_set_counter(ssh_channel channel,
ssh_counter counter);
/**
* @brief Write data to the channel.
*
* @param[in] channel The channel .
* @param[in] data The data to be written.
* @param[in] len The length of the data.
*
* @return The number of bytes written, or SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len);
/**
* @brief Write data to the channel's standard error.
*
* @param[in] channel The channel .
* @param[in] data The data to be written.
* @param[in] len The length of the data.
*
* @return The number of bytes written, or SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel,
const void *data,
uint32_t len);
/**
* @brief Get the current window size of the channel.
*
* @param[in] channel The channel .
*
* @return The window size.
*/
LIBSSH_API uint32_t ssh_channel_window_size(ssh_channel channel);
/**
* @brief Get the file name from a path.
*
* @param[in] path The path.
*
* @return The base name, or NULL on error.
*/
LIBSSH_API char *ssh_basename (const char *path);
/**
* @brief Clean up and free a public key hash.
*
* @param[in,out] hash The hash to free.
*/
LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
/**
* @brief Connects to the ssh server.
*
* @param[in] session The ssh session.
*
* @return SSH_OK on success (0), SSH_ERROR on error (-1).
*/
LIBSSH_API int ssh_connect(ssh_session session);
/**
* @brief Create a new connector.
*
* @param[in] session The session .
*
* @return A new connector, or NULL on error.
*/
LIBSSH_API ssh_connector ssh_connector_new(ssh_session session);
/**
* @brief Free a connector.
*
* @param[in] connector The connector to free.
*/
LIBSSH_API void ssh_connector_free(ssh_connector connector);
/**
* @brief Set the input channel for the connector.
*
* @param[in] connector The connector .
* @param[in] channel The channel .
* @param[in] flags Flags for the connector.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_connector_set_in_channel(ssh_connector connector,
ssh_channel channel,
enum ssh_connector_flags_e flags);
/**
* @brief Set the output channel for the connector.
*
* @param[in] connector The connector .
* @param[in] channel The channel .
* @param[in] flags Flags for the connector.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_connector_set_out_channel(ssh_connector connector,
ssh_channel channel,
enum ssh_connector_flags_e flags);
/**
* @brief Set the input file descriptor for the connector.
*
* @param[in] connector The connector .
* @param[in] fd The file descriptor.
*/
LIBSSH_API void ssh_connector_set_in_fd(ssh_connector connector, socket_t fd);
/**
* @brief Set the output file descriptor for the connector.
*
* @param[in] connector The connector .
* @param[in] fd The file descriptor.
*/
LIBSSH_API void ssh_connector_set_out_fd(ssh_connector connector, socket_t fd);
/**
* @brief Get the copyright information.
*
* @return The copyright string.
*/
LIBSSH_API const char *ssh_copyright(void);
/**
* @brief Disconnects from the ssh server.
*
* @param[in] session The ssh session to be disconnected.
*/
LIBSSH_API void ssh_disconnect(ssh_session session);
/**
* @brief Get the directory name from a path.
*
* @param[in] path The path.
*
* @return The directory name, or NULL on error.
*/
LIBSSH_API char *ssh_dirname (const char *path);
LIBSSH_API int ssh_finalize(void);
@@ -924,16 +544,6 @@ LIBSSH_API ssh_channel ssh_channel_open_forward_port(ssh_session session,
SSH_DEPRECATED LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session,
int timeout_ms,
int *destination_port);
/**
* @brief Cancel a reverse port forwarding.
*
* @param[in] session The ssh session.
* @param[in] address The address bound.
* @param[in] port The port bound.
*
* @return SSH_OK on success, SSH_ERROR on error.
*/
LIBSSH_API int ssh_channel_cancel_forward(ssh_session session,
const char *address,
int port);
@@ -942,20 +552,7 @@ LIBSSH_API int ssh_channel_listen_forward(ssh_session session,
int port,
int *bound_port);
/**
* @brief Free an ssh session.
*
* @param[in] session The session to free.
*/
LIBSSH_API void ssh_free(ssh_session session);
/**
* @brief Get the disconnect message from the server.
*
* @param[in] session The ssh session.
*
* @return The disconnect message, or NULL if none.
*/
LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
LIBSSH_API const char *ssh_get_error(void *error);
LIBSSH_API int ssh_get_error_code(void *error);

View File

@@ -118,7 +118,7 @@ LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o);
*
* @param[in] userdata A pointer to private data to pass to the callbacks.
*
* @return SSH_OK on success, SSH_ERROR if an error occurred.
* @return `SSH_OK` on success, `SSH_ERROR` if an error occurred.
*
* @code
* struct ssh_callbacks_struct cb = {
@@ -172,7 +172,7 @@ LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o);
* @param ssh_bind_o The ssh server bind to accept a connection.
* @param session A preallocated ssh session
* @see ssh_new
* @return SSH_OK when a connection is established
* @return `SSH_OK` when a connection is established
*/
LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session);
@@ -186,7 +186,7 @@ LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session);
* inbound connection
* @see ssh_new
* @see ssh_bind_accept
* @return SSH_OK when a connection is established
* @return `SSH_OK` when a connection is established
*/
LIBSSH_API int ssh_bind_accept_fd(ssh_bind ssh_bind_o, ssh_session session,
socket_t fd);
@@ -198,7 +198,7 @@ LIBSSH_API ssh_gssapi_creds ssh_gssapi_get_creds(ssh_session session);
*
* @param session A connected ssh session
* @see ssh_bind_accept
* @return SSH_OK if the key exchange was successful
* @return `SSH_OK` if the key exchange was successful
*/
LIBSSH_API int ssh_handle_key_exchange(ssh_session session);
@@ -215,9 +215,8 @@ LIBSSH_API int ssh_handle_key_exchange(ssh_session session);
* @see ssh_handle_key_exchange
* @see ssh_options_set
*
* @return SSH_OK if initialization succeeds.
* @return `SSH_OK` if initialization succeeds.
*/
LIBSSH_API int ssh_server_init_kex(ssh_session session);
/**
@@ -257,7 +256,7 @@ LIBSSH_API void ssh_set_auth_methods(ssh_session session, int auth_methods);
*
* @param[in] banner The server's banner.
*
* @return SSH_OK on success, SSH_ERROR on error.
* @return `SSH_OK` on success, `SSH_ERROR` on error.
*/
LIBSSH_API int ssh_send_issue_banner(ssh_session session, const ssh_string banner);