Macros | |
#define | IS_LINKLOCAL(a) ((a & 0xffff0000) == 0xfea90000 ) |
A DHCP server will automatically supply all the required address settings. DHCP requires the use of symbolic hostnames, since the IP address of a machine may change if restarted after the DHCP lease time is expired. Hence, a DHCP-based network always requires a DNS server for name resolution. The DNS server IP address however is provided by DHCP and must not be specified manually. The net_init() call with enabled DHCP is:
Parameter DHCP_ENABLE makes net_init() a blocking call. It blocks until a new local IP address was assigned by a DHCP server or a timeout occurred when no DHCP server was available. In case of timeout the device automatically selects a free link-local address within subnet 169.254.x.x.
The netconfig.c settings for DHCP are:
Replace dsk.company.net with the host name for your device. You must specify the "fully qualified hostname", including the domain name (company.net in this example). If you are not sure about the domain name, ask your network administrator or execute the Windows PC program winipcfg.exe or ipconfig.exe. Host Information will display the fully qualified hostname of your PC.
Since DHCP also provides the local subnet mask and the default gateway, calling net_set_gateway() to set these parameters is obsolete and not required in this configuration.
Use macro IS_LINKLOCAL(ip) to determine if a DHCP server was available or not.
Refer to Software Initialization for further initialization details
#define IS_LINKLOCAL | ( | a | ) | ((a & 0xffff0000) == 0xfea90000 ) |
Macro for testing link-local addresses