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.

Returns the IP protocol number of the next header.

See IpNumber or ip_number for a definition of the known values.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.