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.
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for State<I>where
I: Freeze,
impl<I> RefUnwindSafe for State<I>where
I: RefUnwindSafe,
impl<I> Send for State<I>where
I: Send,
impl<I> Sync for State<I>where
I: Sync,
impl<I> Unpin for State<I>where
I: Unpin,
impl<I> UnwindSafe for State<I>where
I: 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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more