pub struct MessageDeframer {
pub frames: VecDeque<OpaqueMessage>,
pub desynced: bool,
buf: Box<[u8; 18437]>,
used: usize,
}
Expand description
This deframer works to reconstruct TLS messages
from arbitrary-sized reads, buffering as necessary.
The input is read()
, the output is the frames
deque.
Fields§
§frames: VecDeque<OpaqueMessage>
Completed frames for output.
desynced: bool
Set to true if the peer is not talking TLS, but some other protocol. The caller should abort the connection, because the deframer cannot recover.
buf: Box<[u8; 18437]>
A fixed-size buffer containing the currently-accumulating TLS message.
used: usize
What size prefix of buf
is used.
Implementations§
source§impl MessageDeframer
impl MessageDeframer
pub fn new() -> Self
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. If this means our internal buffer contains
full messages, decode them all.
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.
sourcefn try_deframe_one(&mut self) -> BufferContents
fn try_deframe_one(&mut self) -> BufferContents
Does our buf
contain a full message? It does if it is big enough to
contain a header, and that header has a length which falls within buf
.
If so, deframe it and place the message onto the frames output queue.
fn buf_consume(&mut self, taken: usize)
Trait Implementations§
source§impl Default for MessageDeframer
impl Default for MessageDeframer
source§impl ProtocolMessageDeframer<TLSProtocolTypes> for MessageDeframer
impl ProtocolMessageDeframer<TLSProtocolTypes> for MessageDeframer
type OpaqueProtocolMessage = OpaqueMessage
fn pop_frame(&mut self) -> Option<OpaqueMessage>
fn read(&mut self, rd: &mut dyn Read) -> Result<usize>
Auto Trait Implementations§
impl Freeze for MessageDeframer
impl RefUnwindSafe for MessageDeframer
impl Send for MessageDeframer
impl Sync for MessageDeframer
impl Unpin for MessageDeframer
impl UnwindSafe for MessageDeframer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
§type PreprendResult = Tail
type PreprendResult = Tail
TupleList
], of an [Prepend::prepend()
] call,
including the prepended entry.