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 datacheck: Verify E2E protection on received dataforward: Forward protected data (Profile 11 specific)
Required Associated Types§
Required Methods§
Sourcefn new(config: Self::Config) -> E2EResult<Self>where
Self: Sized,
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
Sourcefn protect(&mut self, data: &mut [u8]) -> E2EResult<()>
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 addedErr(E2EError)if an error occurred
Sourcefn check(&mut self, data: &[u8]) -> E2EResult<E2EStatus>
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 resultErr(E2EError)if an error occurred during checking