TCPIP_DHCPS_LeaseRemoveById Function

C

TCPIP_DHCPS_RES TCPIP_DHCPS_LeaseRemoveById(TCPIP_NET_HANDLE netH, const uint8_t* clientId, size_t idLen, 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
clientIdthe client ID, usually a MAC address
idLenlength of the ID
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 client entry not found

- 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

The maximum size of the client ID should be TCPIP_DHCPS_CLIENT_ID_MAX_SIZE. Extra characters will be truncated. Usually the client ID is a MAC address. However some clients can use different, longer IDs.

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.