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.

Header inclusion [link] 

Members [link] 

Types [link] 

Functions [link] 

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.

FieldDescription
void * user_pv;User private data
assh_allocator_t * f_alloc;Memory allocator function
void * alloc_pv;Memory allocator private data
const struct assh_prng_s * prng;Pseudo random number generator
union <anonymous> {Pseudo random number generator private data, allocated by the assh_prng_init_t function and freed by assh_prng_cleanup_t.
void * prng_pv;
intptr_t prng_pvl;
};
size_t session_count;Number of initialized sessions attached to this context.
struct assh_key_s * keys;Head of loaded keys list
const struct assh_algo_s ** algos;Registered algorithms
size_t algo_realloc:1;Set if algos is not a static array
size_t algo_max:15;Number of algorithm slots
size_t algo_cnt:16;Number of registered algorithms
uint32_t pck_pool_max_bsize;Packet pool: maximum allocated size in a single bucket.
uint32_t pck_pool_max_size;Packet pool: maximum byte amount of spare packets before releasing to the memory allocator.
uint32_t pck_pool_size;Packet pool: current byte amount of spare packets not yet released to the memory allocator.
struct assh_packet_pool_s pool[(16-6)];Packet pool buckets of spare packets by size.
const struct assh_service_s * srvs[CONFIG_ASSH_MAX_SERVICES];Registered services.
enum assh_context_type_e type:2;Client/server context type.
size_t srvs_count:6;Number of registered services
uint8_t safety_weight;Indicates how algorithms safety must be favored over speed.
uint8_t timeout_transport;Timeout waiting for reply to the version string and service start requests. Expressed in seconds minus 1.
uint8_t timeout_kex;Maximum duration of a key exchange, in seconds minus 1.
uint16_t timeout_rekex;Duration before initiating a new key exchanges, in seconds minus 1.
uint16_t timeout_userauth;Maximum duration of the user authentication process, in seconds minus 1.
uint16_t timeout_keepalive;Delay between transmission of the SSH_MSG_IGNORE packets by the running service for keepalive purpose, in seconds. Disabled when 0.
size_t kex_init_size:16;Estimated size of the kex init packet, computed when new algorithms are registered.

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.

IdentifierValueDescription
ASSH_SERVER0Sessions associated to the context will be server side.
ASSH_CLIENT1Sessions associated to the context will be client side.
ASSH_CLIENT_SERVER2No 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.

struct assh_packet_pool_s [link] 

This struct is for internal use only.

This struct is declared in assh/assh_context.h source file, line 54.

This struct is the packet pool allocator bucket structure. Freed packets are inserted in the linked list of the bucket associated with their size.

FieldDescription
struct assh_packet_s * pck;
size_t count;
size_t size;
Valid XHTML 1.0 StrictGenerated by diaxen on Sun Oct 25 23:31:03 2020 using MkDoc