dhcpv6_core::client

Struct ClientStateMachine

Source
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: SplitByteSlice>( &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: Freeze, I: Freeze,

§

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

§

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

§

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

§

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

§

impl<I, R> UnwindSafe for ClientStateMachine<I, R>
where R: 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>,

Source§

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>,

Source§

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