Jump to main content

##

# TCPIP_DHCPS_LeaseRemoveAll Function

## C

    TCPIP_DHCPS_RES TCPIP_DHCPS_LeaseRemoveAll(TCPIP_NET_HANDLE netH, bool keepPerm, bool keepAddBusy);

## Description

Remove all entries from the DHCP server DB

This function is used to remove all entries from the DB of the selected interface

## Precondition

The DHCP Server module should have been initialized.

## Parameters

Parameters | Description
--- | ---
hNet | selected interface handle
keepPerm | - if true, the permanent entries will not be deleted
| - otherwise the permanent entries will be deleted as well
keepAddBusy | - if true, the corresponding IP address (if the entry exists) will continue to be marked as busy
| and it won't be used for other client leases
| - otherwise, the IP address will be marked as available
| This should be the default

## Returns

- TCPIP_DHCPS_RES_OK - if the operation completed successfully

- < 0 - if wrong interface or DHCP server is not running on that interface

- TCPIP_DHCPS_RES_ACCESS_LOCKED - if access to the DHCP server DB is locked by another thread and the the call can be retried. Multi-threaded access is enabled (build symbol TCPIP_DHCPS_MULTI_THREADED_ACCESS != 0)

## Remarks

Function exists only when build symbol TCPIP_DHCPS_DYNAMIC_DB_ACCESS != 0

When the server leases are removed, the corresponding clients (if they exist) will still hold valid leases. When the clients eventually contact the server to renew their leases the operation will fail as the server has no more knwoledge of the client lease.