pub struct Icmpv6Slice<'a> { /* private fields */ }Expand description
A slice containing an ICMPv6 network package.
Struct allows the selective read of fields in the ICMPv6 packet.
Implementations§
Source§impl<'a> Icmpv6Slice<'a>
impl<'a> Icmpv6Slice<'a>
Sourcepub fn from_slice(slice: &'a [u8]) -> Result<Icmpv6Slice<'a>, LenError>
pub fn from_slice(slice: &'a [u8]) -> Result<Icmpv6Slice<'a>, LenError>
Creates a slice containing an ICMPv6 packet.
§Errors
The function will return an Err err::LenError
if the given slice is too small (smaller then Icmpv6Header::MIN_LEN) or
too large (bigger then icmpv6::MAX_ICMPV6_BYTE_LEN).
Sourcepub fn header(&self) -> Icmpv6Header
pub fn header(&self) -> Icmpv6Header
Decode the header fields and copy the results to a Icmpv6Header struct.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Number of bytes/octets that will be converted into a
Icmpv6Header when Icmpv6Slice::header gets called.
Sourcepub fn icmp_type(&self) -> Icmpv6Type
pub fn icmp_type(&self) -> Icmpv6Type
Decode the header values (excluding the checksum) into an Icmpv6Type enum.
Sourcepub fn is_checksum_valid(
&self,
source_ip: [u8; 16],
destination_ip: [u8; 16],
) -> bool
pub fn is_checksum_valid( &self, source_ip: [u8; 16], destination_ip: [u8; 16], ) -> bool
Returns if the checksum in the slice is correct.
Sourcepub fn bytes5to8(&self) -> [u8; 4]
pub fn bytes5to8(&self) -> [u8; 4]
Returns the bytes from position 4 till and including the 8th position in the ICMPv6 header.
These bytes located at th 5th, 6th, 7th and 8th position of the ICMP packet can depending on the ICMPv6 type and code contain additional data.
Sourcepub fn payload_slice(&self) -> Result<Icmpv6PayloadSlice<'a>, LenError>
pub fn payload_slice(&self) -> Result<Icmpv6PayloadSlice<'a>, LenError>
Returns the structured payload of the ICMPv6 message if this type is supported.
Trait Implementations§
Source§impl<'a> Clone for Icmpv6Slice<'a>
impl<'a> Clone for Icmpv6Slice<'a>
Source§fn clone(&self) -> Icmpv6Slice<'a>
fn clone(&self) -> Icmpv6Slice<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more