StreamParser

Trait StreamParser 

Source
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§

Source

fn name(&self) -> &'static str

Protocol identifier (e.g., “http”, “tls”).

Source

fn can_parse_stream(&self, context: &StreamContext) -> bool

Check if this parser can handle the stream based on context.

Source

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.

Source

fn message_schema(&self) -> Vec<FieldDescriptor>

Schema for messages produced by this parser.

Provided Methods§

Source

fn display_name(&self) -> &'static str

Human-readable name.

Implementors§