tfNgDhcpGetOption

Jump to: navigation, search

Table of Contents >> Optional Protocols >> DHCP


#include <trsocket.h>


int tfNgDhcpGetOption (
ttUserInterface interfaceHandle,
int indexType,
int index,
int bootOption,
void TM_FAR * dataPtr,
int TM_FAR * dataLenPtr
);


Function Description

This function instructs the DHCP client to retrieve the specified custom option sent by a DHCP server. The DHCP option headers are removed before passing the option data to the caller. This function supports option lengths in excess of 255 bytes and will concatenate multiple instances of the specified option (see RFC 3396 - Encoding Long Options in DHCP).


Parameters

  • interfaceHandle
    The interface on which to retrieve the option.
  • indexType
    The index parameter type. Specify TM_BT_CONF for multihome index (Automatic Configuration) or TM_BT_USER for user index (User-Controlled Configuration).
  • index
    Multihome or user index on which to retrieve this option.
  • bootOption
    The option code to retrieve.
  • dataPtr
    Pointer to a buffer to store the option data into.
  • dataLenPtr
    Pointer to an integer variable that, on input, contains the length of the data buffer (may be >255 bytes). Upon return, the variable will be updated to reflect the actual length of the option data stored in dataPtr. Specify a length of 1 to discover how much buffer space to allocate for the option.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    Invalid arguments in the call.
  • TM_ENOBUFS
    Insufficient memory.
  • TM_EMSGSIZE
    Insufficient buffer space to store the option data. *dataLenPtr will be updated to reflect the actual length of the option data.
  • TM_ENOENT
    No such option was received from the server.


Usage

This function can be used to retrieve options sent by the server that are not natively supported by the DHCP client (see Table 1 below). Any unrecognized option sent by the DHCP server can be accessed with this function.

Table 1 - Examples of custom DHCP options
Option Description
43 Vendor-specific information (RFC 2132, section 8.4).
60 Vendor class identifier (RFC 2132, section 9.13).
124 Vendor-identifying vendor class option (RFC 3925, section 3).
125 Vendor-identifying vendor-specific information option (RFC 3925, section 4).


Table of Contents >> Optional Protocols >> DHCP