[][src]Struct etherparse::Ipv4HeaderSlice

pub struct Ipv4HeaderSlice<'a> { /* fields omitted */ }

A slice containing an ipv4 header of a network package.

Methods

impl<'a> Ipv4HeaderSlice<'a>[src]

pub fn from_slice(slice: &'a [u8]) -> Result<Ipv4HeaderSlice<'a>, ReadError>[src]

Creates a slice containing an ipv4 header (including header options).

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

Returns the slice containing the ipv4 header

pub fn version(&self) -> u8[src]

Read the "version" field of the IPv4 header (should be 4).

pub fn ihl(&self) -> u8[src]

Read the "ip header length" (length of the ipv4 header + options in multiples of 4 bytes).

pub fn dcp(&self) -> u8[src]

Read the "differentiated_services_code_point" from the slice.

pub fn ecn(&self) -> u8[src]

Read the "explicit_congestion_notification" from the slice.

pub fn total_len(&self) -> u16[src]

Read the "total length" from the slice (total length of ip header + payload).

pub fn payload_len(&self) -> u16[src]

Determine the payload length based on the ihl & total_length field of the header.

pub fn identification(&self) -> u16[src]

Read the "identification" field from the slice.

pub fn dont_fragment(&self) -> bool[src]

Read the "dont fragment" flag from the slice.

pub fn more_fragments(&self) -> bool[src]

Read the "more fragments" flag from the slice.

pub fn fragments_offset(&self) -> u16[src]

Read the "fragment_offset" field from the slice.

pub fn ttl(&self) -> u8[src]

Read the "time_to_live" field from the slice.

pub fn protocol(&self) -> u8[src]

Read the "protocol" field from the slice.

pub fn header_checksum(&self) -> u16[src]

Read the "header checksum" field from the slice.

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

Returns a slice containing the ipv4 source address.

pub fn source_addr(&self) -> Ipv4Addr[src]

Return the ipv4 source address as an std::net::Ipv4Addr

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

Returns a slice containing the ipv4 source address.

pub fn destination_addr(&self) -> Ipv4Addr[src]

Return the ipv4 destination address as an std::net::Ipv4Addr

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

Returns a slice containing the ipv4 header options (empty when there are no options).

pub fn to_header(&self) -> Ipv4Header[src]

Decode all the fields and copy the results to a Ipv4Header struct

Trait Implementations

impl<'a> Clone for Ipv4HeaderSlice<'a>[src]

impl<'a> Eq for Ipv4HeaderSlice<'a>[src]

impl<'a> PartialEq<Ipv4HeaderSlice<'a>> for Ipv4HeaderSlice<'a>[src]

impl<'a> Debug for Ipv4HeaderSlice<'a>[src]

impl<'a> StructuralPartialEq for Ipv4HeaderSlice<'a>[src]

impl<'a> StructuralEq for Ipv4HeaderSlice<'a>[src]

Auto Trait Implementations

impl<'a> Send for Ipv4HeaderSlice<'a>

impl<'a> Sync for Ipv4HeaderSlice<'a>

impl<'a> Unpin for Ipv4HeaderSlice<'a>

impl<'a> UnwindSafe for Ipv4HeaderSlice<'a>

impl<'a> RefUnwindSafe for Ipv4HeaderSlice<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]