pub struct Decoder<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> { /* private fields */ }Expand description
A bounded RFC 8681 sliding-window decoder.
The decoder maintains a reduced linear system without allocation. Source
symbols are addressable with symbol while they remain in
the active window. Packet integrity must be checked before symbols are passed
here because erasure coding cannot authenticate corrupted input.
Implementations§
Source§impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
Sourcepub fn new(config: RlcConfig, equation_capacity: usize) -> Result<Self, Error>
pub fn new(config: RlcConfig, equation_capacity: usize) -> Result<Self, Error>
Creates an empty decoder with a bounded active equation count.
Sourcepub const fn window(&self) -> Option<(EncodingSymbolId, usize)>
pub const fn window(&self) -> Option<(EncodingSymbolId, usize)>
Returns the ESI and total span of the retained decoding window.
Sourcepub fn discard_before(
&mut self,
first_retained_esi: EncodingSymbolId,
) -> Result<(), Error>
pub fn discard_before( &mut self, first_retained_esi: EncodingSymbolId, ) -> Result<(), Error>
Discards decoder state older than first_retained_esi.
Equations that still depend on an unknown expired symbol are discarded. This lets an integrating real-time protocol enforce its latency budget even when no newer source symbol arrives.
Sourcepub fn symbol(&self, esi: EncodingSymbolId) -> Option<&[u8]>
pub fn symbol(&self, esi: EncodingSymbolId) -> Option<&[u8]>
Returns a received or recovered symbol while it remains in the window.
Sourcepub fn known_symbols(
&self,
) -> KnownSymbols<'_, MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS> ⓘ
pub fn known_symbols( &self, ) -> KnownSymbols<'_, MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS> ⓘ
Iterates over all known symbols in ascending wrapping ESI order.
Sourcepub fn receive_source(
&mut self,
esi: EncodingSymbolId,
symbol: &[u8],
) -> Result<SourceReport, Error>
pub fn receive_source( &mut self, esi: EncodingSymbolId, symbol: &[u8], ) -> Result<SourceReport, Error>
Submits a systematic source symbol.
Sourcepub fn receive_repair(
&mut self,
id: RepairPayloadId,
symbol: &[u8],
) -> Result<DecodeReport, Error>
pub fn receive_repair( &mut self, id: RepairPayloadId, symbol: &[u8], ) -> Result<DecodeReport, Error>
Submits one repair symbol and returns its contribution to decoding.