pub struct Client<T> {
pub rng: T,
pub mac: [u8; 6],
}Expand description
A simple DHCP client. The client is unaware of the IP/UDP transport layer and operates purely in terms of packets represented as Rust slices.
As such, the client can generate all BOOTP requests and parse BOOTP replies.
Fields§
§rng: T§mac: [u8; 6]Implementations§
Source§impl<T> Client<T>where
T: RngCore,
impl<T> Client<T>where
T: RngCore,
pub const fn new(rng: T, mac: [u8; 6]) -> Self
pub fn discover<'o>( &mut self, opt_buf: &'o mut [DhcpOption<'o>], secs: u16, ip: Option<Ipv4Addr>, ) -> (Packet<'o>, u32)
pub fn request<'o>( &mut self, opt_buf: &'o mut [DhcpOption<'o>], secs: u16, ip: Ipv4Addr, broadcast: bool, ) -> (Packet<'o>, u32)
pub fn release<'o>( &mut self, opt_buf: &'o mut [DhcpOption<'o>], secs: u16, ip: Ipv4Addr, ) -> Packet<'o>
pub fn decline<'o>( &mut self, opt_buf: &'o mut [DhcpOption<'o>], secs: u16, ip: Ipv4Addr, ) -> Packet<'o>
pub fn is_offer(&self, reply: &Packet<'_>, xid: u32) -> bool
pub fn is_ack(&self, reply: &Packet<'_>, xid: u32) -> bool
pub fn is_nak(&self, reply: &Packet<'_>, xid: u32) -> bool
pub fn bootp_request<'o>( &mut self, secs: u16, ip: Option<Ipv4Addr>, broadcast: bool, options: Options<'o>, ) -> (Packet<'o>, u32)
pub fn is_bootp_reply_for_us( &self, reply: &Packet<'_>, xid: u32, expected_message_types: Option<&[MessageType]>, ) -> bool
Auto Trait Implementations§
impl<T> Freeze for Client<T>where
T: Freeze,
impl<T> RefUnwindSafe for Client<T>where
T: RefUnwindSafe,
impl<T> Send for Client<T>where
T: Send,
impl<T> Sync for Client<T>where
T: Sync,
impl<T> Unpin for Client<T>where
T: Unpin,
impl<T> UnwindSafe for Client<T>where
T: UnwindSafe,
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