lwIP 2.0.0  lwIP 2.0.0
LightweightIPstack
dhcp.h File Reference
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/udp.h"

Data Structures

struct  dhcp_msg
 

Macros

#define DHCP_COARSE_TIMER_SECS   60
 
#define DHCP_COARSE_TIMER_MSECS   (DHCP_COARSE_TIMER_SECS * 1000UL)
 
#define DHCP_FINE_TIMER_MSECS   500
 
#define DHCP_OPTIONS_LEN   DHCP_MIN_OPTIONS_LEN
 
#define dhcp_remove_struct(netif)   do { (netif)->dhcp = NULL; } while(0)
 
#define DHCP_OP_OFS   0
 
#define DHCP_STATE_OFF   0
 
#define DHCP_STATE_BOUND   10
 
#define DHCP_STATE_BACKING_OFF   12
 
#define DHCP_AUTOIP_COOP_STATE_OFF   0
 
#define DHCP_DISCOVER   1
 
#define DHCP_HTYPE_ETH   1
 
#define DHCP_OPTION_PAD   0
 
#define DHCP_OPTION_REQUESTED_IP   50 /* RFC 2132 9.1, requested IP address */
 
#define DHCP_OVERLOAD_NONE   0
 

Functions

void dhcp_set_struct (struct netif *netif, struct dhcp *dhcp)
 
void dhcp_cleanup (struct netif *netif)
 
err_t dhcp_start (struct netif *netif)
 
err_t dhcp_renew (struct netif *netif)
 
err_t dhcp_release (struct netif *netif)
 
void dhcp_stop (struct netif *netif)
 
void dhcp_inform (struct netif *netif)
 
void dhcp_network_changed (struct netif *netif)
 
void dhcp_arp_reply (struct netif *netif, const ip4_addr_t *addr)
 
u8_t dhcp_supplied_address (const struct netif *netif)
 
void dhcp_coarse_tmr (void)
 
void dhcp_fine_tmr (void)
 

Detailed Description

DHCP client API

Macro Definition Documentation

#define DHCP_AUTOIP_COOP_STATE_OFF   0

AUTOIP cooperation flags

#define DHCP_COARSE_TIMER_MSECS   (DHCP_COARSE_TIMER_SECS * 1000UL)

period (in milliseconds) of the application calling dhcp_coarse_tmr()

#define DHCP_COARSE_TIMER_SECS   60

period (in seconds) of the application calling dhcp_coarse_tmr()

#define DHCP_DISCOVER   1

DHCP message types

#define DHCP_FINE_TIMER_MSECS   500

period (in milliseconds) of the application calling dhcp_fine_tmr()

#define DHCP_HTYPE_ETH   1

DHCP hardware type, currently only ethernet is supported

#define DHCP_OP_OFS   0

DHCP message item offsets and length

#define DHCP_OPTION_PAD   0

BootP options

#define DHCP_OPTION_REQUESTED_IP   50 /* RFC 2132 9.1, requested IP address */

DHCP options

#define DHCP_OPTIONS_LEN   DHCP_MIN_OPTIONS_LEN

make sure user does not configure this too small allow this to be configured in lwipopts.h, but not too small set this to be sufficient for your options in outgoing DHCP msgs

#define DHCP_OVERLOAD_NONE   0

possible combinations of overloading the file and sname fields with options

#define dhcp_remove_struct (   netif)    do { (netif)->dhcp = NULL; } while(0)

Remove a struct dhcp previously set to the netif using dhcp_set_struct()

#define DHCP_STATE_BACKING_OFF   12

not yet implemented #define DHCP_STATE_RELEASING 11

#define DHCP_STATE_BOUND   10

not yet implemented #define DHCP_STATE_PERMANENT 9

#define DHCP_STATE_OFF   0

DHCP client states

Function Documentation

void dhcp_arp_reply ( struct netif netif,
const ip4_addr_t addr 
)

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

Match an ARP reply with the offered IP address.

Parameters
netifthe network interface on which the reply was received
addrThe IP address we received a reply from
void dhcp_coarse_tmr ( void  )

to be called every minute

The DHCP timer that checks for lease renewal/rebind timeouts.

void dhcp_fine_tmr ( void  )

to be called every half second

DHCP transaction timeout handling

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

void dhcp_network_changed ( struct netif netif)

Handle a possible change in the network configuration

Handle a possible change in the network configuration.

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

u8_t dhcp_supplied_address ( const struct netif netif)

check if DHCP supplied netif->ip_addr

check if DHCP supplied netif->ip_addr

Parameters
netifthe netif to check
Returns
1 if DHCP supplied netif->ip_addr (states BOUND or RENEWING), 0 otherwise