Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

DHCPv4

DHCPv4
[IPv4]

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.
void dhcp_release_and_stop (struct netif *netif)
 Release a DHCP lease and stop DHCP statemachine (and AUTOIP if LWIP_DHCP_AUTOIP_COOP).
err_t dhcp_release (struct netif *netif)
 This function calls dhcp_release_and_stop() internally.
void dhcp_stop (struct netif *netif)
 This function calls dhcp_release_and_stop() internally.

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

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

Definition at line 712 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:
netifThe lwIP network interface

Definition at line 814 of file lwip_dhcp.c.

err_t dhcp_release ( struct netif netif )

This function calls dhcp_release_and_stop() internally.

Definition at line 1394 of file lwip_dhcp.c.

void dhcp_release_and_stop ( struct netif netif )

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

Parameters:
netifnetwork interface

Definition at line 1318 of file lwip_dhcp.c.

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

Definition at line 1150 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:
netifthe netif for which to set the struct dhcp
dhcp(uninitialised) dhcp struct allocated by the application

Definition at line 690 of file lwip_dhcp.c.

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

Definition at line 737 of file lwip_dhcp.c.

void dhcp_stop ( struct netif netif )

This function calls dhcp_release_and_stop() internally.

Definition at line 1406 of file lwip_dhcp.c.