1.2.1.3 DHCP Client Module
The DHCP client module will allow your application to dynamically obtain an IP address and a subnet mask from a DHCP server on the same network. Additionally, the DHCP client will get other parameters, such as gateway and DNS addresses
Abstraction Model
This module provides software abstraction of the DHCP module existent in any TCP/IP Stack implementation. It dynamically obtains an IP address and a subnet mask from a DHCP server on the same network
![dhcp_diagram1](GUID-90A7B2F8-7623-4629-99D5-AC3CF1A5C39D-low.png)
How the Library Works
The Dynamic Host Configuration protocol (DHCP) is a standard networking protocol used to automatically allocate IP addresses for hosts in a network.
The DHCP server has a pool of IP addresses, which are leased to clients requesting them. The leases have a time-out after which the hosts need to renew the lease or acquire a new one.
The DHCP client module in the TCP/IP stack takes care of the communication with the DHCP server and renewing the lease when the time-out expires.
Library Interface
Name | Description |
---|---|
Macros | |
TCPIP_DHCP_CLIENT_ENABLED | Default value for the enable/disable the DHCP client at stack start-up. |
TCPIP_DHCP_HOST_NAME_SIZE | Maximum size of a host name to be advertised to the DHCP server default value is 20 |
TCPIP_DHCP_TASK_TICK_RATE | The DHCP task processing rate: number of milliseconds to generate an DHCP tick. Used by the DHCP state machine The default value is 200 milliseconds. The lower the rate (higher the frequency) the higher the module priority and higher module performance can be obtained The value cannot be lower than the TCPIP_STACK_TICK_RATE. |
TCPIP_DHCP_TIMEOUT | Defines how long to wait before a DHCP lease is acquired when the DHCP module is enabled, seconds |
TCPIP_DHCP_BOOT_FILE_NAME_SIZE | size of the storage for the Boot file name should always be <= 128 default value is 128 |
TCPIP_DHCP_STORE_BOOT_FILE_NAME | enable the usage of the Boot file name received from the DHCP server |
Configuration Functions | |
TCPIP_DHCP_Enable | Enables the DHCP client for the specified interface. |
TCPIP_DHCP_Renew | Renews the DHCP lease for the specified interface. |
TCPIP_DHCP_Request | Requests the supplied IPv4 address from a DHCP server. |
TCPIP_DHCP_Disable | Disables the DHCP Client for the specified interface. |
TCPIP_DHCP_HandlerRegister | Registers a DHCP Handler. |
TCPIP_DHCP_HandlerDeRegister | Deregisters a previously registered DHCP handler. |
TCPIP_DHCP_HostNameCallbackRegister | Registers a DHCP host name callback with the DHCP client. |
TCPIP_DHCP_RequestTimeoutSet | Sets the DHCP client request and base time-out values. |
Status Functions | |
TCPIP_DHCP_IsEnabled | Determines if the DHCP client is enabled on the specified interface. |
TCPIP_DHCP_IsServerDetected | Determines if the DHCP client on the specified interface has been able to contact a DHCP server. |
TCPIP_DHCP_IsBound | Determines if the DHCP client has an IP address lease on the specified interface. |
TCPIP_DHCP_InfoGet | Returns information about the DHCP client on the specified interface. |
TCPIP_DHCP_IsActive | Determines if the DHCP client is currently active on the specified interface. |
TCPIP_DHCP_Task | Standard TCP/IP stack module task function. |
Data Types and Constants | |
TCPIP_DHCP_EVENT_HANDLER | DHCP event handler prototype. |
TCPIP_DHCP_EVENT_TYPE | DHCP Event Type |
TCPIP_DHCP_HANDLE | DHCP handle. |
TCPIP_DHCP_HOST_NAME_CALLBACK | DHCP Host name callback function. |
TCPIP_DHCP_INFO | Reports DHCP module information. |
TCPIP_DHCP_MODULE_CONFIG | DHCP Module Configuration run-time parameters. |
TCPIP_DHCP_STATUS | Lists the current status of the DHCP module. |