Trait retina_core::protocols::packet::Packet
source · pub trait Packet<'a> {
// Required methods
fn mbuf(&self) -> &Mbuf;
fn header_len(&self) -> usize;
fn next_header_offset(&self) -> usize;
fn next_header(&self) -> Option<usize>;
fn parse_from(outer: &'a impl Packet<'a>) -> Result<Self>
where Self: Sized;
// Provided method
fn parse_to<T: Packet<'a>>(&'a self) -> Result<T>
where Self: Sized { ... }
}
Expand description
Represents a single packet.
Required Methods§
sourcefn header_len(&self) -> usize
fn header_len(&self) -> usize
Offset from the beginning of the header to the start of the payload.
sourcefn next_header_offset(&self) -> usize
fn next_header_offset(&self) -> usize
Offset from the beginning of the packet buffer to the start of the payload.
sourcefn next_header(&self) -> Option<usize>
fn next_header(&self) -> Option<usize>
Next level IANA protocol number.
sourcefn parse_from(outer: &'a impl Packet<'a>) -> Result<Self>where
Self: Sized,
fn parse_from(outer: &'a impl Packet<'a>) -> Result<Self>where
Self: Sized,
Parses a Packet
from the outer encapsulating Packet
’s payload.