tfDhcpConfSet

Jump to: navigation, search

Table of Contents >> Optional Protocols >> DHCP Automatic Configuration


#include <trsocket.h>


int tfDhcpConfSet (
ttUserInterface interfaceHandle,
int mHomeIndex,
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 tfOpenInterface()/tfConfigInterface(). It is called by the user when the user wants to specify his/her own Client ID, or suppress the Client ID option, or if the user wants to start in INIT_REBOOT state, or if the user wants 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().
  • mHomeIndex
    The multihome index.
  • 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.
  • 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 This 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. This flag is not supported by tfDhcpConfSet(). Instead, use the TM_DEV_DHCP_INFO_ONLY flag when calling tfOpenInterface() or tfConfigInterface().
  • 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, i.e. prior to calling tfDhcpUserStart() or tfOpenInterface()/tfConfigInterface().
  • TM_ENOBUFS
    Insufficient memory to complete the operation.


Table of Contents >> Optional Protocols >> DHCP Automatic Configuration