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

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

NameDescription
Macros
TCPIP_DHCP_CLIENT_ENABLEDDefault value for the enable/disable the DHCP client at stack start-up.
TCPIP_DHCP_HOST_NAME_SIZEMaximum size of a host name to be advertised to the DHCP server default value is 20
TCPIP_DHCP_TASK_TICK_RATEThe 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_TIMEOUTDefines how long to wait before a DHCP lease is acquired when the DHCP module is enabled, seconds
TCPIP_DHCP_BOOT_FILE_NAME_SIZEsize of the storage for the Boot file name should always be <= 128 default value is 128
TCPIP_DHCP_STORE_BOOT_FILE_NAMEenable the usage of the Boot file name received from the DHCP server
Configuration Functions
TCPIP_DHCP_EnableEnables the DHCP client for the specified interface.
TCPIP_DHCP_RenewRenews the DHCP lease for the specified interface.
TCPIP_DHCP_RequestRequests the supplied IPv4 address from a DHCP server.
TCPIP_DHCP_DisableDisables the DHCP Client for the specified interface.
TCPIP_DHCP_HandlerRegisterRegisters a DHCP Handler.
TCPIP_DHCP_HandlerDeRegisterDeregisters a previously registered DHCP handler.
TCPIP_DHCP_HostNameCallbackRegisterRegisters a DHCP host name callback with the DHCP client.
TCPIP_DHCP_RequestTimeoutSetSets the DHCP client request and base time-out values.
Status Functions
TCPIP_DHCP_IsEnabledDetermines if the DHCP client is enabled on the specified interface.
TCPIP_DHCP_IsServerDetectedDetermines if the DHCP client on the specified interface has been able to contact a DHCP server.
TCPIP_DHCP_IsBoundDetermines if the DHCP client has an IP address lease on the specified interface.
TCPIP_DHCP_InfoGetReturns information about the DHCP client on the specified interface.
TCPIP_DHCP_IsActiveDetermines if the DHCP client is currently active on the specified interface.
TCPIP_DHCP_TaskStandard TCP/IP stack module task function.
Data Types and Constants
TCPIP_DHCP_EVENT_HANDLERDHCP event handler prototype.
TCPIP_DHCP_EVENT_TYPEDHCP Event Type
TCPIP_DHCP_HANDLEDHCP handle.
TCPIP_DHCP_HOST_NAME_CALLBACKDHCP Host name callback function.
TCPIP_DHCP_INFOReports DHCP module information.
TCPIP_DHCP_MODULE_CONFIGDHCP Module Configuration run-time parameters.
TCPIP_DHCP_STATUSLists the current status of the DHCP module.