Line 2: | Line 2: | ||
==DHCP from an application perspective== |
==DHCP from an application perspective== |
||
− | To enable DHCP, you must make sure to compile in DHCP. You can do this by defining the LWIP_DHCP option in lwipopts.h to 1 and be sure that the module gets initialized (see Initializing lwIP for the right way to initialize modules for your platform). |
+ | To enable DHCP, you must make sure to compile in DHCP. You can do this by defining the LWIP_DHCP option in lwipopts.h to 1 and be sure that the module gets initialized (see Initializing lwIP for the right way to initialize modules for your platform). In addition, LWIP_UDP must be non-zero, since DHCP is a protocol that utilizes UDP. |
To use DHCP on an interface, simply use the following commands: |
To use DHCP on an interface, simply use the following commands: |
||
Line 10: | Line 10: | ||
* dhcp_release() - release the DHCP lease, usually called before dhcp_stop() |
* dhcp_release() - release the DHCP lease, usually called before dhcp_stop() |
||
* dhcp_stop() - stop DHCP configuration for an interface |
* dhcp_stop() - stop DHCP configuration for an interface |
||
− | * dhcp_inform() - inform server of our manual IP address |
+ | * dhcp_inform() - inform server of our manual IP address |
Note: These functions are lwIP core functions. They are not protected against concurrent access. In multithreaded environments, they may be called from the core thread only (aka. the tcpip-thread). When calling from other threads, use the netifapi_dhcp_*() functions defined in the api-module netifapi.c. |
Note: These functions are lwIP core functions. They are not protected against concurrent access. In multithreaded environments, they may be called from the core thread only (aka. the tcpip-thread). When calling from other threads, use the netifapi_dhcp_*() functions defined in the api-module netifapi.c. |
Revision as of 10:33, 15 May 2012
DHCP from an application perspective
To enable DHCP, you must make sure to compile in DHCP. You can do this by defining the LWIP_DHCP option in lwipopts.h to 1 and be sure that the module gets initialized (see Initializing lwIP for the right way to initialize modules for your platform). In addition, LWIP_UDP must be non-zero, since DHCP is a protocol that utilizes UDP.
To use DHCP on an interface, simply use the following commands:
- dhcp_start() - start DHCP configuration for an interface.
- dhcp_renew() - enforce early lease renewal (not needed normally)
- dhcp_release() - release the DHCP lease, usually called before dhcp_stop()
- dhcp_stop() - stop DHCP configuration for an interface
- dhcp_inform() - inform server of our manual IP address
Note: These functions are lwIP core functions. They are not protected against concurrent access. In multithreaded environments, they may be called from the core thread only (aka. the tcpip-thread). When calling from other threads, use the netifapi_dhcp_*() functions defined in the api-module netifapi.c.
DHCP support history in lwIP
HEAD | Unspecified. |
1.2 | Unspecified. |
External references
- RFC 1531 "Dynamic Host Configuration Protocol" October 1993, obsoleted by RFC 1541
- RFC 1541 "Dynamic Host Configuration Protocol" October 1993, obsoleted by RFC 2131
- RFC 2131 "Dynamic Host Configuration Protocol" March 1997, updated by RFC 3396
- RFC 3396 "Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)" November 2002