Type Alias Ipv6RawExtensionHeader

Source
pub type Ipv6RawExtensionHeader = Ipv6RawExtHeader;
👎Deprecated since 0.14.0: Please use the type Ipv6RawExtHeader instead
Expand description

Deprecated. Use Ipv6RawExtHeader instead.

Aliased Type§

struct Ipv6RawExtensionHeader {
    pub next_header: IpNumber,
    /* private fields */
}

Fields§

§next_header: IpNumber

IP protocol number specifying the next header or transport layer protocol.

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

Implementations

Source§

impl Ipv6RawExtHeader

Source

pub const MIN_LEN: usize = 8usize

Minimum length of an raw IPv6 extension header in bytes/octets.

Source

pub const MAX_LEN: usize = 2_048usize

Maximum length of an raw IPv6 extension header in bytes/octets.

This number is calculated by multiplying the maximum “hdr ext len” (0xff) with 8 and adding 8. As RFC8200 states that “hdr ext len” is defined as “8-bit unsigned integer. Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.”

Source

pub const MIN_PAYLOAD_LEN: usize = 6usize

Minimum length of a Ipv6RawExtHeader payload

Source

pub const MAX_PAYLOAD_LEN: usize = 2_046usize

Maximum length of a Ipv6RawExtHeader the payload

Source

pub fn header_type_supported(next_header: IpNumber) -> bool

Returns true if the given header type ip number can be represented in an Ipv6ExtensionHeader.

Source

pub fn new_raw( next_header: IpNumber, payload: &[u8], ) -> Result<Ipv6RawExtHeader, ExtPayloadLenError>

Creates an generic IPv6 extension header with the given data.

§Arguments
  • next_header - type of content after this header (protocol number)
  • payload - slice containing the data of the header. This must NOT contain the next header and extended header length fields of the header.

Note that payload must have at least the length of 6 bytes and only supports length increases in steps of 8. This measn that the following expression must be true (payload.len() + 2) % 8 == 0. The maximum length of the payload is 2046 bytes (Ipv6RawExtHeader::MAX_PAYLOAD_LEN).

If a payload with a non supported length is provided a crate::err::ipv6_exts::ExtPayloadLenError is returned.

Source

pub fn from_slice(slice: &[u8]) -> Result<(Ipv6RawExtHeader, &[u8]), LenError>

Read an Ipv6ExtensionHeader from a slice and return the header & unused parts of the slice.

Source

pub fn payload(&self) -> &[u8]

Return a slice containing the current payload. This does NOT contain the next_header and header_length fields. But everything after these two fields.

Source

pub fn set_payload(&mut self, payload: &[u8]) -> Result<(), ExtPayloadLenError>

Sets the payload (content of the header after the next_header & header_length fields).

Note that payload must have at least the length of 6 bytes and only supports length increases in steps of 8. This measn that the following expression must be true (payload.len() + 2) % 8 == 0. The maximum length of the payload is 2046 bytes (crate::Ipv6RawExtHeader::MAX_PAYLOAD_LEN).

If a payload with a non supported length is provided a crate::err::ipv6_exts::ExtPayloadLenError is returned and the payload of the header is not changed.

Source

pub fn read<T: Read + Seek + Sized>( reader: &mut T, ) -> Result<Ipv6RawExtHeader, Error>

Available on crate feature std only.

Read an fragment header from the current reader position.

Source

pub fn read_limited<T: Read + Seek + Sized>( reader: &mut LimitedReader<T>, ) -> Result<Ipv6RawExtHeader, LimitedReadError>

Available on crate feature std only.

Read an fragment header from the current limited reader position.

Source

pub fn write<W: Write + Sized>(&self, writer: &mut W) -> Result<(), Error>

Available on crate feature std only.

Writes a given IPv6 extension header to the current position.

Source

pub fn to_bytes(&self) -> ArrayVec<u8, { Ipv6RawExtHeader::MAX_LEN }>

Returns the serialized header.

Source

pub fn header_len(&self) -> usize

Length of the header in bytes.

Trait Implementations

Source§

impl Clone for Ipv6RawExtHeader

Source§

fn clone(&self) -> Ipv6RawExtHeader

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ipv6RawExtHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Ipv6RawExtHeader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Ipv6RawExtHeader

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Ipv6RawExtHeader