<div class="content"><p> </p><p>The <b>R_DhcpAddSubnetElementV6</b> method adds an IPv6
prefix element (such as IPv6 reservation or IPv6 exclusion range) to the IPv6
prefix in the DHCPv6 server. </p><dl>
<dd>
<div><pre> DWORD R_DhcpAddSubnetElementV6(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IPV6_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_ELEMENT_DATA_V6 AddElementInfo
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>SubnetAddress: </b>This is of type <span><a href="48b74c46-bf64-40db-92b9-6e61cee1bd33" data-linktype="relative-path">DHCP_IPV6_ADDRESS (section 2.2.1.2.28)</a></span>
that contains the IPv6 address of the subnet for which the IPv6 prefix element
is added.</p><p><b>AddElementInfo: </b>This is a pointer to structure
<span><a href="69f63a7f-55f2-4b1e-bc01-96c9ed3c92d9" data-linktype="relative-path">DHCP_SUBNET_ELEMENT_DATA_V6 (section 2.2.1.2.60)</a></span>
that contains the IPv6 prefix element that needs to be added to the IPv6
prefix.</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 <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>.
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>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000057</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>An invalid parameter is specified in the <i>AddElementInfo</i>
  parameter.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x000007DE</p>
  <p>ERROR_DUPLICATE_TAG</p>
  </td>
  <td>
  <p>The specified exclusion range conflicts with existing
  exclusion ranges.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E2D</p>
  <p>ERROR_DHCP_JET_ERROR</p>
  </td>
  <td>
  <p>An error occurred while accessing the DHCP server
  database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E36</p>
  <p>ERROR_DHCP_RESERVEDIP_EXITS</p>
  </td>
  <td>
  <p>An IPv6 reservation exists for one or both of the
  following:</p>
  <ul><li><p><span><span>  
  </span></span><span>the specified IPv6 address</span></p>
  </li><li><p><span><span>  
  </span></span><span>the <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_6b55682d-9815-4dcd-b990-af62890ca699" data-linktype="relative-path">DHCPv6 client-identifier</a></span>
  (section <span><a href="c3703409-c016-4f58-ba0f-a4da12f605fb" data-linktype="relative-path">2.2.1.2.5.3</a></span>) and
  interface identifier pair specified in reservation information</span></p>
  </li></ul></td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 59.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate whether this method is authorized for read/write access
per section <span><a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a></span>. If not,
return the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>If the <b>AddElementInfo</b> pointer is NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv6Scope</b> object corresponding to <b>SubnetAddress</b>
from <b>DHCPv6ScopeList</b> of the DHCPv6 server in which the IPv6 prefix
element needs to be added. If no <b>DHCPv6Scope</b> object corresponds to <b>SubnetAddress</b>,
return ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is Dhcpv6ExcludedIpRanges and the exclusion
range specified in <b>AddElementInfo</b> partially overlaps with any of the
entries in <b>DHCPv6Scope.DHCPv6ExclusionRangeList</b>, return
ERROR_DUPLICATE_TAG; else add the IPv6 exclusion range to <b>DHCPv6ExclusionRangeList</b>.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is Dhcpv6ExcludedIpRanges and the start
address is greater than the end address, add this entry to <b>DHCPv6Scope.DHCPv6ExclusionRangeList</b>.
Note that IPv6 addresses can be leased out from this inverted range.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is Dhcpv6ExcludedIpRanges and the specified
exclusion range is outside of the subnet prefix specified in the <b>SubnetAddress</b>
parameter, add this entry to <b>DHCPv6Scope.DHCPv6ExclusionRangeList</b>. This
range will not exclude any IPv6 addresses on the DHCPv6 server.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is set to Dhcpv6ReservedIps and there is no
<b>DHCPv6Reservation</b> object in <b>DHCPv6Scope.DHCPv6ReservationList</b>
that has a <b>ReservedAddress</b> equal to the <b>ReservedIpAddress</b> passed
in <b>AddElementInfo</b>, and there is no entry in <b>DHCPv6Scope.DHCPv6ClientInfoList</b>
corresponding to the DHCPv6 client-identifier and the interface identifier as
specified in the reservation information, then create <b>DHCPv6Reservation</b>
and <b>DHCPv6ClientInfo</b> objects corresponding to the information provided
in <b>AddElementInfo</b>, and add them to <b>DHCPv6ReservationList</b> and <b>DHCPv6ClientInfoList</b>,
respectively.<a id="Appendix_A_Target_61"></a><a aria-label="Product behavior note 61" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_61" data-linktype="relative-path">&lt;61&gt;</a></p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is set to Dhcpv6ReservedIps and there is a <b>DHCPv6Reservation</b>
object in <b>DHCPv6ReservationList</b> for the IPv6 address or DHCPv6 client
identifier, and an interface definition pair already exists for the reserved
address specified in the reservation information, return
ERROR_DHCP_RESERVEDIP_EXITS.<a id="Appendix_A_Target_62"></a><a aria-label="Product behavior note 62" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_62" data-linktype="relative-path">&lt;62&gt;</a></p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is Dhcpv6ReservedIps and there is already
an entry in <b>DHCPv6ClientInfoList</b> for the DHCPv6 client identifier and
the interface identifier with the same IPv6 address as specified in the
reservation information, then add the IPv6 reservation to <b>DHCPv6ReservationList</b>
and <b>DHCPv6ClientInfoList</b> as above. If there is an existing entry in <b>DHCPv6ClientInfoList</b>
(which is of type <b>DHCPv6ClientInfo</b>) for the DHCPv6 client identifier and
the interface, but with a different IPv6 address, and a corresponding entry in <b>DHCPv6ReservationList</b>
(which is of type <b>DHCPv6Reservation</b>) also exists for the client, then
return ERROR_DHCP_RESERVEDIP_EXITS. If there is an existing entry in <b>DHCPv6ClientInfoList</b>
for the client with a different IPv6 address, but no corresponding entry in <b>DHCPv6ReservationList</b>
exists, remove the existing entry from <b>DHCPv6ClientInfoList</b>, create a
new <b>DHCPv6ClientInfo</b> object from the data in <b>AddElementInfo</b>, and
add it to <b>DHCPv6ClientInfoList</b>. Also add a corresponding entry in <b>DHCPv6ReservationList</b>.<a id="Appendix_A_Target_63"></a><a aria-label="Product behavior note 63" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_63" data-linktype="relative-path">&lt;63&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the <b>ElementType</b> is Dhcpv6ReservedIps and there is
already an entry in <b>DHCPv6ClientInfoList</b> for the IPv6 address specified
in the reservation information but the DHCPv6 client-identifier and interface
identifier are different, then delete this entry, create a new <b>DHCPv6ClientInfo</b>
object, and add it to <b>DHCPv6ClientInfoList</b>. Also add a corresponding <b>DHCPv6Reservation</b>
entry to <b>DHCPv6ReservationList</b>.<a id="Appendix_A_Target_64"></a><a aria-label="Product behavior note 64" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_64" data-linktype="relative-path">&lt;64&gt;</a></p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is Dhcpv6ReservedIps and the specified
reservation address is outside the subnet prefix specified in the <b>SubnetAddress</b>
parameter, then create a new <b>DHCPv6Reservation</b> object from the
information in <b>AddElementInfo</b>, and add it to <b>DHCPv6ReservationList</b>.This
reservation does not cause the specified IPv6 address to be leased out to the
DHCPv6 client that is specified by the DHCPv6 client-identifier (section 2.2.1.2.5.3)
and the interface identifier (section <span><a href="01fc2011-4b53-4104-a820-df22a5b2bf8e" data-linktype="relative-path">2.2.1.2.58</a></span>) in the
reservation.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is set to Dhcpv6IpRanges, do no processing
and return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p></div>