Struct etherparse::Ipv4HeaderSlice [−][src]
A slice containing an ipv4 header of a network package.
Implementations
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]
fn clone(&self) -> Ipv4HeaderSlice<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for Ipv4HeaderSlice<'a>
[src]
impl<'a> Eq for Ipv4HeaderSlice<'a>
[src]
impl<'a> PartialEq<Ipv4HeaderSlice<'a>> for Ipv4HeaderSlice<'a>
[src]
fn eq(&self, other: &Ipv4HeaderSlice<'a>) -> bool
[src]
fn ne(&self, other: &Ipv4HeaderSlice<'a>) -> bool
[src]
impl<'a> StructuralEq for Ipv4HeaderSlice<'a>
[src]
impl<'a> StructuralPartialEq for Ipv4HeaderSlice<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Ipv4HeaderSlice<'a>
[src]
impl<'a> Send for Ipv4HeaderSlice<'a>
[src]
impl<'a> Sync for Ipv4HeaderSlice<'a>
[src]
impl<'a> Unpin for Ipv4HeaderSlice<'a>
[src]
impl<'a> UnwindSafe for Ipv4HeaderSlice<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,