Function esp_idf_svc::sys::mbedtls_ssl_conf_session_cache
source ยท pub unsafe extern "C" fn mbedtls_ssl_conf_session_cache(
conf: *mut mbedtls_ssl_config,
p_cache: *mut c_void,
f_get_cache: Option<unsafe extern "C" fn(_: *mut c_void, _: *const u8, _: usize, _: *mut mbedtls_ssl_session) -> i32>,
f_set_cache: Option<unsafe extern "C" fn(_: *mut c_void, _: *const u8, _: usize, _: *const mbedtls_ssl_session) -> i32>,
)
Expand description
\brief Set the session cache callbacks (server-side only) If not set, no session resuming is done (except if session tickets are enabled too).
The session cache has the responsibility to check for stale
entries based on timeout. See RFC 5246 for recommendations.
Warning: session.peer_cert is cleared by the SSL/TLS layer on
connection shutdown, so do not cache the pointer! Either set
it to NULL or make a full copy of the certificate.
The get callback is called once during the initial handshake
to enable session resuming. The get function has the
following parameters: (void *parameter, mbedtls_ssl_session *session)
If a valid entry is found, it should fill the master of
the session object with the cached values and return 0,
return 1 otherwise. Optionally peer_cert can be set as well
if it is properly present in cache entry.
The set callback is called once during the initial handshake
to enable session resuming after the entire handshake has
been finished. The set function has the following parameters:
(void *parameter, const mbedtls_ssl_session *session). The function
should create a cache entry for future retrieval based on
the data in the session structure and should keep in mind
that the mbedtls_ssl_session object presented (and all its referenced
data) is cleared by the SSL/TLS layer when the connection is
terminated. It is recommended to add metadata to determine if
an entry is still valid in the future. Return 0 if
successfully cached, return 1 otherwise.
\param conf SSL configuration \param p_cache parameter (context) for both callbacks \param f_get_cache session get callback \param f_set_cache session set callback