This chapter contains a description of all NetX Duo DHCP Server services (listed below) in alphabetic order.
Note
|
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 Server instance
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);
This service creates a DHCP Server instance with a previously created IP instance.
Important
|
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. |
-
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
-
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.
Create a IP address pool
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);
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).
-
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
-
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.
/* 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. */
Remove Client record from Server database
UINT nx_dhcp_clear_client_record(
NX_DHCP_SERVER *dhcp_ptr,
NX_DHCP_CLIENT *dhcp_client_ptr);
-
dhcp_ptr: Pointer to DHCP Server control block.
-
dhcp_client_ptr: Pointer to DHCP Client to remove
-
NX_SUCCESS (0x00) Successful DHCP Server create.
-
NX_PTR_ERROR (0x16) Invalid pointer input.
-
NX_CALLER_ERROR (0x11) Non thread caller of service
Set network parameters for DHCP options
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);
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.
-
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_SUCCESS (0x00) Successful DHCP Server create.
-
NX_DHCP_SERVER_BAD_INTERFACE_INDEX (0xA1) Index does not match addresses
-
NX_DHCP_INVALID_NETWORK_PARAMETERS (0xA3) Invalid network parameters
-
NX_PTR_ERROR (0x16) Invalid pointer input.
Delete a DHCP Server instance
-
NX_SUCCESS (0x00) Successful DHCP Server delete.
-
NX_PTR_ERROR (0x16) Invalid pointer input.
-
NX_DHCP_PARAMETER_ERROR (0x92) Invalid non pointer input
-
NX_CALLER_ERROR (0x11) Invalid caller of service.
Start DHCP Server processing
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_SUCCESS (0x00) Successful Server start.
-
NX_DHCP_ALREADY_STARTED (0x93) DHCP already started.
-
NX_PTR_ERROR (0x16) Invalid pointer input.
-
NX_CALLER_ERROR (0x11) Invalid caller of service.
-
NX_DHCP_PARAMETER_ERROR (0x92) Invalid non pointer input
Stops DHCP Server processing
This service stops DHCP Server processing, which includes of receiving DHCP Client requests.
-
NX_SUCCESS (0x00) Successful DHCP stop.
-
NX_DHCP_ALREADY_STARTED (0x93) DHCP already started.
-
NX_PTR_ERROR (0x16) Invalid pointer input.
-
NX_CALLER_ERROR (0x11) Invalid caller of service.
-
NX_DHCP_PARAMETER_ERROR (0x92) Invalid non pointer input