Skip to main content

E2ERegistry

Struct E2ERegistry 

Source
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

Source

pub fn new() -> Self

Create an empty registry.

Source

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.

Source

pub fn unregister(&mut self, key: &E2EKey)

Remove E2E configuration (and all state) for the given key.

Source

pub fn contains_key(&self, key: &E2EKey) -> bool

Returns true if a profile is registered for key.

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for E2ERegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for E2ERegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more