Struct etherparse::Ipv6FragmentHeaderSlice [−][src]
pub struct Ipv6FragmentHeaderSlice<'a> { /* fields omitted */ }
Expand description
Slice containing an IPv6 fragment header.
Implementations
Creates a hop by hop header slice from a slice.
Creates a hop by hop header slice from a slice (assumes slice size & content was validated before).
Safety
This function assumes that the passed slice has at least the length of 8. If a slice with length less then 8 is passed to this function the behavior will be undefined.
Returns the slice containing the ipv6 fragment header.
Fragment offset in 8 octets.
Note: In the header only 13 bits are used, so the allowed range of the value is between 0 and 0x1FFF (inclusive).
True if more fragment packets will follow. False if this is the last packet.
Checks if the fragment header actually fragments the packet.
Returns false if the fragment offset is 0 and the more flag is not set. Otherwise returns true.
RFC8200 explicitly states that fragment headers that don’t fragment the packet payload are allowed. See the following quote from RFC8200 page 32:
Revised the text to handle the case of fragments that are whole datagrams (i.e., both the Fragment Offset field and the M flag are zero). If received, they should be processed as a reassembled packet. Any other fragments that match should be processed independently. The Fragment creation process was modified to not create whole datagram fragments (Fragment Offset field and the M flag are zero). See RFC6946 and RFC8021 for more information.“
use etherparse::Ipv6FragmentHeaderSlice;
{
let slice = Ipv6FragmentHeaderSlice::from_slice(&[
0, 0, 0, 0, // offset 0 & more_fragments not set
1, 2, 3, 4,
]).unwrap();
assert!(false == slice.is_fragmenting_payload());
}
{
let slice = Ipv6FragmentHeaderSlice::from_slice(&[
0, 0, 0, 0b1000_0000u8, // more_fragments set
1, 2, 3, 4,
]).unwrap();
assert!(slice.is_fragmenting_payload());
}
{
let slice = Ipv6FragmentHeaderSlice::from_slice(&[
0, 0, 1, 0, // non zero offset
1, 2, 3, 4,
]).unwrap();
assert!(slice.is_fragmenting_payload());
}
Identifcation value generated by the source
Decode some of the fields and copy the results to a Ipv6FragmentHeader struct.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Ipv6FragmentHeaderSlice<'a>
impl<'a> Send for Ipv6FragmentHeaderSlice<'a>
impl<'a> Sync for Ipv6FragmentHeaderSlice<'a>
impl<'a> Unpin for Ipv6FragmentHeaderSlice<'a>
impl<'a> UnwindSafe for Ipv6FragmentHeaderSlice<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more