Struct etherparse::Icmpv6Slice
source · 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.
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>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for Icmpv6Slice<'a>
impl<'a> Debug for Icmpv6Slice<'a>
source§impl<'a> PartialEq for Icmpv6Slice<'a>
impl<'a> PartialEq for Icmpv6Slice<'a>
source§fn eq(&self, other: &Icmpv6Slice<'a>) -> bool
fn eq(&self, other: &Icmpv6Slice<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> Eq for Icmpv6Slice<'a>
impl<'a> StructuralPartialEq for Icmpv6Slice<'a>
Auto Trait Implementations§
impl<'a> Freeze for Icmpv6Slice<'a>
impl<'a> RefUnwindSafe for Icmpv6Slice<'a>
impl<'a> Send for Icmpv6Slice<'a>
impl<'a> Sync for Icmpv6Slice<'a>
impl<'a> Unpin for Icmpv6Slice<'a>
impl<'a> UnwindSafe for Icmpv6Slice<'a>
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
Mutably borrows from an owned value. Read more