3.1.4.49 R_DhcpCreateSubnetVQ (Opnum 48)

The R_DhcpCreateSubnetVQ method is used to create the new IPv4 subnet along with its NAP state on the DHCPv4 server. This method is an extension of R_DhcpCreateSubnet (section 3.1.4.1).

 DWORD R_DhcpCreateSubnetVQ(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_INFO_VQ SubnetInfoVQ
 );

ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.

SubnetAddress: This is of type DHCP_IP_ADDRESS (section 2.2.1.2.1), containing the IPv4 address of the subnet.

SubnetInfoVQ: This is a pointer to a structure of type DHCP_SUBNET_INFO_VQ (section 2.2.1.2.45) that contains information about the IPv4 subnet, including the IPv4 subnet mask and the IPv4 address of the subnet. The structure DHCP_HOST_INFO (section 2.2.1.2.7) (referred by the PrimaryHost member) stored in the SubnetInfoVQ parameter MUST be ignored by both the caller and the server.

Return Values: 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 [MS-ERREF]. This error code value can correspond to a DHCP-specific failure, which takes a value between 20000 and 20099, or any generic failure.

Return value/code

Description

0x00000000

ERROR_SUCCESS

The call was successful.

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database.

0x00004E54

ERROR_DHCP_SUBNET_EXISTS

The IPv4 scope parameters are incorrect. Either the IPv4 scope already exists, corresponding to the SubnetAddress and SubnetMask 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 SubnetAddress and SubnetMask members of the new IPv4 scope and the subnet address and mask of an already existing IPv4 scope.

The opnum field value for this method is 48.

When processing this call, the DHCP server MUST do the following:

  • Validate if this method is authorized for read/write access per section 3.5.5. If not, return the error ERROR_ACCESS_DENIED.

  • If the SubnetAddress input parameter is 0, return ERROR_INVALID_PARAMETER.

  • If the SubnetInfoVQ input parameter is NULL, return ERROR_INVALID_PARAMETER.

  • If the SubnetAddress input parameter is not the same as the SubnetAddress member of the SubnetInfoVQ input parameter, return ERROR_INVALID_PARAMETER.

  • If the bitwise AND operation of the SubnetAddress input parameter with the SubnetMask member of the SubnetInfoVQ input parameter is not the same as the SubnetAddress input parameter, return ERROR_INVALID_PARAMETER.

  • Iterate through the server ADM element DHCPv4ScopesList and validate that the range of IPv4 addresses, that correspond to the SubnetAddress and SubnetMask members of the SubnetInfoVQ parameter, does not overlap the range of IPv4 addresses that correspond to the subnet address and mask of any DHCPv4Scope ADM element entry present in DHCPv4ScopesList ADM element. If an overlap is detected, return ERROR_DHCP_SUBNET_EXISTS.

  • Create a DHCPv4Scope ADM element object and insert it into the DHCPv4ScopesList ADM element. The DHCPv4Scope ADM element object is initialized as follows:

    • The DHCPv4Scope.ScopeInfo ADM element is initialized with the information contained in the SubnetInfoVQ parameter. The QuarantineOn member of the DHCPv4Scope.ScopeInfo ADM element is set to 0.

    • The DHCPv4Scope.DelayOffer ADM element is set to 0.

    • The DHCPv4Scope.SuperScopeId ADM element is set to 0.

    • The DHCPv4Scope.DHCPv4IpRangesList ADM element is set to empty list.

    • The DHCPv4Scope.DHCPv4ExclusionRangesList ADM element is set to empty list.

    • The DHCPv4Scope.DHCPv4ReservationsList ADM element is set to empty list.

    • The DHCPv4Scope.DHCPv4ClientsList ADM element is set to empty list.

    • The DHCPv4Scope.DHCPv4OptionValues ADM element is set to empty list.

  • Return ERROR_SUCCESS.

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].