pub unsafe extern "C" fn mbedtls_ssl_set_session(
ssl: *mut mbedtls_ssl_context,
session: *const mbedtls_ssl_session,
) -> c_int
Expand description
\brief Load a session for session resumption.
Sessions loaded through this call will be considered
for session resumption in the next handshake.
\note Even if this call succeeds, it is not guaranteed that the next handshake will indeed be shortened through the use of session resumption: The server is always free to reject any attempt for resumption and fall back to a full handshake.
\note This function can handle a variety of mechanisms for session resumption: For TLS 1.2, both session ID-based resumption and ticket-based resumption will be considered. For TLS 1.3, sessions equate to tickets, and loading one session by calling this function will lead to its corresponding ticket being advertised as resumption PSK by the client. This depends on session tickets being enabled (see #MBEDTLS_SSL_SESSION_TICKETS configuration option) though. If session tickets are disabled, a call to this function with a TLS 1.3 session, will not have any effect on the next handshake for the SSL context \p ssl.
\param ssl The SSL context representing the connection which should be attempted to be setup using session resumption. This must be initialized via mbedtls_ssl_init() and bound to an SSL configuration via mbedtls_ssl_setup(), but the handshake must not yet have been started. \param session The session to be considered for session resumption. This must be a session previously exported via mbedtls_ssl_get_session(), and potentially serialized and deserialized through mbedtls_ssl_session_save() and mbedtls_ssl_session_load() in the meantime.
\return \c 0 if successful. \return \c MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if the session could not be loaded because one session has already been loaded. This error is non-fatal, and has no observable effect on the SSL context or the session that was attempted to be loaded. \return Another negative error code on other kinds of failure.
\sa mbedtls_ssl_get_session() \sa mbedtls_ssl_session_load()