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>
impl<A: ActivationAuthProvider, const BUF: usize> ConnectionState<A, BUF>
pub fn new( config: ConnectionConfig, activation: ActivationStateMachine<A>, now: Instant, ) -> Self
pub fn is_active(&self) -> bool
pub fn active_source_address(&self) -> Option<u16>
Sourcepub fn handle(
&mut self,
payload_type: &PayloadType,
payload_data: &[u8],
now: Instant,
)
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.
Sourcepub fn tick(&mut self, now: Instant)
pub fn tick(&mut self, now: Instant)
Advances connection timers - idle timeout and alive check timeout.
Sourcepub fn drop_activation_line(&mut self, reason: ActivationDenialReason)
pub fn drop_activation_line(&mut self, reason: ActivationDenialReason)
Drops the activation line - models ignition off or power loss mid-session.
Sourcepub fn drain_events(
&mut self,
) -> impl Iterator<Item = ConnectionEvent<BUF>> + '_
pub fn drain_events( &mut self, ) -> impl Iterator<Item = ConnectionEvent<BUF>> + '_
Drains accumulated connection events.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more