DhcpHlprIsV4PolicyValid function (dhcpsapi.h)

The DhcpHlprIsV4PolicyValid function verifies a DHCP server policy.

Syntax

DWORD DHCP_API_FUNCTION DhcpHlprIsV4PolicyValid(
  [in] LPDHCP_POLICY pPolicy
);

Parameters

[in] pPolicy

Pointer to DHCP_POLICY structure that contains the policy to verify.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, it returns one of the following or an error code from DHCP Server Management API Error Codes.

Value Meaning
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist.
ERROR_INVALID_PARAMETER
The parameter was invalid.
ERROR_DHCP_INVALID_POLICY_EXPRESSION
The specified conditions or expressions of the policy are invalid.
ERROR_DHCP_RANGE_INVALID_IN_SERVER_POLICY
A policy range has been specified for a server level policy.
ERROR_DHCP_POLICY_RANGE_BAD
The specified policy range is not contained within the IP address range of the scope or the specified policy range is invalid.

Remarks

The API performs the following validations on the policy structure.

  1. The policy must be well formed.
  2. Server policies must not have any ranges.
  3. Server policies must have the subnet address set to 0.0.0.0.
  4. Scope policies must have a subnet address.
  5. All associated ranges must be valid and non-overlapping.
  6. For all expressions, the parent expression index must be set to 0.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header dhcpsapi.h
Library Dhcpsapi.lib
DLL Dhcpsapi.dll

See also

DhcpHlprAddV4PolicyCondition

DhcpHlprAddV4PolicyExpr

DhcpHlprAddV4PolicyRange

DhcpHlprCreateV4Policy

DhcpHlprFreeV4Policy

DhcpHlprIsV4PolicySingleUC

DhcpHlprIsV4PolicyWellFormed

DhcpHlprModifyV4PolicyExpr

DhcpHlprResetV4PolicyExpr