pub struct Ipv6RawExtHeaderSlice<'a> { /* private fields */ }
Expand description

Slice containing an IPv6 extension header without specific decoding methods (fallback in case no specific implementation is available).

Slice containing an IPv6 extension header with only minimal data interpretation. NOTE only ipv6 header extensions with the first two bytes representing the next header and the header length in 8-octets (- 8 octets) can be represented with this struct. This excludes the “Authentication Header” (AH) and “Encapsulating Security Payload” (ESP).

The following headers can be represented in a Ipv6ExtensionHeaderSlice:

  • HopbyHop
  • Destination Options
  • Routing
  • Mobility
  • Host Identity Protocol
  • Shim6 Protocol

Implementations§

source§

impl<'a> Ipv6RawExtHeaderSlice<'a>

source

pub fn header_type_supported(next_header: IpNumber) -> bool

Returns true if the given header type ip number can be represented in an Ipv6ExtensionHeaderSlice.

source

pub fn from_slice( slice: &'a [u8] ) -> Result<Ipv6RawExtHeaderSlice<'a>, LenError>

Creates a generic ipv6 extension header slice from a slice.

source

pub unsafe fn from_slice_unchecked(slice: &'a [u8]) -> Ipv6RawExtHeaderSlice<'a>

Creates a raw ipv6 extension header slice from a slice (assumes slice size & content was validated before).

§Safety

This method assumes that the slice was previously validated to contain a valid & supported raw ipv6 extension header. This means the slice length must at least be at least 8 and (slice[1] + 1)*8. The data that the slice points must also be valid (meaning no nullptr or alike allowed).

If these preconditions are not fulfilled the behavior of this function and the methods of the return IpAuthHeaderSlice will be undefined.

source

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

Returns the slice containing the ipv6 extension header

source

pub fn next_header(&self) -> IpNumber

Returns the IP protocol number of the next header or transport layer protocol.

See IpNumber or ip_number for a definition of the known values.

source

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

Returns a slice containing the payload data of the header.

This contains all the data after the header length field until the end of the header (length specified by the hdr ext length field).

source

pub fn to_header(&self) -> Ipv6RawExtHeader

Convert the slice to an Ipv6RawExtHeader.

Decode some of the fields and copy the results to a Ipv6RawExtHeader struct together with a slice pointing to the non decoded parts.

Trait Implementations§

source§

impl<'a> Clone for Ipv6RawExtHeaderSlice<'a>

source§

fn clone(&self) -> Ipv6RawExtHeaderSlice<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Ipv6RawExtHeaderSlice<'a>

source§

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

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

impl<'a> PartialEq for Ipv6RawExtHeaderSlice<'a>

source§

fn eq(&self, other: &Ipv6RawExtHeaderSlice<'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> Eq for Ipv6RawExtHeaderSlice<'a>

source§

impl<'a> StructuralPartialEq for Ipv6RawExtHeaderSlice<'a>

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.