Chapter 3 - Description of NetX Duo DHCP Server Services
This chapter contains a description of all NetX Duo DHCP Server 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. |
nx_dhcp_server create
Create a DHCP Server instance
Prototype
UINT nx_dhcp_server_create(
NX_DHCP_SERVER *dhcp_ptr,
NX_IP *ip_ptr,
VOID *stack_ptr,
ULONG stack_size,
CHAR *input_address_list,
CHAR *name_ptr,
NX_PACKET_POOL *packet_pool_ptr);
Description
This service creates a DHCP Server instance with a previously created IP instance.
| The application must make sure the packet pool created for the IP create service has a minimum 548 byte payload, not including the UDP, IP and Ethernet headers. |
Input Parameters
-
dhcp_ptr: Pointer to DHCP Server control block.
-
ip_ptr: Pointer to DHCP Server IP instance.
-
stack_ptr: Pointer DHCP Server stack location.
-
stack_size: Size of DHCP Server stack input_address_list Pointer to Server’s list of IP addresses
-
name_ptr: Pointer to DHCP Server name packet_pool_ptr Pointer to DHCP Server packet pool
Return Values
-
NX_SUCCESS (0x00) Successful DHCP Server create.
-
NX_DHCP_INADEQUATE_PACKET_POOL_PAYLOAD (0xA9) Packet payload too small error
-
NX_DHCP_NO_SERVER_OPTION_LIST (0x96) Server option list is empty
-
NX_DHCP_PARAMETER_ERROR (0x92) Invalid non pointer input
-
NX_CALLER_ERROR (0x11) Invalid caller of service.
-
NX_PTR_ERROR (0x16) Invalid pointer input.
nx_dhcp_create_server_ip_address_list
Create a IP address pool
Prototype
UINT nx_dhcp_create_server_ip_address_list(
NX_DHCP_SERVER *dhcp_ptr,
UINT iface_index,
ULONG start_ip_address,
ULONG end_ip_address,
UINT *addresses_added);
Description
This service creates a network interface specific pool of available IP addresses for the specified DHCP server to assign. The start and end IP addresses must match the specified network interface. The actual number of IP addresses added may be less than the total addresses if the IP address list is not large enough (which is set in the user configurable NX_DHCP_IP_ADDRESS_MAX_LIST_SIZE parameter).
Input Parameters
-
dhcp_ptr: Pointer to DHCP Server control block.
-
iface_index: Index corresponding to network interface
-
start_ip_address: First available IP address
-
end_ip_address: Last of the available IP address
-
addresses_added: Number of IP addresses added to list
Return Values
-
NX_SUCCESS (0x00) Successful DHCP Server create.
-
NX_DHCP_SERVER_BAD_INTERFACE_INDEX (0xA1) Index does not match addresses
-
NX_DHCP_INVALID_IP_ADDRESS_LIST (0x99) Invalid address input
-
NX_DHCP_INVALID_IP_ADDRESS (0x9B) Illogical start/end addresses
-
NX_PTR_ERROR (0x16) Invalid pointer input.
Example
/* Create a pool of available IP addresses to assign. */
status = nx_dhcp_create_server_ip_list(&dhcp_server, iface_index,
START_IP_ADDRESS_LIST, END_IP_ADDRESS_LIST, &addresses_added);
/* If status is NX_SUCCESS a IP address list was successfully created.
addresses_added indicates how many IP addresses were actually added to the
list. */
nx_dhcp_clear_client_record
Remove Client record from Server database
Prototype
UINT nx_dhcp_clear_client_record(
NX_DHCP_SERVER *dhcp_ptr,
NX_DHCP_CLIENT *dhcp_client_ptr);
Input Parameters
-
dhcp_ptr: Pointer to DHCP Server control block.
-
dhcp_client_ptr: Pointer to DHCP Client to remove
nx_dhcp_set_interface_network_parameters
Set network parameters for DHCP options
Prototype
UINT nx_dhcp_set_interface_network_parameters(
NX_DHCP_SERVER *dhcp_ptr,
UINT iface_index,
ULONG subnet_mask,
ULONG default_gateway_address,
ULONG dns_server_address);
Description
This service sets default values for network critical parameters for the specified interface. The DHCP server will include these options in its OFFER and ACK replies to the DHCP Client. If the host set interface parameters on which a DHCP server is running, the parameters will defaulted as follows: the router set to the primary interface gateway for the DHCP server itself, the DNS server address to the DHCP server itself, and the subnet mask to the same as the DHCP server interface is configured with.
Input Parameters
-
dhcp_ptr: Pointer to DHCP Server control block.
-
iface_index: Index corresponding to network interface
-
subnet_mask: Subnet mask for Client network
-
default_gateway_address: Client’s router IP address
-
dns_server_address: DNS server for Client’s network
nx_dhcp_server_delete
nx_dhcp_server_start
Start DHCP Server processing
Description
This service starts DHCP Server processing, which includes creating a server UDP socket, binding the DHCP port and waiting to receive Client DHCP requests.
nx_dhcp_server_stop
Stops DHCP Server processing
Description
This service stops DHCP Server processing, which includes of receiving DHCP Client requests.