Crate e2e_protection

Crate e2e_protection 

Source
Expand description

e2e-protection (v0.4.0)

Profile-first E2E toolkit with a tiny session layer.

  • Core: E2eProfile, E2eSession, CounterPolicy
  • Feature autosar: provides P11, P22, P44, P7, P4m, P7m

See each profile module’s docs for wire details.

use e2e_protection::{E2eSession, CounterPolicy, E2eProfile};
#[cfg(feature="autosar")]
use e2e_protection::profiles::autosar::profile11::{P11, P11DataIdMode};

#[cfg(feature="autosar")]
let mut tx = E2eSession::new(
    P11 { mode: P11DataIdMode::Both { data_id: 0x0042 } },
    CounterPolicy::Rollover { bits: 4, step: 1 },
);
let frame = tx.wrap(&[0x12, 0x34])?;

let mut rx = E2eSession::new(
    P11 { mode: P11DataIdMode::Both { data_id: 0x0042 } },
    CounterPolicy::Rollover { bits: 4, step: 1 },
);
let pl = rx.unwrap(&frame)?;
assert_eq!(pl, &[0x12, 0x34]);
#[cfg(not(feature="autosar"))]

Modules§

profiles
Profile groups.

Structs§

CheckInfo
Minimal report returned by E2eProfile::check.
E2eSession
High-level session object that holds a profile and a counter policy.

Enums§

CounterPolicy
How counters should evolve across a session.
E2eError
Errors that may happen during protect/check/unwrap.

Traits§

E2eProfile
A single E2E profile. Implementations encapsulate packing, CRC calculation, and validation.