pub struct MessageHandler<'a, 'm, Side: SideData> { /* private fields */ }Expand description
Driver for handling messages from the TlsInputBuffer.
Must be driven to completion to make progress, by calling either Self::handle_all() or
repeatedly calling Self::next_payload() until it returns None.
Backpressure is provided by the TlsInputBuffer implementation. When using a VecInput
buffer, VecInput::read() will not ingest more data once the internal buffer is full.
Implementations§
Source§impl<'a, 'm, Side: SideData> MessageHandler<'a, 'm, Side>
impl<'a, 'm, Side: SideData> MessageHandler<'a, 'm, Side>
Sourcepub fn handle_all(self, buf: &mut Vec<u8>) -> Result<IoState, Error>
pub fn handle_all(self, buf: &mut Vec<u8>) -> Result<IoState, Error>
Handles all complete messages from the input buffer.
Writes any plaintext application data from the input into buf, and returns the I/O
state of the connection after processing the last message. If an error is returned,
the connection is in a fatal error state and no further progress can be made. After
an error is received from this function, you should not continue to fill up the buffer.
However, you may call the other methods on the connection, including
Connection::send_close_notify(). Any alert produced by the error will have
been appended to the tls buffer; most likely you will want to send that data
to the peer and then close the underlying connection.
Sourcepub fn next_payload(&mut self) -> Option<Result<Payload<'_>, Error>>
pub fn next_payload(&mut self) -> Option<Result<Payload<'_>, Error>>
Yields the first payload of plaintext application data from the input buffer.
Should be called repeatedly until it returns None, at which point the input buffer no
longer contains any complete messages and should be refilled by the application.