3.1.4.20 R_DhcpDeleteClientInfo (Opnum 19)

The R_DhcpDeleteClientInfo method deletes the specified DHCPv4 client lease record from the DHCPv4 server database. It also frees up the DHCPv4 client IPv4 address for redistribution.

 DWORD R_DhcpDeleteClientInfo(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, ref] LPDHCP_SEARCH_INFO ClientInfo
 );

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

ClientInfo: This is of type DHCP_SEARCH_INFO (section 2.2.1.2.18) structure, defining the key to be used to search the DHCPv4 client lease record that needs to be deleted on the DHCPv4 server. In case the SearchType member is DhcpClientName and there are multiple lease records with the same ClientName member, the server will delete the lease record for any of the clients with that client name.

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.

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database, or the client entry is not present in the database.

0x00004E33

ERROR_DHCP_RESERVED_CLIENT

The specified DHCP client is a reserved DHCP client.

The opnum field value for this method is 19.

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 the method is not authorized, return the error ERROR_ACCESS_DENIED.

  • Iterate through the server Abstract Data Model (ADM) element DHCPv4ClientsList of all the DHCPv4Scope ADM element entries in the server ADM element DHCPv4ScopesList, and retrieve the first DHCPv4Client ADM element entry corresponding to the ClientIpAddress member, ClientHardwareAddress member, or ClientName member as specified by the SearchType member in the SearchInfo parameter (section 2.2.1.2.18). If no such entry is found, return ERROR_DHCP_JET_ERROR.

  •  If there is any DHCPv4Reservation ADM element entry in the DHCPv4ReservationsList ADM element corresponding to the DHCPv4Client.ClientIpAddress ADM element, return the error ERROR_DHCP_RESERVED_CLIENT.

  • Delete the DNS resource records for the DHCPv4 client from the DNS server. If the DHCPv4 client lease address state specified in the DHCPv4Client.AddressState ADM element has ADDRESS_BIT_CLEANUP and ADDRESS_BIT_BOTH_REC (section 3.1.1.2) set to 1, then delete both A and PTR records from the DNS server by sending the message for DNS PTR and A resource record deletion, ([RFC1035] sections 3.3, 3.4 and 4.1, and [RFC2136] sections 2.5 and 3.4) with the data given in the table below. If the DHCPv4 client lease address state specified in the DHCPv4Client.AddressState ADM element has ADDRESS_BIT_CLEANUP set to 1 and ADDRESS_BIT_BOTH_REC (section 3.1.1.2) set to 0, then delete PTR record from the DNS server by sending the message for DNS PTR resource record deletion, ([RFC1035] sections 3.3 and 4.1, and [RFC2136] sections 2.5 and 3.4) with the data shown in the table below. The DNS update message is sent to the DNS server(s) configured as the DNS server option (option 6) value ([RFC2132] section 3.8) in the DHCPv4Scope.DHCPv4ScopeOptValuesList ADM element. If the DNS server option value is not found in the DHCPv4Scope.DHCPv4ScopeOptValuesList ADM element, then the message for creation of the DNS PTR record is sent to the DNS server(s) configured as DNS server option value in the DHCPv4ServerOptValueList ADM element. If the DNS server option value is not found in the DHCPv4ServerOptValueList ADM element, too, then the message for deletion of the DNS resource record is sent to the DNS server configured on the network interface of the DHCP server.

    The DNS message is sent to the DNS server by using the transport specified in [RFC1035] section 4.2.

    The resource record ([RFC1034] section 3.6) is populated with the following information for a DNS A delete message.

    DNS Fields

    Values

    NAME ([RFC1035] sections 3.3 and 4.1, and [RFC2136] section 2.5)

    If the SearchInfo parameter has the SearchType member as DhcpClientName, then the ClientName member of the SearchInfo parameter is used to populate this field. If the SearchInfo parameter has the SearchType member as DhcpClientIpAddress or DhcpClientHardwareAddress, then obtain the client name from the DHCPv4Client ADM element to populate this field.

    The resource record is populated with the following information for a DNS PTR delete message.

    DNS Fields

    Values

    NAME ([RFC1035] sections 3.3 and 4.1, and [RFC2136] section 2.5)

    The IP address in the ClientIpAddress member of the SearchInfo parameter, or the IP address corresponding to the ClientName member or ClientHardwareAddress member of the SearchInfo parameter.

  • Set the IPv4 address to be free for redistribution to other DHCPv4 clients by deleting the DHCPv4Client ADM element entry from the DHCPv4ClientsList ADM element and setting the bit corresponding to the IPv4 address in that the DHCPv4IpRange.Bitmask ADM element to 0 to indicate the availability of the address for allocation to DHCPv4 clients. Return ERROR_SUCCESS.

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