Trait wolfssl::IOCallbacks

source ·
pub trait IOCallbacks {
    // Required methods
    fn recv(&mut self, buf: &mut [u8]) -> IOCallbackResult<usize>;
    fn send(&mut self, buf: &[u8]) -> IOCallbackResult<usize>;
}
Expand description

The application provided IO callbacks documented at EmbedRecieve (whose inputs and outputs we need to emulate). See also wolfSSL_CTX_SetIORecv which is the best docs for wolfSSL_SSLSetIORecv and wolfSSL_SSLSetIOSend, which are what we actually use.

Required Methods§

source

fn recv(&mut self, buf: &mut [u8]) -> IOCallbackResult<usize>

Called when WolfSSL wishes to receive some data.

Receive as many bytes as possible into provided buffer, return the number of bytes actually received. If the operation would block std::io::ErrorKind::WouldBlock then return IOCallbackResult::WouldBlock.

source

fn send(&mut self, buf: &[u8]) -> IOCallbackResult<usize>

Called when WolfSSL wishes to send some data

Send as many bytes as possible from the provided buffer, return the number of bytes actually consumed. If the operation would block std::io::ErrorKind::WouldBlock then return IOCallbackResult::WouldBlock.

Implementors§