Struct etherparse::IpAuthHeader
source · pub struct IpAuthHeader {
pub next_header: IpNumber,
pub spi: u32,
pub sequence_number: u32,
/* private fields */
}Expand description
IP Authentication Header (rfc4302)
Fields§
§next_header: IpNumberIP protocol number specifying the next header or transport layer protocol.
See IpNumber or ip_number for a definition of the known values.
spi: u32Security Parameters Index
sequence_number: u32This unsigned 32-bit field contains a counter value that increases by one for each packet sent.
Implementations§
source§impl<'a> IpAuthHeader
impl<'a> IpAuthHeader
sourcepub const MIN_LEN: usize = 12usize
pub const MIN_LEN: usize = 12usize
Minimum length of an IP authentication header in bytes/octets.
sourcepub const MAX_LEN: usize = 1_028usize
pub const MAX_LEN: usize = 1_028usize
Maximum length of an IP authentication header in bytes/octets.
This number is calculated by taking the maximum value that the “payload length” field supports (0xff) adding 2 and multiplying the sum by 4 as the “payload length” specifies how many 4 bytes words are present in the header.
sourcepub const MAX_ICV_LEN: usize = 1_016usize
pub const MAX_ICV_LEN: usize = 1_016usize
The maximum amount of bytes/octets that can be stored in the ICV part of an IP authentication header.
sourcepub fn new(
next_header: IpNumber,
spi: u32,
sequence_number: u32,
raw_icv: &'a [u8],
) -> Result<IpAuthHeader, IcvLenError>
pub fn new( next_header: IpNumber, spi: u32, sequence_number: u32, raw_icv: &'a [u8], ) -> Result<IpAuthHeader, IcvLenError>
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
(IpAuthHeader::MAX_ICV_LEN). If the slice length does
not fulfill these requirements the value is not copied and an
crate::err::ip_auth::IcvLenError is returned.
If successful an Ok(()) is returned.
sourcepub fn from_slice(
slice: &'a [u8],
) -> Result<(IpAuthHeader, &'a [u8]), HeaderSliceError>
pub fn from_slice( slice: &'a [u8], ) -> Result<(IpAuthHeader, &'a [u8]), HeaderSliceError>
Read an authentication header from a slice and return the header & unused parts of the slice.
sourcepub fn read<T: Read + Sized>(
reader: &mut T,
) -> Result<IpAuthHeader, HeaderReadError>
Available on crate feature std only.
pub fn read<T: Read + Sized>( reader: &mut T, ) -> Result<IpAuthHeader, HeaderReadError>
std only.Read an authentication header from the current reader position.
sourcepub fn read_limited<T: Read + Sized>(
reader: &mut LimitedReader<T>,
) -> Result<IpAuthHeader, HeaderLimitedReadError>
Available on crate feature std only.
pub fn read_limited<T: Read + Sized>( reader: &mut LimitedReader<T>, ) -> Result<IpAuthHeader, HeaderLimitedReadError>
std only.Read an authentication header from the current reader position with a limited reader.
sourcepub fn set_raw_icv(&mut self, raw_icv: &[u8]) -> Result<(), IcvLenError>
pub fn set_raw_icv(&mut self, raw_icv: &[u8]) -> Result<(), IcvLenError>
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
(IpAuthHeader::MAX_ICV_LEN). If the slice length does
not fulfill these requirements the value is not copied and an
crate::err::ip_auth::IcvLenError is returned.
If successful an Ok(()) is returned.
sourcepub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
Available on crate feature std only.
pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
std only.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§
source§impl Clone for IpAuthHeader
impl Clone for IpAuthHeader
source§fn clone(&self) -> IpAuthHeader
fn clone(&self) -> IpAuthHeader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for IpAuthHeader
impl Debug for IpAuthHeader
source§impl Default for IpAuthHeader
impl Default for IpAuthHeader
source§impl PartialEq for IpAuthHeader
impl PartialEq for IpAuthHeader
impl Eq for IpAuthHeader
Auto Trait Implementations§
impl Freeze for IpAuthHeader
impl RefUnwindSafe for IpAuthHeader
impl Send for IpAuthHeader
impl Sync for IpAuthHeader
impl Unpin for IpAuthHeader
impl UnwindSafe for IpAuthHeader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)