pub enum DhcpState {
Init,
Discovering {
start_tsc: TscTimestamp,
},
Bound {
config: DhcpConfig,
bound_tsc: TscTimestamp,
},
Failed {
error: DhcpError,
},
}Expand description
DHCP client state machine.
Tracks DHCP discovery progress and wraps smoltcp’s DHCP socket.
Variants§
Init
Initial state - not started
Discovering
DHCP discovery in progress
Fields
§
start_tsc: TscTimestampWhen discovery started
Bound
IP address obtained
Failed
DHCP failed
Implementations§
Source§impl DhcpState
impl DhcpState
Sourcepub fn step(
&mut self,
dhcp_config: Option<DhcpConfig>,
now_tsc: u64,
timeout_ticks: u64,
) -> StepResult
pub fn step( &mut self, dhcp_config: Option<DhcpConfig>, now_tsc: u64, timeout_ticks: u64, ) -> StepResult
Step the state machine.
§Arguments
dhcp_config: Current DHCP config from smoltcp (None if not yet configured)now_tsc: Current TSC valuetimeout_ticks: DHCP timeout in TSC ticks
§Returns
Pending: Still discoveringDone: Bound, callconfig()to get configurationTimeout: Discovery timed outFailed: Discovery failed
Sourcepub fn config(&self) -> Option<&DhcpConfig>
pub fn config(&self) -> Option<&DhcpConfig>
Get DHCP configuration (if bound).
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if DHCP is complete (bound or failed).
Sourcepub fn is_discovering(&self) -> bool
pub fn is_discovering(&self) -> bool
Check if still discovering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DhcpState
impl RefUnwindSafe for DhcpState
impl Send for DhcpState
impl Sync for DhcpState
impl Unpin for DhcpState
impl UnwindSafe for DhcpState
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
Mutably borrows from an owned value. Read more