pub struct RawLayer {
pub index: LayerIndex,
}Expand description
A layer representing raw (unparsed) payload data.
The Raw layer is the simplest layer type - it just holds arbitrary bytes without any protocol-specific parsing. It’s typically found at the end of a packet after all known protocols have been parsed.
Fields§
§index: LayerIndexThe layer’s position within the packet buffer.
Implementations§
Source§impl RawLayer
impl RawLayer
Sourcepub fn new(index: LayerIndex) -> Self
pub fn new(index: LayerIndex) -> Self
Create a new RawLayer with the given index.
Sourcepub fn from_start(start: usize) -> Self
pub fn from_start(start: usize) -> Self
Create a RawLayer that spans the entire buffer from start to the end.
Sourcepub fn header_len(&self, buf: &[u8]) -> usize
pub fn header_len(&self, buf: &[u8]) -> usize
Get the header length (for Raw, this is the entire payload).
Sourcepub fn hex_preview(&self, buf: &[u8], max_bytes: usize) -> String
pub fn hex_preview(&self, buf: &[u8], max_bytes: usize) -> String
Get a hexdump preview of the payload (first N bytes).
Sourcepub fn ascii_preview(&self, buf: &[u8], max_bytes: usize) -> String
pub fn ascii_preview(&self, buf: &[u8], max_bytes: usize) -> String
Get an ASCII preview of the payload (printable chars only).
Sourcepub fn hashret(&self, buf: &[u8]) -> Vec<u8> ⓘ
pub fn hashret(&self, buf: &[u8]) -> Vec<u8> ⓘ
Compute a hash for request/response matching. For Raw, we just return the first 8 bytes as a simple hash.
Sourcepub fn answers(&self, buf: &[u8], other: &RawLayer, other_buf: &[u8]) -> bool
pub fn answers(&self, buf: &[u8], other: &RawLayer, other_buf: &[u8]) -> bool
Check if this Raw layer “answers” another Raw layer. For Raw payloads, we consider them matching if they have the same content.
Sourcepub fn get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Get a field value by name.
Sourcepub fn set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
pub fn set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Set a field value by name.
Sourcepub fn field_names() -> &'static [&'static str]
pub fn field_names() -> &'static [&'static str]
Get the list of field names for this layer.