Skip to main content

Server

Struct Server 

Source
struct Server {
    leases: [Lease; 8],
}
Expand description

The server’s fixed lease pool.

Fields§

§leases: [Lease; 8]

Implementations§

Source§

impl Server

Source

const fn new() -> Self

Empty pool — every slot free, nothing expired yet.

Source

fn pool_addr(slot: usize) -> Option<Ipv4Address>

Address owned by a pool slot.

Source

fn slot_of_addr(ip: Ipv4Address) -> Option<usize>

Slot that owns ip, when the address is inside the pool.

Source

fn active_slot(&self, mac: [u8; 6], now: Instant) -> Option<usize>

Slot actively (unexpired) leased to mac.

Source

fn refresh(&mut self, slot: usize, now: Instant)

Extend a lease for another full duration.

Source

fn assign(&mut self, mac: [u8; 6], now: Instant) -> Option<Ipv4Address>

Assign a pool address to mac (reusing its existing lease, else claiming a free or expired slot).

Source

fn bind_addr(&mut self, mac: [u8; 6], ip: Ipv4Address, now: Instant) -> bool

Bind mac to a specific pool address (the REQUEST path).

Source

fn free(&mut self, slot: usize)

Free a slot (RELEASE / DECLINE).

Source

fn handle(&mut self, msg: &ClientMsg, now: Instant) -> Option<Action>

Decide the reply for one client message; None means no answer.

Source

fn handle_request(&mut self, msg: &ClientMsg, now: Instant) -> Option<Action>

REQUEST: confirm a lease (ACK) or send the client back to DISCOVER (NAK).

Auto Trait Implementations§

§

impl Freeze for Server

§

impl RefUnwindSafe for Server

§

impl Send for Server

§

impl Sync for Server

§

impl Unpin for Server

§

impl UnsafeUnpin for Server

§

impl UnwindSafe for Server

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.