Kea 2.7.5
|
Abstract Lease Manager. More...
#include <lease_mgr.h>
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 <ype=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. | |
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 | 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 | 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 std::string | getType () const =0 |
Return backend type. | |
virtual VersionPair | getVersion (const std::string &timer_name=std::string()) const =0 |
Returns backend version. | |
virtual bool | isJsonSupported () const =0 |
Checks if JSON support is enabled in the database. | |
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 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 | 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 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. | |
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 ¶meters) |
Extended information / Bulk Lease Query shared interface. | |
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 248 of file lease_mgr.h.
|
inline |
Constructor.
Definition at line 252 of file lease_mgr.h.
|
inlinevirtual |
Destructor.
Definition at line 256 of file lease_mgr.h.
|
protectedvirtual |
Extract extended info from a lease6 and add it into tables.
lease | IPv6 lease to process. |
Definition at line 1194 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().
|
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.
lease | lease to be added |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
lease | lease to be added |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
protectedpure virtual |
Add lease6 extended info into by-relay-id table.
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().
|
protectedpure virtual |
Add lease6 extended info into by-remote-id table.
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().
|
virtual |
Return the by-relay-id table size.
Must be derived by backends implementing the table.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 1255 of file lease_mgr.cc.
|
virtual |
Return the by-remote-id table size.
Must be derived by backends implementing the table.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 1260 of file lease_mgr.cc.
|
pure virtual |
Checks if the IPv4 lease limits set in the given user context are exceeded.
Abstract method.
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 } } } } |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Checks if the IPv6 lease limits set in the given user context are exceeded.
Abstract method.
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 } } } } |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Clears the class-lease count map.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
|
pure virtual |
Deletes all expired and reclaimed DHCPv4 leases.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Deletes all expired and reclaimed DHCPv6 leases.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
protectedpure virtual |
Delete lease6 extended info from tables.
addr | The address of the lease. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Deletes an IPv4 lease.
lease | IPv4 lease to be deleted. |
isc::dhcp::DbOperationError | An operation on the open database has failed. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Deletes an IPv6 lease.
lease | IPv6 lease to be deleted. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
static |
Extract relay and remote identifiers from the extended info.
lease | Pointer to the lease to be updated. |
ignore_errors | When true (the default) ignore errors, when false throw an exception. |
Definition at line 1108 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().
|
pure virtual |
Returns the class lease count for a given class and lease type.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
static |
Class method to return extended version info This class method must be redeclared and redefined in derived classes.
Definition at line 516 of file lease_mgr.cc.
References isc_throw.
|
pure virtual |
Returns description of the backend.
This description may be multiline text that describes the backend.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
[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.
|
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.
[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.
|
inline |
Returns the setting indicating if lease6 extended info tables are enabled.
Definition at line 1010 of file lease_mgr.h.
Referenced by isc::dhcp::Memfile_LeaseMgr::buildExtendedInfoTables6().
|
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.
clientid | client identifier |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
clientid | client identifier |
subnet_id | identifier of the subnet that lease must belong to |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
addr | address of the searched lease |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
hwaddr | hardware address of the client |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
hwaddr | hardware address of the client |
subnet_id | identifier of the subnet that lease must belong to |
Implemented in isc::dhcp::Memfile_LeaseMgr.
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.
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 |
MultipleRecords | if there is more than one lease matching |
Definition at line 55 of file lease_mgr.cc.
References getLeases6(), isc_throw, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
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.
type | specifies lease type: (NA, TA or PD) |
addr | address of the searched lease |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv4 leases.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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:
lower_bound_address | IPv4 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv4 leases for the particular hostname.
hostname | hostname in lower case. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv4 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns existing IPv4 leases with a given relay-id.
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 |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns existing IPv4 leases with a given remote-id.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv6 leases.
Implemented in isc::dhcp::Memfile_LeaseMgr.
Referenced by getLease6().
|
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:
lower_bound_address | IPv6 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns collection of leases for matching DUID.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv6 leases for the particular hostname.
hostname | hostname in lower case. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
type | specifies lease type: (NA, TA or PD) |
duid | client DUID |
iaid | IA identifier |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
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 |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns all IPv6 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns a page of IPv6 leases for a subnet identifier.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns existing IPv6 leases with a given relay-id.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns existing IPv6 leases with a given remote-id.
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. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Return backend type.
Returns the type of the backend (e.g. "mysql", "memfile" etc.)
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns backend version.
timer_name | The DB reconnect timer name. |
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.
|
pure virtual |
Checks if JSON support is enabled in the database.
Abstract method.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Recount the leases per class for V4 leases.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Recount the leases per class for V6 leases.
Implemented in isc::dhcp::Memfile_LeaseMgr.
void isc::dhcp::LeaseMgr::recountLeaseStats4 | ( | ) |
Recalculates per-subnet and global stats for IPv4 leases.
This method recalculates the following statistics: per-subnet:
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 72 of file lease_mgr.cc.
References isc::dhcp::CfgMgr::instance(), startLeaseStatsQuery4(), startPoolLeaseStatsQuery4(), isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, and isc::dhcp::Lease::TYPE_V4.
void isc::dhcp::LeaseMgr::recountLeaseStats6 | ( | ) |
Recalculates per-subnet and global stats for IPv6 leases.
This method recalculates the following statistics: per-subnet:
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 282 of file lease_mgr.cc.
References isc::dhcp::CfgMgr::instance(), startLeaseStatsQuery6(), startPoolLeaseStatsQuery6(), isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.
|
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.
|
inline |
Modifies the setting whether the lease6 extended info tables are enabled.
enabled | new setting. |
Definition at line 1018 of file lease_mgr.h.
Referenced by isc::dhcp::Memfile_LeaseMgr::Memfile_LeaseMgr(), and setExtendedInfoTablesEnabled().
|
protected |
Extended information / Bulk Lease Query shared interface.
Decode parameters to set whether the lease extended info tables are enabled.
parameters | The parameter map. |
Definition at line 521 of file lease_mgr.cc.
References setExtendedInfoTablesEnabled().
|
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.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 256 of file lease_mgr.cc.
Referenced by recountLeaseStats4().
|
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.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 495 of file lease_mgr.cc.
Referenced by recountLeaseStats6().
|
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.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 261 of file lease_mgr.cc.
Referenced by recountLeaseStats4().
|
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.
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 500 of file lease_mgr.cc.
Referenced by recountLeaseStats6().
|
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.
subnet_id | id of the subnet for which stats are desired |
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 266 of file lease_mgr.cc.
|
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.
subnet_id | id of the subnet for which stats are desired |
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 505 of file lease_mgr.cc.
|
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.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 271 of file lease_mgr.cc.
|
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.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented in isc::dhcp::Memfile_LeaseMgr.
Definition at line 510 of file lease_mgr.cc.
|
pure virtual |
Updates IPv4 lease.
lease4 | The lease to be updated. |
If no such lease is present, an exception will be thrown.
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Updates IPv6 lease.
lease6 | The lease to be updated. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Upgrade extended info (v4).
On SQL backends for all leases with a not null user context.
page_size | The page size used for retrieval. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Upgrade extended info (v6).
On SQL backends for all leases with a not null user context.
page_size | The page size used for retrieval. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
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:
lease | Pointer to the lease to be updated. |
check | Sanity/consistency check level. |
Definition at line 535 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().
|
static |
Upgrade a V6 lease user context to the new extended info entry.
In details:
lease | Pointer to the lease to be updated. |
check | Sanity/consistency check level. |
Definition at line 756 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::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().
|
pure virtual |
Wipe extended info table (v6).
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Virtual method which removes specified leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet (or 0 for all subnets) |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Virtual method which removes specified leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet (or 0 for all subnets) |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Write V4 leases to a file.
filename | File name to write leases. |
Implemented in isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Write V6 leases to a file.
filename | File name to write leases. |
Implemented in isc::dhcp::Memfile_LeaseMgr.