Skip to main content

LctHeader

Struct LctHeader 

Source
pub struct LctHeader<'a> {
    pub version: u8,
    pub psi: u8,
    pub close_session: bool,
    pub close_object: bool,
    pub codepoint: u8,
    pub cci: &'a [u8],
    pub tsi: &'a [u8],
    pub toi: &'a [u8],
    pub extensions: Vec<HeaderExtension<'a>>,
}
Expand description

A decoded LCT header (RFC 5651 §5.1).

The flag-driven field widths are reconstructed from the typed fields on serialize: C from cci.len(), S/O/H from tsi/toi, and HDR_LEN from the total. None of the wire length/flag bytes are stored raw.

Fields§

§version: u8

LCT version (V). RFC 5651 = LCT_VERSION (1).

§psi: u8

Protocol-Specific Indication (PSI, 2 bits). Meaning is per instantiation.

§close_session: bool

Close Session flag (A).

§close_object: bool

Close Object flag (B).

§codepoint: u8

Codepoint (CP, 8 bits) — opaque codec identifier.

§cci: &'a [u8]

Congestion Control Information. Length is 4*(C+1) bytes; C is derived as cci.len()/4 − 1, so it must be 4, 8, 12 or 16 bytes.

§tsi: &'a [u8]

Transport Session Identifier. Length 4*S + 2*H bytes (0, 2, 4 or 6).

§toi: &'a [u8]

Transport Object Identifier. Length 4*O + 2*H bytes (0, 2, 4, …, 14).

§extensions: Vec<HeaderExtension<'a>>

Header-extension chain occupying the header space up to HDR_LEN.

Implementations§

Source§

impl<'a> LctHeader<'a>

Source

pub fn c_flag(&self) -> u8

The C flag value (CCI words − 1), derived from the CCI length.

Source

pub fn h_flag(&self) -> u8

The H half-word flag, derived from TSI/TOI parity.

RFC 5651 §5.1: TSI and TOI both carry the half-word when H is set, so both must agree (the flags_from_lengths validator enforces this on serialize). A validly constructed header always has matching parity; we use && to reflect the RFC constraint rather than the || that would mask a corrupted struct.

Source

pub fn s_flag(&self) -> u8

The S flag (full 32-bit words in TSI).

Source

pub fn o_flag(&self) -> u8

The O flag (full 32-bit words in TOI).

Source

pub fn serialized_len(&self) -> usize

Total serialized length in bytes (fixed + CCI/TSI/TOI + extensions).

Source

pub fn hdr_len(&self) -> usize

HDR_LEN as it appears on the wire — total header length in 32-bit words.

Source

pub fn parse(data: &'a [u8]) -> Result<(Self, usize)>

Parse an LCT header from the start of data. Reads HDR_LEN to find the end of the header (incl. extensions); trailing bytes (FEC Payload ID / payload) are left for the caller. Returns the header and bytes consumed.

Source

pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>

Serialize the LCT header into out, recomputing the flag bits and HDR_LEN from the typed fields. Returns bytes written.

Trait Implementations§

Source§

impl<'a> Clone for LctHeader<'a>

Source§

fn clone(&self) -> LctHeader<'a>

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<'a> Debug for LctHeader<'a>

Source§

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

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

impl<'a> Eq for LctHeader<'a>

Source§

impl<'a> PartialEq for LctHeader<'a>

Source§

fn eq(&self, other: &LctHeader<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> Serialize for LctHeader<'a>

Available on crate feature serde only.
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<'a> StructuralPartialEq for LctHeader<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for LctHeader<'a>

§

impl<'a> RefUnwindSafe for LctHeader<'a>

§

impl<'a> Send for LctHeader<'a>

§

impl<'a> Sync for LctHeader<'a>

§

impl<'a> Unpin for LctHeader<'a>

§

impl<'a> UnsafeUnpin for LctHeader<'a>

§

impl<'a> UnwindSafe for LctHeader<'a>

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, 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.