pub enum IncomingState {
Idle(LastResponse),
Received(bool),
SendingAck,
SendingRst,
SendingPiggybacked,
AwaitingResponse,
SendingCon(RetransmissionState),
SendingNon,
}Expand description
The state in which the incoming communication path is currently
Variants§
Idle(LastResponse)
New requests can be handled
Received(bool)
A request was received and needs to be handled by the user. The contained bool determines
if the request was confirmable (true) or non-confirmable (false).
In any case, the response may be sent with IncomingCommunication::schedule_response
immediately. For CON requests, this will result in a piggybacked response. For NON
requests, a NON response will be sent which is considered the default case for NON requests
(see RFC 7252 5.2.3 Non-confirmable: “If the request message is Non-confirmable, then the
response SHOULD be returned in a Non-confirmable message as well.”)
Furthermore, IncomingCommunication::schedule_rst may be called in both cases which will
transmit a RST message.
If a different behavior is desired, the following different options exist:
- In
Received(true),IncomingCommunication::schedule_empty_ackallows to send an empty ACK which will trigger a state transition viaIncomingState::SendingAckintoIncomingState::AwaitingResponsewhere separate responses may be sent. Additionally,IncomingCommunication::schedule_piggybacked_responsemay be called which is identical toIncomingCommunication::schedule_responsein this case. - In
Received(false),IncomingCommunication::schedule_con_responseandIncomingCommunication::schedule_non_responseare available, the second being identical toIncomingCommunication::schedule_responsein this case.
In this state, the message buffer contains the request message. Thus, the request
message may be obtained by calling IncomingCommunication::request.
SendingAck
An ACK is being sent. Afterwards, we will go into the IncomingState::AwaitingResponse
state.
SendingRst
A RST message is being sent. Afterwards, we will go back to the Idle state.
SendingPiggybacked
A piggybacked response is being sent. Afterwards, we will go into the Idle state.
AwaitingResponse
The request has been acknowledged, i.e. a separate response is expected. In this state,
IncomingCommunication::schedule_con_response and
IncomingCommunication::schedule_non_response are available and either of those
must be called by the user.
In this state, the message buffer still contains the request message and may be obtained
with IncomingCommunication::request.
SendingCon(RetransmissionState)
A separate CON response is being sent. We will stay in this state and try retransmissions until an ACK to this message is received or until the whole communication attempt (with retries) times out.
SendingNon
A separate NON response is being sent.
Trait Implementations§
Source§impl Clone for IncomingState
impl Clone for IncomingState
Source§fn clone(&self) -> IncomingState
fn clone(&self) -> IncomingState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more