Skip to main content

leodos_protocols/coding/framing/
mod.rs

1//! Frame synchronization and transmission unit encoding.
2
3/// Channel Access Data Unit — ASM framing and frame sync
4/// (CCSDS 131.0-B-5).
5pub mod cadu;
6/// Communications Link Transmission Unit (CLTU) encoding.
7pub mod cltu;
8
9/// Wraps coded data for transmission (ASM for TM, CLTU for TC).
10pub trait Framer {
11    /// Error type for framing operations.
12    type Error;
13    /// Frames `data` into `output` (e.g. prepends ASM).
14    fn frame(&self, data: &[u8], output: &mut [u8]) -> Result<usize, Self::Error>;
15}
16
17/// Extracts coded data from a framed transmission.
18pub trait Deframer {
19    /// Error type for deframing operations.
20    type Error;
21    /// Strips framing from `data` and writes the payload to `output`.
22    fn deframe(&self, data: &[u8], output: &mut [u8]) -> Result<usize, Self::Error>;
23}