3.1.4.3 R_DhcpGetSubnetInfo (Opnum 2)

The R_DhcpGetSubnetInfo method retrieves the information about a specific IPv4 subnet defined on the DHCPv4 server. The caller of this function is responsible for freeing the memory pointed to by SubnetInfo by calling the function midl_user_free (section 3).

 DWORD R_DhcpGetSubnetInfo(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [out] 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 information is retrieved.

SubnetInfo: This is a pointer of type LPDHCP_SUBNET_INFO in which the information for the subnet matching the ID specified by SubnetAddress is retrieved.

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

0x00004E25

ERROR_DHCP_SUBNET_NOT_PRESENT

The specified IPv4 subnet does not exist.

The opnum field value for this method is 2.

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

  • Validate whether this method is authorized for read access per section 3.5.4. If not, return the error ERROR_ACCESS_DENIED.

  • If the SubnetInfo parameter is NULL, return ERROR_INVALID_PARAMETER.

  • Retrieve the server ADM element DHCPv4Scope entry whose subnet ID is equal to the SubnetAddress parameter from the DHCPv4ScopesList server ADM element. For the DHCP_HOST_INFO structure, the IpAddress field is populated as "127.0.0.1" and the other fields are empty.

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

  • Copy the information in DHCPv4Scope.ScopeInfo ADM element into the SubnetInfo structure, and return it to the caller.

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