pub trait Layer {
// Required methods
fn kind(&self) -> LayerKind;
fn summary(&self, data: &[u8]) -> String;
fn header_len(&self, data: &[u8]) -> usize;
// Provided methods
fn hashret(&self, _data: &[u8]) -> Vec<u8> ⓘ { ... }
fn answers(&self, _data: &[u8], _other: &Self, _other_data: &[u8]) -> bool { ... }
fn extract_padding<'a>(&self, data: &'a [u8]) -> (&'a [u8], &'a [u8]) { ... }
fn field_names(&self) -> &'static [&'static str] { ... }
}Expand description
Trait for types that can act as a network protocol layer.
This trait defines the core interface for all protocol layers, including methods for packet matching (hashret/answers) and padding extraction
Required Methods§
Sourcefn header_len(&self, data: &[u8]) -> usize
fn header_len(&self, data: &[u8]) -> usize
Get the header length for this layer
Provided Methods§
Sourcefn answers(&self, _data: &[u8], _other: &Self, _other_data: &[u8]) -> bool
fn answers(&self, _data: &[u8], _other: &Self, _other_data: &[u8]) -> bool
Check if this packet answers another packet.
Sourcefn extract_padding<'a>(&self, data: &'a [u8]) -> (&'a [u8], &'a [u8])
fn extract_padding<'a>(&self, data: &'a [u8]) -> (&'a [u8], &'a [u8])
Extract padding from the packet.
Sourcefn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Get the list of field names for this layer
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.