pub struct E2ERegistry { /* private fields */ }Expand description
Registry mapping message keys to E2E profile configurations and counter state.
On a shared subnet several devices send the same (service, method) under
the same fixed instance id. The profile configuration is endpoint-agnostic
(one per E2EKey), but the receive counter state must be independent
per device — otherwise two senders’ interleaved counters collide into
spurious WrongSequence results. Receive state is therefore keyed by
(source, key) and created lazily the first time a source is seen.
Transmit (protect) counter state stays per-key: a fan-out publish sends the
same protected bytes (one counter) to every subscriber, and per-recipient
transmit counters are handled a layer up (e.g. iris_someip_client).
Implementations§
Source§impl E2ERegistry
impl E2ERegistry
Sourcepub fn register(&mut self, key: E2EKey, profile: E2EProfile)
pub fn register(&mut self, key: E2EKey, profile: E2EProfile)
Register an E2E profile for the given key, creating fresh transmit state and clearing any prior per-source receive state for the key.
Sourcepub fn unregister(&mut self, key: &E2EKey)
pub fn unregister(&mut self, key: &E2EKey)
Remove E2E configuration (and all state) for the given key.
Sourcepub fn contains_key(&self, key: &E2EKey) -> bool
pub fn contains_key(&self, key: &E2EKey) -> bool
Returns true if a profile is registered for key.
Sourcepub fn check<'a>(
&mut self,
source: IpAddr,
key: E2EKey,
payload: &'a [u8],
upper_header: [u8; 8],
) -> Option<(E2ECheckStatus, &'a [u8])>
pub fn check<'a>( &mut self, source: IpAddr, key: E2EKey, payload: &'a [u8], upper_header: [u8; 8], ) -> Option<(E2ECheckStatus, &'a [u8])>
Run E2E check for key against source’s receive counter state, if
configured.
Returns None if no profile is registered for key. Otherwise returns
the check status and the best available payload (stripped E2E header on
success, original bytes on check failure).
Sourcepub fn protect(
&mut self,
key: E2EKey,
payload: &[u8],
upper_header: [u8; 8],
output: &mut [u8],
) -> Option<Result<usize, Error>>
pub fn protect( &mut self, key: E2EKey, payload: &[u8], upper_header: [u8; 8], output: &mut [u8], ) -> Option<Result<usize, Error>>
Run E2E protect for key if configured.
Returns None if no profile is registered for key.
Sourcepub fn reset_source(&mut self, source: IpAddr)
pub fn reset_source(&mut self, source: IpAddr)
Drop all per-source receive state for source (e.g. on its reboot), so
its next frame starts a fresh counter sequence. Configuration and
transmit state are untouched.