Function esp_idf_sys::mbedtls_ssl_get_session

source ยท
pub unsafe extern "C" fn mbedtls_ssl_get_session(
    ssl: *const mbedtls_ssl_context,
    session: *mut mbedtls_ssl_session,
) -> c_int
Expand description

\brief Export a session in order to resume it later.

\param ssl The SSL context representing the connection for which to to export a session structure for later resumption. \param session The target structure in which to store the exported session. This must have been initialized with mbedtls_ssl_session_init() but otherwise be unused.

\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, once implemented, sessions equate to tickets, and calling this function multiple times will export the available tickets one a time until no further tickets are available, in which case MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE will be returned.

\note Calling this function multiple times will only be useful once TLS 1.3 is supported. For TLS 1.2 connections, this function should be called at most once.

\return \c 0 if successful. In this case, \p session can be used for session resumption by passing it to mbedtls_ssl_set_session(), and serialized for storage via mbedtls_ssl_session_save(). \return #MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if no further session is available for export. This error is a non-fatal, and has no observable effect on the SSL context or the destination session. \return Another negative error code on other kinds of failure.

\sa mbedtls_ssl_set_session() \sa mbedtls_ssl_session_save()