assh/assh_service.h header reference
Description [link]
This header file provides declarations related to the service module interface. Functions are provided to register services on a library struct assh_context_s object.
See also coremod and srvlayer.
Header inclusion [link]
Members [link]
Types [link]
- struct assh_event_service_start_s
- union assh_event_service_u
- struct assh_service_s
- typedef void (assh_service_cleanup_t)(struct assh_session_s *s)
- typedef assh_status_t (assh_service_init_t)(struct assh_session_s *s)
- typedef assh_status_t (assh_service_process_t)(struct assh_session_s *s, struct assh_packet_s *p, struct assh_event_s *e)
- enum assh_service_state_e
Functions [link]
- assh_status_t assh_service_by_name(struct assh_context_s *c, size_t name_len, const char *name, const struct assh_service_s **srv_)
- assh_status_t assh_service_register(struct assh_context_s *c, struct assh_service_s *srv)
- assh_status_t assh_service_register_default(struct assh_context_s *c)
- assh_status_t assh_service_register_va(struct assh_context_s *c, ...)
- assh_status_t assh_service_loop(struct assh_session_s *s, struct assh_packet_s *p, struct assh_event_s *e)
- assh_status_t assh_service_next(struct assh_session_s *s, const struct assh_service_s **srv)
- void assh_service_start(struct assh_session_s *s, const struct assh_service_s *next)
- void assh_service_stop(struct assh_session_s *s)
Macros [link]
Members detail [link]
struct assh_event_service_start_s [link]
This struct is declared in assh/assh_service.h source file, line 132.
The ASSH_EVENT_SERVICE_START event is reported when a service has started.
Field | Description |
---|---|
const struct assh_service_s *const srv; | A pointer to the module descriptor of the starting service. (ro) |
union assh_event_service_u [link]
This union is declared in assh/assh_service.h source file, line 139.
This union contains all service related event structures.
Field | Description |
---|---|
struct assh_event_service_start_s start; |
assh_status_t assh_service_by_name(struct assh_context_s *c, size_t name_len, const char *name, const struct assh_service_s **srv_) [link]
This function is declared in assh/assh_service.h source file, line 174.
This function lookup a registered service by name.
assh_status_t assh_service_register(struct assh_context_s *c, struct assh_service_s *srv) [link]
This function is declared in assh/assh_service.h source file, line 147.
This function registers a single struct assh_service_s for use by the given context.
See also assh_service_register_va.
assh_status_t assh_service_register_default(struct assh_context_s *c) [link]
This function is declared in assh/assh_service.h source file, line 162.
This function registers the standard ssh-userauth and ssh-connection services. The appropriate client or server services are used depending on the context type.
assh_status_t assh_service_register_va(struct assh_context_s *c, ...) [link]
This function is declared in assh/assh_service.h source file, line 156.
This function registers one or more struct assh_service_s for use by the given context.
When registering service modules onto a client context, the registration order determines the order used to request execution of the services.
See also assh_service_register.
struct assh_service_s [link]
This struct is declared in assh/assh_service.h source file, line 118.
This struct is the service module descriptor. It can be registered on a struct assh_context_s instance for use by all associated sessions.
See also coremod and assh_service_register.
Field | Description |
---|---|
const char * name; | |
assh_service_init_t * f_init; | |
assh_service_cleanup_t * f_cleanup; | |
assh_service_process_t * f_process; | |
enum assh_context_type_e side:2; | |
assh_bool_t no_user_auth:1; |
#define ASSH_SERVICE_CLEANUP_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_service.h source file, line 65.
This macro expands to:
void (n)(struct assh_session_s *s)
See also assh_service_cleanup_t.
#define ASSH_SERVICE_INIT_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_service.h source file, line 54.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_session_s *s)
See also assh_service_init_t.
#define ASSH_SERVICE_PROCESS_FCN(n) [link]
This macro is for internal use only.
This macro is declared in assh/assh_service.h source file, line 77.
This macro expands to:
assh_status_t (n)(struct assh_session_s *s,
struct assh_packet_s *p,
struct assh_event_s *e)
See also assh_service_process_t.
typedef void (assh_service_cleanup_t)(struct assh_session_s *s) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_service.h source file, line 75.
This declaration involves expansion of the ASSH_SERVICE_CLEANUP_FCN macro.
This typedef defines the function type for the cleanup operation of the ssh service module interface. This function is called when the service terminates or when the session cleanup occurs. It has to free the resources allocated by the service initialization function and set the assh_session_s::srv and assh_session_s::srv_pv fields to NULL.
typedef assh_status_t (assh_service_init_t)(struct assh_session_s *s) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_service.h source file, line 63.
This declaration involves expansion of the ASSH_SERVICE_INIT_FCN macro.
This typedef defines the function type for the initialization operation of the ssh service module interface. This function is called when a service request is successful. This function must set the assh_session_s::srv field and may set the assh_session_s::srv_pv field as well to store its private data.
assh_status_t assh_service_loop(struct assh_session_s *s, struct assh_packet_s *p, struct assh_event_s *e) [link]
This function is for internal use only.
This function is declared in assh/assh_service.h source file, line 168.
assh_status_t assh_service_next(struct assh_session_s *s, const struct assh_service_s **srv) [link]
This function is for internal use only.
This function is declared in assh/assh_service.h source file, line 181.
This function returns the next service which must be started for the current client session. Designed for use by service implementations.
typedef assh_status_t (assh_service_process_t)(struct assh_session_s *s, struct assh_packet_s *p, struct assh_event_s *e) [link]
This typedef is for internal use only.
This typedef is declared in assh/assh_service.h source file, line 111.
This declaration involves expansion of the ASSH_SERVICE_PROCESS_FCN macro.
This typedef defines the function type for event processing of the ssh service module interface. This function is called from the assh_transport_dispatch function when the current state of the transport layer is ASSH_TR_SERVICE, ASSH_TR_SERVICE_KEX or ASSH_TR_DISCONNECT. It must update the assh_session_s::srv_deadline field when the state is less than ASSH_TR_DISCONNECT.
A packet may be passed to the function for processing by the running service. This function must be able to handle some SSH_MSG_UNIMPLEMENTED packets as well as packets with a message id greater or equal to SSH_MSG_SERVICE_FIRST. If no new received packet is available, the parameter is NULL.
The function may initialize the passed event object, in this case the event will be reported to the caller of the assh_event_get function.
The function can return the ASSH_NO_DATA value to indicate that the provided packet has not been processed and must be provided again on the next call. If no event is reported and ASSH_NO_DATA is returned, the function is called again immediately.
This function should check the current state of the transport layer and report any termination related events when the state is ASSH_TR_DISCONNECT. If the function reports no event and return ASSH_OK when the state is ASSH_TR_DISCONNECT, the state will change to ASSH_TR_CLOSED and the function will not be called any more.
void assh_service_start(struct assh_session_s *s, const struct assh_service_s *next) [link]
This function is for internal use only.
This function is declared in assh/assh_service.h source file, line 193.
This function stops the currently running service and schedules execution of the specified service. Designed for use by service implementations.
enum assh_service_state_e [link]
This enum is for internal use only.
This enum is declared in assh/assh_service.h source file, line 47.
Identifier | Value | Description |
---|---|---|
ASSH_SRV_NONE | 0 | |
ASSH_SRV_REQUESTED | 1 | |
ASSH_SRV_INIT | 2 | |
ASSH_SRV_RUNNING | 3 |
void assh_service_stop(struct assh_session_s *s) [link]
This function is for internal use only.
This function is declared in assh/assh_service.h source file, line 187.
This function stops the currently running service. Designed for use by client service implementations. This will make assh send a SSH_MSG_SERVICE_REQUEST message to the server in order to start the next service.