assh/assh_context.h header reference
Description [link]
The library uses a context structure to store stuff common to multiple sessions. This header file provides declaration of the struct assh_context_s structure and related functions.
Members [link]
Types [link]
- struct assh_context_s
- enum assh_context_type_e
Functions [link]
- void assh_context_cleanup(struct assh_context_s *ctx)
- assh_status_t assh_context_create(struct assh_context_s **ctx, enum assh_context_type_e type, assh_allocator_t *alloc, void *alloc_pv, const struct assh_prng_s *prng, const struct assh_buffer_s *prng_seed)
- void * assh_context_get_pv(const struct assh_context_s *ctx)
- assh_status_t assh_context_init(struct assh_context_s *ctx, enum assh_context_type_e type, assh_allocator_t *alloc, void *alloc_pv, const struct assh_prng_s *prng, const struct assh_buffer_s *prng_seed)
- struct assh_key_s ** assh_context_keys(struct assh_context_s *ctx)
- size_t assh_context_refcount(const struct assh_context_s *ctx)
- void assh_context_release(struct assh_context_s *ctx)
- void assh_context_set_keepalive(struct assh_context_s *c, uint_fast16_t keepalive)
- void assh_context_set_pv(struct assh_context_s *ctx, void *private)
- void assh_context_set_timeouts(struct assh_context_s *c, uint_fast8_t transport, uint_fast8_t kex, uint_fast16_t rekex, uint_fast16_t userauth)
- assh_status_t assh_deps_init(void )
Members detail [link]
void assh_context_cleanup(struct assh_context_s *ctx) [link]
This function is declared in assh/assh_context.h source file, line 232.
This function releases resources associated with an user allocated struct assh_context_s instance.
Any associated struct assh_session_s objects must have been released when this function is called.
See also assh_context_init.
assh_status_t assh_context_create(struct assh_context_s **ctx, enum assh_context_type_e type, assh_allocator_t *alloc, void *alloc_pv, const struct assh_prng_s *prng, const struct assh_buffer_s *prng_seed) [link]
This function is declared in assh/assh_context.h source file, line 197.
This function allocates and initializes an struct assh_context_s instance.
If the alloc parameter is NULL, a default memory allocator will be used provided that one have been compiled in the library.
If the prng parameter is NULL, a default random generator will be used. Some random number generator require the seed argument to be not NULL.
See also assh_context_release.
void * assh_context_get_pv(const struct assh_context_s *ctx) [link]
This function is declared in assh/assh_context.h source file, line 241.
This function retrieves the user private pointer attached to the context.
See also assh_context_set_pv.
assh_status_t assh_context_init(struct assh_context_s *ctx, enum assh_context_type_e type, assh_allocator_t *alloc, void *alloc_pv, const struct assh_prng_s *prng, const struct assh_buffer_s *prng_seed) [link]
This function is declared in assh/assh_context.h source file, line 222.
This function initializes an user allocated struct assh_context_s instance. When a stable ABI is needed, the assh_context_create function must be used instead.
This requires the same arguments as the assh_context_create function.
See also assh_context_cleanup.
struct assh_key_s ** assh_context_keys(struct assh_context_s *ctx) [link]
This function is declared in assh/assh_context.h source file, line 251.
This function returns the list head of keys attached to the context. It can be used to attach more keys. The assh_key_flush function will be called on this list on context cleanup.
See also asshh_hostkey_load_file and asshh_hostkey_load_filename.
size_t assh_context_refcount(const struct assh_context_s *ctx) [link]
This function is declared in assh/assh_context.h source file, line 255.
This function returns the number of sessions that use the given context.
void assh_context_release(struct assh_context_s *ctx) [link]
This function is declared in assh/assh_context.h source file, line 206.
This function releases an struct assh_context_s instance created by the assh_context_create function as well as associated resources.
All existing struct assh_session_s objects must have been released when this function is called.
See also assh_context_create.
struct assh_context_s [link]
This struct is declared in assh/assh_context.h source file, line 74.
This struct is the library main context structure. It is designed to store resources shared between multiple struct assh_session_s instances.
It stores the following resources:
the set of registered algorithms,
the memory allocator context,
the random generator context,
the user configurable protocol timeouts,
the list of server host keys.
void assh_context_set_keepalive(struct assh_context_s *c, uint_fast16_t keepalive) [link]
This function is declared in assh/assh_context.h source file, line 169.
This function sets the idle delay before transmission of a keep-alive message by the running service. No keep-alive messages are transmitted when 0.
void assh_context_set_pv(struct assh_context_s *ctx, void *private) [link]
This function is declared in assh/assh_context.h source file, line 237.
This function sets the user private pointer of the context.
See also assh_context_get_pv.
void assh_context_set_timeouts(struct assh_context_s *c, uint_fast8_t transport, uint_fast8_t kex, uint_fast16_t rekex, uint_fast16_t userauth) [link]
This function is declared in assh/assh_context.h source file, line 163.
This function sets various timeout delays related to the transport layer. Values are expressed in second unit. When passing 0, the delay is not changed.
enum assh_context_type_e [link]
This enum is declared in assh/assh_context.h source file, line 40.
This specifies the type of ssh sessions that will be created.
Identifier | Description |
---|---|
ASSH_SERVER | Sessions associated to the context will be server side. |
ASSH_CLIENT | Sessions associated to the context will be client side. |
ASSH_CLIENT_SERVER | No session can be associated to the context. The context may still be used to perform key management operations. |
assh_status_t assh_deps_init(void ) [link]
This function is declared in assh/assh_context.h source file, line 180.
This function takes care of performing the external libraries global initialization.
The assh library does not use global variables and does not require global initialization. You do not need to call this function if you know that you use a standalone build of assh or if you already perform the initialization of the required third party libraries in your application code.