Struct etherparse::IpAuthenticationHeader
source · [−]pub struct IpAuthenticationHeader {
pub next_header: u8,
pub spi: u32,
pub sequence_number: u32,
/* private fields */
}
Expand description
IP Authentication Header (rfc4302)
Fields
next_header: u8
IP protocol number specifying the next header or transport layer protocol.
See IpNumber or ip_number for a definition of the known values.
spi: u32
Security Parameters Index
sequence_number: u32
This unsigned 32-bit field contains a counter value that increases by one for each packet sent.
Implementations
sourceimpl<'a> IpAuthenticationHeader
impl<'a> IpAuthenticationHeader
pub const MAX_ICV_LEN: usize = 1_016usize
sourcepub fn new(
next_header: u8,
spi: u32,
sequence_number: u32,
raw_icv: &'a [u8]
) -> Result<IpAuthenticationHeader, ValueError>
pub fn new(
next_header: u8,
spi: u32,
sequence_number: u32,
raw_icv: &'a [u8]
) -> Result<IpAuthenticationHeader, ValueError>
Create a new authentication header with the given parameters.
Note: The length of the raw_icv slice must be a multiple of 4
and the maximum allowed length is 1016 bytes
(IpAuthenticationHeader::MAX_ICV_LEN
). If the slice length does
not fullfill these requirements the value is not copied and an
Err(ValueError::IpAuthenticationHeaderBadIcvLength)
is returned.
If successfull an Ok(()) is returned.
sourcepub fn from_slice(
slice: &'a [u8]
) -> Result<(IpAuthenticationHeader, &'a [u8]), ReadError>
pub fn from_slice(
slice: &'a [u8]
) -> Result<(IpAuthenticationHeader, &'a [u8]), ReadError>
Read an authentication header from a slice and return the header & unused parts of the slice.
sourcepub fn read<T: Read + Seek + Sized>(
reader: &mut T
) -> Result<IpAuthenticationHeader, ReadError>
pub fn read<T: Read + Seek + Sized>(
reader: &mut T
) -> Result<IpAuthenticationHeader, ReadError>
Read an authentication header from the current reader position.
sourcepub fn raw_icv(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn raw_icv(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns a slice the raw icv value.
sourcepub fn set_raw_icv(&mut self, raw_icv: &[u8]) -> Result<(), ValueError>
pub fn set_raw_icv(&mut self, raw_icv: &[u8]) -> Result<(), ValueError>
Sets the icv value to the given raw value. The length of the slice must be
a multiple of 4 and the maximum allowed length is 1016 bytes
(IpAuthenticationHeader::MAX_ICV_LEN
). If the slice length does
not fullfill these requirements the value is not copied and an
Err(ValueError::IpAuthenticationHeaderBadIcvLength)
is returned.
If successfull an Ok(()) is returned.
sourcepub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), WriteError>
pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), WriteError>
Writes the given authentication header to the current position.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Length of the header in bytes.
Trait Implementations
sourceimpl Clone for IpAuthenticationHeader
impl Clone for IpAuthenticationHeader
sourcefn clone(&self) -> IpAuthenticationHeader
fn clone(&self) -> IpAuthenticationHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for IpAuthenticationHeader
impl Debug for IpAuthenticationHeader
impl Eq for IpAuthenticationHeader
Auto Trait Implementations
impl RefUnwindSafe for IpAuthenticationHeader
impl Send for IpAuthenticationHeader
impl Sync for IpAuthenticationHeader
impl Unpin for IpAuthenticationHeader
impl UnwindSafe for IpAuthenticationHeader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more