This chapter contains a description of all NetX Duo DHCP Client services (listed below) in alphabetic order.
In the Return Values section in the following API descriptions, values in BOLD are not affected by the NX_DISABLE_ERROR_CHECKING define that is used to disable API error checking, while non-bold values are completely disabled.
Create a DHCP instance
UINT nx_dhcp_create(
NX_DHCP *dhcp_ptr,
NX_IP *ip_ptr,
CHAR *name_ptr);
This service creates a DHCP instance for the previously created IP instance. By default the primary interface is enabled for running DHCP. The name input, while not used in the NetX Duo implementation of DHCP Client, must follow RFC 1035 criteria for host names. The total length must not exceed 255 characters, the labels separate by dots must begin with a letter, and end with a letter or number, and may contain hyphens but no other non-alphanumeric character.
If the application would like to run DHCP another interface registered with the IP instance, (using nx_ip_interface_attach), the application can call nx_dhcp_set_interface_index to run DHCP on just that interface, or nx_dhcp_interface_enable to run DHCP on that interface as well. See description of these services for more details.
Note: The application must make sure the DHCP Client packet pool payload can support the minimum DHCP message size specified by the RFC 2131 Section 2 (548 bytes of DHCP message data plus UDP, IP and physical network frame headers).
Threads, Initialization
/* Create a DHCP instance. */
status = nx_dhcp_create(&my_dhcp, &my_ip, "My-DHCP");
/* If status is NX_SUCCESS a DHCP instance was successfully created. */
Enable the specified interface to run DHCP
UINT nx_dhcp_interface_enable(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service enables the specified interface for running DHCP. By default the primary interface is enabled for DHCP Client. At this point, DHCP can be started on this interface either by calling nx_dhcp_interface_start or to start DHCP on all enabled interfaces nx_dhcp_start.
Note: The application must first register this interface with the IP instance, using nx_ip_interface_attach.
Further, there must be an available DHCP Client interface ‘record’ to add this interface to the list of enabled interfaces. By default NX_DHCP_CLIENT_MAX_RECORDS is defined to 1. Set this option to the maximum number of interfaces expected to run DHCP Client simultaneously. Typically NX_DHCP_CLIENT_MAX_RECORDS will equal NX_MAX_PHYSICAL_INTERFACES; however, if a device has more physical interfaces than it expects to run DHCP Client, it can save memory by setting NX_DHCP_CLIENT_MAX_RECORDS to less than that number. There is not a one to one mapping of physical interfaces with DHCP Client interface records.
The difference between this service and nx_dhcp_set_interface_index is the latter sets only a single interface to run DHCP whereas this service simply adds the specified interface to the list of Client interfaces enabled for DHCP.
To disable an interface for DHCP, the application can call the nx_dhcp_interface_disable service.
Threads, Initialization
/* Enable DHCP on a secondary interface. It is already enabled on the primary
interface. NX_DHCP_CLIENT_MAX_RECORDS is set to 2. */
status = nx_dhcp_interface_enable(&my_dhcp, 1);
/* If status is NX_SUCCESS the interface was successfully enabled. */
status = nx_dhcp_start(&my_dhcp);
/* If status is NX_SUCCESS DHCP is running on interface 0 and 1. */
Disable the specified interface to run DHCP
UINT nx_dhcp_interface_disable(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service disables the specified interface for running DHCP. It reinitializes the DHCP Client on this interface.
To restart the DHCP Client the application must re-enable the interface using nx_dhcp_interface_enable and restart DHCP by calling nx_dhcp_interface_start.
Threads
/* Disable DHCP on a secondary interface. */
status = nx_dhcp_interface_disable(&my_dhcp, 1);
/* If status is NX_SUCCESS the interface is successfully disabled. */
Set the DHCP broadcast flag
UINT nx_dhcp_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT clear_flag);
This service sets or clears the broadcast flag the DHCP message header for all interfaces enabled for DHCP. For some DHCP messages (e.g. DISCOVER) the broadcast flag is set to broadcast because the Client does not have an IP address.
clear_flag values:
This service is intended for DHCP Clients that must go through a router to get to the DHCP Server, where the router rejects forwarding broadcast messages.
Threads, Initialization
/* Send DHCP Client messages with the broadcast flag cleared (e.g. request a
unicast response). */
status = nx_dhcp_clear_broadcast_flag(&my_dhcp, NX_TRUE);
/* If status is NX_SUCCESS the DHCP Client broadcast flag is updated. */
Set or clear the broadcast flag on the specified interface
UINT nx_dhcp_interface_clear_broadcast_flag(
NX_DHCP *dhcp_ptr,
UINT interface_index,
UINT clear_flag);
This service enables the DHCP Client host application to set or clear the broadcast flag in DHCP Client messages to the DHCP Server on the specified interface. For more details see nx_dhcp_clear_broadcast_flag.
Threads, Initialization
/* Send DHCP Client messages with the broadcast flag cleared (e.g. request a
unicast response) on a previously attached secondary interface. */
iface_index = 1;
status = nx_dhcp_interface_clear_broadcast_flag(&my_dhcp, iface_index, NX_TRUE);
/* If status is NX_SUCCESS the DHCP Client broadcast flag is updated. */
Delete a DHCP instance
UINT nx_dhcp_delete(NX_DHCP *dhcp_ptr);
This service deletes a previously created DHCP instance.
Threads
/* Delete a DHCP instance. */
status = nx_dhcp_delete(&my_dhcp);
/* If status is NX_SUCCESS the DHCP instance was successfully deleted. */
Send a force renew message
UINT nx_dhcp_force_renew(NX_DHCP *dhcp_ptr);
This service enables the host application to send a force renew message on all interfaces enabled for DHCP. The DHCP Client must be in a BOUND state. This function sets the state to RENEW such that the DHCP Client will try to renew before the T1 timeout expires.
To send a force renew on a specific interface when multiple interfaces are DHCP-enabled, use nx_dhcp_interface_force_renew.
Threads
/* Send a force renew message from the Client. */
status = nx_dhcp_force_renew(&my_dhcp);
/* If status is NX_SUCCESS the DHCP client state is the RENEWING state and the
DHCP Client thread task will begin renewing before T1 is expired. */
Send a force renew message on the specified interface
UINT nx_dhcp_interface_force_renew(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service enables the host application to send a force renew message on the input interface as long as that interface has been enabled for DHCP (see nx_dhcp_interface_enable). The DHCP Client on the specified interface must be in a BOUND state. This function sets the state to RENEW such that the DHCP Client will try to renew before the T1 timeout expires.
Threads
/* Send a force renew message to the server on interface 1. */
status = nx_dhcp_interface_force_renew(&my_dhcp, 1);
/* If status is NX_SUCCESS the DHCP client state is the RENEWING state and the
DHCP Client thread task will begin renewing before T1 is expired. */
Set the DHCP Client packet pool
UINT nx_dhcp_packet_pool_set(
NX_DHCP *dhcp_ptr,
NX_PACKET_POOL *packet_pool_ptr);
This service allows the application to create the DHCP Client packet pool by passing in a pointer to a previously created packet pool in this service call. To use this feature, the host application must define NX_DHCP_CLIENT_USER_CREATE_PACKET_POOL. When defined, the nx_dhcp_create service will not create the Client’s packet pool.
Note: The application is recommended to use the default values for the DHCP client packet pool payload, defined as NX_DHCP_PACKET_PAYLOAD in nxd_dhcp_client.h when creating the packet pool.
Application code
/* Create the packet pool. */
status = nx_packet_pool_create(&dhcp_pool, "DHCP Client Packet Pool",
NX_DHCP_PACKET_PAYLOAD, pointer,
(15 * NX_DHCP_PACKET_PAYLOAD));
/* Create the DHCP Client. */
status = nx_dhcp_create(&dhcp_0, &ip_0, "janetsdhcp1");
/* Set the DHCP Client packet pool. */
status = nx_dhcp_packet_pool_set(&my_dhcp, packet_pool_ptr);
/* If status is NX_SUCCESS packet pool was successfully set. */
Set requested IP address for DHCP instance
UINT nx_dhcp_request_client_ip(
NX_DHCP *dhcp_ptr,
ULONG client_ip_address,
UINT skip_discover_message);
This service sets the IP address for the DHCP Client to request from the DHCP Server on the first interface enabled for DHCP in the DHCP Client record. If the skip_discover_message flag is set, the DHCP Client skips the Discover message and sends a Request message.
To set the request for a specific IP for DHCP messages on a specific interface, use the nx_dhcp_interface_request_client_ip service.
Threads
/* Set the DHCP Client requested IP address and skip the discover message. */
status = nx_dhcp_request_client_ip(&my_dhcp, IP(192,168,0,6), NX_TRUE);
/* If status is NX_SUCCESS requested IP address was successfully set. */
Set requested IP address for DHCP instance on specified interface
UINT nx_dhcp_interface_request_client_ip(
NX_DHCP *dhcp_ptr,
UINT interface_index,
ULONG client_ip_address,
UINT skip_discover_message);
This service sets the IP address for the DHCP Client to request from the DHCP Server on the specified interface, if that interface is enabled for DHCP (see nx_dhcp_interface_enable). If the skip_discover_message flag is set, the DHCP Client skips the Discover message and sends a Request message.
Threads
/* Set the DHCP Client requested IP address and skip the discover message on
interface 0. */
status = nx_dhcp_interface_request_client_ip(&my_dhcp, 0, IP(192,168,0,6), NX_TRUE);
/* If status is NX_SUCCESS requested IP address was successfully set. */
Clear the DHCP client network parameters
UINT nx_dhcp_reinitialize(NX_DHCP *dhcp_ptr);
This service clears the host application network parameters (IP address, network address and network mask), and clears the DHCP Client state on all interfaces enabled for DHCP. It is used in combination with nx_dhcp_stop and nx_dhcp_start to ‘restart’ the DHCP state machine:
nx_dhcp_stop(&my_dhcp);
nx_dhcp_reinitialize(&my_dhcp);
nx_dhcp_start(&my_dhcp);
To reinitialize the DHCP Client on a specific interface when multiple interfaces are enabled for DHCP, use the nx_dhcp_interface_reinitialize service.
Threads
/* Reinitialize the previously started DHCP client. */
status = nx_dhcp_reinitialize(&my_dhcp);
/* If status is NX_SUCCESS the host application successfully reinitialized its network parameters and DHCP client state. */
Clear the DHCP client network parameters on the specified interface
UINT nx_dhcp_interface_reinitialize(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service clears the network parameters (IP address, network address and network mask) on the specified interface if that interface is enabled for DHCP (see nx_dhcp_interface_enable). See nx_dhcp_reinitialize for more details.
Threads
/* Reinitialize the previously started DHCP client on interface 1. */
status = nx_dhcp_interface_reinitialize(&my_dhcp, 1);
/* If status is NX_SUCCESS the host application successfully reinitialized its network parameters and DHCP client state. */
Release Leased IP address
UINT nx_dhcp_release(NX_DHCP *dhcp_ptr);
This service releases the IP address obtained from a DHCP server by sending the RELEASE message to that server. It then reinitializes the DHCP Client. This service is applied to all interfaces enabled for DHCP.
The application can restart the DHCP Client by calling nx_dhcp_start.
To release an address back to the DHCP server on a specific interface, use the nx_dhcp_interface_release service
Threads
/* Release the previously leased IP address. */
status = nx_dhcp_release(&my_dhcp);
/* If status is NX_SUCCESS the previous IP lease was successfully released. */
Release IP address on the specified interface
UINT nx_dhcp_interface_release(NX_DHCP *dhcp_ptr, UINT interface_index);
This service releases the IP address obtained from a DHCP server on the specified interface and reinitializes the DHCP Client. The DHCP Client can be restarted by calling nx_dhcp_start.
Threads
/* Release the previously leased IP address on interface 1. */
status = nx_dhcp_interface_release(&my_dhcp, 1);
/* If status is NX_SUCCESS the previous IP lease was successfully released. */
Decline IP address from DHCP Server
UINT nx_dhcp_decline(NX_DHCP *dhcp_ptr);
This service declines an IP address leased from the DHCP server on all interfaces enabled for DHCP. If NX_DHCP_CLIENT_SEND_ ARP_PROBE is defined, the DHCP Client will send a DECLINE message if it detects that the IP address is already in use. See ARP Probes in Chapter One for more information on ARP probe configuration in the NetX Duo DHCP Client.
The application can use this service to decline its IP address if it discovers the address is in use by other means.
This service reinitializes the DHCP Client to that it can be restarted by calling nx_dhcp_start.
Threads
/* Decline the IP address offered by the DHCP server. */
status = nx_dhcp_decline(&my_dhcp);
/* If status is NX_SUCCESS the previous IP address decline message was successfully transmitted. */
Decline IP address from DHCP Server on the specified interface
UINT nx_dhcp_interface_decline(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service sends the DECLINE message to the server to decline an IP address assigned by the DHCP server. It also reinitializes the DHCP Client. See nx_dhcp_decline for more details.
Threads
/* Decline the IP address offered by the DHCP server on interface 2. */
status = nx_dhcp_interface_decline(&my_dhcp, 2);
/* If status is NX_SUCCESS the previous IP address decline message was successfully transmitted. */
Send DHCP message to Server
UINT nx_dhcp_send_request(
NX_DHCP *dhcp_ptr,
UINT dhcp_message_type);
This service sends the specified DHCP message to the DHCP server on the first interface enabled for DHCP found in the DHCP Client record. To send a RELEASE or DECLINE message, the application must use the nx_dhcp[_interface]_release or nx_dhcp_interface_decline services respectively.
The DHCP Client must be started to use this service except for sending the INFORM_REQUEST message type.
Note: This service is not intended for the host application to ‘drive’ the DHCP Client state machine.
Threads
/* Send the DHCP INFORM REQUEST message to the server. */
status = nx_dhcp_send_request(&my_dhcp, NX_DHCP_TYPE_DHCPINFORM);
/* If status is NX_SUCCESS a DHCP message was successfully sent. */
Send DHCP message to Server on a specific interface
UINT nx_dhcp_interface_send_request(
NX_DHCP *dhcp_ptr,
UINT interface_index,
UINT dhcp_message_type);
This service sends a message to the DHCP server on the specified interface if that interface is enabled for DHCP. To send a RELEASE or DECLINE message, the application must use the nx_dhcp[_interface]_release or nx_dhcp_interface_decline services respectively.
The DHCP Client must be started to use this service except for sending the DHCP INFORM REQUEST message type.
This service is not intended for the host application to ‘drive’ the DHCP Client state machine.
Threads
/* Send the INFORM REQUEST message to the server on the primary interface. */
status = nx_dhcp_interface_send_request(&my_dhcp, 0, NX_DHCP_TYPE_DHCPINFORM);
/* If status is NX_SUCCESS a DHCP message was successfully sent. */
Get the DHCP Client’s DHCP server IP address
UINT nx_dhcp_server_address_get(
NX_DHCP *dhcp_ptr,
ULONG server_address);
This service retrieves the DHCP Client DHCP server IP address on the first interface enabled for DHCP found in the DHCP Client record. The caller can only use this service after the DHCP Client is bound to an IP address assigned by the DHCP Server. The host application can use the nx_ip_status_check service to verify IP address is set, or it can use the nx_dhcp_state_change_notify and query the DHCP Client state is NX_DHCP_STATE_BOUND. See nx_dhcp_state_change_notify for more details about setting the state change callback function.
To find the DHCP server on a specific interface when multiple interfaces are enabled for DHCP Client, use the nx_dhcp_interface_server_address_get service
Threads
/* Use the state change notify service to determine the Client transition to the bound state and get its DHCP server IP address.*/
void dhcp_state_change(NX_DHCP *dhcp_ptr, UCHAR new_state)
{
ULONG server_address;
UINT status;
/* Increment state changes counter. */
state_changes++;
if (dhcp_0.nx_dhcp_state == NX_DHCP_STATE_BOUND)
{
status = nx_dhcp_server_address_get(&dhcp_0, &server_address);
}
}
Get the DHCP Client’s DHCP server IP address on the specified interface
UINT nx_dhcp_interface_server_address_get(
NX_DHCP *dhcp_ptr,
UINT interface_index,
ULONG server_address);
This service retrieves the DHCP Client DHCP server IP address on the specified interface if that interface is enabled for DHCP. The DHCP Client must be in the Bound state. After starting the DHCP Client on that interface, the host application can either use the nx_ip_status_check service to verify the IP address is set, or it can use the DHCP Client state change callback and query the DHCP Client state is NX_DHCP_STATE_BOUND. See nx_dhcp_state_change_notify for more details about setting the state change callback function.
Threads
/* Use the state change notify service to determine the Client transition to the
bound state and get its DHCP server IP address. */
void dhcp_state_change(NX_DHCP *dhcp_ptr, UCHAR new_state)
{
ULONG server_address;
UINT status;
/* Increment state changes counter. */
state_changes++;
/* Get the DHCP server IP address on interface 1 */
if (dhcp_0.nx_dhcp_state == NX_DHCP_STATE_BOUND)
{
status = nx_dhcp_interface_server_address_get(&dhcp_0, 1,
&server_address);
}
}
Set network interface for DHCP instance
UINT nx_dhcp_set_interface_index(
NX_DHCP *dhcp_ptr,
UINT index);
This service sets the network interface for the DHCP instance to connect to the DHCP Server on when running DHCP Client configured for a single network interface.
By default the DHCP Client runs on the primary interface. To run DHCP on a secondary service, use this service to set the secondary interface as the DHCP Client interface. The application must previously register the specified interface to the IP instance using the nx_ip_interface_attach service.
Note: This service is intended for applications that intend to run the DHCP Client on only one interface. To run DHCP on multiple interfaces see nx_dhcp_interface_enable for more details.
Threads
/* Set the DHCP Client interface to the secondary interface (index 1). */
status = nx_dhcp_set_interface_index(&my_dhcp, 1);
/* If status is NX_SUCCESS a DHCP interface was successfully set. */
Start DHCP processing
UINT nx_dhcp_start(NX_DHCP *dhcp_ptr);
This service starts DHCP processing on all interfaces enabled for DHCP. By default the primary interface is enabled for DHCP when the application calls nx_dhcp_create.
To verify when the IP instance is bound to an IP address on the DHCP Client interface, use nx_ip_status_check to see confirm the IP address is valid.
If there are other interfaces already running DHCP, this service will not affect them.
To start DHCP on a specific interface when multiple interfaces are enabled, use the nx_dhcp_interface_start service.
Threads
/* Start the DHCP processing for this IP instance. */
status = nx_dhcp_start(&my_dhcp);
/* If status is NX_SUCCESS the DHCP was successfully started. */
Start DHCP processing on the specified interface
UINT nx_dhcp_interface_start(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service starts DHCP processing on the specified interface if that interface is enabled for DHCP. See nx_dhcp_interface_enable for more details about enabling an interface for DHCP. By default the primary interface is enabled for DHCP when the application calls nx_dhcp_create.
If there are no other interfaces running DHCP Client this service will start/resume the DHCP Client thread and (re)activate the DHCP Client timer.
The application should use nx_ip_status_check to verify if an IP address is obtained.
Threads
/* Start the DHCP processing for this IP instance on interface 1. */
status = nx_dhcp_interface_start(&my_dhcp, 1);
/* If status is NX_SUCCESS the DHCP was successfully started. */
Set DHCP state change callback function
UINT nx_dhcp_state_change_notify(
NX_DHCP *dhcp_ptr,
VOID (*dhcp_state_change_notify)(
NX_DHCP *dhcp_ptr,
UCHAR new_state));
This service registers the specified callback function dhcp_state_change_notify for notifying an application of DHCP state changes. The callback function supplies the state the DHCP Client has transitioned into.
Following are values associated with the various DHCP states:
Threads, Initialization
/* Register the "my_state_change" function to be called on any DHCP state change, assuming DHCP has already been created. */
status = nx_dhcp_state_change_notify(&my_dhcp, my_state_change);
/* If status is NX_SUCCESS the callback function was successfully
registered. */
Set DHCP state change callback function on the specified interface
UINT nx_dhcp_interface_state_change_notify(
NX_DHCP *dhcp_ptr,
UINT interface_index,
VOID (*dhcp_state_change_notify)(
NX_DHCP *dhcp_ptr,
UINT interface_index,
UCHAR new_state));
This service registers the specified callback function for notifying an application of DHCP state changes. The callback function input arguments are the interface index and the state the DHCP Client has transitioned to on that interface.
For more information about state change functions, see nx_dhcp_state_change_notify().
Threads, Initialization
/* Register the "my_state_change" function to be called on any DHCP state change,
assuming DHCP has already been created. */
void dhcp_interstate_state_change(NX_DHCP *dhcp_ptr, UINT iface_index,
UCHAR new_state);
status = nx_dhcp_interstate_state_change_notify(&my_dhcp,
dhcp_interstate_state_change);
/* If status is NX_SUCCESS the callback function was successfully
registered. */
Stops DHCP processing
UINT nx_dhcp_stop(NX_DHCP *dhcp_ptr);
This service stops DHCP processing on all interfaces that have started DHCP processing. If there are no interfaces processing DHCP, this service will suspend the DHCP Client thread, and inactivate the DHCP Client timer.
To stop DHCP on a specific interface if multiple interfaces are enabled for DHCP, use the nx_dhcp_interface_stop service.
Threads
/* Stop the DHCP processing for this IP instance. */
status = nx_dhcp_stop(&my_dhcp);
/* If status is NX_SUCCESS the DHCP was successfully stopped. */
Stop DHCP processing on the specified interface
UINT nx_dhcp_interface_stop(
NX_DHCP *dhcp_ptr,
UINT interface_index);
This service stops DHCP processing on the specified interface if DHCP is already started. If there are no other interfaces running DHCP, the DHCP thread and timer are suspended.
Threads
/* Stop DHCP processing for this IP instance on interface 1. */
status = nx_dhcp_interface_stop(&my_dhcp, 1);
/* If status is NX_SUCCESS the DHCP was successfully stopped. */
Retrieve a DHCP option from last server response
UINT nx_dhcp_user_option_retrieve(
NX_DHCP *dhcp_ptr,
UINT request_option,
UCHAR *destination_ptr,
UINT *destination_size);
This service retrieves the specified DHCP option from the DHCP options buffer on the first interface enabled for DHCP found on the DHCP Client record. If successful, the option data is copied into the specified buffer.
Threads
UCHAR dns_ip_string[4];
ULONG size;
/* Obtain the IP address of the DNS server. */
size = sizeof(dnx_ip_string);
status = nx_dhcp_user_option_retrieve(&my_dhcp, NX_DHCP_OPTION_DNS_SVR,
dns_ip_string, &size);
/* If status is NX_SUCCESS the DNS IP address is in dns_ip_string. */
Retrieve a DHCP option from last server response on the specified interface
UINT nx_dhcp_interface_user_option_retrieve(
NX_DHCP *dhcp_ptr,
UINT interface_index,
UINT request_option, UCHAR *destination_ptr,
UINT *destination_size);
This service retrieves the specified DHCP option from the DHCP options buffer on the specified interface, if that interface is enabled for DHCP. If successful, the option data is copied into the specified buffer.
Threads
UCHAR dns_ip_string[4];
ULONG size;
/* Obtain the IP address of the DNS server on the primary interface. */
size = sizeof(dnx_ip_string);
status = nx_dhcp_interface_user_option_retrieve(&my_dhcp, 0, NX_DHCP_OPTION_DNS_SVR,
dns_ip_string, &size);
/* If status is NX_SUCCESS the DNS IP address is in dns_ip_string. */
Convert four bytes to ULONG
ULONG nx_dhcp_user_option_convert(UCHAR *option_string_ptr);
This service converts the four characters pointed to by “option_string_ptr” into an unsigned long value. It is especially useful when IP addresses are
present.
Threads
UCHAR dns_ip_string[4];
ULONG dns_ip;
/* Convert the first four bytes of "dns_ip_string" to an actual IP
address in "dns_ip." */
dns_ip= nx_dhcp_user_option_convert(dns_ip_string);
/* If status is NX_SUCCESS the DNS IP address is in "dns_ip." */
Set callback function for adding user supplied options
ULONG nx_dhcp_user_option_add_callback_set(
NX_DHCP *dhcp_ptr,
UINT (*dhcp_user_option_add)(
NX_DHCP *dhcp_ptr,
UINT iface_index,
UINT message_type,
UCHAR *user_option_ptr,
UINT *user_option_length));
This service registers the specified callback function for adding user supplied options.
If the callback function specified, the applications can add user supplied options into the packet by iface_index and message_type.
Note: In user’s routine. Applications must follow the DHCP options format when add user supplied options. The total size of user options must be less or equal to user_option_length, and update the user_option_length as real options length. Return NX_TRUE if add options successfully, else return NX_FALSE.
Threads
/* Register the "my_dhcp_user_option_add" function to be called when add DHCP
options, assuming DHCP has already been created. */
status = nx_dhcp_user_option_add_callback_set(&my_dhcp, my_dhcp_user_option_add);
/* If status is NX_SUCCESS the callback function was successfully registered. */