lwIP 2.2.1 Lightweight IP stack

Functions
DHCPv4
APIs » "raw" APIs » IP » IPv4

## 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)
void | dhcp_release_and_stop (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
  LWIP_HOOK_DHCP_APPEND_OPTIONS
  LWIP_HOOK_DHCP_PARSE_OPTION
  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

  netif | the 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

  netif | The lwIP network interface

## ◆ dhcp_release()

err_t dhcp_release | ( | struct netif * | netif | ) |

This function calls dhcp_release_and_stop() internally.

Deprecated:
  Use dhcp_release_and_stop() instead.

## ◆ dhcp_release_and_stop()

void dhcp_release_and_stop | ( | struct netif * | netif | ) |

Release a DHCP lease and stop DHCP statemachine (and AUTOIP if LWIP_DHCP_AUTOIP_COOP).

Parameters

  netif | network interface

## ◆ dhcp_renew()

err_t dhcp_renew | ( | struct netif * | netif | ) |

Renew an existing DHCP lease at the involved DHCP server.

Parameters

  netif | network 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

  netif | the 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

  netif | The lwIP network interface

Returns
  lwIP error code
  - ERR_OK - No error
  - ERR_MEM - Out of memory

## ◆ dhcp_stop()

void dhcp_stop | ( | struct netif * | netif | ) |

This function calls dhcp_release_and_stop() internally.

Deprecated:
  Use dhcp_release_and_stop() instead.