pub unsafe extern "C" fn mbedtls_ssl_session_save(
    session: *const mbedtls_ssl_session,
    buf: *mut c_uchar,
    buf_len: usize,
    olen: *mut usize
) -> c_int
Expand description

\brief Save session structure as serialized data in a buffer. On client, this can be used for saving session data, potentially in non-volatile storage, for resuming later. On server, this can be used for alternative implementations of session cache or session tickets.

\see mbedtls_ssl_session_load()

\param session The session structure to be saved. \param buf The buffer to write the serialized data to. It must be a writeable buffer of at least \p buf_len bytes, or may be \c NULL if \p buf_len is \c 0. \param buf_len The number of bytes available for writing in \p buf. \param olen The size in bytes of the data that has been or would have been written. It must point to a valid \c size_t.

\note \p olen is updated to the correct value regardless of whether \p buf_len was large enough. This makes it possible to determine the necessary size by calling this function with \p buf set to \c NULL and \p buf_len to \c 0.

\return \c 0 if successful. \return #MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL if \p buf is too small.