pub struct DhcpClient { /* private fields */ }Expand description
DHCP client
Implementations§
Source§impl DhcpClient
impl DhcpClient
Sourcepub fn new(mac_address: MacAddress) -> Self
pub fn new(mac_address: MacAddress) -> Self
Create a new DHCP client
Sourcepub fn create_discover(&self) -> DhcpPacket
pub fn create_discover(&self) -> DhcpPacket
Create DHCP DISCOVER packet
Sourcepub fn create_request(
&self,
offered_ip: Ipv4Address,
server_id: Ipv4Address,
) -> DhcpPacket
pub fn create_request( &self, offered_ip: Ipv4Address, server_id: Ipv4Address, ) -> DhcpPacket
Create DHCP REQUEST packet
Sourcepub fn process_offer(&mut self, packet: &DhcpPacket) -> Result<(), KernelError>
pub fn process_offer(&mut self, packet: &DhcpPacket) -> Result<(), KernelError>
Process DHCP OFFER – parse options and transition to Requesting.
Sourcepub fn process_ack(&mut self, packet: &DhcpPacket) -> Result<(), KernelError>
pub fn process_ack(&mut self, packet: &DhcpPacket) -> Result<(), KernelError>
Process DHCP ACK – configure network interface with obtained parameters.
Sourcepub fn process_response(&mut self, data: &[u8]) -> Result<(), KernelError>
pub fn process_response(&mut self, data: &[u8]) -> Result<(), KernelError>
Process an incoming DHCP response packet.
Dispatches to process_offer or process_ack based on the
message type option.
Sourcepub fn config(&self) -> Option<&DhcpConfig>
pub fn config(&self) -> Option<&DhcpConfig>
Get current configuration (if bound)
Sourcepub fn start(&mut self) -> Result<(), KernelError>
pub fn start(&mut self) -> Result<(), KernelError>
Start DHCP negotiation – sends DISCOVER via UDP broadcast.