3.2.4.108 R_DhcpV4SetPolicyEnforcement (Opnum 107)

The R_DhcpV4SetPolicyEnforcement method is used to set the state (enable/disable) of policy enforcement of the server or the specified IPv4 subnet.

 DWORD R_DhcpV4SetPolicyEnforcement(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] BOOL ServerPolicy,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in] BOOL Enable
 );

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 set.

SubnetAddress: This is of type DHCP_IP_ADDRESS structure (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 the ServerPolicy parameter is TRUE.

Enable: This Boolean type parameter specifies the value to set for policy enforcement.

Return Values: A 32-bit unsigned integer value that indicates return status. A return value of 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 107.

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

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

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

  • If ServerPolicy parameter is TRUE, set the server ADM element DHCPv4ServerPolicyEnforcement with the value passed in the Enable parameter and 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 the server ADM element DHCPv4ScopesList. If the DHCPv4Scope ADM element entry is not present, return ERROR_DHCP_SUBNET_NOT_PRESENT.

  • Set the DHCPv4Scope.DHCPv4ScopePolicyEnforcement ADM element for the retrieved DHCPv4Scope ADM element with the value passed in the Enable parameter.

  • Return ERROR_SUCCESS.

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