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.
Trait Implementations§
Source§impl LayerDispatch for RawLayer
impl LayerDispatch for RawLayer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Source§fn dispatch_get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
fn dispatch_get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Source§fn dispatch_set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
fn dispatch_set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Auto Trait Implementations§
impl Freeze for RawLayer
impl RefUnwindSafe for RawLayer
impl Send for RawLayer
impl Sync for RawLayer
impl Unpin for RawLayer
impl UnsafeUnpin for RawLayer
impl UnwindSafe for RawLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more