Expand Minimize

DhcpGetOptionValueV5 function

The DhcpGetOptionValueV5 function retrieves a DHCP option value (the option code and associated data) for a particular scope. This function extends the functionality provided by DhcpGetOptionValue by allowing the caller to specify a class and/or vendor for the option.

Syntax


DWORD DhcpGetOptionValueV5(
  _In_   LPWSTR ServerIpAddress,
  _In_   DWORD Flags,
  _In_   DHCP_OPTION_ID OptionID,
  _In_   LPWSTR ClassName,
  _In_   LPWSTR VendorName,
  _In_   DHCP_CONST DHCP_OPTION_SCOPE_INFO ScopeInfo,
  _Out_  LPDHCP_OPTION_VALUE *OptionValue
);

Parameters

ServerIpAddress [in]

Unicode string that specifies the IP address or hostname of the DHCP server.

Flags [in]

Flag value that indicates whether the option is for a specific or default vendor class.

ValueMeaning
0x00000000

The option value is retrieved for a default vendor class.

DHCP_FLAGS_OPTION_IS_VENDOR
0x00000003

The option value is retrieved for a specific vendor class. The vendor name is supplied in VendorName.

 

OptionID [in]

DHCP_OPTION_ID value that specifies the code for the option value to retrieve.

ClassName [in]

Unicode string that specifies the DHCP class name of the option. This parameter is optional.

VendorName [in]

Unicode string that specifies the vendor of the option. This parameter is optional, and should be null when Flags is not set to DHCP_FLAGS_OPTION_IS_VENDOR. If the vendor class is not specified, the option value is returned for the default vendor class.

ScopeInfo [in]

DHCP_OPTION_SCOPE_INFO structure that contains information on the scope where the option value is set.

OptionValue [out]

DHCP_OPTION_VALUE structure that contains the returned option code and data.

Note  

The memory for this parameter must be free using DhcpRpcFreeMemory.

Return value

This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.

Return codeDescription
ERROR_ACCESS_DENIED

This call was performed by a client who is not a member of the "DHCP Administrators" security group.

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server's database.

ERROR_DHCP_SUBNET_NOT_PRESENT

The specified IPv4 subnet is not defined on the DHCP server.

ERROR_DHCP_OPTION_NOT_PRESENT

The specified option definition does not exist in the DHCP server database.

ERROR_DHCP_NOT_RESERVED_CLIENT

The specified DHCP client is not a reserved client.

 

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Dhcpsapi.h

Library

Dhcpsapi.lib

DLL

Dhcpsapi.dll

See also

DhcpSetOptionValueV5
DhcpGetOptionValue
DHCP_OPTION_SCOPE_INFO
DHCP_OPTION_VALUE

 

 

Community Additions

ADD
Show:
© 2014 Microsoft