DhcpAddSubnetElementV4 function (dhcpsapi.h)
The DhcpAddSubnetElementV4 function adds an element describing a feature or aspect of the subnet to the subnet entry in the DHCP database. This function extends DhcpAddSubnetElement by incorporating subnet elements that consider client type.
Syntax
DWORD DHCP_API_FUNCTION DhcpAddSubnetElementV4(
[in] DHCP_CONST WCHAR *ServerIpAddress,
[in] DHCP_IP_ADDRESS SubnetAddress,
[in] DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V4 *AddElementInfo
);
Parameters
[in] ServerIpAddress
Pointer to a Unicode string that contains the IP address of the subnet DHCP server.
[in] SubnetAddress
DHCP_IP_ADDRESS structure that contains the IP address of the subnet.
[in] AddElementInfo
DHCP_SUBNET_ELEMENT_DATA_V4 structure that contains the element data to add to the subnet. The V4 structure adds support for differentiation between DHCP and BOOTP clients.
Return value
This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.
Return code | Description |
---|---|
|
An error occurred while accessing the DHCP server database. |
|
The specified IPv4 subnet does not exist. |
|
The specified option definition does not exist in the DHCP server database. |
|
The specified IPv4 address range either overlaps an existing range or is not valid. |
|
Conversion of a scope to a DHCPv4-only scope or to a BOOTP-only scope is not allowed when DHCPv4 and BOOTP clients are present in the scope to convert. Manually delete either the DHCPv4 or the BOOTP clients from the scope, as appropriate for the type of scope being created. |
|
The specified IPv4 address range already exists. |
|
The multicast scope range must allow for at least 256 IPv4 addresses. |
|
The specified DHCPv4 client is not an IPv4 reserverdclient. |
|
The specified IPv4 address or hardware address is in use by another DHCPv4 client. |
|
The specified address is not available. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | dhcpsapi.h |
Library | Dhcpsapi.lib |
DLL | Dhcpsapi.dll |