pub enum State<I> {
Init(Init),
Selecting(Selecting<I>),
Requesting(Requesting<I>),
Bound(Bound<I>),
Renewing(Renewing<I>),
Rebinding(Rebinding<I>),
WaitingToRestart(WaitingToRestart<I>),
}
Expand description
All possible core state machine states from the state-transition diagram in RFC 2131.
Variants§
Init(Init)
The default initial state of the state machine (no known currently-assigned IP address or DHCP server).
Selecting(Selecting<I>)
The Selecting state (broadcasting DHCPDISCOVERs and receiving DHCPOFFERs).
Requesting(Requesting<I>)
The Requesting state (broadcasting DHCPREQUESTs and receiving DHCPACKs and DHCPNAKs).
Bound(Bound<I>)
The Bound state (we actively have a lease and are waiting to transition to Renewing).
Renewing(Renewing<I>)
The Renewing state (we actively have a lease that we are trying to renew by unicasting requests to our known DHCP server).
Rebinding(Rebinding<I>)
The Rebinding state (we actively have a lease that we are trying to renew by broadcasting requests to any DHCP server).
WaitingToRestart(WaitingToRestart<I>)
Waiting to restart the configuration process (via transitioning to Init).
Implementations§
Source§impl<I: Instant> State<I>
impl<I: Instant> State<I>
Sourcepub async fn run<C: Clock<Instant = I>>(
&self,
config: &ClientConfig,
packet_socket_provider: &impl PacketSocketProvider,
udp_socket_provider: &impl UdpSocketProvider,
rng: &mut impl RngProvider,
clock: &C,
stop_receiver: &mut UnboundedReceiver<()>,
) -> Result<Step<I>, Error>
pub async fn run<C: Clock<Instant = I>>( &self, config: &ClientConfig, packet_socket_provider: &impl PacketSocketProvider, udp_socket_provider: &impl UdpSocketProvider, rng: &mut impl RngProvider, clock: &C, stop_receiver: &mut UnboundedReceiver<()>, ) -> Result<Step<I>, Error>
Run the client state machine for one “step”.
Sourcepub async fn on_address_rejection<C: Clock<Instant = I>>(
&self,
config: &ClientConfig,
packet_socket_provider: &impl PacketSocketProvider,
clock: &C,
ip_address: SpecifiedAddr<Ipv4Addr>,
) -> Result<AddressRejectionOutcome<I>, Error>
pub async fn on_address_rejection<C: Clock<Instant = I>>( &self, config: &ClientConfig, packet_socket_provider: &impl PacketSocketProvider, clock: &C, ip_address: SpecifiedAddr<Ipv4Addr>, ) -> Result<AddressRejectionOutcome<I>, Error>
Handles an acquired address being rejected.
Sourcepub fn apply(
&self,
config: &ClientConfig,
transition: Transition<I>,
) -> (State<I>, Option<TransitionEffect<I>>)
pub fn apply( &self, config: &ClientConfig, transition: Transition<I>, ) -> (State<I>, Option<TransitionEffect<I>>)
Applies a state-transition to self
, returning the next state and
effects that need to be performed by bindings as a result of the transition.