Skip to content

Commit

Permalink
Document DHCPv4 client.
Browse files Browse the repository at this point in the history
  • Loading branch information
astro committed Jul 31, 2018
1 parent 35b3314 commit 5b82cc8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/dhcp/clientv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,22 @@ pub struct Client {
/// You must call `poll()` after `iface.poll()` to send and receive
/// DHCP packets.
impl Client {
/// TODO
/// # Usage
/// ```rust,no_run
/// let dhcp_rx_buffer = RawSocketBuffer::new(
/// [RawPacketMetadata::EMPTY; 1],
/// vec![0; 1500]
/// );
/// let dhcp_tx_buffer = RawSocketBuffer::new(
/// [RawPacketMetadata::EMPTY; 1],
/// vec![0; 3000]
/// );
/// let mut dhcp = Dhcpv4Client::new(
/// &mut socket_set,
/// dhcp_rx_buffer, dhcp_tx_buffer,
/// Instant::now()
/// );
/// ```
pub fn new<'a, 'b, 'c>(sockets: &mut SocketSet<'a, 'b, 'c>, rx_buffer: RawSocketBuffer<'b, 'c>, tx_buffer: RawSocketBuffer<'b, 'c>, now: Instant) -> Self
where 'b: 'c,
{
Expand Down Expand Up @@ -320,6 +335,8 @@ impl Client {
self.next_egress = now;
}

/// Returns iterable set of DNS servers as received from the DHCP
/// server.
pub fn dns_servers(&self) -> DnsServers {
DnsServers {
dns_servers: &self.dns_servers,
Expand Down

0 comments on commit 5b82cc8

Please sign in to comment.