lwIP  2.0.2
Lightweight IP stack

Functions

void dhcp_set_struct (struct netif *netif, struct dhcp *dhcp)
 
void dhcp_cleanup (struct netif *netif)
 
err_t dhcp_start (struct netif *netif)
 
void dhcp_inform (struct netif *netif)
 
err_t dhcp_renew (struct netif *netif)
 
err_t dhcp_release (struct netif *netif)
 
void dhcp_stop (struct netif *netif)
 

Detailed Description

DHCP (IPv4) related functions This is a DHCP client for the lwIP TCP/IP stack. It aims to conform with RFC 2131 and RFC 2132.

Options: DHCP_COARSE_TIMER_SECS (recommended 60 which is a minute) DHCP_FINE_TIMER_MSECS (recommended 500 which equals TCP coarse timer)

dhcp_start() starts a DHCP client instance which configures the interface by obtaining an IP address lease and maintaining it.

Use dhcp_release() to end the lease and use dhcp_stop() to remove the DHCP client.

See also
DHCPv4

Function Documentation

◆ dhcp_cleanup()

void dhcp_cleanup ( struct netif netif)

Removes a struct dhcp from a netif.

ATTENTION: Only use this when not using dhcp_set_struct() to allocate the struct dhcp since the memory is passed back to the heap.

Parameters
netifthe netif from which to remove the struct dhcp

◆ dhcp_inform()

void dhcp_inform ( struct netif netif)

Inform a DHCP server of our manual configuration.

This informs DHCP servers of our fixed IP address configuration by sending an INFORM message. It does not involve DHCP address configuration, it is just here to be nice to the network.

Parameters
netifThe lwIP network interface

◆ dhcp_release()

err_t dhcp_release ( struct netif netif)

Release a DHCP lease (usually called before dhcp_stop).

Parameters
netifnetwork interface which must release its lease

◆ dhcp_renew()

err_t dhcp_renew ( struct netif netif)

Renew an existing DHCP lease at the involved DHCP server.

Parameters
netifnetwork interface which must renew its lease

◆ dhcp_set_struct()

void dhcp_set_struct ( struct netif netif,
struct dhcp *  dhcp 
)

Set a statically allocated struct dhcp to work with. Using this prevents dhcp_start to allocate it using mem_malloc.

Parameters
netifthe netif for which to set the struct dhcp
dhcp(uninitialised) dhcp struct allocated by the application

◆ dhcp_start()

err_t dhcp_start ( struct netif netif)

Start DHCP negotiation for a network interface.

If no DHCP client instance was attached to this interface, a new client is created first. If a DHCP client instance was already present, it restarts negotiation.

Parameters
netifThe lwIP network interface
Returns
lwIP error code
  • ERR_OK - No error
  • ERR_MEM - Out of memory

◆ dhcp_stop()

void dhcp_stop ( struct netif netif)

Remove the DHCP client from the interface.

Parameters
netifThe network interface to stop DHCP on