pub trait SocketState<const C: usize>: Send {
// Required methods
fn session_id(&self) -> &str;
fn run(
&mut self,
components: SocketComponents<C>,
) -> Result<(), SessionError>;
fn stop(&mut self) -> Result<(), SessionError>;
fn incoming_segment(
&mut self,
id: &SegmentId,
ind: SeqIndicator,
) -> Result<(), SessionError>;
fn incoming_retransmission_request(
&mut self,
request: SegmentRequest<C>,
) -> Result<(), SessionError>;
fn incoming_acknowledged_frames(
&mut self,
ack: FrameAcknowledgements<C>,
) -> Result<(), SessionError>;
fn frame_complete(&mut self, id: u32) -> Result<(), SessionError>;
fn frame_emitted(&mut self, id: u32) -> Result<(), SessionError>;
fn frame_discarded(&mut self, id: u32) -> Result<(), SessionError>;
fn segment_sent(&mut self, segment: &Segment) -> Result<(), SessionError>;
}
Expand description
Abstraction of the SessionSocket
state.
Required Methods§
Sourcefn session_id(&self) -> &str
fn session_id(&self) -> &str
Gets ID of this Session.
Sourcefn run(&mut self, components: SocketComponents<C>) -> Result<(), SessionError>
fn run(&mut self, components: SocketComponents<C>) -> Result<(), SessionError>
Starts the necessary processes inside the state. Should be idempotent if called multiple times.
Sourcefn stop(&mut self) -> Result<(), SessionError>
fn stop(&mut self) -> Result<(), SessionError>
Stops processes inside the state for the given direction.
Sourcefn incoming_segment(
&mut self,
id: &SegmentId,
ind: SeqIndicator,
) -> Result<(), SessionError>
fn incoming_segment( &mut self, id: &SegmentId, ind: SeqIndicator, ) -> Result<(), SessionError>
Called when the Socket receives a new segment from Downstream. When the error is returned, the incoming segment is not passed Upstream.
Sourcefn incoming_retransmission_request(
&mut self,
request: SegmentRequest<C>,
) -> Result<(), SessionError>
fn incoming_retransmission_request( &mut self, request: SegmentRequest<C>, ) -> Result<(), SessionError>
Called when segment retransmission request is received from Downstream.
Sourcefn incoming_acknowledged_frames(
&mut self,
ack: FrameAcknowledgements<C>,
) -> Result<(), SessionError>
fn incoming_acknowledged_frames( &mut self, ack: FrameAcknowledgements<C>, ) -> Result<(), SessionError>
Called when an acknowledgement of frames is received from Downstream.
Sourcefn frame_complete(&mut self, id: u32) -> Result<(), SessionError>
fn frame_complete(&mut self, id: u32) -> Result<(), SessionError>
Called when a complete Frame has been finalized from segments received from Downstream.
Sourcefn frame_emitted(&mut self, id: u32) -> Result<(), SessionError>
fn frame_emitted(&mut self, id: u32) -> Result<(), SessionError>
Called when a complete Frame emitted to Upstream in-sequence.
Sourcefn frame_discarded(&mut self, id: u32) -> Result<(), SessionError>
fn frame_discarded(&mut self, id: u32) -> Result<(), SessionError>
Called when a frame could not be completed from the segments received from Downstream.
Sourcefn segment_sent(&mut self, segment: &Segment) -> Result<(), SessionError>
fn segment_sent(&mut self, segment: &Segment) -> Result<(), SessionError>
Called when a segment of a Frame was sent to the Downstream.