Deprecated fork of old network stack source from github. Please use official library instead: https://mbed.org/users/mbed_official/code/EthernetInterface/

Embed: (wiki syntax)

« Back to documentation index

dhcp.h File Reference

dhcp.h File Reference

Go to the source code of this file.

Data Structures

struct  dhcp_msg
 minimum set of fields of any DHCP message More...

Functions

PACK_STRUCT_END 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 configuration
err_t dhcp_renew (struct netif *netif)
 enforce early lease renewal (not needed normally)
err_t dhcp_release (struct netif *netif)
 release the DHCP lease, usually called before dhcp_stop()
void dhcp_stop (struct netif *netif)
 stop DHCP configuration
void dhcp_inform (struct netif *netif)
 inform server of our manual IP address
void dhcp_network_changed (struct netif *netif)
 Handle a possible change in the network configuration.
void dhcp_arp_reply (struct netif *netif, ip_addr_t *addr)
 if enabled, check whether the offered IP address is not in use, using ARP
void dhcp_coarse_tmr (void)
 to be called every minute
void dhcp_fine_tmr (void)
 to be called every half second

Detailed Description

Definition in file dhcp.h.


Function Documentation

void dhcp_arp_reply ( struct netif netif,
ip_addr_t *  addr 
)

if enabled, check whether the offered IP address is not in use, using ARP

if enabled, check whether the offered IP address is not in use, using ARP

Parameters:
netifthe network interface on which the reply was received
addrThe IP address we received a reply from

Definition at line 799 of file dhcp.c.

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 602 of file dhcp.c.

void dhcp_coarse_tmr ( void   )

to be called every minute

Definition at line 333 of file dhcp.c.

void dhcp_fine_tmr ( void   )

to be called every half second

to be called every half second

A DHCP server is expected to respond within a short period of time. This timer checks whether an outstanding DHCP request is timed out.

Definition at line 365 of file dhcp.c.

void dhcp_inform ( struct netif netif )

inform server of our manual IP address

inform server of our manual IP address

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 708 of file dhcp.c.

void dhcp_network_changed ( struct netif netif )

Handle a possible change in the network configuration.

This enters the REBOOTING state to verify that the currently bound address is still valid.

Definition at line 762 of file dhcp.c.

err_t dhcp_release ( struct netif netif )

release the DHCP lease, usually called before dhcp_stop()

release the DHCP lease, usually called before dhcp_stop()

Parameters:
netifnetwork interface which must release its lease

Definition at line 1178 of file dhcp.c.

err_t dhcp_renew ( struct netif netif )

enforce early lease renewal (not needed normally)

enforce early lease renewal (not needed normally)

Parameters:
netifnetwork interface which must renew its lease

Definition at line 1013 of file dhcp.c.

PACK_STRUCT_END 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 583 of file dhcp.c.

err_t dhcp_start ( struct netif netif )

start DHCP configuration

start DHCP configuration

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 625 of file dhcp.c.

void dhcp_stop ( struct netif netif )

stop DHCP configuration

stop DHCP configuration

Parameters:
netifThe network interface to stop DHCP on

Definition at line 1230 of file dhcp.c.