libssh
0.5.4
|
Callback which can be replaced in libssh. More...
Data Structures | |
struct | ssh_callbacks |
The structure to replace libssh functions with appropriate callbacks. More... | |
struct | ssh_socket_callbacks |
These are the callbacks exported by the socket structure They are called by the socket module when a socket event appears. More... | |
Macros | |
#define | ssh_callbacks_init(p) |
Initializes an ssh_callbacks_struct A call to this macro is mandatory when you have set a new ssh_callback_struct structure. More... | |
#define | SSH_PACKET_CALLBACK(name) int name (ssh_session session, uint8_t type, ssh_buffer packet, void *user) |
This macro declares a packet callback handler. More... | |
#define | SSH_PACKET_NOT_USED 2 |
Packet was not used and should be passed to any other callback available. | |
#define | SSH_PACKET_USED 1 |
return values for a ssh_packet_callback More... | |
Typedefs | |
typedef int(* | ssh_auth_callback )(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) |
SSH authentication callback. More... | |
typedef void(* | ssh_channel_close_callback )(ssh_session session, ssh_channel channel, void *userdata) |
SSH channel close callback. More... | |
typedef int(* | ssh_channel_data_callback )(ssh_session session, ssh_channel channel, void *data, uint32_t len, int is_stderr, void *userdata) |
SSH channel data callback. More... | |
typedef void(* | ssh_channel_eof_callback )(ssh_session session, ssh_channel channel, void *userdata) |
SSH channel eof callback. More... | |
typedef void(* | ssh_channel_exit_signal_callback )(ssh_session session, ssh_channel channel, const char *signal, int core, const char *errmsg, const char *lang, void *userdata) |
SSH channel exit signal callback. More... | |
typedef void(* | ssh_channel_exit_status_callback )(ssh_session session, ssh_channel channel, int exit_status, void *userdata) |
SSH channel exit status callback. More... | |
typedef void(* | ssh_channel_signal_callback )(ssh_session session, ssh_channel channel, const char *signal, void *userdata) |
SSH channel signal callback. More... | |
typedef void(* | ssh_global_request_callback )(ssh_session session, ssh_message message, void *userdata) |
SSH global request callback. More... | |
typedef void(* | ssh_log_callback )(ssh_session session, int priority, const char *message, void *userdata) |
SSH log callback. More... | |
typedef int(* | ssh_packet_callback )(ssh_session session, uint8_t type, ssh_buffer packet, void *user) |
Prototype for a packet callback, to be called when a new packet arrives. More... | |
typedef void(* | ssh_status_callback )(ssh_session session, float status, void *userdata) |
SSH Connection status callback. More... | |
Functions | |
LIBSSH_API int | ssh_set_callbacks (ssh_session session, ssh_callbacks cb) |
Set the session callback functions. More... | |
LIBSSH_API int | ssh_set_channel_callbacks (ssh_channel channel, ssh_channel_callbacks cb) |
Set the channel callback functions. More... | |
Callback which can be replaced in libssh.
#define ssh_callbacks_init | ( | p | ) |
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.
#define SSH_PACKET_CALLBACK | ( | name | ) | int name (ssh_session session, uint8_t type, ssh_buffer packet, void *user) |
This macro declares a packet callback handler.
#define SSH_PACKET_USED 1 |
return values for a ssh_packet_callback
Packet was used and should not be parsed by another callback
typedef int(* ssh_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) |
SSH authentication callback.
prompt | Prompt to be displayed. |
buf | Buffer to save the password. You should null-terminate it. |
len | Length of the buffer. |
echo | Enable or disable the echo of what you type. |
verify | Should the password be verified? |
userdata | Userdata to be passed to the callback function. Useful for GUI applications. |
typedef void(* ssh_channel_close_callback)(ssh_session session, ssh_channel channel, void *userdata) |
SSH channel close callback.
Called when a channel is closed by remote peer
session | Current session handler |
channel | the actual channel |
userdata | Userdata to be passed to the callback function. |
typedef int(* ssh_channel_data_callback)(ssh_session session, ssh_channel channel, void *data, uint32_t len, int is_stderr, void *userdata) |
SSH channel data callback.
Called when data is available on a channel
session | Current session handler |
channel | the actual channel |
data | the data that has been read on the channel |
len | the length of the data |
is_stderr | is 0 for stdout or 1 for stderr |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_channel_eof_callback)(ssh_session session, ssh_channel channel, void *userdata) |
SSH channel eof callback.
Called when a channel receives EOF
session | Current session handler |
channel | the actual channel |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_channel_exit_signal_callback)(ssh_session session, ssh_channel channel, const char *signal, int core, const char *errmsg, const char *lang, void *userdata) |
SSH channel exit signal callback.
Called when a channel has received an exit signal
session | Current session handler |
channel | the actual channel |
signal | the signal name (without the SIG prefix) |
core | a boolean telling wether a core has been dumped or not |
errmsg | the description of the exception |
lang | the language of the description (format: RFC 3066) |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_channel_exit_status_callback)(ssh_session session, ssh_channel channel, int exit_status, void *userdata) |
SSH channel exit status callback.
Called when a channel has received an exit status
session | Current session handler |
channel | the actual channel |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_channel_signal_callback)(ssh_session session, ssh_channel channel, const char *signal, void *userdata) |
SSH channel signal callback.
Called when a channel has received a signal
session | Current session handler |
channel | the actual channel |
signal | the signal name (without the SIG prefix) |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_global_request_callback)(ssh_session session, ssh_message message, void *userdata) |
SSH global request callback.
All global request will go through this callback.
session | Current session handler |
message | the actual message |
userdata | Userdata to be passed to the callback function. |
typedef void(* ssh_log_callback)(ssh_session session, int priority, const char *message, void *userdata) |
SSH log callback.
All logging messages will go through this callback
session | Current session handler |
priority | Priority of the log, the smaller being the more important |
message | the actual message |
userdata | Userdata to be passed to the callback function. |
typedef int(* ssh_packet_callback)(ssh_session session, uint8_t type, ssh_buffer packet, void *user) |
Prototype for a packet callback, to be called when a new packet arrives.
session | The current session of the packet |
type | packet type (see ssh2.h) |
packet | buffer containing the packet, excluding size, type and padding fields |
user | user argument to the callback and are called each time a packet shows up |
typedef void(* ssh_status_callback)(ssh_session session, float status, void *userdata) |
SSH Connection status callback.
session | Current session handler |
status | Percentage of connection status, going from 0.0 to 1.0 once connection is done. |
userdata | Userdata to be passed to the callback function. |
LIBSSH_API int ssh_set_callbacks | ( | ssh_session | session, |
ssh_callbacks | cb | ||
) |
Set the session callback functions.
This functions sets the callback structure to use your own callback functions for auth, logging and status.
session | The session to set the callback structure. |
cb | The callback structure itself. |
LIBSSH_API int ssh_set_channel_callbacks | ( | ssh_channel | channel, |
ssh_channel_callbacks | cb | ||
) |
Set the channel callback functions.
This functions sets the callback structure to use your own callback functions for channel data and exceptions
channel | The channel to set the callback structure. |
cb | The callback structure itself. |