tfDhcpUserSet

Jump to: navigation, search

Table of Contents >> Optional Protocols >> DHCP User Configured


#include <trsocket.h>


int tfDhcpUserSet (
ttUserInterface interfaceHandle,
int userIndex,
int flags,
ttUserIpAddress requestedIpAddress,
unsigned char * clientIdPtr,
int clientIdLength
);


Function Description

This function allows the user to set the DHCP initial state (INIT or INIT_REBOOT) prior to the user calling tfDhcpUserStart(). This function is called by the user when the user wants to specify their own CLIENT ID, suppress the CLIENT ID option, wishes to start in the INIT_REBOOT state, or wishes to specify an IP address in the DISCOVERY phase.

If the user specifies the INIT_REBOOT state then the requested IP address needs to be specified as well.

If the user specifies the INIT state (i.e. TM_DHCPF_INIT_REBOOT is not set) then the user can specify the IP address and/or CLIENT ID option.

If the CLIENT ID is not specified, and not suppressed, the stack will pick a unique CLIENT ID that will be the same across reboots provided that the user uses the same type of configuration and same index.

If the user specifies the TM_DHCPF_FQDN_ENABLE flag, then 'clientIdPtr' is used to indicate the DHCP FQDN option domain name. If 'flags' is set to TM_DHCPF_FQDN_ENABLE and the 'clientIdPtr' is NULL, then the global FQDN, as configured by tfUserSetFqdn(), will be used instead.


Warning Warning: The TM_DHCPF_FQDN_ENABLE flag cannot be set at the same time as the other flags, with the exception of TM_DHCP_FQDN_PARTIAL.


Parameters

  • interfaceHandle
    The device entry as returned by tfAddInterface().
  • userIndex
    The user index of the BOOT entry. This value must be between 0 and tvMaxUserDhcpEntries - 1.
  • flags
    0 or a combination of:
  • TM_DHCPF_INIT_REBOOT. This option is invalid by itself—it must be combined with TM_DHCPF_REQUESTED_IP_ADDRESS.
  • TM_DHCPF_REQUESTED_IP_ADDRESS. Parameter requestedIpAddress is set. This flag is incompatible with the TM_DHCPF_INFO_ONLY flag.
  • TM_DHCPF_SUPPRESS_CLIENT_ID.
  • TM_DHCPF_FQDN_ENABLE. This option must be specified separately from the above options.
  • TM_DHCPF_FQDN_PARTIAL. This is ignored if 'clientIdPtr' is NULL.
  • TM_DHCPF_FQDN_ASCII. The DHCP FQDN option is binary encoded as recommended by the latest draft, however older servers only accept this option ASCII encoded. This flag, when used in conjunction with TM_DHCPF_FQDN_ENABLE, causes the DHCP_FQDN option to be ASCII encoded.
  • TM_DHCPF_HOST_NAME. Sets/resets the host name option when flags is set to TM_BOOTPF_HOST_NAME. When the dataPtr is NULL and dataLength is zero, the host name option is reset else it will be set using clientIdPtr. Note that the HOST Name option must be set separately from other BOOTP options.
  • TM_DHCPF_FQDN_FLAG_S_ZERO. When this bit is set, the stack DHCP client will set the "S" bit to zero in the FQDN option sent in the DHCP message, which tells the server that it should not perform the A RR DNS (FQDN-to-address) updates.
  • TM_DHCPF_FQDN_FLAG_N_ONE. When this bit is set, the stack DHCP client will set the "N" bit to one, and the "S" bit to zero in the FQDN option sent in the DHCP messages. This tells the server that it should not perform any DNS updates.
  • TM_DHCPF_FQDN_DISABLE. Set this bit to disable FQDN on an interface.
  • TM_DHCPF_INFO_ONLY. If a user has obtained an IP address through some other means (e.g. manual configuration), the TM_DHCPF_INFO_ONLY flag can be set to send a DHCPINFORM message to obtain the remaining configuration parameters (e.g. default router, DNS servers). This flag is incompatible with the TM_DHCPF_REQUESTED_IP_ADDRESS flag. Note: TM_DHCPF_INFO_ONLY is supported by tfDhcpUserSet() but not tfDhcpConfSet().
  • requestedIpAddress
    The IP address requested by the user in network byte order. Note that your requested IP address will persist after you close and reopen an interface. If you want to remove a previously set value, set a zero requestedIpAddress prior to reopening the interface.
  • clientIdPtr
    A pointer to the CLIENT ID. When 'flags' is set to TM_DHCPF_FQDN_ENABLE, the FQDN will be stored in this parameter. If it is NULL, the global FQDN (tvFqndStruct) will be used instead.
  • clientIdLength
    The length of the CLIENT ID. When 'flags' is set to TM_DHCPF_FQDN_ENABLE, this field represents the FQDN domain length.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    One of the parameters was invalid.
  • TM_EPERM
    This call can only be made in the INIT state prior to calling tfDhcpUserStart().
  • TM_EINVAL
    Insufficient memory to complete the operation.


Table of Contents >> Optional Protocols >> DHCP User Configured