BearSSL

Data Fields
br_ssl_session_cache_class Struct Reference

Class type for a session parameter cache. More...

`#include <bearssl_ssl.h>`

## Data Fields
size_t | context_size
| Context size (in bytes). More...
void(* | save )(const br_ssl_session_cache_class **ctx, br_ssl_server_context *server_ctx, const br_ssl_session_parameters *params)
| Record a session. More...
int(* | load )(const br_ssl_session_cache_class **ctx, br_ssl_server_context *server_ctx, br_ssl_session_parameters *params)
| Lookup a session in the cache. More...

## Detailed Description

Class type for a session parameter cache.

Session parameters are saved in the cache with `save()`, and retrieved with `load()`. The cache implementation can apply any storage and eviction strategy that it sees fit. The SSL server context that performs the request is provided, so that its functionalities may be used by the implementation (e.g. hash functions or random number generation).

## Field Documentation

## ◆ context_size

size_t br_ssl_session_cache_class::context_size

Context size (in bytes).

## ◆ load

int(* br_ssl_session_cache_class::load) (const br_ssl_session_cache_class **ctx, br_ssl_server_context *server_ctx, br_ssl_session_parameters *params)

Lookup a session in the cache.

The session ID to lookup is in `params` and always has length exactly 32 bytes. If the session parameters are found in the cache, then the parameters shall be copied into the `params` structure. Returned value is 1 on successful lookup, 0 otherwise.

Parameters

  ctx | session cache context.
  server_ctx | SSL server context.
  params | destination for session parameters.

Returns
  1 if found, 0 otherwise.

## ◆ save

void(* br_ssl_session_cache_class::save) (const br_ssl_session_cache_class **ctx, br_ssl_server_context *server_ctx, const br_ssl_session_parameters *params)

Record a session.

This callback should record the provided session parameters. The `params` structure is transient, so its contents shall be copied into the cache. The session ID has been randomly generated and always has length exactly 32 bytes.

Parameters

  ctx | session cache context.
  server_ctx | SSL server context.
  params | session parameters to save.

The documentation for this struct was generated from the following file:

- bearssl_ssl.h