pub struct MessageDeframer { /* private fields */ }
Expand description
This deframer works to reconstruct TLS messages
from arbitrary-sized reads, buffering as necessary.
The input is read()
, get the output from pop()
.
Implementations§
source§impl MessageDeframer
impl MessageDeframer
pub fn new() -> Self
sourcepub fn pop(&mut self) -> Result<Option<OpaqueMessage>, Error>
pub fn pop(&mut self) -> Result<Option<OpaqueMessage>, Error>
Return any complete messages that the deframer has been able to parse.
Returns an Error
if the deframer failed to parse some message contents,
Ok(None)
if no full message is buffered, and Ok(Some(_))
if a valid message was found.
sourcepub fn read(&mut self, rd: &mut dyn Read) -> Result<usize>
pub fn read(&mut self, rd: &mut dyn Read) -> Result<usize>
Read some bytes from rd
, and add them to our internal buffer.
sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Returns true if we have messages for the caller to process, either whole messages in our output queue or partial messages in our buffer.