Struct zero_packet::network::ipv4::IPv4Reader
source · pub struct IPv4Reader<'a> {
pub bytes: &'a [u8],
}
Expand description
Reads IPv4 header fields.
Fields§
§bytes: &'a [u8]
Implementations§
source§impl<'a> IPv4Reader<'a>
impl<'a> IPv4Reader<'a>
sourcepub fn new(bytes: &'a [u8]) -> Result<Self, &'static str>
pub fn new(bytes: &'a [u8]) -> Result<Self, &'static str>
Creates a new IPv4Reader
from the given slice.
sourcepub fn total_length(&self) -> u16
pub fn total_length(&self) -> u16
Returns the total length field.
Includes the entire packet (header and payload).
sourcepub fn fragment_offset(&self) -> u16
pub fn fragment_offset(&self) -> u16
Returns the fragment offset field.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the actual header length in bytes.
Trait Implementations§
source§impl<'a> Debug for IPv4Reader<'a>
impl<'a> Debug for IPv4Reader<'a>
source§impl<'a> PartialEq for IPv4Reader<'a>
impl<'a> PartialEq for IPv4Reader<'a>
source§fn eq(&self, other: &IPv4Reader<'a>) -> bool
fn eq(&self, other: &IPv4Reader<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> StructuralPartialEq for IPv4Reader<'a>
Auto Trait Implementations§
impl<'a> Freeze for IPv4Reader<'a>
impl<'a> RefUnwindSafe for IPv4Reader<'a>
impl<'a> Send for IPv4Reader<'a>
impl<'a> Sync for IPv4Reader<'a>
impl<'a> Unpin for IPv4Reader<'a>
impl<'a> UnwindSafe for IPv4Reader<'a>
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
Mutably borrows from an owned value. Read more