assh/assh_event.h header reference
Description
The API of the library is event based, as explained in the evts section.
This header contains declaration of the assh_event_s structure as well as event management functions.
Header inclusion
Members
Types
- enum assh_event_id_e
- struct assh_event_s
- typedef assh_status_t (assh_event_done_t)(assh_session_s *s, const assh_event_s *e, assh_status_e inerr)
Functions
- void assh_event_done(assh_session_s *s, assh_event_s *e, assh_status_e err)
- assh_bool_t assh_event_get(assh_session_s *s, assh_event_s *e, assh_time_t time)
Macro
Members detail
void assh_event_done(assh_session_s *s, assh_event_s *e, assh_status_e err)
This function is declared in assh/assh_event.h source file, line 248.
This function acknowledges the last event returned by the assh_event_get function.
If an error occurred during event processing by the caller, it should be reported to this function, especially if the error must terminate the session.
When an error is reported, the content of the event object is considered undefined by the library. The error will later be reported by an ASSH_EVENT_SESSION_ERROR event unless shadowed by an other error of higher severity.
See also fsms and evts.
assh_bool_t assh_event_get(assh_session_s *s, assh_event_s *e, assh_time_t time)
This function is declared in assh/assh_event.h source file, line 229.
This function runs the various state machines which implement the ssh2 protocol, including the currently running service and key-exchange. It then reports the next available event to the caller.
The assh_event_done function must be called after each successful call to this function, before requesting the next event.
This function can be called again unless 0 is returned eventually. This occurs when the session terminates.
When the function returns 1, the passed object event is initialized and can be examined by the application.
In order for the library to handle protocol timeouts properly, the current time in seconds has to be passed to this function. When this is the case, the assh_session_deadline function can be used to get the next ssh2 protocol deadline.
See also fsms, evts and assh_session_closed.
This enum is declared in assh/assh_event.h source file, line 42.
This enum specifies event types.
Identifier | Value | Description |
---|---|---|
ASSH_EVENT_INVALID | 0 | This event id is not valid and can be used to mark non-initialized event objects. |
ASSH_EVENT_READ | 1 | See assh_event_transport_read_s. |
ASSH_EVENT_WRITE | 2 | See assh_event_transport_write_s. |
ASSH_EVENT_DISCONNECT | 3 | See assh_event_transport_disconnect_s. |
ASSH_EVENT_DEBUG | 4 | See assh_event_transport_debug_s. |
ASSH_EVENT_SESSION_ERROR | 5 | See assh_event_session_error_s. |
ASSH_EVENT_KEX_HOSTKEY_LOOKUP | 6 | See assh_event_kex_hostkey_lookup_s. |
ASSH_EVENT_KEX_DONE | 7 | See assh_event_kex_done_s. |
ASSH_EVENT_SERVICE_START | 9 | See assh_event_service_start_s. |
ASSH_EVENT_USERAUTH_CLIENT_USER | 10 | See assh_event_userauth_client_user_s. |
ASSH_EVENT_USERAUTH_CLIENT_METHODS | 11 | See assh_event_userauth_client_methods_s. |
ASSH_EVENT_USERAUTH_CLIENT_BANNER | 12 | See assh_event_userauth_client_banner_s. |
ASSH_EVENT_USERAUTH_CLIENT_PWCHANGE | 13 | See assh_event_userauth_client_pwchange_s. |
ASSH_EVENT_USERAUTH_CLIENT_KEYBOARD | 14 | See assh_event_userauth_client_keyboard_s. |
ASSH_EVENT_USERAUTH_CLIENT_SUCCESS | 15 | |
ASSH_EVENT_USERAUTH_CLIENT_SIGN | 16 | See assh_event_userauth_client_sign_s. |
ASSH_EVENT_USERAUTH_SERVER_METHODS | 20 | See assh_event_userauth_server_methods_s. |
ASSH_EVENT_USERAUTH_SERVER_NONE | 21 | See assh_event_userauth_server_none_s. |
ASSH_EVENT_USERAUTH_SERVER_USERKEY | 22 | See assh_event_userauth_server_userkey_s. |
ASSH_EVENT_USERAUTH_SERVER_PASSWORD | 23 | See assh_event_userauth_server_password_s. |
ASSH_EVENT_USERAUTH_SERVER_KBINFO | 24 | See assh_event_userauth_server_kbinfo_s. |
ASSH_EVENT_USERAUTH_SERVER_KBRESPONSE | 25 | See assh_event_userauth_server_kbresponse_s. |
ASSH_EVENT_USERAUTH_SERVER_HOSTBASED | 26 | See assh_event_userauth_server_hostbased_s. |
ASSH_EVENT_USERAUTH_SERVER_SUCCESS | 27 | See assh_event_userauth_server_success_s. |
ASSH_EVENT_REQUEST | 30 | See assh_event_request_s. |
ASSH_EVENT_REQUEST_ABORT | 31 | See assh_event_request_abort_s. |
ASSH_EVENT_REQUEST_SUCCESS | 32 | See assh_event_request_success_s. |
ASSH_EVENT_REQUEST_FAILURE | 33 | See assh_event_request_failure_s. |
ASSH_EVENT_CHANNEL_OPEN | 34 | See assh_event_channel_open_s. |
ASSH_EVENT_CHANNEL_CONFIRMATION | 35 | See assh_event_channel_confirmation_s. |
ASSH_EVENT_CHANNEL_FAILURE | 36 | See assh_event_channel_failure_s. |
ASSH_EVENT_CHANNEL_DATA | 37 | See assh_event_channel_data_s. |
ASSH_EVENT_CHANNEL_WINDOW | 38 | See assh_event_channel_window_s. |
ASSH_EVENT_CHANNEL_EOF | 39 | See assh_event_channel_eof_s. |
ASSH_EVENT_CHANNEL_CLOSE | 40 | See assh_event_channel_close_s. |
ASSH_EVENT_CHANNEL_ABORT | 41 | See assh_event_channel_abort_s. |
ASSH_EVENT_COUNT | 42 |
This struct is declared in assh/assh_event.h source file, line 145.
This struct holds an event reported by the assh_event_get function.
Field | Description |
---|---|
assh_event_id_e id; | Id of the event. |
assh_event_done_t * f_done; | Pointer to the event acknowledge function, if any. |
void * done_pv; | Private data for the event acknowledge function. |
union <anonymous> { | |
<anonymous>::assh_event_session_u session; | |
assh_event_transport_u transport; | |
assh_event_kex_u kex; | |
<anonymous>::assh_event_service_u service; | |
assh_event_userauth_client_u userauth_client; | |
assh_event_userauth_server_u userauth_server; | |
assh_event_connection_u connection; | |
uintptr_t params[16]; | Padding |
}; |
This macro is for internal use only.
This macro is declared in assh/assh_event.h source file, line 127.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_session_s *s,
const struct assh_event_s *e,
enum assh_status_e inerr)
See also assh_event_done_t.
typedef assh_status_t (assh_event_done_t)(assh_session_s *s, const assh_event_s *e, assh_status_e inerr)
This typedef is for internal use only.
This typedef is declared in assh/assh_event.h source file, line 135.
This declaration involves expansion of the ASSH_EVENT_DONE_FCN macro.
This typedef is called when the event has been processed.
See also assh_event_done.