TCPIP_DHCPS_LeaseRemove Function

C

TCPIP_DHCPS_RES TCPIP_DHCPS_LeaseRemove(TCPIP_NET_HANDLE netH, uint16_t leaseIx, bool keepAddBusy);

Description

Remove one entry from the DHCP server DB

This function is used to remove one entry from the DB of the selected interface

Precondition

The DHCP Server module should have been initialized.

Parameters

ParametersDescription
hNetselected interface handle
leaseIxlease index
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 selected entry was found and deleted from the selected interface

- < 0 - if wrong interface or DHCP server is not running on that interface, or wrong/unused index

- 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

The function will delete permanent leases too.

When a server lease is removed, a corresponding client (if exists) will still hold a valid lease. When the client eventually contacts the server to renew its lease the operation will fail as the server has no knwoledge of the client lease.