E2EProfile

Trait E2EProfile 

Source
pub trait E2EProfile {
    type Config;

    // Required methods
    fn new(config: Self::Config) -> E2EResult<Self>
       where Self: Sized;
    fn protect(&mut self, data: &mut [u8]) -> E2EResult<()>;
    fn check(&mut self, data: &[u8]) -> E2EResult<E2EStatus>;
}
Expand description

This trait defines the common interface that all E2E profiles must implement. Each profile provides three main operations:

  • protect: Add E2E protection to data
  • check: Verify E2E protection on received data
  • forward: Forward protected data (Profile 11 specific)

Required Associated Types§

Source

type Config

Configuration type for this profile

Required Methods§

Source

fn new(config: Self::Config) -> E2EResult<Self>
where Self: Sized,

Create a new instance with the given configuration

§Errors

Returns E2EError::InvalidConfiguration if the configuration is invalid

Source

fn protect(&mut self, data: &mut [u8]) -> E2EResult<()>

Add E2E protection to the given data buffer

This function modifies the data buffer in-place by adding:

  • CRC checksum
  • Sequence counter
  • Data ID (if applicable)
§Arguments
  • data - Mutable reference to the data buffer to protect
§Returns
  • Ok(()) if protection was successfully added
  • Err(E2EError) if an error occurred
Source

fn check(&mut self, data: &[u8]) -> E2EResult<E2EStatus>

Check E2E protection on received data

This function verifies the integrity of the received data by checking:

  • CRC checksum
  • Sequence counter continuity
  • Data ID (if applicable)
§Arguments
  • data - Reference to the received data buffer
§Returns
  • Ok(E2EStatus) indicating the check result
  • Err(E2EError) if an error occurred during checking

Implementors§