Rtos API example
DHCP (IPv4) related functions This is a DHCP client for the lwIP TCP/IP stack. More...
Functions | |
void | dhcp_set_struct (struct netif *netif, struct dhcp *dhcp) |
Set a statically allocated struct dhcp to work with. | |
void | dhcp_cleanup (struct netif *netif) |
Removes a struct dhcp from a netif. | |
err_t | dhcp_start (struct netif *netif) |
Start DHCP negotiation for a network interface. | |
void | dhcp_inform (struct netif *netif) |
Inform a DHCP server of our manual configuration. | |
err_t | dhcp_renew (struct netif *netif) |
Renew an existing DHCP lease at the involved DHCP server. | |
err_t | dhcp_release (struct netif *netif) |
Release a DHCP lease (usually called before dhcp_stop). | |
void | dhcp_stop (struct netif *netif) |
Remove the DHCP client from the interface. |
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
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:
-
netif the netif from which to remove the struct dhcp
Definition at line 697 of file lwip_dhcp.c.
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:
-
netif The lwIP network interface
Definition at line 802 of file lwip_dhcp.c.
Release a DHCP lease (usually called before dhcp_stop).
- Parameters:
-
netif network interface which must release its lease
Definition at line 1280 of file lwip_dhcp.c.
Renew an existing DHCP lease at the involved DHCP server.
- Parameters:
-
netif network interface which must renew its lease
Definition at line 1127 of file lwip_dhcp.c.
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:
-
netif the netif for which to set the struct dhcp dhcp (uninitialised) dhcp struct allocated by the application
Definition at line 676 of file lwip_dhcp.c.
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:
-
netif The lwIP network interface
- Returns:
- lwIP error code
- ERR_OK - No error
- ERR_MEM - Out of memory
Definition at line 721 of file lwip_dhcp.c.
void dhcp_stop | ( | struct netif * | netif ) |
Remove the DHCP client from the interface.
- Parameters:
-
netif The network interface to stop DHCP on
Definition at line 1343 of file lwip_dhcp.c.
Generated on Sun Jul 17 2022 08:25:37 by 1.7.2