The SSH message functions
Overview
This file contains the message parsing utilities for client and server programs using libssh. More…
// global functions void ssh_message_free(ssh_message msg); ssh_message ssh_message_get(ssh_session session); int ssh_message_subtype(ssh_message msg); int ssh_message_type(ssh_message msg); static int ssh_execute_client_request( ssh_session session, ssh_message msg ); static int ssh_execute_message_callback( ssh_session session, ssh_message msg ); static int ssh_execute_server_callbacks( ssh_session session, ssh_message msg ); static int ssh_execute_server_request( ssh_session session, ssh_message msg ); ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg); int ssh_message_channel_request_open_reply_accept_channel( ssh_message msg, ssh_channel chan ); int ssh_message_channel_request_reply_success(ssh_message msg); int ssh_message_handle_channel_request( ssh_session session, ssh_channel channel, ssh_buffer packet, const char* request, uint8_t want_reply ); static ssh_message ssh_message_new(ssh_session session); ssh_message ssh_message_pop_head(ssh_session session); void ssh_message_queue( ssh_session session, ssh_message message ); static int ssh_message_termination(void* s); static ssh_buffer ssh_msg_userauth_build_digest( ssh_session session, ssh_message msg, const char* service ); SSH_PACKET_CALLBACK(ssh_packet_service_request); SSH_PACKET_CALLBACK(ssh_packet_userauth_request); SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response); SSH_PACKET_CALLBACK(ssh_packet_channel_open); SSH_PACKET_CALLBACK(ssh_packet_global_request);
Detailed Documentation
This file contains the message parsing utilities for client and server programs using libssh.
On the server the the main loop of the program will call ssh_message_get(session) to get messages as they come. They are not 1-1 with the protocol messages. Then, the user will know what kind of a message it is and use the appropriate functions to handle it (or use the default handlers if you don’t know what to do).
Global Functions
void ssh_message_free(ssh_message msg)
Free a SSH message.
Parameters:
msg |
The message to release the memory. |
ssh_message ssh_message_get(ssh_session session)
Retrieve a SSH message from a SSH session.
Warning
This function blocks until a message has been received. Betterset up a callback if this behavior is unwanted.
Parameters:
session |
The SSH session to get the message. |
Returns:
The SSH message received, NULL in case of error, or timeout elapsed.
int ssh_message_subtype(ssh_message msg)
Get the subtype of the message.
Parameters:
msg |
The message to get the subtype from. |
Returns:
The message type or -1 on error.
int ssh_message_type(ssh_message msg)
Get the type of the message.
Parameters:
msg |
The message to get the type from. |
Returns:
The message type or -1 on error.