Function esp_idf_hal::sys::mbedtls_ssl_set_bio

source ·
pub unsafe extern "C" fn mbedtls_ssl_set_bio(
    ssl: *mut mbedtls_ssl_context,
    p_bio: *mut c_void,
    f_send: Option<unsafe extern "C" fn(_: *mut c_void, _: *const u8, _: usize) -> i32>,
    f_recv: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
    f_recv_timeout: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize, _: u32) -> i32>,
)
Expand description

\brief Set the underlying BIO callbacks for write, read and read-with-timeout.

\param ssl SSL context \param p_bio parameter (context) shared by BIO callbacks \param f_send write callback \param f_recv read callback \param f_recv_timeout blocking read callback with timeout.

\note One of f_recv or f_recv_timeout can be NULL, in which case the other is used. If both are non-NULL, f_recv_timeout is used and f_recv is ignored (as if it were NULL).

\note The two most common use cases are: - non-blocking I/O, f_recv != NULL, f_recv_timeout == NULL - blocking I/O, f_recv == NULL, f_recv_timeout != NULL

\note For DTLS, you need to provide either a non-NULL f_recv_timeout callback, or a f_recv that doesn’t block.

\note See the documentations of \c mbedtls_ssl_send_t, \c mbedtls_ssl_recv_t and \c mbedtls_ssl_recv_timeout_t for the conventions those callbacks must follow.

\note On some platforms, net_sockets.c provides \c mbedtls_net_send(), \c mbedtls_net_recv() and \c mbedtls_net_recv_timeout() that are suitable to be used here.