libssh.c_bindings.callbacks

Undocumented in source.

Members

Aliases

ssh_auth_gssapi_mic_callback
alias ssh_auth_gssapi_mic_callback = int function(ssh_session session, const char* user, const char* principal, void* userdata)

@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.

ssh_auth_none_callback
alias ssh_auth_none_callback = int function(ssh_session session, const char* user, void* userdata)

@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.

ssh_auth_password_callback
alias ssh_auth_password_callback = int function(ssh_session session, const char* user, const char* password, void* userdata)

@brief SSH authentication callback. @param session Current session handler @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.

ssh_auth_pubkey_callback
alias ssh_auth_pubkey_callback = int function(ssh_session session, const char* user, ssh_key_struct* pubkey, byte signature_state, void* userdata)

@brief SSH authentication callback. @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 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.

ssh_callback_data
alias ssh_callback_data = int function(const void* data, size_t len, void* user)

@internal @brief callback for data received messages. @param data data retrieved from the socket or stream @param len number of bytes available from this stream @param user user-supplied pointer sent along with all callback messages @returns number of bytes processed by the callee. The remaining bytes will be sent in the next callback message, when more data is available.

ssh_callback_int
alias ssh_callback_int = void function(int code, void* user)

@internal @brief callback to process simple codes @param code value to transmit @param user Userdata to pass in callback

ssh_callback_int_int
alias ssh_callback_int_int = void function(int code, int errno_code, void* user)
Undocumented in source.
ssh_callbacks
alias ssh_callbacks = ssh_callbacks_struct*
Undocumented in source.
ssh_channel_auth_agent_req_callback
alias ssh_channel_auth_agent_req_callback = void function(ssh_session session, ssh_channel channel, void* userdata)

@brief SSH auth-agent-request from the client. This request is sent by a client when agent forwarding is available. Server is free to ignore this callback, no answer is expected. @param channel the channel @param userdata Userdata to be passed to the callback function.

ssh_channel_callback_data
alias ssh_channel_callback_data = int function(ssh_channel channel, int code, void* data, size_t len, void* user)
Undocumented in source.
ssh_channel_callback_int
alias ssh_channel_callback_int = int function(ssh_channel channel, int code, void* user)
Undocumented in source.
ssh_channel_callbacks
alias ssh_channel_callbacks = ssh_channel_callbacks_struct*
Undocumented in source.
ssh_channel_close_callback
alias ssh_channel_close_callback = void function(ssh_session session, ssh_channel channel, void* userdata)

@brief SSH channel close callback. Called when a channel is closed by remote peer @param session Current session handler @param channel the actual channel @param userdata Userdata to be passed to the callback function.

ssh_channel_data_callback
alias ssh_channel_data_callback = int function(ssh_session session, ssh_channel channel, void* data, uint len, int is_stderr, void* userdata)

@brief SSH channel data callback. Called when data is available on a channel @param session Current session handler @param channel the actual channel @param data the data that has been read on the channel @param len the length of the data @param is_stderr is 0 for stdout or 1 for stderr @param userdata Userdata to be passed to the callback function. @returns number of bytes processed by the callee. The remaining bytes will be sent in the next callback message, when more data is available.

ssh_channel_env_request_callback
alias ssh_channel_env_request_callback = int function(ssh_session session, ssh_channel channel, const char* env_name, const char* env_value, void* userdata)

@brief SSH channel environment request from a client. @param channel the channel @param env_name name of the environment value to be set @param env_value value of the environment value to be set @param userdata Userdata to be passed to the callback function. @returns 0 if the env request is accepted @returns 1 if the request is denied @warning some environment variables can be dangerous if changed (e.g. LD_PRELOAD) and should not be fulfilled.

ssh_channel_eof_callback
alias ssh_channel_eof_callback = void function(ssh_session session, ssh_channel channel, void* userdata)

@brief SSH channel eof callback. Called when a channel receives EOF @param session Current session handler @param channel the actual channel @param userdata Userdata to be passed to the callback function.

ssh_channel_exec_request_callback
alias ssh_channel_exec_request_callback = int function(ssh_session session, ssh_channel channel, const char* command, void* userdata)

@brief SSH channel Exec request from a client. @param channel the channel @param command the shell command to be executed @param userdata Userdata to be passed to the callback function. @returns 0 if the exec request is accepted @returns 1 if the request is denied

ssh_channel_exit_signal_callback
alias ssh_channel_exit_signal_callback = void function(ssh_session session, ssh_channel channel, const char* signal, int core, const char* errmsg, const char* lang, void* userdata)

@brief SSH channel exit signal callback. Called when a channel has received an exit signal @param session Current session handler @param channel the actual channel @param signal the signal name (without the SIG prefix) @param core a boolean telling wether a core has been dumped or not @param errmsg the description of the exception @param lang the language of the description (format: RFC 3066) @param userdata Userdata to be passed to the callback function.

ssh_channel_exit_status_callback
alias ssh_channel_exit_status_callback = void function(ssh_session session, ssh_channel channel, int exit_status, void* userdata)

@brief SSH channel exit status callback. Called when a channel has received an exit status @param session Current session handler @param channel the actual channel @param userdata Userdata to be passed to the callback function.

ssh_channel_open_request_session_callback
alias ssh_channel_open_request_session_callback = ssh_channel function(ssh_session session, void* userdata)

@brief Handles an SSH new channel open session request @param session current session handler @param userdata Userdata to be passed to the callback function. @returns a valid ssh_channel handle if the request is to be allowed @returns NULL if the request should not be allowed @warning The channel pointer returned by this callback must be closed by the application.

ssh_channel_open_request_x11_callback
alias ssh_channel_open_request_x11_callback = ssh_channel function(ssh_session session, const char* originator_address, int originator_port, void* userdata)

@brief Handles an SSH new channel open X11 request. This happens when the server sends back an X11 connection attempt. This is a client-side API @param session current session handler @param userdata Userdata to be passed to the callback function. @returns a valid ssh_channel handle if the request is to be allowed @returns NULL if the request should not be allowed @warning The channel pointer returned by this callback must be closed by the application.

ssh_channel_pty_request_callback
alias ssh_channel_pty_request_callback = int function(ssh_session session, ssh_channel channel, const char* term, int width, int height, int pxwidth, int pwheight, void* userdata)

@brief SSH channel PTY request from a client. @param channel the channel @param term The type of terminal emulation @param width width of the terminal, in characters @param height height of the terminal, in characters @param pxwidth width of the terminal, in pixels @param pxheight height of the terminal, in pixels @param userdata Userdata to be passed to the callback function. @returns 0 if the pty request is accepted @returns -1 if the request is denied

ssh_channel_pty_window_change_callback
alias ssh_channel_pty_window_change_callback = int function(ssh_session session, ssh_channel channel, int width, int height, int pxwidth, int pwheight, void* userdata)

@brief SSH channel PTY windows change (terminal size) from a client. @param channel the channel @param width width of the terminal, in characters @param height height of the terminal, in characters @param pxwidth width of the terminal, in pixels @param pxheight height of the terminal, in pixels @param userdata Userdata to be passed to the callback function. @returns 0 if the pty request is accepted @returns -1 if the request is denied

ssh_channel_shell_request_callback
alias ssh_channel_shell_request_callback = int function(ssh_session session, ssh_channel channel, void* userdata)

@brief SSH channel Shell request from a client. @param channel the channel @param userdata Userdata to be passed to the callback function. @returns 0 if the shell request is accepted @returns 1 if the request is denied

ssh_channel_signal_callback
alias ssh_channel_signal_callback = void function(ssh_session session, ssh_channel channel, const char* signal, void* userdata)

@brief SSH channel signal callback. Called when a channel has received a signal @param session Current session handler @param channel the actual channel @param signal the signal name (without the SIG prefix) @param userdata Userdata to be passed to the callback function.

ssh_channel_subsystem_request_callback
alias ssh_channel_subsystem_request_callback = int function(ssh_session session, ssh_channel channel, const char* subsystem, void* userdata)

@brief SSH channel subsystem request from a client. @param channel the channel @param subsystem the subsystem required @param userdata Userdata to be passed to the callback function. @returns 0 if the subsystem request is accepted @returns 1 if the request is denied

ssh_channel_x11_req_callback
alias ssh_channel_x11_req_callback = void function(ssh_session session, ssh_channel channel, int single_connection, const char* auth_protocol, const char* auth_cookie, uint screen_number, void* userdata)

@brief SSH X11 request from the client. This request is sent by a client when X11 forwarding is requested(and available). Server is free to ignore this callback, no answer is expected. @param channel the channel @param userdata Userdata to be passed to the callback function.

ssh_global_request_callback
alias ssh_global_request_callback = void function(ssh_session session, ssh_message message, void* userdata)

@brief SSH global request callback. All global request will go through this callback. @param session Current session handler @param message the actual message @param userdata Userdata to be passed to the callback function.

ssh_gssapi_accept_sec_ctx_callback
alias ssh_gssapi_accept_sec_ctx_callback = int function(ssh_session session, ssh_string input_token, ssh_string* output_token, void* userdata)
Undocumented in source.
ssh_gssapi_select_oid_callback
alias ssh_gssapi_select_oid_callback = ssh_string function(ssh_session session, const char* user, int n_oid, ssh_string* oids, void* userdata)
Undocumented in source.
ssh_gssapi_verify_mic_callback
alias ssh_gssapi_verify_mic_callback = int function(ssh_session session, ssh_string mic, void* mic_buffer, size_t mic_buffer_size, void* userdata)
Undocumented in source.
ssh_log_callback
alias ssh_log_callback = void function(ssh_session session, int priority, const char* message, void* userdata)

@brief SSH log callback. All logging messages will go through this callback @param session Current session handler @param priority Priority of the log, the smaller being the more important @param message the actual message @param userdata Userdata to be passed to the callback function.

ssh_logging_callback
alias ssh_logging_callback = void function(int priority, const char* function_, const char* buffer, void* userdata)

@brief SSH log callback.

ssh_message_callback
alias ssh_message_callback = int function(ssh_session, ssh_message message, void* user)
Undocumented in source.
ssh_packet_callback
alias ssh_packet_callback = int function(ssh_session session, ubyte type, ssh_buffer packet, void* user)

@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 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

ssh_packet_callbacks
alias ssh_packet_callbacks = ssh_packet_callbacks_struct*
Undocumented in source.
ssh_server_callbacks
alias ssh_server_callbacks = ssh_server_callbacks_struct*
Undocumented in source.
ssh_service_request_callback
alias ssh_service_request_callback = int function(ssh_session session, const char* service, void* userdata)

@brief Handles an SSH service request @param session current session handler @param service name of the service (e.g. "ssh-userauth") requested @param userdata Userdata to be passed to the callback function. @returns 0 if the request is to be allowed @returns -1 if the request should not be allowed

ssh_socket_callbacks
alias ssh_socket_callbacks = ssh_socket_callbacks_struct*
Undocumented in source.
ssh_status_callback
alias ssh_status_callback = void function(ssh_session session, float status, void* userdata)

@brief SSH Connection status callback. @param session Current session handler @param status Percentage of connection status, going from 0.0 to 1.0 once connection is done. @param userdata Userdata to be passed to the callback function.

ssh_thread_callback
alias ssh_thread_callback = int function(void** lock)

@group libssh_threads @{

ssh_thread_id_callback
alias ssh_thread_id_callback = uint function()
Undocumented in source.

Functions

ssh_callbacks_init
void ssh_callbacks_init(T p)

@brief Initializes an ssh_callbacks_struct A call to this macro is mandatory when you have set a new ssh_callback_struct structure. Its goal is to maintain the binary compatibility with future versions of libssh as the structure evolves with time.

ssh_get_log_callback
ssh_logging_callback ssh_get_log_callback()

@brief Get the pointer to the logging callback function.

ssh_set_callbacks
int ssh_set_callbacks(ssh_session session, ssh_callbacks cb)

@brief Set the session callback functions.

ssh_set_channel_callbacks
int ssh_set_channel_callbacks(ssh_channel channel, ssh_channel_callbacks cb)

@brief Set the channel callback functions.

ssh_set_log_callback
int ssh_set_log_callback(ssh_logging_callback cb)

@brief Set the logging callback function.

ssh_set_server_callbacks
int ssh_set_server_callbacks(ssh_session session, ssh_server_callbacks cb)

@brief Set the session server callback functions.

ssh_threads_get_noop
ssh_threads_callbacks_struct* ssh_threads_get_noop()

@brief Get the noop threads callbacks structure

ssh_threads_get_pthread
ssh_threads_callbacks_struct* ssh_threads_get_pthread()

@brief returns a pointer on the pthread threads callbacks, to be used with ssh_threads_set_callbacks. @warning you have to link with the library ssh_threads. @see ssh_threads_set_callbacks

ssh_threads_set_callbacks
int ssh_threads_set_callbacks(ssh_threads_callbacks_struct* cb)

@brief Set the thread callbacks structure.

Manifest constants

SSH_PACKET_NOT_USED
enum SSH_PACKET_NOT_USED;

Packet was not used and should be passed to any other callback * available

SSH_PACKET_USED
enum SSH_PACKET_USED;

Packet was used and should not be parsed by another callback

SSH_SOCKET_CONNECTED_ERROR
enum SSH_SOCKET_CONNECTED_ERROR;
Undocumented in source.
SSH_SOCKET_CONNECTED_OK
enum SSH_SOCKET_CONNECTED_OK;
Undocumented in source.
SSH_SOCKET_CONNECTED_TIMEOUT
enum SSH_SOCKET_CONNECTED_TIMEOUT;
Undocumented in source.
SSH_SOCKET_EXCEPTION_EOF
enum SSH_SOCKET_EXCEPTION_EOF;
Undocumented in source.
SSH_SOCKET_EXCEPTION_ERROR
enum SSH_SOCKET_EXCEPTION_ERROR;
Undocumented in source.
SSH_SOCKET_FLOW_WRITEWILLBLOCK
enum SSH_SOCKET_FLOW_WRITEWILLBLOCK;
Undocumented in source.
SSH_SOCKET_FLOW_WRITEWONTBLOCK
enum SSH_SOCKET_FLOW_WRITEWONTBLOCK;
Undocumented in source.

Structs

ssh_callbacks_struct
struct ssh_callbacks_struct

The structure to replace libssh functions with appropriate callbacks.

ssh_channel_callbacks_struct
struct ssh_channel_callbacks_struct
Undocumented in source.
ssh_packet_callbacks_struct
struct ssh_packet_callbacks_struct
Undocumented in source.
ssh_server_callbacks_struct
struct ssh_server_callbacks_struct

This structure can be used to implement a libssh server, with appropriate callbacks.

ssh_socket_callbacks_struct
struct ssh_socket_callbacks_struct

These are the callbacks exported by the socket structure They are called by the socket module when a socket event appears

ssh_threads_callbacks_struct
struct ssh_threads_callbacks_struct
Undocumented in source.

Meta