Embedded TCP/IP stack
4.1.0
|
Detailed Description
The user application can use the DHCP-client service to retrieve various network parameters (IP address, gateway address, subnet mask) from a DHCP server.
The DHCP client code keeps the IP address parameters updated by renewing it automatically, without user application intervention.
After the DHCP client is initialized by calling the fnet_dhcp_cln_init() function, the user application should call the main service-polling function fnet_service_poll() periodically in background.
The DHCP client will be released automatically if an application sets any of the IP-related parameters directly by the fnet_netif_set_ip4_addr() or fnet_netif_set_ip4_gateway() calls.
For example:
Configuration parameters:
- FNET_CFG_DHCP_CLN
- FNET_CFG_DHCP_CLN_BOOTP
- FNET_CFG_DHCP_CLN_PORT
- FNET_CFG_DHCP_SRV_PORT
- FNET_CFG_DHCP_CLN_RESPONSE_TIMEOUT
- FNET_CFG_DNS
- FNET_CFG_DHCP_CLN_BROADCAST
Data Structures | |
struct | fnet_dhcp_cln_params |
Initialization parameters for the fnet_dhcp_cln_init() function. More... | |
struct | fnet_dhcp_cln_options |
DHCP options are retrieved from a DHCP server. More... | |
Macros | |
#define | FNET_DHCP_CLN_LEASE_INFINITY (0xFFFFFFFFU) |
Infinite lease time. The lease-option value, when a client acquires a lease for a network address for infinite time. . More... | |
#define | FNET_DHCP_CLN_LEASE_MIN |
Minimum lease-time value in seconds. If a client-acquired lease time is less than the FNET_DHCP_CLN_LEASE_MIN, the lease time will be pushed to the FNET_DHCP_CLN_LEASE_MIN value. More... | |
Typedefs | |
typedef void * | fnet_dhcp_cln_desc_t |
DHCPv4 client descriptor. More... | |
typedef void(* | fnet_dhcp_cln_callback_t) (fnet_dhcp_cln_desc_t desc, fnet_netif_desc_t netif, void *cookie) |
DHCP client event handler callback function prototype, that is called when the DHCP client has updated the IPv4 parameters (in BOUND state) or sends the DHCP discover message. More... | |
Functions | |
fnet_dhcp_cln_desc_t | fnet_dhcp_cln_init (struct fnet_dhcp_cln_params *params) |
Initializes the DHCPv4 client service. More... | |
void | fnet_dhcp_cln_release (fnet_dhcp_cln_desc_t desc) |
Releases the DHCPv4 client service. More... | |
void | fnet_dhcp_cln_get_options (fnet_dhcp_cln_desc_t desc, struct fnet_dhcp_cln_options *options) |
Retrieves the current DHCPv4 client options retrieved from a DHCP server. More... | |
void | fnet_dhcp_cln_set_callback_updated (fnet_dhcp_cln_desc_t desc, fnet_dhcp_cln_callback_t callback_updated, void *cookie) |
Registers the "IP parameters updated" DHCP event handler callback. More... | |
void | fnet_dhcp_cln_set_callback_discover (fnet_dhcp_cln_desc_t desc, fnet_dhcp_cln_callback_t callback_discover, void *cookie) |
Registers the "Discover message sent" DHCP event handler callback. More... | |
fnet_bool_t | fnet_dhcp_cln_is_enabled (fnet_dhcp_cln_desc_t desc) |
Detects if the DHCP Client service is enabled or disabled. More... | |
fnet_dhcp_cln_desc_t | fnet_dhcp_cln_get_by_netif (fnet_netif_desc_t netif) |
Looks for a DHCP Client assigned to the specified network interface. More... | |
© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net