Struct AuthenticationHeaderWriter

Source
pub struct AuthenticationHeaderWriter<'a> {
    pub bytes: &'a mut [u8],
}
Expand description

Writes the Authentication Header fields.

Fields§

§bytes: &'a mut [u8]

Implementations§

Source§

impl<'a> AuthenticationHeaderWriter<'a>

Source

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

Creates a new AuthenticationHeaderWriter from the given data slice.

Source

pub fn header_len(&self) -> usize

Returns the total header length in bytes.

Source

pub fn set_next_header(&mut self, next_header: u8)

Sets the next header field.

Identifies the type of the next header.

Source

pub fn set_payload_len(&mut self, payload_len: u8)

Sets the payload length field.

Length of this Authentication Header with scaling factor of 4, minus 2.

E.g: Header length = (payload_len + 2) * 4.

Source

pub fn set_reserved(&mut self, reserved: u16)

Sets the reserved field.

Should be all zeros.

Source

pub fn set_spi(&mut self, spi: u32)

Sets the Security Parameters Index field.

Arbitrary value which is used (together with the dest_addr) to identify the security association of the receiving party.

Source

pub fn set_sequence_number(&mut self, sequence_number: u32)

Sets the sequence number field.

Monotonically increasing counter value to prevent replay attacks.

Source

pub fn set_authentication_data( &mut self, data: &[u8], ) -> Result<(), &'static str>

Sets the authentication data field.

Padding:

  • 4-octet alignment for IPv4 packets.
  • 8-octet alignment for IPv6 packets.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.