<div class="content" name="R_DhcpGetOptionValueV6" uuid="d22f04a2-c1b7-4b51-a5d1-009de6e5eb19"><p>The <b>R_DhcpGetOptionValueV6</b> method retrieves the
option value for a specific option on the DHCPv6 server for specific user and
vendor class. <i>ScopeInfo</i> defines the scope from which the option value
needs to be retrieved. The caller of this function can free the memory pointed
by <i>OptionValue</i> by calling the function <b>midl_user_free</b> (section <a href="a7e5f2d1-04b7-4363-bdc0-76a1099664eb" data-linktype="relative-path">3</a>).</p><dl>
<dd>
<div><pre> DWORD R_DhcpGetOptionValueV6(
     [in, unique, string]  DHCP_SRV_HANDLE ServerIpAddress,
     [in]    DWORD Flags,
     [in]    DHCP_OPTION_ID OptionID,
     [in, string, unique]   WCHAR *ClassName,
     [in, string, unique]   WCHAR *VendorName,
     [in]    LPDHCP_OPTION_SCOPE_INFO6 ScopeInfo,
     [out]      LPDHCP_OPTION_VALUE OptionValue
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>Flags: </b>A value that indicates if the option
whose value is retrieved is for a specific vendor class or default vendor
class.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>DHCP_FLAGS_OPTION_DEFAULT 0x00000000</td>
  <td>Option value is retrieved for the default vendor class.</td>
 </tr><tr>
  <td>DHCP_FLAGS_OPTION_IS_VENDOR 0x00000003</td>
  <td>If a bitwise AND operation with this bitmask yields a nonzero value, it indicates that the option value is retrieved for the specified vendor class.</td>
 </tr></tbody></table>
</dd></dl><p><b>OptionID: </b>This is of type <a href="4a0bb785-ceec-4f7a-b4a7-64555f6e0b62" data-linktype="relative-path">DHCP_OPTION_ID (section 2.2.1.2.3)</a>,
containing the option identifier for the option being retrieved.</p><p><b>ClassName: </b>A pointer to a null-terminated
Unicode string that contains the name of the user class for which the option
value is being requested. This parameter is optional.</p><p><b>VendorName: </b>A pointer to a null-terminated
Unicode string that contains the name of the vendor class for which the option
value is being requested. If the vendor class is not specified, the default
vendor class is used.</p><p><b>ScopeInfo: </b>This is a pointer to a <a href="35c698cc-7141-4985-9940-87361653c79d" data-linktype="relative-path">DHCP_OPTION_SCOPE_INFO6 (section 2.2.1.2.30)</a>
that contains information describing the DHCPv6 scope this option value is retrieved
on. This value defines that option is being retrieved from the default, server,
or scope level or for an IPv6 reservation.</p><p><b>OptionValue: </b>This is a pointer of type <a href="fa30c949-e063-4aea-b839-a6210e77741e" data-linktype="relative-path">LPDHCP_OPTION_VALUE</a> in which
the option value is retrieved corresponding to <i>OptionID</i>. For dynamic DNS
update settings, see section <a href="17acb876-ed9f-4ecd-b7bc-1a3ff34952cd" data-linktype="relative-path">3.3.2</a>.</p><p><b>Return Values: </b>A 32-bit unsigned integer value
that indicates return status. A return value ERROR_SUCCESS (0x00000000)
indicates that the operation was completed successfully, else it contains a
Win32 error code, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
This error code value can correspond to a DHCP-specific failure, which takes a
value between 20000 and 20099, or any generic failure.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 ERROR_SUCCESS</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x00004E25 ERROR_DHCP_SUBNET_NOT_PRESENT</td>
  <td>The specified subnet is not defined on the DHCP server.</td>
 </tr><tr>
  <td>0x00004E2A ERROR_DHCP_OPTION_NOT_PRESENT</td>
  <td>The specified option is not defined at the specified level in the DHCP server.</td>
 </tr><tr>
  <td>0x00004E32 ERROR_DHCP_NOT_RESERVED_CLIENT</td>
  <td>The reserved IPv6 client is not defined on the DHCP server.</td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 78.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate if this method is authorized for read access per section
<a href="baec2112-1146-4c42-b77e-b706e170a590" data-linktype="relative-path">3.5.4</a>. If not, return
the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>The <i>Flags</i> parameter MUST pass one of the validations given
in the <i>Flags</i> parameter description. Otherwise, the method returns
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If <i>ClassName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <i>ClassName</i> from the server ADM element <b>DHCPv6ClassDefList</b>.
If the <b>DHCPv6ClassDef</b> entry is not found, return ERROR_FILE_NOT_FOUND.
If <i>ClassName</i> is NULL, it refers to the default user class (section <a href="8a151805-0803-42fe-b201-e2ff378ffa8b" data-linktype="relative-path">3.1.1.17</a>).</p>
</li><li><p><span><span> 
</span></span>If <i>VendorName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <i>VendorName</i> from the server ADM element <b>DHCPv6ClassDefList</b>.
If the <b>DHCPv6ClassDef</b> entry is not found, return ERROR_FILE_NOT_FOUND.
If <i>VendorName</i> is NULL, it refers to the default vendor class (section
3.1.1.17).</p>
</li><li><p><span><span> 
</span></span>Allocate memory for the <i>OptionValue</i> parameter equal to the
size of the DHCP_OPTION_VALUE structure.</p>
</li><li><p><span><span> 
</span></span>If the enumeration in the <i>ScopeInfo</i> parameter is
DhcpDefaultOptions6, retrieve the <b>DHCPv6ClassedOptionDef</b> object from <b>DHCPv6ClassedOptionDefList</b>
for the specified user class and vendor class. If the object is not found, free
the memory allocated to <i>OptionValue</i>, and return
ERROR_DHCP_OPTION_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>If the enumeration in the <i>ScopeInfo</i> parameter is
DhcpDefaultOptions6, fill the <i>OptionValue</i> parameter with the <b>OptionId</b>,
<b>OptVal</b>, and <b>OptValLen</b> fields of the <b>DHCPv6ClassedOptionDef</b>
object retrieved, and return ERROR_SUCCESS to the caller.</p>
</li><li><p><span><span> 
</span></span>If the enumeration in the <i>ScopeInfo</i> parameter is DhcpGlobalOptions6,
retrieve the <b>DHCPv6ClassedOptValue</b> object from the <b>DHCPv6ServerClassedOptValueList</b>
corresponding to the specific user class and vendor class. If it is not found,
free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.<a id="Appendix_A_Target_71"></a><a aria-label="Product behavior note 71" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_71" data-linktype="relative-path">&lt;71&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the enumeration in the <i>ScopeInfo</i> parameter is
DhcpGlobalOptions6, retrieve the <b>DHCPv6OptionValue</b> object corresponding
to the <i>OptionID</i> parameter from <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList</b>.
If it is not found, free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If the enumeration value in the <i>ScopeInfo</i> parameter is
DhcpScopeOptions6, retrieve the <b>DHCPv6Scope</b> object from <b>DHCPv6ScopeList</b>
corresponding to <i>ScopeInfo</i> parameter. If the corresponding entry is not
present, free the memory allocated to <i>OptionValue</i>, and return
ERROR_DHCP_SUBNET_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>If the enumeration value in the <i>ScopeInfo</i> parameter is
DhcpScopeOptions6, retrieve the <b>DHCPv6ClassedOptValue</b> object from <b>DHCPv6Scope.DHCPv6ScopeClassedOptValueList</b>
corresponding to the specific user class and vendor class. If it is not found,
free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If the enumeration value in the <i>ScopeInfo</i> parameter is
DhcpScopeOptions6, retrieve the <b>DHCPv6OptionValue</b> object corresponding
to the <i>OptionID</i> parameter from <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList</b>.
If it is not found, free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> parameter contains DhcpReservedOptions6
enumeration value, retrieve the <b>DHCPv6Scope</b> object and then retrieve the
<b>DHCPv6Scope.DHCPv6ReservationList.DHCPv6Reservation</b> object corresponding
to <i>ScopeInfo</i> parameter. If the corresponding <b>DHCPv6Scope</b> object
or the corresponding <b>DHCPv6Reservation</b> object is not present, free the
memory allocated to <i>OptionValue</i>, and return
ERROR_DHCP_NOT_RESERVED_CLIENT.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> parameter contains DhcpReservedOptions6
enumeration value, retrieve the <b>DHCPv6ClassedOptValue</b> object from <b>DHCPv6Reservation.DHCPv6ResvClassedOptValueList</b>
corresponding to the specific user class and vendor class. If it is not found,
free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> parameter contains DhcpReservedOptions6
enumeration value, retrieve the <b>DHCPv6OptionValue</b> object corresponding
to the <i>OptionID</i> parameter from <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList</b>.
If it is not found, free the memory allocated to <i>OptionValue</i>, and return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>Fill the information in the retrieved <b>DHCPv6OptionValue</b>
object into the <i>OptionValue</i> parameter, and return ERROR_SUCCESS to the
caller.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>