ThreadX docsThreadX docs
ThreadX
ThreadX Modules
NetX Duo
FileX
GUIX
USBX
TraceX
LevelX
ThreadX
ThreadX Modules
NetX Duo
FileX
GUIX
USBX
TraceX
LevelX
  • NetX Duo Documentation

    • Understand NetX Duo
    • NetX Duo documentation
    • Chapter 1 - Introduction to NetX Duo
    • Chapter 2 - Installation and Use of NetX Duo
    • Chapter 3 - Functional Components of NetX Duo
    • Chapter 4 - Description of NetX Duo Services
    • Chapter 5 - NetX Duo Network Drivers
    • Appendix A - NetX Duo Services
    • Appendix B - NetX Duo Constants
    • Appendix C - NetX Duo Data Types
    • Appendix D - NetX Duo BSD-Compatible Socket API
    • Appendix E - NetX Duo ASCII Character Codes
    • Auto-IP

      • Chapter 1 - Introduction to NetX Duo AutoIP
      • Chapter 2 - Installation and use of NetX Duo AutoIP
      • Chapter 3 - Description of NetX Duo AutoIP services
    • BSD

      • Chapter 1 - Introduction to NetX Duo BSD
      • Chapter 2 - Installation and use of NetX Duo BSD
      • Chapter 3 - NetX Duo BSD Services
    • Crypto

      • Chapter 1 - Introduction to NetX Duo Crypto
      • Chapter 2 - Installation and use of NetX Duo Crypto
      • Chapter 3 - Functional description of NetX Duo Crypto
      • Chapter 4 - NetX Duo Crypto API description
      • Appendix - NetX Duo Crypto CAVS test
    • DHCP Client

      • Chapter 1 - Introduction to the NetX Duo DHCP Client
      • Chapter 2 - Installation and use of NetX Duo DHCP Client
      • Chapter 3 - Description of NetX Duo DHCP Client services
      • Appendix A - Description of the Restore state feature for NetX Duo DHCP Client services
    • DHCP Server

      • Chapter 1 - Introduction to NetX Duo DHCP Server
      • Chapter 2 - Installation and Use of the NetX Duo DHCP Server
      • Chapter 3 - Description of NetX Duo DHCP server services
    • DHCPv6 Client

      • Chapter 1 - Introduction to NetX Duo DHCPv6 Client
      • Chapter 2 - Installation and use of NetX Duo DHCPv6 Client
      • Chapter 3 - NetX Duo DHCPv6 configuration options
      • Chapter 4 - NetX Duo DHCPv6 Client services
      • Appendix A - Description of the Restore State Feature for NetX Duo DHCPv6 Client
    • DHCPv6 Server

      • Chapter 1 - Introduction to NetX Duo DHCPv6 server
      • Chapter 2 - Installation and use of NetX Duo DHCPv6 server
      • Chapter 3 - NetX Duo DHCPv6 server configuration options
      • Chapter 4 - NetX Duo DHCPv6 server services
      • Appendix A – NetX Duo DHCPv6 option codes
      • Appendix B - NetX Duo DHCPv6 server status codes
      • Appendix C - NetX Duo DHCPv6 unique identifiers (DUIDs)
      • Appendix D - NetX Duo Advanced DHCPv6 server example
    • DNS

      • Chapter 1 - Introduction to the NetX Duo DNS Client
      • Chapter 2 - Installation and Use of NetX Duo DNS Client
      • Chapter 3 - Description of NetX Duo DNS Client Services
    • FTP

      • Chapter 1 - Introduction to NetX Duo FTP
      • Chapter 2 - Installation and use of FTP
      • Chapter 3 - Description of FTP services
    • HTTP

      • Chapter 1 - Introduction to NetX Duo HTTP
      • Chapter 2 - Installation and Use of NetX Duo HTTP
      • Chapter 3 - Description of NetX Duo HTTP Services
    • iperf

      • Chapter 1 - Introduction to NetX Duo Iperf
      • Chapter 2 - Installing and using NetX Duo Iperf
      • Chapter 3 - Running the UDP Transmit Test
    • mDNS

      • Chapter 1 - Introduction to NetX Duo mDNS/DNS-SD
      • Chapter 2 - Installation and use of mDNS
      • Chapter 3 - Description of internal service cache
      • Chapter 4 - Description of mDNS services
    • mqtt

      • Chapter 1 - Introduction to NetX Duo MQTT
      • Chapter 2 - Installation and use of NetX Duo MQTT client
      • Chapter 3 - Description of NetX Duo MQTT Client Services
    • NAT

      • Chapter 1 - An introduction to Network Address Translation
      • Chapter 2 - Installation and use of NAT
      • Chapter 3 - NAT configuration options
      • Chapter 4 - Description of NAT services
    • POP3 Client

      • Chapter 1 - Introduction to NetX Duo POP3
      • Chapter 2 - Installation and use of NetX Duo POP3 Client
      • Chapter 3 - Description of POP3 Client services
    • PPP

      • Chapter 1 - Introduction to the NetX Duo Point-to-Point Protocol (PPP)
      • Chapter 2 - Installation and use of NetX Duo Point-to-Point Protocol (PPP)
      • Chapter 3 - Description of NetX Duo Point-to-Point Protocol (PPP) services
    • PTP Client

      • Chapter 1 - Introduction to NetX Duo PTP Client
      • Chapter 2 - Installation and Use of NetX Duo PTP Client
      • Chapter 3 - Description of NetX Duo PTP Client Services
    • rtp

      • Chapter 1 - Introduction to the NetX Duo RTP Sender
      • Chapter 2 - Installation and use of NetX Duo RTP Sender
      • Chapter 3 - Description of NetX Duo RTP Sender Services
    • rtsp

      • Chapter 1 - Introduction to the NetX Duo RTSP Server
      • Chapter 2 - Installation and use of NetX Duo RTSP Server
      • Chapter 3 - Description of NetX Duo RTSP Server Services
    • Secure DTLS

      • Chapter 1 - Introduction to NetX Duo Secure DTLS
      • Chapter 2 - Installation and use of NetX Duo Secure DTLS
      • Chapter 3 - Functional description of NetX Duo Secure DTLS
      • Chapter 4 - Description of NetX Duo Secure DTLS services
      • Appendix A - NetX Duo Secure DTLS return/error codes
    • Secure TLS

      • Chapter 1 - Introduction to NetX Duo Secure
      • Chapter 2 - Installation and use of NetX Duo Secure
      • Chapter 3 - Functional description of NetX Duo Secure
      • Chapter 4 - Description of NetX Duo Secure services
      • Appendix A - NetX Duo Secure return/error codes
    • SMTP Client

      • Chapter 1 - Introduction to NetX Duo SMTP client
      • Chapter 2 - Installation and use of NetX Duo SMTP client
      • Chapter 3 - Client description of SMTP Client services
    • snmp

      • Chapter 1 - Introduction to NetX Duo SNMP
      • Chapter 2 - Installation and use of the NetX Duo SNMP agent
      • Chapter 3 - Description of NetX Duo SNMP agent services
    • sntp client

      • Chapter 1 - Introduction to NetX Duo SNTP
      • Chapter 2 - Installation and Use of NetX Duo SNTP Client
      • Chapter 3 - Description of NetX Duo SNTP Client Services
      • Appendix A - NetX Duo SNTP Fatal Error Codes
    • telnet

      • Chapter 1 - Introduction to NetX Duo Telnet
      • Chapter 2 - Installation and use of NetX Duo Telnet
      • Chapter 3 - Description of NetX Duo Telnet services
    • TFTP

      • Chapter 1 - Introduction to NetX Duo TFTP
      • Chapter 2 - Installation and use of NetX Duo TFTP
      • Chapter 3 - Description of NetX Duo TFTP services
    • Web HTTP

      • Chapter 1 - Introduction to HTTP and HTTPS
      • Chapter 2 - Installation and use of HTTP and HTTPS
      • Chapter 3 - Description of HTTP services
    • About the NetX Duo User Guide

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.

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.

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.

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.

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.

Allowed From

Application

Example

/* Create a DHCP Server instance. */

status = nx_dhcp_server_create(&dhcp_server, &server_ip, pointer,
    DEMO_SERVER_STACK_SIZE, SERVER_IP_ADDRESS_LIST, "DHCP server", &server_pool);

/* If status is NX_SUCCESS a DHCP Server instance was successfully created. */

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.

Allowed From

Application

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);

Description

This service clears the Client record from the Server database.

Input Parameters

  • dhcp_ptr: Pointer to DHCP Server control block.
  • dhcp_client_ptr: Pointer to DHCP Client to remove

Return Values

  • NX_SUCCESS (0x00) Successful DHCP Server create.
  • NX_PTR_ERROR (0x16) Invalid pointer input.
  • NX_CALLER_ERROR (0x11) Non thread caller of service

Allowed From

Application

Example

/* Remove Client record from the server database. */
status = nx_dhcp_clear_client_record(&dhcp_server, &dhcp_client_ptr);

/* If status is NX_SUCCESS the specified Client was removed from the database. */

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

Return Values

  • 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.

Allowed From

Application

Example

/* Set network parameters for a specific interface. */

status = nx_dhcp_set_interface_network_parameters(&dhcp_server, iface_index,
    NX_DHCP_SUBNET_MASK, NX_DHCP_DEFAULT_GATEWAY,
    NX_DHCP_DNS_SERVER);

/* If status is NX_SUCCESS network parameters were successfully set. */

nx_dhcp_server_delete

Delete a DHCP Server instance

Prototype

UINT nx_dhcp_server_delete(NX_DHCP_SERVER *dhcp_ptr);

Description

This service deletes a previously created DHCP Server instance.

Input Parameters

  • dhcp_ptr: Pointer to a DHCP Server instance.

Return Values

  • 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.

Allowed From

Threads

Example

/* Delete a DHCP Server instance. */

status = nx_dhcp_server_delete(&dhcp_server);

/* If status is NX_SUCCESS the DHCP Server instance was successfully deleted. */

nx_dhcp_server_start

Start DHCP Server processing

Prototype

UINT nx_dhcp_server_start(NX_DHCP_SERVER *dhcp_ptr);

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.

Input Parameters

  • dhcp_ptr: Pointer to previously created DHCP instance.

Return Values

  • 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

Allowed From

Threads

Example

/* Start the DHCP Server processing for this IP instance. */

status = nx_dhcp_server_start(&dhcp_server);

/* If status is NX_SUCCESS the DHCP Server was successfully started. */

nx_dhcp_server_stop

Stops DHCP Server processing

Prototype

UINT nx_dhcp_server_stop(NX_DHCP_SERVER *dhcp_ptr);

Description

This service stops DHCP Server processing, which includes of receiving DHCP Client requests.

Input Parameters

  • dhcp_ptr: Pointer to DHCP Server instance.

Return Values

  • 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

Allowed From

Threads

Example

/* Stop the DHCP Server processing for this IP instance. */

status = nx_dhcp_server_stop(&dhcp_server);

/* If status is NX_SUCCESS the DHCP Server was successfully stopped. */
Prev
Chapter 2 - Installation and Use of the NetX Duo DHCP Server