<div class="content"><p> </p><p>The <b>R_DhcpCreateSubnetVQ</b> method is used to create the
new IPv4 subnet along with its <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_f30fdc41-d7c1-422e-b5a8-9dcce071ebeb" data-linktype="relative-path">NAP</a></span> state on the
DHCPv4 server. This method is an extension of <span><a href="8b3c3d99-490d-4a16-a9c1-0ed0349f37b0" data-linktype="relative-path">R_DhcpCreateSubnet (section 3.1.4.1)</a></span>.</p><dl>
<dd>
<div><pre> DWORD R_DhcpCreateSubnetVQ(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_INFO_VQ SubnetInfoVQ
 );
</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="5122557b-b85d-4982-8ffb-98d8d934e353" data-linktype="relative-path">DHCP_IP_ADDRESS (section 2.2.1.2.1)</a></span>,
containing the IPv4 address of the subnet.</p><p><b>SubnetInfoVQ: </b>This is a pointer to a structure
of type <span><a href="baec452a-0eda-44d4-b2d7-acd86950b2a6" data-linktype="relative-path">DHCP_SUBNET_INFO_VQ (section 2.2.1.2.45)</a></span>
that contains information about the IPv4 subnet, including the IPv4 subnet mask
and the IPv4 address of the subnet. The structure <span><a href="51e16f4a-cb1d-400a-85c7-defe4cba1609" data-linktype="relative-path">DHCP_HOST_INFO (section 2.2.1.2.7)</a></span>
(referred by the <b>PrimaryHost</b> member) stored in the <i>SubnetInfoVQ</i>
parameter MUST be ignored by both the caller and the server.</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>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>0x00004E54</p>
  <p>ERROR_DHCP_SUBNET_EXISTS</p>
  </td>
  <td>
  <p>The IPv4 <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_128cd76b-eecb-41e6-96f7-f73c2bf9235a" data-linktype="relative-path">scope</a></span> parameters
  are incorrect. Either the IPv4 scope already exists, corresponding to the <b>SubnetAddress</b>
  and <b>SubnetMask</b> members of the
  DHCP_SUBNET_INFO_VQ (section 2.2.1.2.45) structure, or there is a
  range overlap of IPv4 addresses between those associated with the <b>SubnetAddress</b>
  and <b>SubnetMask</b> members of the new IPv4 scope and the subnet address
  and mask of an already existing IPv4 scope.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 48.</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/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 <i>SubnetAddress</i> input parameter is 0, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <i>SubnetInfoVQ</i> input parameter is NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <i>SubnetAddress</i> input parameter is not the same as
the <b>SubnetAddress</b> member of the <i>SubnetInfoVQ</i> input parameter,
return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the bitwise AND operation of the <i>SubnetAddress</i> input
parameter with the <b>SubnetMask</b> member of the <i>SubnetInfoVQ</i> input
parameter is not the same as the <i>SubnetAddress</i> input parameter, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Iterate through the server ADM element <b>DHCPv4ScopesList</b>
and validate that the range of IPv4 addresses, that correspond to the <b>SubnetAddress</b>
and <b>SubnetMask</b> members of the <i>SubnetInfoVQ</i> parameter, does not
overlap the range of IPv4 addresses that correspond to the subnet address and
mask of any <b>DHCPv4Scope</b> ADM element entry present in <b>DHCPv4ScopesList</b>
ADM element. If an overlap is detected, return ERROR_DHCP_SUBNET_EXISTS.</p>
</li><li><p><span><span> 
</span></span>Create a <b>DHCPv4Scope</b> ADM element object and insert it into
the <b>DHCPv4ScopesList</b> ADM element. The <b>DHCPv4Scope</b> ADM element
object is initialized as follows:</p>
<ul><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.ScopeInfo</b> ADM element is initialized with the information
contained in the <i>SubnetInfoVQ</i> parameter. The <b>QuarantineOn</b> member
of the <b>DHCPv4Scope.ScopeInfo</b> ADM element is set to 0.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DelayOffer</b> ADM element is set to 0.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.SuperScopeId</b> ADM element is set to 0.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DHCPv4IpRangesList</b> ADM element is set to empty list.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DHCPv4ExclusionRangesList</b> ADM element is set to empty list.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DHCPv4ReservationsList</b> ADM element is set to empty list.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DHCPv4ClientsList</b> ADM element is set to empty list.</p>
</li><li><p><span><span>  </span></span>The
<b>DHCPv4Scope.DHCPv4OptionValues</b> ADM element is set to empty list.</p>
</li></ul></li><li><p><span><span> 
</span></span>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>