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.
#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;
}
}
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.