3.2.4.107 R_DhcpV4QueryPolicyEnforcement (Opnum 106)

The R_DhcpV4QueryPolicyEnforcement method is used to retrieve the state (enabled/disabled) of policy enforcement on the server or the specified IPv4 subnet.

 DWORD R_DhcpV4QueryPolicyEnforcement(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] BOOL ServerPolicy,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [out] BOOL* Enabled
 );

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

ServerPolicy: This Boolean type indicates if the policy enforcement state of the server can be returned.

SubnetAddress: This is of type DHCP_IP_ADDRESS (section 2.2.1.2.1), which contains the IPv4 subnet ID for which the policy enforcement state can be returned. This parameter is ignored if ServerPolicy parameter is TRUE.

Enabled: This out parameter is a pointer to a Boolean type and indicates the state of policy enforcement. The memory for this must be allocated by the caller.

Return Values: A 32-bit unsigned integer value that indicates return status. A return value ERROR_SUCCESS (0x00000000) indicates operation was completed successfully. Otherwise, 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.

The opnum field value for this method is 106.

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

  • If ServerPolicy parameter is TRUE and the SubnetAddress parameter is not NULL or if the ServerPolicy parameter is FALSE and the SubnetAddress parameter is NULL, return ERROR_INVALID_PARAMETER.

  • Validate whether this method is authorized for read access as specified in section 3.5.4. If not, return ERROR_ACCESS_DENIED.

  • If ServerPolicy parameter is TRUE retrieve the server ADM element DHCPv4ServerPolicyEnforcement. Assign the value in the DHCPv4PolicyEnforcement ADM element to the out parameter Enabled. Return ERROR_SUCCESS.

  • If ServerPolicy parameter is FALSE, retrieve the server ADM element DHCPv4ScopesList. Retrieve the DHCPv4Scope ADM element entry corresponding to the SubnetAddress parameter from DHCPv4ScopesList ADM element. If the DHCPv4Scope ADM element entry is not present, return ERROR_DHCP_SUBNET_NOT_PRESENT.

  • Retrieve the DHCPv4Scope.DHCPv4ScopePolicyEnforcement ADM element for the retrieved DHCPv4Scope ADM element. Assign the value in DHCPv4ScopePolicyEnforcement ADM element to the out parameter Enabled

  • Return ERROR_SUCCESS.

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