Kea: isc::dhcp::LeaseMgr Class Reference

| Kea 3.2.0-git

isc::dhcp::LeaseMgr Class Referenceabstract

Abstract Lease Manager. More...

`#include <lease_mgr.h>`

Inheritance diagram for isc::dhcp::LeaseMgr:
[legend]

## Public Member Functions
| LeaseMgr ()
| Constructor.
virtual | ~LeaseMgr ()
| Destructor.
virtual bool | addLease (const Lease4Ptr &lease)=0
| Adds an IPv4 lease.
virtual bool | addLease (const Lease6Ptr &lease)=0
| Adds an IPv6 lease.
virtual size_t | byRelayId6size () const
| Return the by-relay-id table size.
virtual size_t | byRemoteId6size () const
| Return the by-remote-id table size.
virtual std::string | checkLimits4 (isc::data::ConstElementPtr const &user_context) const =0
| Checks if the IPv4 lease limits set in the given user context are exceeded.
virtual std::string | checkLimits6 (isc::data::ConstElementPtr const &user_context) const =0
| Checks if the IPv6 lease limits set in the given user context are exceeded.
virtual void | clearClassLeaseCounts ()=0
| Clears the class-lease count map.
virtual void | commit ()=0
| Commit Transactions.
virtual uint64_t | deleteExpiredReclaimedLeases4 (const uint32_t secs)=0
| Deletes all expired and reclaimed DHCPv4 leases.
virtual uint64_t | deleteExpiredReclaimedLeases6 (const uint32_t secs)=0
| Deletes all expired and reclaimed DHCPv6 leases.
virtual bool | deleteLease (const Lease4Ptr &lease)=0
| Deletes an IPv4 lease.
virtual bool | deleteLease (const Lease6Ptr &lease)=0
| Deletes an IPv6 lease.
virtual size_t | getClassLeaseCount (const ClientClass &client_class, const Lease::Type &ltype=Lease::TYPE_V4) const =0
| Returns the class lease count for a given class and lease type.
virtual std::string | getDescription () const =0
| Returns description of the backend.
virtual void | getExpiredLeases4 (Lease4Collection &expired_leases, const size_t max_leases) const =0
| Returns a collection of expired DHCPv4 leases.
virtual void | getExpiredLeases6 (Lease6Collection &expired_leases, const size_t max_leases) const =0
| Returns a collection of expired DHCPv6 leases.
bool | getExtendedInfoTablesEnabled () const
| Returns the setting indicating if lease6 extended info tables are enabled.
virtual Lease4Collection | getLease4 (const ClientId &clientid) const =0
| Returns existing IPv4 lease for specified client-id.
virtual Lease4Ptr | getLease4 (const ClientId &clientid, SubnetID subnet_id) const =0
| Returns existing IPv4 lease for specified client-id.
virtual Lease4Ptr | getLease4 (const isc::asiolink::IOAddress &addr) const =0
| Returns an IPv4 lease for specified IPv4 address.
virtual Lease4Collection | getLease4 (const isc::dhcp::HWAddr &hwaddr) const =0
| Returns existing IPv4 leases for specified hardware address.
virtual Lease4Ptr | getLease4 (const isc::dhcp::HWAddr &hwaddr, SubnetID subnet_id) const =0
| Returns existing IPv4 leases for specified hardware address and a subnet.
virtual Lease6Collection | getLease6 (const isc::dhcp::HWAddr &hwaddr) const =0
| Returns existing IPv6 leases for specified hardware address.
Lease6Ptr | getLease6 (Lease::Type type, const DUID &duid, uint32_t iaid, SubnetID subnet_id) const
| returns zero or one IPv6 lease for a given duid+iaid+subnet_id
virtual Lease6Ptr | getLease6 (Lease::Type type, const isc::asiolink::IOAddress &addr) const =0
| Returns existing IPv6 lease for a given IPv6 address.
virtual Lease4Collection | getLeases4 () const =0
| Returns all IPv4 leases.
virtual Lease4Collection | getLeases4 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const =0
| Returns range of IPv4 leases using paging.
virtual Lease4Collection | getLeases4 (const std::string &hostname) const =0
| Returns all IPv4 leases for the particular hostname.
virtual Lease4Collection | getLeases4 (SubnetID subnet_id) const =0
| Returns all IPv4 leases for the particular subnet identifier.
virtual Lease4Collection | getLeases4 (uint32_t state, SubnetID subnet_id) const =0
| Returns all IPv4 leases for the particular state and subnet.
virtual Lease4Collection | getLeases4ByRelayId (const OptionBuffer &relay_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size, const time_t &qry_start_time=0, const time_t &qry_end_time=0)=0
| Returns existing IPv4 leases with a given relay-id.
virtual Lease4Collection | getLeases4ByRemoteId (const OptionBuffer &remote_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size, const time_t &qry_start_time=0, const time_t &qry_end_time=0)=0
| Returns existing IPv4 leases with a given remote-id.
virtual Lease6Collection | getLeases6 () const =0
| Returns all IPv6 leases.
virtual Lease6Collection | getLeases6 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const =0
| Returns range of IPv6 leases using paging.
virtual Lease6Collection | getLeases6 (const DUID &duid) const =0
| Returns collection of leases for matching DUID.
virtual Lease6Collection | getLeases6 (const std::string &hostname) const =0
| Returns all IPv6 leases for the particular hostname.
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid) const =0
| Returns existing IPv6 leases for a given DUID+IA combination.
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid, SubnetID subnet_id) const =0
| Returns existing IPv6 lease for a given DUID+IA combination.
virtual Lease6Collection | getLeases6 (SubnetID subnet_id) const =0
| Returns all IPv6 leases for the particular subnet identifier.
virtual Lease6Collection | getLeases6 (SubnetID subnet_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const =0
| Returns a page of IPv6 leases for a subnet identifier.
virtual Lease6Collection | getLeases6 (uint32_t state, SubnetID subnet_id) const =0
| Returns all IPv6 leases for the particular state and subnet.
virtual Lease6Collection | getLeases6ByRelayId (const DUID &relay_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size)=0
| Returns existing IPv6 leases with a given relay-id.
virtual Lease6Collection | getLeases6ByRemoteId (const OptionBuffer &remote_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size)=0
| Returns existing IPv6 leases with a given remote-id.
virtual std::string | getName () const =0
| Returns backend name.
virtual data::ElementPtr | getStatus () const
| Return status information.
virtual std::string | getType () const =0
| Return backend type.
virtual VersionPair | getVersion (const std::string &timer_name=std::string()) const =0
| Returns backend version.
virtual isc::data::ConstElementPtr | lfcStartHandler ()
| Handler for kea-lfc-start command.
virtual void | recountClassLeases4 ()=0
| Recount the leases per class for V4 leases.
virtual void | recountClassLeases6 ()=0
| Recount the leases per class for V6 leases.
void | recountLeaseStats4 ()
| Recalculates per-subnet and global stats for IPv4 leases.
void | recountLeaseStats6 ()
| Recalculates per-subnet and global stats for IPv6 leases.
virtual void | rollback ()=0
| Rollback Transactions.
void | setExtendedInfoTablesEnabled (const bool enabled)
| Modifies the setting whether the lease6 extended info tables are enabled.
virtual bool | sflqCreateFlqPool4 (asiolink::IOAddress start_address, asiolink::IOAddress end_address, SubnetID subnet_id, bool recreate=false)
| Creates a v4 SFLQ Pool.
virtual bool | sflqCreateFlqPool6 (asiolink::IOAddress start_address, asiolink::IOAddress end_address, Lease::Type lease_type, uint8_t delegated_len, SubnetID subnet_id, bool recreate=false)
| Calls stored procedure to create an SFLQ pool for v6.
virtual asiolink::IOAddress | sflqPickFreeLease4 (asiolink::IOAddress start_address, asiolink::IOAddress end_address)
| Finds a free V4 address within the given pool range.
virtual asiolink::IOAddress | sflqPickFreeLease6 (asiolink::IOAddress start_address, asiolink::IOAddress end_address)
| Finds a free V6 address/prefix within the given pool range.
virtual bool | sflqPool4Del (asiolink::IOAddress start_address, asiolink::IOAddress end_address, bool force=false)
| Delete the SFLQ V4 pool that matches a start and end address.
virtual SflqPoolInfoCollectionPtr | sflqPool4Get (asiolink::IOAddress start_address, asiolink::IOAddress end_address)
| Fetch all SFLQ V4 pools that overlap an address range.
virtual SflqPoolInfoCollectionPtr | sflqPool4Get (SubnetID subnet_id)
| Fetch all SFLQ V4 pools belonging to a subnet.
virtual SflqPoolInfoCollectionPtr | sflqPool4GetAll ()
| Fetch all SFLQ V4 pools.
virtual bool | sflqPool6Del (asiolink::IOAddress start_address, asiolink::IOAddress end_address, bool force=false)
| Delete the SFLQ V6 pool that matches a start and end address.
virtual SflqPoolInfoCollectionPtr | sflqPool6Get (asiolink::IOAddress start_address, asiolink::IOAddress end_address)
| Fetch all SFLQ V6 pools that overlap an address range.
virtual SflqPoolInfoCollectionPtr | sflqPool6Get (SubnetID subnet_id)
| Fetch all SFLQ V6 pools belonging to a subnet.
virtual SflqPoolInfoCollectionPtr | sflqPool6GetAll ()
| Fetch all SFLQ V6 pools.
virtual LeaseStatsQueryPtr | startLeaseStatsQuery4 ()
| Creates and runs the IPv4 lease stats query for all subnets.
virtual LeaseStatsQueryPtr | startLeaseStatsQuery6 ()
| Creates and runs the IPv6 lease stats query for all subnets.
virtual LeaseStatsQueryPtr | startPoolLeaseStatsQuery4 ()
| Creates and runs the IPv4 lease stats query for all subnets and pools.
virtual LeaseStatsQueryPtr | startPoolLeaseStatsQuery6 ()
| Creates and runs the IPv6 lease stats query for all subnets and pools.
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery4 (const SubnetID &subnet_id)
| Creates and runs the IPv4 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery6 (const SubnetID &subnet_id)
| Creates and runs the IPv6 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery4 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
| Creates and runs the IPv4 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery6 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
| Creates and runs the IPv6 lease stats query for a single subnet.
virtual void | updateLease4 (const Lease4Ptr &lease4)=0
| Updates IPv4 lease.
virtual void | updateLease6 (const Lease6Ptr &lease6)=0
| Updates IPv6 lease.
virtual size_t | upgradeExtendedInfo4 (const LeasePageSize &page_size)=0
| Upgrade extended info (v4).
virtual size_t | upgradeExtendedInfo6 (const LeasePageSize &page_size)=0
| Upgrade extended info (v6).
virtual void | wipeExtendedInfoTables6 ()=0
| Wipe extended info table (v6).
virtual size_t | wipeLeases4 (const SubnetID &subnet_id)=0
| Virtual method which removes specified leases.
virtual size_t | wipeLeases6 (const SubnetID &subnet_id)=0
| Virtual method which removes specified leases.
virtual void | writeLeases4 (const std::string &filename)=0
| Write V4 leases to a file.
virtual void | writeLeases6 (const std::string &filename)=0
| Write V6 leases to a file.

## Static Public Member Functions
static void | bumpStat (const std::string &stat, SubnetID &subnet_id, PoolPtr pool, int value)
| Helper function that adds a value to an address stat's global, subnet, and pool level values.
static void | bumpStatPrefix (const std::string &stat, SubnetID &subnet_id, PoolPtr pool, int value)
| Helper function that adds a value to a prefix stat's global, subnet, and pool level values.
static void | extractLease4ExtendedInfo (const Lease4Ptr &lease, bool ignore_errors=true)
| Extract relay and remote identifiers from the extended info.
static std::string | getDBVersion ()
| Class method to return extended version info This class method must be redeclared and redefined in derived classes.
static void | updateStatsOnAdd (const Lease4Ptr &lease)
| Update in-memory stats when adding a v4 lease.
static void | updateStatsOnAdd (const Lease6Ptr &lease)
| Update in-memory stats when adding a V6 lease.
static void | updateStatsOnDelete (const Lease4Ptr &lease)
| Update in-memory stats when deleting a v4 lease.
static void | updateStatsOnDelete (const Lease6Ptr &lease)
| Update in-memory stats when deleting a v6 lease.
static void | updateStatsOnUpdate (const Lease4Ptr &existing, const Lease4Ptr &lease)
| Update in-memory stats when updating a v4 lease.
static void | updateStatsOnUpdate (const Lease6Ptr &existing, const Lease6Ptr &lease)
| Update in-memory stats when updating a v6 lease.
static bool | upgradeLease4ExtendedInfo (const Lease4Ptr &lease, CfgConsistency::ExtendedInfoSanity check=CfgConsistency::EXTENDED_INFO_CHECK_FIX)
| The following queries are used to fulfill Bulk Lease Query queries.
static bool | upgradeLease6ExtendedInfo (const Lease6Ptr &lease, CfgConsistency::ExtendedInfoSanity check=CfgConsistency::EXTENDED_INFO_CHECK_FIX)
| Upgrade a V6 lease user context to the new extended info entry.
static bool | useSharedFlqStatement (Lease4Ptr lease)
| Determine if SFLQ alternate SQL statements should be used for a given v4 lease.
static bool | useSharedFlqStatement (Lease6Ptr lease)
| Determine if SFLQ alternate SQL statements should be used for a given v6 lease.

## Protected Member Functions
virtual bool | addExtendedInfo6 (const Lease6Ptr &lease)
| Extract extended info from a lease6 and add it into tables.
virtual void | addRelayId6 (const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &relay_id)=0
| Add lease6 extended info into by-relay-id table.
virtual void | addRemoteId6 (const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &remote_id)=0
| Add lease6 extended info into by-remote-id table.
virtual void | deleteExtendedInfo6 (const isc::asiolink::IOAddress &addr)=0
| Delete lease6 extended info from tables.
void | setExtendedInfoTablesEnabled (const db::DatabaseConnection::ParameterMap &parameters)
| Extended information / Bulk Lease Query shared interface.

## Detailed Description

Abstract Lease Manager.

This is an abstract API for lease database backends. It provides unified interface to all backends. As this is an abstract class, it should not be used directly, but rather specialized derived class should be used instead.

This class throws no exceptions. However, methods in concrete implementations of this class may throw exceptions: see the documentation of those classes for details.

Definition at line 275 of file lease_mgr.h.

## Constructor & Destructor Documentation

## ◆ LeaseMgr()

isc::dhcp::LeaseMgr::LeaseMgr | ( |  | ) |
| inline

Constructor.

Definition at line 279 of file lease_mgr.h.

Referenced by isc::dhcp::TrackingLeaseMgr::TrackingLeaseMgr().

## ◆ ~LeaseMgr()

virtual isc::dhcp::LeaseMgr::~LeaseMgr | ( |  | ) |
| inlinevirtual

Destructor.

Definition at line 283 of file lease_mgr.h.

## Member Function Documentation

## ◆ addExtendedInfo6()

bool isc::dhcp::LeaseMgr::addExtendedInfo6 | ( | const Lease6Ptr & | lease | ) |
| protectedvirtual

Extract extended info from a lease6 and add it into tables.

Parameters

  lease | IPv6 lease to process.

Returns
  true if something was added, false otherwise.

Definition at line 1241 of file lease_mgr.cc.

References addRelayId6(), addRemoteId6(), isc::util::encode::decodeHex(), isc::data::Element::list, and isc::data::Element::map.

Referenced by isc::dhcp::Memfile_LeaseMgr::buildExtendedInfoTables6().

Here is the call graph for this function:

## ◆ addLease() [1/2]

virtual bool isc::dhcp::LeaseMgr::addLease | ( | const Lease4Ptr & | lease | ) |
| pure virtual

Adds an IPv4 lease.

The lease may be modified due to sanity checks setting (see LeaseSanityChecks in CfgConsistency) before being inserted. For performance reasons, the sanity checks do not make a copy, but rather modify lease in place if needed.

Parameters

  lease | lease to be added

Returns
  true if the lease was added, false if not (because a lease with the same address was already there or failed sanity checks)

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), and isc::dhcp::Dhcpv4Srv::serverDecline().

## ◆ addLease() [2/2]

virtual bool isc::dhcp::LeaseMgr::addLease | ( | const Lease6Ptr & | lease | ) |
| pure virtual

Adds an IPv6 lease.

The lease may be modified due to sanity checks setting (see LeaseSanityChecks in CfgConsistency) before being inserted. For performance reasons, the sanity checks do not make a copy, but rather modify lease in place if needed.

Parameters

  lease | lease to be added

Returns
  true if the lease was added, false if not (because a lease with the same address was already there or failed sanity checks)

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ addRelayId6()

virtual void isc::dhcp::LeaseMgr::addRelayId6 | ( | const isc::asiolink::IOAddress & | lease_addr,
|  | const std::vector< uint8_t > & | relay_id )
| protectedpure virtual

Add lease6 extended info into by-relay-id table.

Parameters

  lease_addr | The address of the lease.
  relay_id | The relay id from the relay header options.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by addExtendedInfo6().

## ◆ addRemoteId6()

virtual void isc::dhcp::LeaseMgr::addRemoteId6 | ( | const isc::asiolink::IOAddress & | lease_addr,
|  | const std::vector< uint8_t > & | remote_id )
| protectedpure virtual

Add lease6 extended info into by-remote-id table.

Parameters

  lease_addr | The address of the lease.
  remote_id | The remote id from the relay header options.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by addExtendedInfo6().

## ◆ bumpStat()

void isc::dhcp::LeaseMgr::bumpStat | ( | const std::string & | stat,
|  | SubnetID & | subnet_id,
|  | PoolPtr | pool,
|  | int | value )
| static

Helper function that adds a value to an address stat's global, subnet, and pool level values.

Parameters

  stat | base name of the statistic e.g. "assigned-addresses", "assigned-nas"
  subnet_id | id of desired subnet
  pool | pointer to the pool (if one) within the subnet, if empty pool level is skipped.
  value | signed value to add to the statistic

Definition at line 1417 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), and isc::stats::StatsMgr::instance().

Referenced by updateStatsOnUpdate(), and updateStatsOnUpdate().

Here is the call graph for this function:

## ◆ bumpStatPrefix()

void isc::dhcp::LeaseMgr::bumpStatPrefix | ( | const std::string & | stat,
|  | SubnetID & | subnet_id,
|  | PoolPtr | pool,
|  | int | value )
| static

Helper function that adds a value to a prefix stat's global, subnet, and pool level values.

Parameters

  stat | base name of the statistic e.g. "assigned-pds"
  subnet_id | id of desired subnet
  pool | pointer to the pool (if one) within the subnet, if empty pool level is skipped.
  value | signed value to add to the statistic

Definition at line 1429 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), and isc::stats::StatsMgr::instance().

Referenced by updateStatsOnUpdate().

Here is the call graph for this function:

## ◆ byRelayId6size()

size_t isc::dhcp::LeaseMgr::byRelayId6size | ( |  | ) | const
| virtual

Return the by-relay-id table size.

Must be derived by backends implementing the table.

Returns
  Always 0.

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 1302 of file lease_mgr.cc.

## ◆ byRemoteId6size()

size_t isc::dhcp::LeaseMgr::byRemoteId6size | ( |  | ) | const
| virtual

Return the by-remote-id table size.

Must be derived by backends implementing the table.

Returns
  Always 0.

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 1307 of file lease_mgr.cc.

## ◆ checkLimits4()

virtual std::string isc::dhcp::LeaseMgr::checkLimits4 | ( | isc::data::ConstElementPtr const & | user_context | ) | const
| pure virtual

Checks if the IPv4 lease limits set in the given user context are exceeded.

Abstract method.

Parameters

  user_context | all or part of the lease's user context which, for the intents and purposes of lease limiting should have the following format (not all nodes are mandatory and values are given only as examples): { "ISC": { "limits": { "client-classes": [ { "name": "foo", "address-limit": 2 } ], "subnet": { "id": 1, "address-limit": 2 } } } }

Returns
  a string describing a limit that is being exceeded, or an empty string if no limits are exceeded

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ checkLimits6()

virtual std::string isc::dhcp::LeaseMgr::checkLimits6 | ( | isc::data::ConstElementPtr const & | user_context | ) | const
| pure virtual

Checks if the IPv6 lease limits set in the given user context are exceeded.

Abstract method.

Parameters

  user_context | all or part of the lease's user context which, for the intents and purposes of lease limiting should have the following format (not all nodes are mandatory and values are given only as examples): { "ISC": { "limits": { "client-classes": [ { "name": "foo", "address-limit": 2, "prefix-limit": 1 } ], "subnet": { "id": 1, "address-limit": 2, "prefix-limit": 1 } } } }

Returns
  a string describing a limit that is being exceeded, or an empty string if no limits are exceeded

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ clearClassLeaseCounts()

virtual void isc::dhcp::LeaseMgr::clearClassLeaseCounts | ( |  | ) |
| pure virtual

Clears the class-lease count map.

Implemented in isc::dhcp::Memfile_LeaseMgr.

References isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_FIX.

Referenced by isc::limits::unload().

## ◆ commit()

virtual void isc::dhcp::LeaseMgr::commit | ( |  | ) |
| pure virtual

Commit Transactions.

Commits all pending database operations. On databases that don't support transactions, this is a no-op.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ deleteExpiredReclaimedLeases4()

virtual uint64_t isc::dhcp::LeaseMgr::deleteExpiredReclaimedLeases4 | ( | const uint32_t | secs | ) |
| pure virtual

Deletes all expired and reclaimed DHCPv4 leases.

Parameters

  secs | Number of seconds since expiration of leases before they can be removed. Leases which have expired later than this time will not be deleted.

Returns
  Number of leases deleted.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::AllocEngine::deleteExpiredReclaimedLeases4().

## ◆ deleteExpiredReclaimedLeases6()

virtual uint64_t isc::dhcp::LeaseMgr::deleteExpiredReclaimedLeases6 | ( | const uint32_t | secs | ) |
| pure virtual

Deletes all expired and reclaimed DHCPv6 leases.

Parameters

  secs | Number of seconds since expiration of leases before they can be removed. Leases which have expired later than this time will not be deleted.

Returns
  Number of leases deleted.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::AllocEngine::deleteExpiredReclaimedLeases6().

## ◆ deleteExtendedInfo6()

virtual void isc::dhcp::LeaseMgr::deleteExtendedInfo6 | ( | const isc::asiolink::IOAddress & | addr | ) |
| protectedpure virtual

Delete lease6 extended info from tables.

Parameters

  addr | The address of the lease.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ deleteLease() [1/2]

virtual bool isc::dhcp::LeaseMgr::deleteLease | ( | const Lease4Ptr & | lease | ) |
| pure virtual

Deletes an IPv4 lease.

Parameters

  lease | IPv4 lease to be deleted.

Returns
  true if deletion was successful, false if no such lease exists.

Exceptions

  isc::dhcp::DbOperationError | An operation on the open database has failed.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::Dhcpv4Srv::processRelease(), isc::dhcp::Dhcpv6Srv::releaseIA_NA(), and isc::dhcp::Dhcpv6Srv::releaseIA_PD().

## ◆ deleteLease() [2/2]

virtual bool isc::dhcp::LeaseMgr::deleteLease | ( | const Lease6Ptr & | lease | ) |
| pure virtual

Deletes an IPv6 lease.

Parameters

  lease | IPv6 lease to be deleted.

Returns
  true if deletion was successful, false if no such lease exists.

Exceptions

  isc::db::DbOperationError | An operation on the open database has failed.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ extractLease4ExtendedInfo()

void isc::dhcp::LeaseMgr::extractLease4ExtendedInfo | ( | const Lease4Ptr & | lease,
|  | bool | ignore_errors = true )
| static

Extract relay and remote identifiers from the extended info.

Parameters

  lease | Pointer to the lease to be updated.
  ignore_errors | When true (the default) ignore errors, when false throw an exception.

Definition at line 1155 of file lease_mgr.cc.

References isc::util::encode::decodeHex(), isc_throw, isc::data::Element::map, and isc::data::Element::string.

Referenced by isc::dhcp::Memfile_LeaseMgr::extractExtendedInfo4(), and isc::lease_cmds::Lease4Parser::parse().

Here is the call graph for this function:

## ◆ getClassLeaseCount()

virtual size_t isc::dhcp::LeaseMgr::getClassLeaseCount | ( | const ClientClass & | client_class,
|  | const Lease::Type & | ltype = Lease::TYPE_V4 ) const
| pure virtual

Returns the class lease count for a given class and lease type.

Parameters

  client_class | client class for which the count is desired
  ltype | type of lease for which the count is desired. Defaults to Lease::TYPE_V4.

Returns
  number of leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

References isc::dhcp::Lease::TYPE_V4.

## ◆ getDBVersion()

std::string isc::dhcp::LeaseMgr::getDBVersion | ( |  | ) |
| static

Class method to return extended version info This class method must be redeclared and redefined in derived classes.

Definition at line 563 of file lease_mgr.cc.

References isc_throw.

## ◆ getDescription()

virtual std::string isc::dhcp::LeaseMgr::getDescription | ( |  | ) | const
| pure virtual

Returns description of the backend.

This description may be multiline text that describes the backend.

Returns
  Description of the backend.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getExpiredLeases4()

virtual void isc::dhcp::LeaseMgr::getExpiredLeases4 | ( | Lease4Collection & | expired_leases,
|  | const size_t | max_leases ) const
| pure virtual

Returns a collection of expired DHCPv4 leases.

This method returns at most `max_leases` expired leases. The leases returned haven't been reclaimed, i.e. the database query must exclude reclaimed leases from the results returned.

Parameters

  [out] | expired_leases | A container to which expired leases returned by the database backend are added.
  | max_leases | A maximum number of leases to be returned. If this value is set to 0, all expired (but not reclaimed) leases are returned.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::AllocEngine::reclaimExpiredLeases4Internal().

## ◆ getExpiredLeases6()

virtual void isc::dhcp::LeaseMgr::getExpiredLeases6 | ( | Lease6Collection & | expired_leases,
|  | const size_t | max_leases ) const
| pure virtual

Returns a collection of expired DHCPv6 leases.

This method returns at most `max_leases` expired leases. The leases returned haven't been reclaimed, i.e. the database query must exclude reclaimed leases from the results returned.

Parameters

  [out] | expired_leases | A container to which expired leases returned by the database backend are added.
  | max_leases | A maximum number of leases to be returned. If this value is set to 0, all expired (but not reclaimed) leases are returned.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::AllocEngine::reclaimExpiredLeases6Internal().

## ◆ getExtendedInfoTablesEnabled()

bool isc::dhcp::LeaseMgr::getExtendedInfoTablesEnabled | ( |  | ) | const
| inline

Returns the setting indicating if lease6 extended info tables are enabled.

Returns
  true if lease6 extended info tables are enabled or false if they are disabled.

Definition at line 1064 of file lease_mgr.h.

Referenced by isc::dhcp::Memfile_LeaseMgr::buildExtendedInfoTables6().

## ◆ getLease4() [1/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLease4 | ( | const ClientId & | clientid | ) | const
| pure virtual

Returns existing IPv4 lease for specified client-id.

Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.

Parameters

  clientid | client identifier

Returns
  lease collection

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLease4() [2/5]

virtual Lease4Ptr isc::dhcp::LeaseMgr::getLease4 | ( | const ClientId & | clientid,
|  | SubnetID | subnet_id ) const
| pure virtual

Returns existing IPv4 lease for specified client-id.

There can be at most one lease for a given client-id in a single pool, so this method will either return a single lease or NULL.

Parameters

  clientid | client identifier
  subnet_id | identifier of the subnet that lease must belong to

Returns
  a pointer to the lease (or NULL if a lease is not found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLease4() [3/5]

virtual Lease4Ptr isc::dhcp::LeaseMgr::getLease4 | ( | const isc::asiolink::IOAddress & | addr | ) | const
| pure virtual

Returns an IPv4 lease for specified IPv4 address.

This method return a lease that is associated with a given address. For other query types (by hardware addr, by client-id) there can be several leases in different subnets (e.g. for mobile clients that got address in different subnets). However, for a single address there can be only one lease, so this method returns a pointer to a single lease, not a container of leases.

Parameters

  addr | address of the searched lease

Returns
  smart pointer to the lease (or NULL if a lease is not found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::lease_query::BulkLeaseQuery4::bulkQueryByClientId(), isc::lease_query::BulkLeaseQuery4::bulkQueryByHWAddr(), isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByClientIdHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHwAddressHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::dhcp::Dhcpv4Srv::processDecline(), isc::dhcp::Dhcpv4Srv::processRelease(), isc::lease_query::LeaseQueryImpl4::queryByIpAddress(), and isc::dhcp::Dhcpv4Srv::recoverStashedAgentOption().

## ◆ getLease4() [4/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLease4 | ( | const isc::dhcp::HWAddr & | hwaddr | ) | const
| pure virtual

Returns existing IPv4 leases for specified hardware address.

Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.

Parameters

  hwaddr | hardware address of the client

Returns
  lease collection

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLease4() [5/5]

virtual Lease4Ptr isc::dhcp::LeaseMgr::getLease4 | ( | const isc::dhcp::HWAddr & | hwaddr,
|  | SubnetID | subnet_id ) const
| pure virtual

Returns existing IPv4 leases for specified hardware address and a subnet.

There can be at most one lease for a given HW address in a single pool, so this method will either return a single lease or NULL.

Parameters

  hwaddr | hardware address of the client
  subnet_id | identifier of the subnet that lease must belong to

Returns
  a pointer to the lease (or NULL if a lease is not found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLease6() [1/3]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLease6 | ( | const isc::dhcp::HWAddr & | hwaddr | ) | const
| pure virtual

Returns existing IPv6 leases for specified hardware address.

Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.

Parameters

  hwaddr | hardware address of the client

Returns
  lease collection

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLease6() [2/3]

Lease6Ptr isc::dhcp::LeaseMgr::getLease6 | ( | Lease::Type | type,
|  | const DUID & | duid,
|  | uint32_t | iaid,
|  | SubnetID | subnet_id ) const

returns zero or one IPv6 lease for a given duid+iaid+subnet_id

This function is mostly intended to be used in unit-tests during the transition from single to multi address per IA. It may also be used in other cases where at most one lease is expected in the database.

It is a wrapper around getLeases6(), which returns a collection of leases. That collection can be converted into a single pointer if there are no leases (NULL pointer) or one lease (use that single lease). If there are more leases in the collection, the function will throw MultipleRecords exception.

Note: This method is not virtual on purpose. It is common for all backends.

Parameters

  type | specifies lease type: (NA, TA or PD)
  duid | client DUID
  iaid | IA identifier
  subnet_id | subnet id of the subnet the lease belongs to

Exceptions

  MultipleRecords | if there is more than one lease matching

Returns
  Lease pointer (or NULL if none is found)

Definition at line 61 of file lease_mgr.cc.

References getLeases6(), isc_throw, and isc::dhcp::IdentifierType< min_size, max_size >::toText().

Here is the call graph for this function:

## ◆ getLease6() [3/3]

virtual Lease6Ptr isc::dhcp::LeaseMgr::getLease6 | ( | Lease::Type | type,
|  | const isc::asiolink::IOAddress & | addr ) const
| pure virtual

Returns existing IPv6 lease for a given IPv6 address.

For a given address, we assume that there will be only one lease. The assumption here is that there will not be site or link-local addresses used, so there is no way of having address duplication.

Parameters

  type | specifies lease type: (NA, TA or PD)
  addr | address of the searched lease

Returns
  smart pointer to the lease (or NULL if a lease is not found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6(), isc::dhcp::Dhcpv6Srv::declineIA(), isc::lease_cmds::LeaseCmdsImpl::getIPv6LeaseForDelete(), isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHwAddressHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::dhcp::Dhcpv6Srv::processAddrRegInform(), isc::lease_query::LeaseQueryImpl6::queryByIpAddress(), isc::dhcp::Dhcpv6Srv::releaseIA_NA(), and isc::dhcp::Dhcpv6Srv::releaseIA_PD().

## ◆ getLeases4() [1/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4 | ( |  | ) | const
| pure virtual

Returns all IPv4 leases.

Returns
  Lease collection (may be empty if no IPv4 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases4() [2/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4 | ( | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size ) const
| pure virtual

Returns range of IPv4 leases using paging.

This method implements paged browsing of the lease database. The first parameter specifies a page size. The second parameter is optional and specifies the starting address of the range. This address is excluded from the returned range. The IPv4 zero address (default) denotes that the first page should be returned. There is no guarantee about the order of returned leases.

The typical usage of this method is as follows:

- Get the first page of leases by specifying IPv4 zero address as the beginning of the range.
- Last address of the returned range should be used as a starting address for the next page in the subsequent call.
- If the number of leases returned is lower than the page size, it indicates that the last page has been retrieved.
- If there are no leases returned it indicates that the previous page was the last page.

Parameters

  lower_bound_address | IPv4 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.

Returns
  Lease collection (may be empty if no IPv4 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases4() [3/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4 | ( | const std::string & | hostname | ) | const
| pure virtual

Returns all IPv4 leases for the particular hostname.

Parameters

  hostname | hostname in lower case.

Returns
  Lease collection (may be empty if no IPv4 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases4() [4/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4 | ( | SubnetID | subnet_id | ) | const
| pure virtual

Returns all IPv4 leases for the particular subnet identifier.

Parameters

  subnet_id | subnet identifier.

Returns
  Lease collection (may be empty if no IPv4 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByStateHandler(), and isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler().

## ◆ getLeases4() [5/5]

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4 | ( | uint32_t | state,
|  | SubnetID | subnet_id ) const
| pure virtual

Returns all IPv4 leases for the particular state and subnet.

Parameters

  state | the state e.g. 1 (declined).
  subnet_id | the subnet identifier (0 for all leases).

Returns
  Lease collection (may be empty if no IPv4 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases4ByRelayId()

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4ByRelayId | ( | const OptionBuffer & | relay_id,
|  | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size,
|  | const time_t & | qry_start_time = 0,
|  | const time_t & | qry_end_time = 0 )
| pure virtual

Returns existing IPv4 leases with a given relay-id.

Parameters

  relay_id | RAI Relay-ID sub-option value for relay_id of interest
  lower_bound_address | IPv4 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.
  qry_start_time | when not zero, only leases whose CLTT is greater than or equal to this value will be included
  qry_end_time | when not zero, only leases whose CLTT is less than or equal to this value will be included

Returns
  collection of IPv4 leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_query::BulkLeaseQuery4::bulkQueryByRelayId().

## ◆ getLeases4ByRemoteId()

virtual Lease4Collection isc::dhcp::LeaseMgr::getLeases4ByRemoteId | ( | const OptionBuffer & | remote_id,
|  | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size,
|  | const time_t & | qry_start_time = 0,
|  | const time_t & | qry_end_time = 0 )
| pure virtual

Returns existing IPv4 leases with a given remote-id.

Parameters

  remote_id | RAI Remote-ID sub-option value for remote-id of interest
  lower_bound_address | IPv4 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.
  qry_start_time | when not zero, only leases whose CLTT is greater than or equal to this value will be included. Defaults to zero.
  qry_end_time | when not zero, only leases whose CLTT is less than or equal to this value will be included. Defaults to zero.

Returns
  collection of IPv4 leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_query::BulkLeaseQuery4::bulkQueryByRemoteId().

## ◆ getLeases6() [1/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( |  | ) | const
| pure virtual

Returns all IPv6 leases.

Returns
  Lease collection (may be empty if no IPv6 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by getLease6().

## ◆ getLeases6() [2/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size ) const
| pure virtual

Returns range of IPv6 leases using paging.

This method implements paged browsing of the lease database. The first parameter specifies a page size. The second parameter is optional and specifies the starting address of the range. This address is excluded from the returned range. The IPv6 zero address (default) denotes that the first page should be returned. There is no guarantee about the order of returned leases.

The typical usage of this method is as follows:

- Get the first page of leases by specifying IPv6 zero address as the beginning of the range.
- Last address of the returned range should be used as a starting address for the next page in the subsequent call.
- If the number of leases returned is lower than the page size, it indicates that the last page has been retrieved.
- If there are no leases returned it indicates that the previous page was the last page.

Parameters

  lower_bound_address | IPv6 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.

Returns
  Lease collection (may be empty if no IPv6 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [3/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | const DUID & | duid | ) | const
| pure virtual

Returns collection of leases for matching DUID.

Returns
  Lease collection (may be empty if no IPv6 lease found for the DUID).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [4/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | const std::string & | hostname | ) | const
| pure virtual

Returns all IPv6 leases for the particular hostname.

Parameters

  hostname | hostname in lower case.

Returns
  Lease collection (may be empty if no IPv6 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [5/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | Lease::Type | type,
|  | const DUID & | duid,
|  | uint32_t | iaid ) const
| pure virtual

Returns existing IPv6 leases for a given DUID+IA combination.

Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.

Parameters

  type | specifies lease type: (NA, TA or PD)
  duid | client DUID
  iaid | IA identifier

Returns
  Lease collection (may be empty if no lease is found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByDuidHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByStateHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler(), isc::lease_query::LeaseQueryImpl6::queryByClientId(), isc::lease_query::LeaseQueryImpl6::queryByLinkNext(), isc::lease_query::LeaseQueryImpl6::queryByLinkStart(), and isc::dhcp::AllocEngine::renewLeases6().

## ◆ getLeases6() [6/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | Lease::Type | type,
|  | const DUID & | duid,
|  | uint32_t | iaid,
|  | SubnetID | subnet_id ) const
| pure virtual

Returns existing IPv6 lease for a given DUID+IA combination.

There may be more than one address, temp. address or prefix for specified duid/iaid/subnet-id tuple.

Parameters

  type | specifies lease type: (NA, TA or PD)
  duid | client DUID
  iaid | IA identifier
  subnet_id | subnet id of the subnet the lease belongs to

Returns
  Lease collection (may be empty if no lease is found)

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [7/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | SubnetID | subnet_id | ) | const
| pure virtual

Returns all IPv6 leases for the particular subnet identifier.

Parameters

  subnet_id | subnet identifier.

Returns
  Lease collection (may be empty if no IPv6 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [8/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | SubnetID | subnet_id,
|  | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size ) const
| pure virtual

Returns a page of IPv6 leases for a subnet identifier.

Parameters

  subnet_id | subnet identifier.
  lower_bound_address | IPv6 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.

Returns
  collection of IPv6 leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6() [9/9]

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6 | ( | uint32_t | state,
|  | SubnetID | subnet_id ) const
| pure virtual

Returns all IPv6 leases for the particular state and subnet.

Parameters

  state | the state e.g. 1 (declined).
  subnet_id | the subnet identifier (0 for all leases).

Returns
  Lease collection (may be empty if no IPv6 lease found).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getLeases6ByRelayId()

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6ByRelayId | ( | const DUID & | relay_id,
|  | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size )
| pure virtual

Returns existing IPv6 leases with a given relay-id.

Parameters

  relay_id | DUID for relay_id of interest.
  lower_bound_address | IPv6 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.

Returns
  collection of IPv6 leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_query::LeaseQueryImpl6::queryByRelayIdNext(), and isc::lease_query::LeaseQueryImpl6::queryByRelayIdStart().

## ◆ getLeases6ByRemoteId()

virtual Lease6Collection isc::dhcp::LeaseMgr::getLeases6ByRemoteId | ( | const OptionBuffer & | remote_id,
|  | const asiolink::IOAddress & | lower_bound_address,
|  | const LeasePageSize & | page_size )
| pure virtual

Returns existing IPv6 leases with a given remote-id.

Parameters

  remote_id | remote-id option data of interest.
  lower_bound_address | IPv6 address used as lower bound for the returned range.
  page_size | maximum size of the page returned.

Returns
  collection of IPv6 leases

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_query::LeaseQueryImpl6::queryByRemoteIdNext(), and isc::lease_query::LeaseQueryImpl6::queryByRemoteIdStart().

## ◆ getName()

virtual std::string isc::dhcp::LeaseMgr::getName | ( |  | ) | const
| pure virtual

Returns backend name.

If the backend is a database, this is the name of the database or the file. Otherwise it is just the same as the type.

Returns
  Name of the backend.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by lfcStartHandler().

## ◆ getStatus()

ElementPtr isc::dhcp::LeaseMgr::getStatus | ( |  | ) | const
| virtual

Return status information.

Can be derived by backends (currently memfile).

Returns
  Null or a map to add to status-get command output.

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 1312 of file lease_mgr.cc.

Referenced by isc::dhcp::ControlledDhcpv4Srv::commandStatusGetHandler(), and isc::dhcp::ControlledDhcpv6Srv::commandStatusGetHandler().

## ◆ getType()

virtual std::string isc::dhcp::LeaseMgr::getType | ( |  | ) | const
| pure virtual

Return backend type.

Returns the type of the backend (e.g. "mysql", "memfile" etc.)

Returns
  Type of the backend.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ getVersion()

virtual VersionPair isc::dhcp::LeaseMgr::getVersion | ( | const std::string & | timer_name = std::string() | ) | const
| pure virtual

Returns backend version.

Parameters

  timer_name | The DB reconnect timer name.

Returns
  Version number as a pair of unsigned integers. "first" is the major version number, "second" the minor number.

Todo
  : We will need to implement 3 version functions eventually: A. abstract API version B. backend version C. database version (stored in the database scheme)

and then check that: B>=A and B=C (it is ok to have newer backend, as it should be backward compatible) Also if B>C, some database upgrade procedure may be triggered

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ lfcStartHandler()

ConstElementPtr isc::dhcp::LeaseMgr::lfcStartHandler | ( |  | ) |
| virtual

Handler for kea-lfc-start command.

Derived by the memfile backend.

Returns
  By default an error saying the backend is not the memfile one.

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 1317 of file lease_mgr.cc.

References isc::config::CONTROL_RESULT_COMMAND_UNSUPPORTED, isc::config::createAnswer(), and getName().

Here is the call graph for this function:

## ◆ recountClassLeases4()

virtual void isc::dhcp::LeaseMgr::recountClassLeases4 | ( |  | ) |
| pure virtual

Recount the leases per class for V4 leases.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ recountClassLeases6()

virtual void isc::dhcp::LeaseMgr::recountClassLeases6 | ( |  | ) |
| pure virtual

Recount the leases per class for V6 leases.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ recountLeaseStats4()

void isc::dhcp::LeaseMgr::recountLeaseStats4 | ( |  | ) |

Recalculates per-subnet and global stats for IPv4 leases.

This method recalculates the following statistics: per-subnet:

- assigned-addresses
- declined-addresses global:
- assigned-addresses
- declined-addresses

It invokes the virtual method, startLeaseStatsQuery4(), which returns an instance of an LeaseStatsQuery. The query query contains a "result set" where each row is an LeaseStatRow that contains a subnet id, a lease type (currently always TYPE_NA), a lease state, and the number of leases of that type, in that state and is ordered by subnet id. The method iterates over the result set rows, setting the appropriate statistic per subnet and adding to the appropriate global statistic.

NULL means not backend does not support recounting.

NULL means not backend does not support recounting.

Definition at line 78 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::stats::StatsMgr::getObservation(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), isc::dhcp::LeaseStatsRow::lease_state_, isc::dhcp::LeaseStatsRow::pool_id_, isc::stats::StatsMgr::setValue(), startLeaseStatsQuery4(), startPoolLeaseStatsQuery4(), isc::dhcp::LeaseStatsRow::state_count_, isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, isc::dhcp::LeaseStatsRow::subnet_id_, and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::dhcp::CfgSubnets4::updateStatistics().

Here is the call graph for this function:

## ◆ recountLeaseStats6()

void isc::dhcp::LeaseMgr::recountLeaseStats6 | ( |  | ) |

Recalculates per-subnet and global stats for IPv6 leases.

This method recalculates the following statistics: per-subnet:

- assigned-nas
- declined-addresses
- assigned-pds
- registered global:
- assigned-nas
- declined-addresses
- assigned-pds
- registered

It invokes the virtual method, startLeaseStatsQuery6(), which returns an instance of an LeaseStatsQuery. The query contains a "result set" where each row is an LeaseStatRow that contains a subnet id, a lease type, a lease state, and the number of leases of that type, in that state and is ordered by subnet id. The method iterates over the result set rows, setting the appropriate statistic per subnet and adding to the appropriate global statistic.

NULL means not backend does not support recounting.

NULL means not backend does not support recounting.

Definition at line 297 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::stats::StatsMgr::getObservation(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), isc::dhcp::LeaseStatsRow::lease_state_, isc::dhcp::LeaseStatsRow::lease_type_, isc::dhcp::LeaseStatsRow::pool_id_, isc::stats::StatsMgr::setValue(), startLeaseStatsQuery6(), startPoolLeaseStatsQuery6(), isc::dhcp::LeaseStatsRow::state_count_, isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, isc::dhcp::Lease::STATE_REGISTERED, isc::dhcp::LeaseStatsRow::subnet_id_, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.

Referenced by isc::dhcp::CfgSubnets6::updateStatistics().

Here is the call graph for this function:

## ◆ rollback()

virtual void isc::dhcp::LeaseMgr::rollback | ( |  | ) |
| pure virtual

Rollback Transactions.

Rolls back all pending database operations. On databases that don't support transactions, this is a no-op.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ setExtendedInfoTablesEnabled() [1/2]

void isc::dhcp::LeaseMgr::setExtendedInfoTablesEnabled | ( | const bool | enabled | ) |
| inline

Modifies the setting whether the lease6 extended info tables are enabled.

Parameters

  enabled | new setting.

Definition at line 1072 of file lease_mgr.h.

Referenced by isc::dhcp::Memfile_LeaseMgr::Memfile_LeaseMgr(), and setExtendedInfoTablesEnabled().

## ◆ setExtendedInfoTablesEnabled() [2/2]

void isc::dhcp::LeaseMgr::setExtendedInfoTablesEnabled | ( | const db::DatabaseConnection::ParameterMap & | parameters | ) |
| protected

Extended information / Bulk Lease Query shared interface.

Decode parameters to set whether the lease extended info tables are enabled.

Note
  : common code in constructors.

Parameters

  parameters | The parameter map.

Definition at line 568 of file lease_mgr.cc.

References setExtendedInfoTablesEnabled().

Here is the call graph for this function:

## ◆ sflqCreateFlqPool4()

bool isc::dhcp::LeaseMgr::sflqCreateFlqPool4 | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address,
|  | SubnetID | subnet_id,
|  | bool | recreate = false )
| virtual

Creates a v4 SFLQ Pool.

Calls stored procedure to create a v4 SFLQ pool. If the pool already exists and recreate is false it simply returns. Otherwise it (re)creates and (re)populates the pool.

Parameters

  start_address | first address in the pool.
  end_address | last address in the pool.
  subnet_id | id of the subnet to which the pool belongs.
  recreate | when true, the pool is recreated if it already exits.

Returns
  True if the pool is (re)created, false it if already exists.

Definition at line 1991 of file lease_mgr.cc.

References isc_throw.

Referenced by isc::lease_cmds::SflqCmdsImpl::sflqPool4RebuildHandler().

## ◆ sflqCreateFlqPool6()

bool isc::dhcp::LeaseMgr::sflqCreateFlqPool6 | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address,
|  | Lease::Type | lease_type,
|  | uint8_t | delegated_len,
|  | SubnetID | subnet_id,
|  | bool | recreate = false )
| virtual

Calls stored procedure to create an SFLQ pool for v6.

Parameters

  start_address | first address/prefix in the pool.
  end_address | last address/prefix in the pool.
  lease_type | TYPE_NA or TYPE_PD.
  delegated_len | bit length of the address/prefix to be leases. For TYPE_NA this parameter should be 128.
  subnet_id | id of the subnet to which the pool belongs.
  recreate | when true, the pool is recreated if it already exits.

Returns
  True if the pool is (re)created, false it if already exists.

Definition at line 2001 of file lease_mgr.cc.

References isc_throw.

Referenced by isc::lease_cmds::SflqCmdsImpl::sflqPool6RebuildHandler().

## ◆ sflqPickFreeLease4()

IOAddress isc::dhcp::LeaseMgr::sflqPickFreeLease4 | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address )
| virtual

Finds a free V4 address within the given pool range.

Calls the sflqPickFreeLease4 stored procedure to find a free address within the SFLQ pool described by the given address range. If there are no free addresses in the pool or the pool does not exist it returns 0.0.0.0. Note the returned address must still be checked for HR conflicts.

Parameters

  start_address | first address in the pool.
  end_address | last address in the pool.

Returns
  A free V4 address or IOAddress::IPV4_ZERO_ADDRESS().

Definition at line 1996 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPickFreeLease6()

IOAddress isc::dhcp::LeaseMgr::sflqPickFreeLease6 | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address )
| virtual

Finds a free V6 address/prefix within the given pool range.

Calls the sflqPickFreeLease6 stored procedure to find a free address/prefix within the SFLQ pool described by the given address range. If there are none free in the pool or the pool does not exist it returns ::. Note the returned address/prefix must still be checked for HR conflicts.

Parameters

  start_address | first address in the pool.
  end_address | last address in the pool.

Returns
  A free V6 address/prefix or IOAddress::IPV6_ZERO_ADDRESS().

Definition at line 2006 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool4Del()

bool isc::dhcp::LeaseMgr::sflqPool4Del | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address,
|  | bool | force = false )
| virtual

Delete the SFLQ V4 pool that matches a start and end address.

Deletes the flq_pool4 entry along with its free_lease4 data. Fails If there are multiple pools that overlap the given range unless force is true.

Parameters

  start_address | start address of the pool to delete.
  end_address | end address of the pool to delete.
  force | overrides check for overlapping pools when true. Defaults to false.

Returns
  True a pool was deleted.

Exceptions

  InvalidOperation | if force is false and overlapping pools are detected.

Definition at line 2026 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool4Get() [1/2]

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool4Get | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address )
| virtual

Fetch all SFLQ V4 pools that overlap an address range.

Since overlapping pools are supported, this function returns all V4 SFLQ pools whose range overlaps the given range.

Parameters

  start_address | range start address
  end_address | range end address

Returns
  A collection of the SFLQ V4 pools.

Definition at line 2021 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool4Get() [2/2]

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool4Get | ( | SubnetID | subnet_id | ) |
| virtual

Fetch all SFLQ V4 pools belonging to a subnet.

Parameters

  subnet_id | id of the desired subnet.

Returns
  A collection of the SFLQ V4 pools.

Definition at line 2016 of file lease_mgr.cc.

References isc_throw.

Referenced by isc::lease_cmds::SflqCmdsImpl::sflqPool4RebuildHandler().

## ◆ sflqPool4GetAll()

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool4GetAll | ( |  | ) |
| virtual

Fetch all SFLQ V4 pools.

Returns
  A collection of the SFLQ V4 pools.

Definition at line 2011 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool6Del()

bool isc::dhcp::LeaseMgr::sflqPool6Del | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address,
|  | bool | force = false )
| virtual

Delete the SFLQ V6 pool that matches a start and end address.

Deletes the flq_pool6 entry along with its free_lease6 data. Fails If there are multiple pools that overlap the given range unless force is true.

Parameters

  start_address | start address of the pool to delete.
  end_address | end address of the pool to delete.
  force | overrides check for overlapping pools when true. Defaults to false.

Returns
  True a pool was deleted.

Exceptions

  InvalidOperation | if force is false and overlapping pools are detected.

Definition at line 2046 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool6Get() [1/2]

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool6Get | ( | asiolink::IOAddress | start_address,
|  | asiolink::IOAddress | end_address )
| virtual

Fetch all SFLQ V6 pools that overlap an address range.

Since overlapping pools are supported, this function returns all V6 SFLQ pools whose range overlaps the given range.

Parameters

  start_address | range start address
  end_address | range end address

Returns
  A collection of the SFLQ V6 pools.

Definition at line 2041 of file lease_mgr.cc.

References isc_throw.

## ◆ sflqPool6Get() [2/2]

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool6Get | ( | SubnetID | subnet_id | ) |
| virtual

Fetch all SFLQ V6 pools belonging to a subnet.

Parameters

  subnet_id | id of the desired subnet.

Returns
  A collection of the SFLQ V6 pools.

Definition at line 2036 of file lease_mgr.cc.

References isc_throw.

Referenced by isc::lease_cmds::SflqCmdsImpl::sflqPool6RebuildHandler().

## ◆ sflqPool6GetAll()

SflqPoolInfoCollectionPtr isc::dhcp::LeaseMgr::sflqPool6GetAll | ( |  | ) |
| virtual

Fetch all SFLQ V6 pools.

Returns
  A collection of the SFLQ V6 pools.

Definition at line 2031 of file lease_mgr.cc.

References isc_throw.

## ◆ startLeaseStatsQuery4()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startLeaseStatsQuery4 | ( |  | ) |
| virtual

Creates and runs the IPv4 lease stats query for all subnets.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for all subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 271 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4(), and recountLeaseStats4().

## ◆ startLeaseStatsQuery6()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startLeaseStatsQuery6 | ( |  | ) |
| virtual

Creates and runs the IPv6 lease stats query for all subnets.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for all subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 542 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6(), and recountLeaseStats6().

## ◆ startPoolLeaseStatsQuery4()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startPoolLeaseStatsQuery4 | ( |  | ) |
| virtual

Creates and runs the IPv4 lease stats query for all subnets and pools.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for all subnets and pools. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID and pool ID.

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 276 of file lease_mgr.cc.

Referenced by recountLeaseStats4().

## ◆ startPoolLeaseStatsQuery6()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startPoolLeaseStatsQuery6 | ( |  | ) |
| virtual

Creates and runs the IPv6 lease stats query for all subnets and pools.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for all subnets and pools. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID and pool ID.

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 547 of file lease_mgr.cc.

Referenced by recountLeaseStats6().

## ◆ startSubnetLeaseStatsQuery4()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startSubnetLeaseStatsQuery4 | ( | const SubnetID & | subnet_id | ) |
| virtual

Creates and runs the IPv4 lease stats query for a single subnet.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for a single subnet. Each row of the result set is an LeaseStatRow.

Parameters

  subnet_id | id of the subnet for which stats are desired

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 281 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4().

## ◆ startSubnetLeaseStatsQuery6()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startSubnetLeaseStatsQuery6 | ( | const SubnetID & | subnet_id | ) |
| virtual

Creates and runs the IPv6 lease stats query for a single subnet.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for a single subnet. Each row of the result set is an LeaseStatRow.

Parameters

  subnet_id | id of the subnet for which stats are desired

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 552 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6().

## ◆ startSubnetRangeLeaseStatsQuery4()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startSubnetRangeLeaseStatsQuery4 | ( | const SubnetID & | first_subnet_id,
|  | const SubnetID & | last_subnet_id )
| virtual

Creates and runs the IPv4 lease stats query for a single subnet.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for an inclusive range of subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.

Parameters

  first_subnet_id | first subnet in the range of subnets
  last_subnet_id | last subnet in the range of subnets

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 286 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4().

## ◆ startSubnetRangeLeaseStatsQuery6()

LeaseStatsQueryPtr isc::dhcp::LeaseMgr::startSubnetRangeLeaseStatsQuery6 | ( | const SubnetID & | first_subnet_id,
|  | const SubnetID & | last_subnet_id )
| virtual

Creates and runs the IPv6 lease stats query for a single subnet.

LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for an inclusive range of subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.

Parameters

  first_subnet_id | first subnet in the range of subnets
  last_subnet_id | last subnet in the range of subnets

Returns
  A populated LeaseStatsQuery

Reimplemented in isc::dhcp::Memfile_LeaseMgr.

Definition at line 557 of file lease_mgr.cc.

Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6().

## ◆ updateLease4()

virtual void isc::dhcp::LeaseMgr::updateLease4 | ( | const Lease4Ptr & | lease4 | ) |
| pure virtual

Updates IPv4 lease.

Parameters

  lease4 | The lease to be updated.

If no such lease is present, an exception will be thrown.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), isc::dhcp::Dhcpv4Srv::declineLease(), isc::lease_cmds::LeaseCmdsImpl::lease4Offer(), isc::lease_cmds::LeaseCmdsImpl::leases4Committed(), isc::dhcp::Dhcpv4Srv::postAllocateNameUpdate(), isc::dhcp::Dhcpv4Srv::processRelease(), and isc::dhcp::Dhcpv4Srv::serverDecline().

## ◆ updateLease6()

virtual void isc::dhcp::LeaseMgr::updateLease6 | ( | const Lease6Ptr & | lease6 | ) |
| pure virtual

Updates IPv6 lease.

Parameters

  lease6 | The lease to be updated.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6(), isc::dhcp::Dhcpv6Srv::checkPostAssignmentChanges(), isc::dhcp::Dhcpv6Srv::declineLease(), isc::lease_cmds::LeaseCmdsImpl::leases6Committed(), isc::dhcp::Dhcpv6Srv::processAddrRegInform(), isc::dhcp::Dhcpv6Srv::releaseIA_NA(), and isc::dhcp::Dhcpv6Srv::releaseIA_PD().

## ◆ updateStatsOnAdd() [1/2]

void isc::dhcp::LeaseMgr::updateStatsOnAdd | ( | const Lease4Ptr & | lease | ) |
| static

Update in-memory stats when adding a v4 lease.

Parameters

  lease | Added lease.

Definition at line 1324 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6(), and isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler().

Here is the call graph for this function:

## ◆ updateStatsOnAdd() [2/2]

void isc::dhcp::LeaseMgr::updateStatsOnAdd | ( | const Lease6Ptr & | lease | ) |
| static

Update in-memory stats when adding a V6 lease.

Parameters

  lease | Added lease.

Definition at line 1366 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), and isc::dhcp::Lease::TYPE_NA.

Here is the call graph for this function:

## ◆ updateStatsOnDelete() [1/2]

void isc::dhcp::LeaseMgr::updateStatsOnDelete | ( | const Lease4Ptr & | lease | ) |
| static

Update in-memory stats when deleting a v4 lease.

Parameters

  lease | Deleted lease.

Definition at line 1872 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), and isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler().

Here is the call graph for this function:

## ◆ updateStatsOnDelete() [2/2]

void isc::dhcp::LeaseMgr::updateStatsOnDelete | ( | const Lease6Ptr & | lease | ) |
| static

Update in-memory stats when deleting a v6 lease.

Parameters

  lease | Deleted lease.

Definition at line 1914 of file lease_mgr.cc.

References isc::stats::StatsMgr::addValue(), isc::stats::StatsMgr::generateName(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), and isc::dhcp::Lease::TYPE_NA.

Here is the call graph for this function:

## ◆ updateStatsOnUpdate() [1/2]

void isc::dhcp::LeaseMgr::updateStatsOnUpdate | ( | const Lease4Ptr & | existing,
|  | const Lease4Ptr & | lease )
| static

Update in-memory stats when updating a v4 lease.

Parameters

  existing | Lease data before update.
  lease | Lease data after update.

Definition at line 1504 of file lease_mgr.cc.

References isc::dhcp::ASSIGNED_ASSIGNED, isc::dhcp::ASSIGNED_DECLINED, isc::dhcp::ASSIGNED_RECLAIMED, isc::dhcp::ASSIGNED_RELEASED, bumpStat(), isc::dhcp::DECLINED_ASSIGNED, isc::dhcp::DECLINED_DECLINED, isc::dhcp::DECLINED_RECLAIMED, isc::dhcp::DECLINED_RELEASED, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::RECLAIMED_ASSIGNED, isc::dhcp::RECLAIMED_DECLINED, isc::dhcp::RELEASED_ASSIGNED, isc::dhcp::RELEASED_DECLINED, STATE_MASK, isc::dhcp::Lease::STATE_REGISTERED, and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), and isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6().

Here is the call graph for this function:

## ◆ updateStatsOnUpdate() [2/2]

void isc::dhcp::LeaseMgr::updateStatsOnUpdate | ( | const Lease6Ptr & | existing,
|  | const Lease6Ptr & | lease )
| static

Update in-memory stats when updating a v6 lease.

Parameters

  existing | Lease data before update.
  lease | Lease data after update.

Definition at line 1639 of file lease_mgr.cc.

References isc::dhcp::ASSIGNED_ASSIGNED, isc::dhcp::ASSIGNED_DECLINED, isc::dhcp::ASSIGNED_RECLAIMED, isc::dhcp::ASSIGNED_REGISTERED, isc::dhcp::ASSIGNED_RELEASED, bumpStat(), bumpStatPrefix(), isc::dhcp::DECLINED_ASSIGNED, isc::dhcp::DECLINED_DECLINED, isc::dhcp::DECLINED_RECLAIMED, isc::dhcp::DECLINED_REGISTERED, isc::dhcp::DECLINED_RELEASED, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::RECLAIMED_ASSIGNED, isc::dhcp::RECLAIMED_DECLINED, isc::dhcp::RECLAIMED_REGISTERED, isc::dhcp::REGISTERED_ASSIGNED, isc::dhcp::REGISTERED_DECLINED, isc::dhcp::REGISTERED_RECLAIMED, isc::dhcp::REGISTERED_REGISTERED, isc::dhcp::REGISTERED_RELEASED, isc::dhcp::RELEASED_ASSIGNED, isc::dhcp::RELEASED_DECLINED, isc::dhcp::RELEASED_REGISTERED, isc::dhcp::Lease::STATE_DECLINED, STATE_MASK, isc::dhcp::Lease::STATE_REGISTERED, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.

Here is the call graph for this function:

## ◆ upgradeExtendedInfo4()

virtual size_t isc::dhcp::LeaseMgr::upgradeExtendedInfo4 | ( | const LeasePageSize & | page_size | ) |
| pure virtual

Upgrade extended info (v4).

On SQL backends for all leases with a not null user context.

- sanitize the user context
- update relay and remote ids
- when the lease was modified update it in the database On memfile backend a similar action is done when the database is loaded from the file. This function implements the new BLQ hook command named "extended-info4-upgrade".

Parameters

  page_size | The page size used for retrieval.

Returns
  The number of updates in the database.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ upgradeExtendedInfo6()

virtual size_t isc::dhcp::LeaseMgr::upgradeExtendedInfo6 | ( | const LeasePageSize & | page_size | ) |
| pure virtual

Upgrade extended info (v6).

On SQL backends for all leases with a not null user context.

- sanitize the user context
- update relay and remote id tables
- when the lease was modified update it in the database On memfile backend a similar action is done when the database is loaded from the file. This function implements the new BLQ hook command named "extended-info6-upgrade".

Parameters

  page_size | The page size used for retrieval.

Returns
  The number of updates in the database.

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ upgradeLease4ExtendedInfo()

bool isc::dhcp::LeaseMgr::upgradeLease4ExtendedInfo | ( | const Lease4Ptr & | lease,
|  | CfgConsistency::ExtendedInfoSanity | check = CfgConsistency::EXTENDED_INFO_CHECK_FIX )
| static

The following queries are used to fulfill Bulk Lease Query queries.

They rely on relay data contained in lease's user-context when the extended-store-info flag is enabled.

Upgrade a V4 lease user context to the new extended info entry.

In details:

- perform sanity checks according to check level.
- change the "ISC" / "relay-agent-info" to a map.
- move the "relay-agent-info" string to the "sub-options" entry of the map.
- decode remote-id and relay-id from the RAI option content and add the raw value in hexadecimal in "remote-id" and/or "relay-id" entries of the map.

Parameters

  lease | Pointer to the lease to be updated.
  check | Sanity/consistency check level.

Returns
  True if the lease user context was updated, false otherwise.

Definition at line 582 of file lease_mgr.cc.

References isc::data::copy(), isc::data::Element::create(), isc::data::Element::createMap(), isc::util::str::decodeFormattedHexString(), isc::util::encode::decodeHex(), isc::dhcp::DHCPSRV_DBG_TRACE, isc::dhcp::DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL, isc::dhcp::DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED, isc::dhcp::dhcpsrv_logger, isc::dhcp::LibDHCP::DHO_DHCP_AGENT_OPTIONS_DEF(), isc::util::encode::encodeHex(), isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_FIX, isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_NONE, isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC, isc_throw, LOG_DEBUG, LOG_ERROR, isc::data::Element::map, isc::dhcp::RAI_OPTION_RELAY_ID, isc::dhcp::RAI_OPTION_REMOTE_ID, isc::data::Element::string, and isc::dhcp::Option::V4.

Referenced by isc::dhcp::Memfile_LeaseMgr::extractExtendedInfo4(), and isc::lease_cmds::Lease4Parser::parse().

Here is the call graph for this function:

## ◆ upgradeLease6ExtendedInfo()

bool isc::dhcp::LeaseMgr::upgradeLease6ExtendedInfo | ( | const Lease6Ptr & | lease,
|  | CfgConsistency::ExtendedInfoSanity | check = CfgConsistency::EXTENDED_INFO_CHECK_FIX )
| static

Upgrade a V6 lease user context to the new extended info entry.

In details:

- perform sanity checks according to check level.
- change the "ISC" / "relays" list entry to "relay-info".
- decode remote-id and relay-id from each relay options and add the raw value in hexadecimal in "remote-id" and/or "relay-id" in the relay item of the list.

Parameters

  lease | Pointer to the lease to be updated.
  check | Sanity/consistency check level.

Returns
  True if the lease user context was updated, false otherwise.

Definition at line 803 of file lease_mgr.cc.

References isc::data::copy(), isc::data::Element::create(), D6O_RELAY_ID, D6O_REMOTE_ID, isc::util::str::decodeFormattedHexString(), isc::util::encode::decodeHex(), DHCP6_OPTION_SPACE, isc::dhcp::DHCPSRV_DBG_TRACE, isc::dhcp::DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL, isc::dhcp::DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED, isc::dhcp::dhcpsrv_logger, isc::util::encode::encodeHex(), isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_FIX, isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_NONE, isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC, isc::data::Element::integer, isc_throw, isc::asiolink::IOAddress::isV6(), isc::data::Element::list, LOG_DEBUG, LOG_ERROR, isc::data::Element::map, isc::data::Element::string, and isc::dhcp::LibDHCP::unpackOptions6().

Referenced by isc::dhcp::Memfile_LeaseMgr::buildExtendedInfoTables6(), and isc::lease_cmds::Lease6Parser::parse().

Here is the call graph for this function:

## ◆ useSharedFlqStatement() [1/2]

bool isc::dhcp::LeaseMgr::useSharedFlqStatement | ( | Lease4Ptr | lease | ) |
| static

Determine if SFLQ alternate SQL statements should be used for a given v4 lease.

Parameters

  lease | v4 lease to test

Returns
  true if SFLQ is in use in this config and the lease's subnet uses SFLQ allocation

Definition at line 2051 of file lease_mgr.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::SharedFlqAllocator::inUse(), and isc::dhcp::Lease::TYPE_V4.

Here is the call graph for this function:

## ◆ useSharedFlqStatement() [2/2]

bool isc::dhcp::LeaseMgr::useSharedFlqStatement | ( | Lease6Ptr | lease | ) |
| static

Determine if SFLQ alternate SQL statements should be used for a given v6 lease.

Parameters

  lease | v6 lease to test

Returns
  true if SFLQ is in use in this config and the lease's subnet uses SFLQ allocation for the lease's lease type.

Definition at line 2067 of file lease_mgr.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and isc::dhcp::SharedFlqAllocator::inUse().

Here is the call graph for this function:

## ◆ wipeExtendedInfoTables6()

virtual void isc::dhcp::LeaseMgr::wipeExtendedInfoTables6 | ( |  | ) |
| pure virtual

Wipe extended info table (v6).

Implemented in isc::dhcp::Memfile_LeaseMgr.

## ◆ wipeLeases4()

virtual size_t isc::dhcp::LeaseMgr::wipeLeases4 | ( | const SubnetID & | subnet_id | ) |
| pure virtual

Virtual method which removes specified leases.

This rather dangerous method is able to remove all leases from specified subnet.

Parameters

  subnet_id | identifier of the subnet (or 0 for all subnets)

Returns
  number of leases removed.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler().

## ◆ wipeLeases6()

virtual size_t isc::dhcp::LeaseMgr::wipeLeases6 | ( | const SubnetID & | subnet_id | ) |
| pure virtual

Virtual method which removes specified leases.

This rather dangerous method is able to remove all leases from specified subnet.

Parameters

  subnet_id | identifier of the subnet (or 0 for all subnets)

Returns
  number of leases removed.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler().

## ◆ writeLeases4()

virtual void isc::dhcp::LeaseMgr::writeLeases4 | ( | const std::string & | filename | ) |
| pure virtual

Write V4 leases to a file.

Parameters

  filename | File name to write leases.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::leaseWriteHandler().

## ◆ writeLeases6()

virtual void isc::dhcp::LeaseMgr::writeLeases6 | ( | const std::string & | filename | ) |
| pure virtual

Write V6 leases to a file.

Parameters

  filename | File name to write leases.

Implemented in isc::dhcp::Memfile_LeaseMgr.

Referenced by isc::lease_cmds::LeaseCmdsImpl::leaseWriteHandler().

The documentation for this class was generated from the following files:

- lease_mgr.h
- lease_mgr.cc