Struct etherparse::Ipv6RawExtHeaderSlice
source · pub struct Ipv6RawExtHeaderSlice<'a> { /* private fields */ }
Expand description
Slice containing an IPv6 extension header without specific decoding methods (fallback in case no specific implementation is available).
Slice containing an IPv6 extension header with only minimal data interpretation. NOTE only ipv6 header extensions with the first two bytes representing the next header and the header length in 8-octets (- 8 octets) can be represented with this struct. This excludes the “Authentication Header” (AH) and “Encapsulating Security Payload” (ESP).
The following headers can be represented in a Ipv6ExtensionHeaderSlice:
- HopbyHop
- Destination Options
- Routing
- Mobility
- Host Identity Protocol
- Shim6 Protocol
Implementations§
source§impl<'a> Ipv6RawExtHeaderSlice<'a>
impl<'a> Ipv6RawExtHeaderSlice<'a>
sourcepub fn header_type_supported(next_header: IpNumber) -> bool
pub fn header_type_supported(next_header: IpNumber) -> bool
Returns true if the given header type ip number can be represented in an Ipv6ExtensionHeaderSlice
.
sourcepub fn from_slice(
slice: &'a [u8]
) -> Result<Ipv6RawExtHeaderSlice<'a>, LenError>
pub fn from_slice( slice: &'a [u8] ) -> Result<Ipv6RawExtHeaderSlice<'a>, LenError>
Creates a generic ipv6 extension header slice from a slice.
sourcepub unsafe fn from_slice_unchecked(slice: &'a [u8]) -> Ipv6RawExtHeaderSlice<'a>
pub unsafe fn from_slice_unchecked(slice: &'a [u8]) -> Ipv6RawExtHeaderSlice<'a>
Creates a raw ipv6 extension header slice from a slice (assumes slice size & content was validated before).
§Safety
This method assumes that the slice was previously validated to contain
a valid & supported raw ipv6 extension header. This means the slice length
must at least be at least 8 and (slice[1] + 1)*8
. The data that the
slice points must also be valid (meaning no nullptr or alike allowed).
If these preconditions are not fulfilled the behavior of this function
and the methods of the return IpAuthHeaderSlice
will be undefined.
sourcepub fn next_header(&self) -> IpNumber
pub fn next_header(&self) -> IpNumber
sourcepub fn payload(&self) -> &'a [u8] ⓘ
pub fn payload(&self) -> &'a [u8] ⓘ
Returns a slice containing the payload data of the header.
This contains all the data after the header length field until the end of the header (length specified by the hdr ext length field).
sourcepub fn to_header(&self) -> Ipv6RawExtHeader
pub fn to_header(&self) -> Ipv6RawExtHeader
Convert the slice to an Ipv6RawExtHeader.
Decode some of the fields and copy the results to a Ipv6RawExtHeader struct together with a slice pointing to the non decoded parts.
Trait Implementations§
source§impl<'a> Clone for Ipv6RawExtHeaderSlice<'a>
impl<'a> Clone for Ipv6RawExtHeaderSlice<'a>
source§fn clone(&self) -> Ipv6RawExtHeaderSlice<'a>
fn clone(&self) -> Ipv6RawExtHeaderSlice<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for Ipv6RawExtHeaderSlice<'a>
impl<'a> Debug for Ipv6RawExtHeaderSlice<'a>
source§impl<'a> PartialEq for Ipv6RawExtHeaderSlice<'a>
impl<'a> PartialEq for Ipv6RawExtHeaderSlice<'a>
source§fn eq(&self, other: &Ipv6RawExtHeaderSlice<'a>) -> bool
fn eq(&self, other: &Ipv6RawExtHeaderSlice<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.