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: u8LCT version (V). RFC 5651 = LCT_VERSION (1).
psi: u8Protocol-Specific Indication (PSI, 2 bits). Meaning is per instantiation.
close_session: boolClose Session flag (A).
close_object: boolClose Object flag (B).
codepoint: u8Codepoint (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>
impl<'a> LctHeader<'a>
Sourcepub fn h_flag(&self) -> u8
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.
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Total serialized length in bytes (fixed + CCI/TSI/TOI + extensions).
Sourcepub fn hdr_len(&self) -> usize
pub fn hdr_len(&self) -> usize
HDR_LEN as it appears on the wire — total header length in 32-bit words.
Sourcepub fn parse(data: &'a [u8]) -> Result<(Self, usize)>
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.
Sourcepub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>
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.