3.1.4.2 R_DhcpSetSubnetInfo (Opnum 1)

The R_DhcpSetSubnetInfo method sets/modifies the information about an IPv4 subnet defined on the DHCPv4 server.

 DWORD R_DhcpSetSubnetInfo(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_INFO SubnetInfo
 );

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

SubnetAddress: This is of type DHCP_IP_ADDRESS, a DWORD structure containing the IPv4 subnet ID for which the subnet information is modified.

SubnetInfo: This is a pointer to a DHCP_SUBNET_INFO (section 2.2.1.2.8) structure that contains the information of the IPv4 subnet that is modified in the existing IPv4 subnet identified by SubnetAddress. The DHCP_HOST_INFO (section 2.2.1.2.7) structure (referred by PrimaryHost) stored in SubnetInfo MUST be ignored by both the caller and the server.

This method does not perform any checks to ensure that the SubnetState field in SubnetInfo is as specified in DHCP_SUBNET_STATE (section 2.2.1.1.2). It is the caller's responsibility to ensure that a valid SubnetState value is passed to this method in SubnetInfo. If SubnetState does not contain a valid value, as specified in DHCP_SUBNET_STATE), the behavior is undefined.

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

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database.

0x00004E25

ERROR_DHCP_SUBNET_NOT_PRESENT

The specified IPv4 subnet does not exist.

The opnum field value for this method is 1.

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

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

  • If the SubnetInfo input parameter is NULL, return ERROR_INVALID_PARAMETER.

  • If the SubnetAddress input field is not the same as the SubnetAddress member of the SubnetInfo input field, return ERROR_INVALID_PARAMETER.

  • If the bitwise AND operation of the SubnetAddress input field with the SubnetMask member of the SubnetInfo input field is not the same as SubnetAddress input field, return ERROR_INVALID_PARAMETER.

  • Retrieve the server ADM element DHCPv4Scope entry corresponding to the SubnetAddress from the DHCPv4ScopesList server ADM element.

  • If the DHCPv4Scope entry corresponding to SubnetAddress is not found, return ERROR_DHCP_SUBNET_NOT_PRESENT.

  • Modify the DHCPv4Scope.ScopeInfo ADM element with information in SubnetInfo.

  • Return ERROR_SUCCESS.

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