Struct zero_packet::network::ipv4::IPv4Parser

source ·
pub struct IPv4Parser<'a> {
    pub data: &'a [u8],
}

Fields§

§data: &'a [u8]

Implementations§

source§

impl<'a> IPv4Parser<'a>

source

pub fn new(data: &'a [u8]) -> Result<Self, &'static str>

Creates a new IPv4Packet from the given data slice.

source

pub fn version(&self) -> u8

Returns the version field.

source

pub fn ihl(&self) -> u8

Returns the IHL field.

source

pub fn dscp(&self) -> u8

Returns the DSCP field.

source

pub fn ecn(&self) -> u8

Returns the ECN field.

source

pub fn total_length(&self) -> u16

Returns the total length field.

source

pub fn id(&self) -> u16

Returns the identification field.

source

pub fn flags(&self) -> u8

Returns the flags field.

source

pub fn fragment_offset(&self) -> u16

Returns the fragment offset field.

source

pub fn ttl(&self) -> u8

Returns the TTL field.

source

pub fn protocol(&self) -> u8

Returns the protocol field.

source

pub fn src_ip(&self) -> &[u8]

Returns a reference to the source IP address field.

source

pub fn dest_ip(&self) -> &[u8]

Returns a reference to the destination IP address field.

source

pub fn checksum(&self) -> u16

Returns the checksum field.

source

pub fn header_len(&self) -> usize

Returns the actual header length in bytes.

source

pub fn header(&self) -> &'a [u8]

Returns a reference to the header.

source

pub fn payload(&self) -> &'a [u8]

Returns a reference to the payload.

Trait Implementations§

source§

impl<'a> Debug for IPv4Parser<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for IPv4Parser<'a>

source§

fn eq(&self, other: &IPv4Parser<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> StructuralPartialEq for IPv4Parser<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for IPv4Parser<'a>

§

impl<'a> RefUnwindSafe for IPv4Parser<'a>

§

impl<'a> Send for IPv4Parser<'a>

§

impl<'a> Sync for IPv4Parser<'a>

§

impl<'a> Unpin for IPv4Parser<'a>

§

impl<'a> UnwindSafe for IPv4Parser<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.