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

A slice containing an IP Authentication Header (rfc4302)

Implementations§

source§

impl<'a> IpAuthHeaderSlice<'a>

source

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

Creates a ip authentication header slice from a slice.

source

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

Creates a ip authentication 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 authentication header. This means the slice length must at least be at least 8 and (slice[1] + 2)*4. 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 authentication 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 spi(&self) -> u32

Read the security parameters index from the slice

source

pub fn sequence_number(&self) -> u32

This unsigned 32-bit field contains a counter value that increases by one for each packet sent.

source

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

Return a slice with the raw integrity check value

source

pub fn to_header(&self) -> IpAuthHeader

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

Trait Implementations§

source§

impl<'a> Clone for IpAuthHeaderSlice<'a>

source§

fn clone(&self) -> IpAuthHeaderSlice<'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 IpAuthHeaderSlice<'a>

source§

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

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

impl<'a> PartialEq for IpAuthHeaderSlice<'a>

source§

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

source§

impl<'a> Eq for IpAuthHeaderSlice<'a>

source§

impl<'a> StructuralPartialEq for IpAuthHeaderSlice<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for IpAuthHeaderSlice<'a>

§

impl<'a> RefUnwindSafe for IpAuthHeaderSlice<'a>

§

impl<'a> Send for IpAuthHeaderSlice<'a>

§

impl<'a> Sync for IpAuthHeaderSlice<'a>

§

impl<'a> Unpin for IpAuthHeaderSlice<'a>

§

impl<'a> UnwindSafe for IpAuthHeaderSlice<'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> 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.