Skip to main content

ExtensionHeader

Enum ExtensionHeader 

Source
#[non_exhaustive]
pub enum ExtensionHeader { Optional { h_len: u8, h_type: u8, body: Vec<u8>, }, Mandatory { h_type: u8, body: Vec<u8>, }, }
Expand description

A single ULE extension header in a chain (RFC 4326 §5).

Each variant carries the H-Type/H-LEN implicitly; the body bytes that follow the introducing Type field are stored typed where the spec defines a layout, else as opaque bytes for forward compatibility.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Optional

Optional header (H-LEN = 1..=5), opaque body of 2 * h_len - 2 bytes.

Covers TimeStamp, Extension-Padding and any unrecognised optional header: the body is preserved verbatim so the chain round-trips.

Fields

§h_len: u8

3-bit length selector (1..=5).

§h_type: u8

8-bit type code.

§body: Vec<u8>

Body bytes (2 * h_len - 2 of them).

§

Mandatory

Mandatory header (H-LEN = 0) whose body consumes the remainder of the SNDU payload up to (but excluding) the CRC.

Test SNDU / Bridged-Frame / TS-Concat / PDU-Concat are all of this form; their inner structure is preserved as opaque bytes (the SNDU Length and CRC give the boundary).

Fields

§h_type: u8

8-bit type code (0x00..0x03 for the RFC-registered set).

§body: Vec<u8>

Body bytes — everything up to the CRC.

Implementations§

Source§

impl ExtensionHeader

Source

pub fn h_len(&self) -> u8

The H-LEN nibble this header serializes with.

Source

pub fn h_type(&self) -> u8

The H-Type byte this header serializes with.

Source

pub fn type_field(&self) -> TypeField

The introducing TypeField for this header.

Source

pub fn is_mandatory(&self) -> bool

true if this is a mandatory (H-LEN = 0) extension header.

Source

pub fn mandatory_h_type(&self) -> Option<MandatoryHType>

The typed MandatoryHType for a Mandatory header, or None if this is an Optional header.

Source

pub fn optional_h_type(&self) -> Option<OptionalHType>

The typed OptionalHType for an Optional header, or None if this is a Mandatory header.

Source

pub fn name(&self) -> &'static str

Spec label for this header kind.

Source

pub fn wire_len(&self) -> usize

Total wire length of this header including its 2-byte introducing Type field.

Trait Implementations§

Source§

impl Clone for ExtensionHeader

Source§

fn clone(&self) -> ExtensionHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ExtensionHeader

Source§

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

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

impl Display for ExtensionHeader

Source§

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

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

impl Eq for ExtensionHeader

Source§

impl PartialEq for ExtensionHeader

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for ExtensionHeader

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ExtensionHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.