pub trait StreamParser: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn can_parse_stream(&self, context: &StreamContext) -> bool;
fn parse_stream(
&self,
data: &[u8],
context: &StreamContext,
) -> StreamParseResult;
fn message_schema(&self) -> Vec<FieldDescriptor>;
// Provided method
fn display_name(&self) -> &'static str { ... }
}Expand description
Trait for parsing application protocols from reassembled streams.
Required Methods§
Sourcefn can_parse_stream(&self, context: &StreamContext) -> bool
fn can_parse_stream(&self, context: &StreamContext) -> bool
Check if this parser can handle the stream based on context.
Sourcefn parse_stream(
&self,
data: &[u8],
context: &StreamContext,
) -> StreamParseResult
fn parse_stream( &self, data: &[u8], context: &StreamContext, ) -> StreamParseResult
Parse from reassembled stream bytes.
Called repeatedly as more data becomes available. Parser should be stateless - all state is managed externally.
Sourcefn message_schema(&self) -> Vec<FieldDescriptor>
fn message_schema(&self) -> Vec<FieldDescriptor>
Schema for messages produced by this parser.
Provided Methods§
Sourcefn display_name(&self) -> &'static str
fn display_name(&self) -> &'static str
Human-readable name.