pub struct ControlStreamParser {
buf: BytesMut,
draft: DraftVersion,
capture_raw: bool,
}Expand description
Stateful inline parser for a MoQT control stream.
Accepts raw byte chunks (as they arrive from RecvStream::read),
buffers them, and emits complete ParsedFrames. In the default
(non-capturing) mode the parser does not clone the frame bytes; in
capturing mode it does, so a hook can rewrite the frame before the
proxy forwards it.
Fields§
§buf: BytesMut§draft: DraftVersion§capture_raw: boolImplementations§
Source§impl ControlStreamParser
impl ControlStreamParser
Sourcepub fn new(draft: DraftVersion) -> Self
pub fn new(draft: DraftVersion) -> Self
Create a new observation-only parser.
ParsedFrame::raw_bytes will be None; use
Self::new_capturing when a hook needs to mutate frames.
Sourcepub fn new_capturing(draft: DraftVersion) -> Self
pub fn new_capturing(draft: DraftVersion) -> Self
Create a new parser that captures the raw wire bytes of each frame.
Use this variant only when a hook may rewrite frames; the extra
Bytes::copy_from_slice per frame is unnecessary for pure
pass-through forwarding.
Sourcepub fn feed(&mut self, data: &[u8]) -> ParseResult
pub fn feed(&mut self, data: &[u8]) -> ParseResult
Feed raw bytes into the parser.
Returns ParseResult::Messages if one or more complete frames
could be decoded, or ParseResult::NeedMore if more data is
needed. Partial frames are buffered internally.