pub struct Session<S: SessionState> {
pub session_id: String,
/* private fields */
}Expand description
Session wrapper with typestate for compile-time state checking.
The type parameter S represents the current session state.
Fields§
§session_id: StringSession identifier.
Implementations§
Source§impl<S: SessionState> Session<S>
impl<S: SessionState> Session<S>
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Returns the session identifier.
Source§impl Session<Disconnected>
impl Session<Disconnected>
Sourcepub fn connect(self) -> Session<Connecting>
pub fn connect(self) -> Session<Connecting>
Transitions to the Connecting state (initiator side).
Sourcepub fn accept(self) -> Session<Connecting>
pub fn accept(self) -> Session<Connecting>
Transitions to the Connecting state after accepting an inbound TCP connection (acceptor side).
Source§impl Session<Connecting>
impl Session<Connecting>
Sourcepub fn send_logon(self) -> Session<LogonSent>
pub fn send_logon(self) -> Session<LogonSent>
Transitions to the LogonSent state after sending Logon (initiator side).
Sourcepub fn on_logon_received(self) -> Session<LogonReceived>
pub fn on_logon_received(self) -> Session<LogonReceived>
Transitions to the LogonReceived state when a Logon arrives from the counterparty (acceptor side).
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions back to Disconnected on connection failure.
Source§impl Session<LogonSent>
impl Session<LogonSent>
Sourcepub fn on_logon_ack(self) -> Session<Active>
pub fn on_logon_ack(self) -> Session<Active>
Transitions to Active state on successful Logon acknowledgement.
Sourcepub fn on_logon_reject(self) -> Session<Disconnected>
pub fn on_logon_reject(self) -> Session<Disconnected>
Transitions to Disconnected on Logon rejection or timeout.
Source§impl Session<LogonReceived>
impl Session<LogonReceived>
Sourcepub fn accept_logon(self) -> Session<Active>
pub fn accept_logon(self) -> Session<Active>
Transitions to Active after successful authentication, once the Logon acknowledgement has been sent back to the counterparty.
Sourcepub fn reject_logon(self) -> Session<Disconnected>
pub fn reject_logon(self) -> Session<Disconnected>
Transitions to Disconnected when authentication fails and the Logon is rejected (Logout/Reject sent, connection dropped).
Sourcepub fn on_timeout(self) -> Session<Disconnected>
pub fn on_timeout(self) -> Session<Disconnected>
Transitions to Disconnected when authentication does not complete within the allowed time.
Source§impl Session<Active>
impl Session<Active>
Sourcepub fn start_resend(self, _begin_seq: u64, _end_seq: u64) -> Session<Resending>
pub fn start_resend(self, _begin_seq: u64, _end_seq: u64) -> Session<Resending>
Transitions to Resending state when a gap is detected.
§Arguments
begin_seq- Begin sequence number of the gapend_seq- End sequence number of the gap
Sourcepub fn initiate_logout(self) -> Session<LogoutPending>
pub fn initiate_logout(self) -> Session<LogoutPending>
Transitions to LogoutPending state.
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions to Disconnected on unexpected disconnect.
Source§impl Session<Resending>
impl Session<Resending>
Sourcepub fn resend_complete(self) -> Session<Active>
pub fn resend_complete(self) -> Session<Active>
Transitions back to Active when resend is complete.
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions to Disconnected on error.
Source§impl Session<LogoutPending>
impl Session<LogoutPending>
Sourcepub fn on_logout_ack(self) -> Session<Disconnected>
pub fn on_logout_ack(self) -> Session<Disconnected>
Transitions to Disconnected on Logout acknowledgement or timeout.
Sourcepub fn on_timeout(self) -> Session<Disconnected>
pub fn on_timeout(self) -> Session<Disconnected>
Transitions to Disconnected on timeout.