Skip to main content

ConnectionState

Struct ConnectionState 

Source
pub struct ConnectionState<A: ActivationAuthProvider, const BUF: usize = 4096> { /* private fields */ }
Expand description

State machine for a single TCP connection to the gateway.

Owns the ActivationStateMachine for this connection and tracks idle/alive-check timing. The gateway drives this via handle_frame and tick.

Implementations§

Source§

impl<A: ActivationAuthProvider, const BUF: usize> ConnectionState<A, BUF>

Source

pub fn new( config: ConnectionConfig, activation: ActivationStateMachine<A>, now: Instant, ) -> Self

Source

pub fn is_active(&self) -> bool

Source

pub fn active_source_address(&self) -> Option<u16>

Source

pub fn handle( &mut self, payload_type: &PayloadType, payload_data: &[u8], now: Instant, )

Processes a validated DoIP payload - raw bytes after the 8-byte header.

The caller has already validated the DoIP header and decoded the payload type. This method receives the payload bytes and the already-decoded payload type for dispatch.

Source

pub fn tick(&mut self, now: Instant)

Advances connection timers - idle timeout and alive check timeout.

Source

pub fn drop_activation_line(&mut self, reason: ActivationDenialReason)

Drops the activation line - models ignition off or power loss mid-session.

Source

pub fn drain_events( &mut self, ) -> impl Iterator<Item = ConnectionEvent<BUF>> + '_

Drains accumulated connection events.

Trait Implementations§

Source§

impl<A: Debug + ActivationAuthProvider, const BUF: usize> Debug for ConnectionState<A, BUF>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A, const BUF: usize> Freeze for ConnectionState<A, BUF>
where A: Freeze,

§

impl<A, const BUF: usize> RefUnwindSafe for ConnectionState<A, BUF>
where A: RefUnwindSafe,

§

impl<A, const BUF: usize> Send for ConnectionState<A, BUF>
where A: Send,

§

impl<A, const BUF: usize> Sync for ConnectionState<A, BUF>
where A: Sync,

§

impl<A, const BUF: usize> Unpin for ConnectionState<A, BUF>
where A: Unpin,

§

impl<A, const BUF: usize> UnsafeUnpin for ConnectionState<A, BUF>
where A: UnsafeUnpin,

§

impl<A, const BUF: usize> UnwindSafe for ConnectionState<A, BUF>
where A: UnwindSafe,

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