Jump to main content

##

# TCPIP_DHCPS_LeaseAddById Function

## C

    TCPIP_DHCPS_RES TCPIP_DHCPS_LeaseAddById(TCPIP_NET_HANDLE netH, const TCPIP_DHCPS_LEASE_SET* pLeaseSet);

## Description

Add a lease to the DHCP server DB

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

## Precondition

The DHCP Server module should have been initialized.

## Parameters

Parameters | Description
--- | ---
hNet | selected interface handle
pLeaseSet | the lease data to be set

## Returns

- TCPIP_DHCPS_RES_OK - if the selected lease was found and updated

- < 0 - if wrong interface or DHCP server is not running on that interface, or lease could not be added

- 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.

Function exists only when build symbol TCPIP_DHCPS_DYNAMIC_DB_ACCESS != 0

An existing lease will be overwritten by this call. If the lease does not exist, it will be added.