pub struct ClientStateMachine<I, R: Rng> { /* private fields */ }
Expand description
The DHCPv6 core state machine.
This struct maintains the state machine for a DHCPv6 client, and expects an imperative shell to drive it by taking necessary actions (e.g. send packets, schedule timers, etc.) and dispatch events (e.g. packets received, timer expired, etc.). All the functions provided by this struct are pure-functional. All state transition functions return a list of actions that the imperative shell should take to complete the transition.
Implementations§
Source§impl<I: Instant, R: Rng> ClientStateMachine<I, R>
impl<I: Instant, R: Rng> ClientStateMachine<I, R>
Sourcepub fn start_stateless(
transaction_id: [u8; 3],
options_to_request: Vec<OptionCode>,
rng: R,
now: I,
) -> (Self, Actions<I>)
pub fn start_stateless( transaction_id: [u8; 3], options_to_request: Vec<OptionCode>, rng: R, now: I, ) -> (Self, Actions<I>)
Starts the client in Stateless mode, as defined in RFC 8415, Section 6.1.
The client exchanges messages with servers to obtain the configuration
information specified in options_to_request
.
Sourcepub fn start_stateful(
transaction_id: [u8; 3],
client_id: ClientDuid,
configured_non_temporary_addresses: HashMap<IAID, HashSet<Ipv6Addr>>,
configured_delegated_prefixes: HashMap<IAID, HashSet<Subnet<Ipv6Addr>>>,
options_to_request: Vec<OptionCode>,
rng: R,
now: I,
) -> (Self, Actions<I>)
pub fn start_stateful( transaction_id: [u8; 3], client_id: ClientDuid, configured_non_temporary_addresses: HashMap<IAID, HashSet<Ipv6Addr>>, configured_delegated_prefixes: HashMap<IAID, HashSet<Subnet<Ipv6Addr>>>, options_to_request: Vec<OptionCode>, rng: R, now: I, ) -> (Self, Actions<I>)
Starts the client in Stateful mode, as defined in RFC 8415, Section 6.2 and RFC 8415, Section 6.3.
The client exchanges messages with server(s) to obtain non-temporary
addresses in configured_non_temporary_addresses
, delegated prefixes in
configured_delegated_prefixes
and the configuration information in
options_to_request
.
pub fn get_dns_servers(&self) -> Vec<Ipv6Addr>
Sourcepub fn handle_timeout(
&mut self,
timeout_type: ClientTimerType,
now: I,
) -> Actions<I>
pub fn handle_timeout( &mut self, timeout_type: ClientTimerType, now: I, ) -> Actions<I>
Handles a timeout event, dispatches based on timeout type.
§Panics
handle_timeout
panics if current state is None.