Struct etherparse::Ipv6FragmentHeader [−][src]
pub struct Ipv6FragmentHeader {
pub next_header: u8,
pub fragment_offset: u16,
pub more_fragments: bool,
pub identification: u32,
}
Expand description
IPv6 fragment header.
Fields
next_header: u8
IP protocol number specifying the next header or transport layer protocol.
See IpNumber or ip_number for a definition of the known values.
fragment_offset: u16
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).
more_fragments: bool
True if more fragment packets will follow. False if this is the last packet.
identification: u32
Identifcation value generated by the source.
Implementations
Create a new fragmentation header with the given parameters.
Note that the fragment_offset
can only support values between 0 and 0x1fff (inclusive).
Read an Ipv6FragmentHeader from a slice and return the header & unused parts of the slice.
Read an fragment header from the current reader position.
Writes a given IPv6 fragment header to the current position.
Length of the header in bytes.
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::{Ipv6FragmentHeader, ip_number::UDP};
// offset 0 & no more fragments result in an unfragmented payload
{
let header = Ipv6FragmentHeader::new(UDP, 0, false, 123);
assert!(false == header.is_fragmenting_payload());
}
// offset 0 & but more fragments will come -> fragmented
{
let header = Ipv6FragmentHeader::new(UDP, 0, true, 123);
assert!(header.is_fragmenting_payload());
}
// offset non zero & no more fragments will come -> fragmented
{
let header = Ipv6FragmentHeader::new(UDP, 1, false, 123);
assert!(header.is_fragmenting_payload());
}
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 RefUnwindSafe for Ipv6FragmentHeader
impl Send for Ipv6FragmentHeader
impl Sync for Ipv6FragmentHeader
impl Unpin for Ipv6FragmentHeader
impl UnwindSafe for Ipv6FragmentHeader
Blanket Implementations
Mutably borrows from an owned value. Read more