pub struct Socket<'a> { /* private fields */ }
Implementations§
source§impl<'a> Socket<'a>
impl<'a> Socket<'a>
DHCP client socket.
The socket acquires an IP address configuration through DHCP autonomously.
You must query the configuration with .poll()
after every call to Interface::poll()
,
and apply the configuration to the Interface
.
sourcepub fn set_retry_config(&mut self, config: RetryConfig)
pub fn set_retry_config(&mut self, config: RetryConfig)
Set the retry/timeouts configuration.
sourcepub fn set_outgoing_options(&mut self, options: &'a [DhcpOption<'a>])
pub fn set_outgoing_options(&mut self, options: &'a [DhcpOption<'a>])
Set the outgoing options.
sourcepub fn set_receive_packet_buffer(&mut self, buffer: &'a mut [u8])
pub fn set_receive_packet_buffer(&mut self, buffer: &'a mut [u8])
Set the buffer into which incoming DHCP packets are copied into.
sourcepub fn set_parameter_request_list(&mut self, parameter_request_list: &'a [u8])
pub fn set_parameter_request_list(&mut self, parameter_request_list: &'a [u8])
Set the parameter request list.
This should contain at least OPT_SUBNET_MASK
(1
), OPT_ROUTER
(3
), and OPT_DOMAIN_NAME_SERVER
(6
).
sourcepub fn max_lease_duration(&self) -> Option<Duration>
pub fn max_lease_duration(&self) -> Option<Duration>
Get the configured max lease duration.
See also Self::set_max_lease_duration()
sourcepub fn set_max_lease_duration(&mut self, max_lease_duration: Option<Duration>)
pub fn set_max_lease_duration(&mut self, max_lease_duration: Option<Duration>)
Set the max lease duration.
When set, the lease duration will be capped at the configured duration if the DHCP server gives us a longer lease. This is generally not recommended, but can be useful for debugging or reacting faster to network configuration changes.
If None, no max is applied (the lease duration from the DHCP server is used.)
sourcepub fn ignore_naks(&self) -> bool
pub fn ignore_naks(&self) -> bool
Get whether to ignore NAKs.
See also Self::set_ignore_naks()
sourcepub fn set_ignore_naks(&mut self, ignore_naks: bool)
pub fn set_ignore_naks(&mut self, ignore_naks: bool)
Set whether to ignore NAKs.
This is not compliant with the DHCP RFCs, since theoretically we must stop using the assigned IP when receiving a NAK. This can increase reliability on broken networks with buggy routers or rogue DHCP servers, however.
sourcepub fn set_ports(&mut self, server_port: u16, client_port: u16)
pub fn set_ports(&mut self, server_port: u16, client_port: u16)
Set the server/client port
Allows you to specify the ports used by DHCP. This is meant to support esoteric usecases allowed by the dhclient program.