lwIP 2.2.0
Lightweight IP stack
|
#include "lwip/opt.h"
#include "lwip/stats.h"
#include "lwip/mem.h"
#include "lwip/udp.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/def.h"
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include "lwip/acd.h"
#include "lwip/dns.h"
#include "lwip/etharp.h"
#include "lwip/prot/dhcp.h"
#include "lwip/prot/iana.h"
#include <string.h>
#include "path/to/my/lwip_hooks.h"
Macros | |
#define | DHCP_ADD_EXTRA_REQUEST_OPTIONS |
#define | SET_TIMEOUT_FROM_OFFERED(result, offered, min, max) |
#define | DHCP_CREATE_RAND_XID 1 |
#define | DHCP_MAX_MSG_LEN(netif) (netif->mtu) |
#define | DHCP_MIN_REPLY_LEN 44 |
Enumerations | |
enum | dhcp_option_idx |
Functions | |
void | dhcp_coarse_tmr (void) |
void | dhcp_fine_tmr (void) |
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) |
void | dhcp_network_changed_link_up (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) |
u8_t | dhcp_supplied_address (const struct netif *netif) |
Dynamic Host Configuration Protocol client
#define DHCP_ADD_EXTRA_REQUEST_OPTIONS |
DHCP_ADD_EXTRA_REQUEST_OPTIONS: Additional options added to the list of options that the client requests from the servers (opt 55: DHCP_OPTION_PARAMETER_REQUEST_LIST) If additional options are requested, define this macro as a comma separated list, with leading comma. This macro is useful for example when requested vendor specific ids (VCI/VSI options), here is an example of requesting the VSI option (option 43) (yes, the notation is a bit strange, but it works :) (NOTE: the space between # and define is required because of doxygen...)
#define DHCP_CREATE_RAND_XID 1 |
DHCP_CREATE_RAND_XID: if this is set to 1, the xid is created using LWIP_RAND() (this overrides DHCP_GLOBAL_XID)
Default for DHCP_GLOBAL_XID is 0xABCD0000 This can be changed by defining DHCP_GLOBAL_XID and DHCP_GLOBAL_XID_HEADER, e.g. #define DHCP_GLOBAL_XID_HEADER "stdlib.h" #define DHCP_GLOBAL_XID rand() DHCP_OPTION_MAX_MSG_SIZE is set to the MTU MTU is checked to be big enough in dhcp_start
#define DHCP_MIN_REPLY_LEN 44 |
Minimum length for reply before packet is parsed
#define SET_TIMEOUT_FROM_OFFERED | ( | result, | |
offered, | |||
min, | |||
max | |||
) |
DHCP_DEFINE_CUSTOM_TIMEOUTS: if this is defined then you can customize various DHCP timeouts using these macros:
enum dhcp_option_idx |
Option handling: options are parsed in dhcp_parse_reply and saved in an array where other functions can load them from. This might be moved into the struct dhcp (not necessarily since lwIP is single-threaded and the array is only used while in recv callback).
void dhcp_coarse_tmr | ( | void | ) |
The DHCP timer that checks for lease renewal/rebind timeouts. Must be called once a minute (see DHCP_COARSE_TIMER_SECS).
void dhcp_fine_tmr | ( | void | ) |
DHCP transaction timeout handling (this function must be called every 500ms, see DHCP_FINE_TIMER_MSECS).
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_link_up | ( | 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.