pub struct Ipv4<'a> { /* private fields */ }
Expand description
An IPv4 packet.
IPv4 options are not parsed by default.
Implementations§
source§impl<'a> Ipv4<'a>
impl<'a> Ipv4<'a>
sourcepub fn version_ihl(&self) -> u8
pub fn version_ihl(&self) -> u8
Returns the 8-bit field containing the version and IHL.
sourcepub fn type_of_service(&self) -> u8
pub fn type_of_service(&self) -> u8
Returns the type of service (former name of the differentiated services field).
sourcepub fn total_length(&self) -> u16
pub fn total_length(&self) -> u16
Returns the total length of the packet in bytes, including the header and data.
sourcepub fn identification(&self) -> u16
pub fn identification(&self) -> u16
Returns the identification field.
sourcepub fn flags_to_fragment_offset(&self) -> u16
pub fn flags_to_fragment_offset(&self) -> u16
Returns the 16-bit field containing the 3-bit flags and 13-bit fragment offset.
sourcepub fn fragment_offset(&self) -> u16
pub fn fragment_offset(&self) -> u16
Returns the fragment offset in units of 8 bytes.
sourcepub fn time_to_live(&self) -> u8
pub fn time_to_live(&self) -> u8
Returns the time to live (TTL) of the packet.
sourcepub fn header_checksum(&self) -> u16
pub fn header_checksum(&self) -> u16
Returns the IPv4 header checksum.
Trait Implementations§
source§impl<'a> Packet<'a> for Ipv4<'a>
impl<'a> Packet<'a> for Ipv4<'a>
source§fn header_len(&self) -> usize
fn header_len(&self) -> usize
Offset from the beginning of the header to the start of the payload.
source§fn 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.
source§fn next_header(&self) -> Option<usize>
fn next_header(&self) -> Option<usize>
Next level IANA protocol number.
Auto Trait Implementations§
impl<'a> Freeze for Ipv4<'a>
impl<'a> RefUnwindSafe for Ipv4<'a>
impl<'a> !Send for Ipv4<'a>
impl<'a> !Sync for Ipv4<'a>
impl<'a> Unpin for Ipv4<'a>
impl<'a> UnwindSafe for Ipv4<'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
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>
Converts
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>
Converts
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