The dhcp_cbfunc function is what DHCP client calls, when
the extended DHCP options are enabled in system configuration. This
function is used to notify the user about extended DHCP option
values. If this function is not provided in the user code, the DHCP
client notifications are not possible.
The argument opt specifies the extended DHCP option code.
The argument *val is a pointer to the option value. The option
value length is len bytes.
The type of the option value is defined by the opt
parameter. Currently supported extended DHCP options are shown in the
table.
Option
Value
Description
42
NTP Servers
Pointer to an array of NTP Server IP addresses.
67
Bootfile Name
Pointer to a 0-terminated boot file name.
The dhcp_cbfunc function is part of RL-TCPnet. The
prototype is defined in net_config.h.
Note
This function is optional. If is not needed for default
DHCP client configuration.
Return Value
The dhcp_cbfunc function does not return any value.
#include <net_config.h>
char boot_file[64];
U8 ntp_server[4];
void dhcp_cbfunc (U8 opt, U8 *val, U16 len) {
/* DHCP client notification callback function */
switch (opt) {
case 42:
/* DHCP Server has returned NTP Server list in DHCP response. */
memcpy (ntp_server, val, 4);
break;
case 67:
/* DHCP Server has returned Bootfile Name in DHCP response. */
strcpy (boot_file, (char *)val);
break;
}
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.