The R_DhcpAddSubnetElementV4 method adds an IPv4 subnet element (IPv4 reservation for DHCPv4 or BOOTP clients, IPv4 exclusion range, or IPv4 range) to the IPv4 subnet in the DHCPv4 server. There is an extension of this method in R_DhcpAddSubnetElementV5 (section 3.2.4.38).

 DWORD R_DhcpAddSubnetElementV4(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_ELEMENT_DATA_V4 AddElementInfo
 );

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

SubnetAddress: This is of type DHCP_IP_ADDRESS, containing the IPv4 subnet ID in which the IPv4 subnet element is added.

AddElementInfo: This is a pointer to a DHCP_SUBNET_ELEMENT_DATA_V4 (section 2.2.1.2.35) structure that contains the IPv4 subnet element that needs to be added to the IPv4 subnet.

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.

0x00004E25

ERROR_DHCP_SUBNET_NOT_PRESENT

The specified IPv4 subnet does not exist on the DHCP server.

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database.

0x00004E32

ERROR_DHCP_NOT_RESERVED_CLIENT

The specified DHCP client is not a reserved client.

0x00004E35

ERROR_DHCP_IPRANGE_EXITS

The specified IPv4 address range already exists.

0x00004E36

ERROR_DHCP_RESERVEDIP_EXITS

The specified IPv4 address or hardware address is being used by another DHCP client.

0x00004E37

ERROR_DHCP_INVALID_RANGE

The specified IPv4 range either overlaps an existing range or is not valid.

0x00004E51

ERROR_DHCP_IPRANGE_CONV_ILLEGAL

Conversion of a BOOTP scope to a DHCP-only scope is illegal, since BOOTP clients exist in the scope. Manually delete BOOTP clients from the scope when converting the range to a DHCP-only range.

0x00004E90

ERROR_SCOPE_RANGE_POLICY_RANGE_CONFLICT

An IP address range is configured for a policy in this scope. This operation cannot be performed on the scope IP address range until the policy IP address range is suitably modified.

0x00004EA1

ERROR_DHCP_FO_IPRANGE_TYPE_CONV_ILLEGAL

Conversion of a failover scope to a BOOTP-only or BOTH scope cannot be performed. Failover is supported only for DHCP scopes.

The opnum field value for this method is 29.

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

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