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>

source

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.

source

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.

source

pub fn get_dns_servers(&self) -> Vec<Ipv6Addr>

source

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.

source

pub fn handle_message_receive<B: ByteSlice>( &mut self, msg: Message<'_, B>, now: I ) -> Actions<I>

Handles a received DHCPv6 message.

§Panics

handle_reply panics if current state is None.

Trait Implementations§

source§

impl<I: Debug, R: Debug + Rng> Debug for ClientStateMachine<I, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I, R> Freeze for ClientStateMachine<I, R>
where R: RngCore + Freeze, I: Freeze,

§

impl<I, R> RefUnwindSafe for ClientStateMachine<I, R>

§

impl<I, R> Send for ClientStateMachine<I, R>
where R: RngCore + Send, I: Send,

§

impl<I, R> Sync for ClientStateMachine<I, R>
where R: RngCore + Sync, I: Sync,

§

impl<I, R> Unpin for ClientStateMachine<I, R>
where R: RngCore + Unpin, I: Unpin,

§

impl<I, R> UnwindSafe for ClientStateMachine<I, R>
where R: RngCore + UnwindSafe, I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more