![]() |
Kea
2.5.2
|
#include <mysql_lease_mgr.h>
Public Member Functions | |
MySqlLeaseMgr (const db::DatabaseConnection::ParameterMap ¶meters) | |
Constructor. More... | |
virtual | ~MySqlLeaseMgr () |
Destructor (closes database) More... | |
virtual bool | addLease (const Lease4Ptr &lease) override |
Adds an IPv4 lease. More... | |
virtual bool | addLease (const Lease6Ptr &lease) override |
Adds an IPv6 lease. More... | |
virtual size_t | byRelayId6size () const override |
Return the by-relay-id table size. More... | |
virtual size_t | byRemoteId6size () const override |
Return the by-remote-id table size. More... | |
virtual void | commit () override |
Commit Transactions. More... | |
MySqlLeaseContextPtr | createContext () const |
Create a new context. More... | |
virtual uint64_t | deleteExpiredReclaimedLeases4 (const uint32_t secs) override |
Deletes all expired-reclaimed DHCPv4 leases. More... | |
virtual uint64_t | deleteExpiredReclaimedLeases6 (const uint32_t secs) override |
Deletes all expired-reclaimed DHCPv6 leases. More... | |
virtual bool | deleteLease (const Lease4Ptr &lease) override |
Deletes an IPv4 lease. More... | |
virtual bool | deleteLease (const Lease6Ptr &lease) override |
Deletes an IPv6 lease. More... | |
virtual std::string | getDescription () const override |
Returns description of the backend. More... | |
virtual void | getExpiredLeases4 (Lease4Collection &expired_leases, const size_t max_leases) const override |
Returns a collection of expired DHCPv4 leases. More... | |
virtual void | getExpiredLeases6 (Lease6Collection &expired_leases, const size_t max_leases) const override |
Returns a collection of expired DHCPv6 leases. More... | |
virtual Lease4Collection | getLease4 (const ClientId &clientid) const override |
Returns existing IPv4 leases for specified client-id. More... | |
virtual Lease4Ptr | getLease4 (const ClientId &clientid, SubnetID subnet_id) const override |
Returns existing IPv4 lease for specified client-id. More... | |
virtual Lease4Ptr | getLease4 (const isc::asiolink::IOAddress &addr) const override |
Returns an IPv4 lease for specified IPv4 address. More... | |
virtual Lease4Collection | getLease4 (const isc::dhcp::HWAddr &hwaddr) const override |
Returns existing IPv4 leases for specified hardware address. More... | |
virtual Lease4Ptr | getLease4 (const isc::dhcp::HWAddr &hwaddr, SubnetID subnet_id) const override |
Returns existing IPv4 leases for specified hardware address and a subnet. More... | |
virtual Lease6Ptr | getLease6 (Lease::Type type, const isc::asiolink::IOAddress &addr) const override |
Returns existing IPv6 lease for a given IPv6 address. More... | |
virtual Lease4Collection | getLeases4 () const override |
Returns all IPv4 leases. More... | |
virtual Lease4Collection | getLeases4 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const override |
Returns range of IPv4 leases using paging. More... | |
virtual Lease4Collection | getLeases4 (const std::string &hostname) const override |
Returns all IPv4 leases for the particular hostname. More... | |
virtual Lease4Collection | getLeases4 (SubnetID subnet_id) const override |
Returns all IPv4 leases for the particular subnet identifier. More... | |
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) override |
The following queries are used to fulfill Bulk Lease Query queries. More... | |
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) override |
Returns existing IPv4 leases with a given remote-id. More... | |
virtual Lease6Collection | getLeases6 () const override |
Returns all IPv6 leases. More... | |
virtual Lease6Collection | getLeases6 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const override |
Returns range of IPv6 leases using paging. More... | |
virtual Lease6Collection | getLeases6 (const DUID &duid) const override |
Returns all IPv6 leases for the DUID. More... | |
virtual Lease6Collection | getLeases6 (const std::string &hostname) const override |
Returns all IPv6 leases for the particular hostname. More... | |
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid) const override |
Returns existing IPv6 leases for a given DUID+IA combination. More... | |
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid, SubnetID subnet_id) const override |
Returns existing IPv6 lease for a given DUID+IA combination. More... | |
virtual Lease6Collection | getLeases6 (SubnetID subnet_id) const override |
Returns all IPv6 leases for the particular subnet identifier. More... | |
virtual Lease6Collection | getLeases6ByLink (const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override |
Returns existing IPv6 leases with on a given link. More... | |
virtual Lease6Collection | getLeases6ByRelayId (const DUID &relay_id, const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override |
Returns existing IPv6 leases with a given relay-id. More... | |
virtual Lease6Collection | getLeases6ByRemoteId (const OptionBuffer &remote_id, const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override |
Returns existing IPv6 leases with a given remote-id. More... | |
virtual std::string | getName () const override |
Returns backend name. More... | |
virtual std::string | getType () const override |
Return backend type. More... | |
virtual std::pair< uint32_t, uint32_t > | getVersion () const override |
Returns backend version. More... | |
virtual void | rollback () override |
Rollback Transactions. More... | |
virtual LeaseStatsQueryPtr | startLeaseStatsQuery4 () override |
Creates and runs the IPv4 lease stats query. More... | |
virtual LeaseStatsQueryPtr | startLeaseStatsQuery6 () override |
Creates and runs the IPv6 lease stats query. More... | |
virtual LeaseStatsQueryPtr | startPoolLeaseStatsQuery4 () override |
Creates and runs the IPv4 lease stats query for all subnets and pools. More... | |
virtual LeaseStatsQueryPtr | startPoolLeaseStatsQuery6 () override |
Creates and runs the IPv6 lease stats query for all subnets and pools. More... | |
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery4 (const SubnetID &subnet_id) override |
Creates and runs the IPv4 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery6 (const SubnetID &subnet_id) override |
Creates and runs the IPv6 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery4 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) override |
Creates and runs the IPv4 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery6 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) override |
Creates and runs the IPv6 lease stats query for a single subnet. More... | |
virtual void | updateLease4 (const Lease4Ptr &lease4) override |
Updates IPv4 lease. More... | |
virtual void | updateLease6 (const Lease6Ptr &lease6) override |
Updates IPv6 lease. More... | |
virtual size_t | upgradeExtendedInfo4 (const LeasePageSize &page_size) override |
Upgrade extended info (v4). More... | |
virtual size_t | upgradeExtendedInfo6 (const LeasePageSize &page_size) override |
Upgrade extended info (v6). More... | |
virtual void | wipeExtendedInfoTables6 () override |
Wipe by-relay-id table (v6). More... | |
virtual size_t | wipeLeases4 (const SubnetID &subnet_id) override |
Removes specified IPv4 leases. More... | |
virtual size_t | wipeLeases6 (const SubnetID &subnet_id) override |
Removed specified IPv6 leases. More... | |
![]() | |
bool | hasCallbacks () const |
Checks if any callbacks have been registered. More... | |
bool | isLocked (const LeasePtr &lease) |
Checks if the lease is locked. More... | |
void | registerCallback (CallbackType type, std::string owner, Lease::Type lease_type, CallbackFn callback_fn) |
Registers a callback function for all subnets. More... | |
void | registerCallback (CallbackType type, std::string owner, SubnetID subnet_id, Lease::Type lease_type, CallbackFn callback_fn) |
Registers a callback function for a subnet. More... | |
void | unregisterAllCallbacks () |
Unregisters all callbacks. More... | |
void | unregisterCallbacks (SubnetID subnet_id, Lease::Type lease_type) |
Unregisters all callbacks for a given subnet identifier. More... | |
![]() | |
LeaseMgr () | |
Constructor. More... | |
virtual | ~LeaseMgr () |
Destructor. More... | |
bool | getExtendedInfoTablesEnabled () const |
Returns the setting indicating if lease6 extended info tables are enabled. More... | |
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 More... | |
void | recountLeaseStats4 () |
Recalculates per-subnet and global stats for IPv4 leases. More... | |
void | recountLeaseStats6 () |
Recalculates per-subnet and global stats for IPv6 leases. More... | |
void | setExtendedInfoTablesEnabled (const bool enabled) |
Modifies the setting whether the lease6 extended info tables are enabled. More... | |
Static Public Member Functions | |
static bool | dbReconnect (util::ReconnectCtlPtr db_reconnect_ctl) |
Attempts to reconnect the server to the lease DB backend manager. More... | |
static std::string | getDBVersion () |
Local version of getDBVersion() class method. More... | |
![]() | |
static void | extractLease4ExtendedInfo (const Lease4Ptr &lease, bool ignore_errors=true) |
Extract relay and remote identifiers from the extended info. More... | |
static std::string | getDBVersion () |
Class method to return extended version info This class method must be redeclared and redefined in derived classes. More... | |
static isc::asiolink::IOServicePtr & | getIOService () |
Returns pointer to the IO service. More... | |
static void | setIOService (const isc::asiolink::IOServicePtr &io_service) |
Sets IO service to be used by the Lease Manager. More... | |
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. More... | |
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. More... | |
Protected Member Functions | |
virtual void | addRelayId6 (const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &relay_id) override |
Add lease6 extended info into by-relay-id table. More... | |
virtual void | addRemoteId6 (const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &remote_id) override |
Add lease6 extended info into by-remote-id table. More... | |
virtual void | deleteExtendedInfo6 (const isc::asiolink::IOAddress &addr) override |
Extended information / Bulk Lease Query shared interface. More... | |
![]() | |
TrackingLeaseMgr () | |
Constructor. More... | |
void | runCallbacks (CallbackType type, const LeasePtr &lease, bool mt_safe) |
Runs registered callbacks of the particular type. More... | |
void | runCallbacksForSubnetID (CallbackType type, SubnetID subnet_id, const LeasePtr &lease, bool mt_safe) |
Runs registered callbacks of the particular type for a subnet id. More... | |
void | trackAddLease (const LeasePtr &lease, bool mt_safe) |
Invokes the callbacks when a new lease is added. More... | |
void | trackDeleteLease (const LeasePtr &lease, bool mt_safe) |
Invokes the callbacks when a lease is deleted. More... | |
void | trackUpdateLease (const LeasePtr &lease, bool mt_safe) |
Invokes the callbacks when a lease is updated. More... | |
bool | tryLock (const LeasePtr &lease) |
Attempts to lock a lease. More... | |
void | unlock (const LeasePtr &lease) |
Attempts to unlock a lease. More... | |
![]() | |
virtual bool | addExtendedInfo6 (const Lease6Ptr &lease) |
Extract extended info from a lease6 and add it into tables. More... | |
void | setExtendedInfoTablesEnabled (const db::DatabaseConnection::ParameterMap ¶meters) |
Extended information / Bulk Lease Query shared interface. More... | |
Additional Inherited Members | |
![]() | |
typedef boost::multi_index_container< Callback, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< Callback, boost::multi_index::member< Callback, CallbackType, &Callback::type >, boost::multi_index::member< Callback, SubnetID, &Callback::subnet_id >, boost::multi_index::member< Callback, Lease::Type, &Callback::lease_type > > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< Callback, boost::multi_index::member< Callback, SubnetID, &Callback::subnet_id >, boost::multi_index::member< Callback, Lease::Type, &Callback::lease_type > > > > > | CallbackContainer |
A multi-index container holding registered callbacks. More... | |
typedef boost::shared_ptr< CallbackContainer > | CallbackContainerPtr |
Pointer to the callback container. More... | |
![]() | |
static std::string | callbackTypeToString (CallbackType type) |
Converts callback type to string for logging purposes. More... | |
![]() | |
CallbackContainerPtr | callbacks_ |
The multi-index container holding registered callbacks. More... | |
std::unordered_set< asiolink::IOAddress, asiolink::IOAddress::Hash > | locked_leases_ |
A set of locked leases. More... | |
MySQL Lease Manager.
This class provides the isc::dhcp::LeaseMgr interface to the MySQL database. Use of this backend presupposes that a MySQL database is available and that the Kea schema has been created within it.
Definition at line 92 of file mysql_lease_mgr.h.
Statement Tags.
The contents of the enum are indexes into the list of compiled SQL statements
Definition at line 719 of file mysql_lease_mgr.h.
isc::dhcp::MySqlLeaseMgr::MySqlLeaseMgr | ( | const db::DatabaseConnection::ParameterMap & | parameters | ) |
Constructor.
Uses the following keywords in the parameters passed to it to connect to the database:
Check the schema version and create an initial context.
parameters | A data structure relating keywords and values concerned with the database. |
isc::dhcp::NoDatabaseName | Mandatory database name not given |
isc::db::DbOpenError | Error opening the database or the schema version is incorrect. |
isc::db::DbOperationError | An operation on the open database has failed. |
Definition at line 2215 of file mysql_lease_mgr.cc.
References createContext(), getVersion(), isc_throw, isc::db::MYSQL_SCHEMA_VERSION_MAJOR, isc::db::MYSQL_SCHEMA_VERSION_MINOR, and isc::dhcp::LeaseMgr::setExtendedInfoTablesEnabled().
|
virtual |
Destructor (closes database)
Definition at line 2243 of file mysql_lease_mgr.cc.
|
overridevirtual |
Adds an IPv4 lease.
lease | lease to be added |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2390 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_ADD_ADDR4, isc::dhcp::TrackingLeaseMgr::hasCallbacks(), INSERT_LEASE4, LOG_DEBUG, and isc::dhcp::TrackingLeaseMgr::trackAddLease().
|
overridevirtual |
Adds an IPv6 lease.
lease | lease to be added |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2417 of file mysql_lease_mgr.cc.
References isc::dhcp::Lease6::ACTION_IGNORE, isc::dhcp::LeaseMgr::addExtendedInfo6(), isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_ADD_ADDR6, isc::dhcp::LeaseMgr::getExtendedInfoTablesEnabled(), isc::dhcp::TrackingLeaseMgr::hasCallbacks(), INSERT_LEASE6, LOG_DEBUG, and isc::dhcp::TrackingLeaseMgr::trackAddLease().
|
overrideprotectedvirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3945 of file mysql_lease_mgr.cc.
References ADD_RELAY_ID6, isc_throw, isc::db::MysqlExecuteStatement(), and isc::asiolink::IOAddress::toBytes().
|
overrideprotectedvirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3989 of file mysql_lease_mgr.cc.
References ADD_REMOTE_ID6, isc_throw, isc::db::MysqlExecuteStatement(), and isc::asiolink::IOAddress::toBytes().
|
overridevirtual |
Return the by-relay-id table size.
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 4823 of file mysql_lease_mgr.cc.
References COUNT_RELAY_ID6, and isc::db::MysqlExecuteStatement().
|
overridevirtual |
Return the by-remote-id table size.
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 4861 of file mysql_lease_mgr.cc.
References COUNT_REMOTE_ID6, and isc::db::MysqlExecuteStatement().
|
overridevirtual |
Commit Transactions.
Commits all pending database operations. On databases that don't support transactions, this is a no-op.
MySQL supports transactions but this manager does not use them.
Implements isc::dhcp::LeaseMgr.
Definition at line 3862 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_COMMIT, and LOG_DEBUG.
MySqlLeaseContextPtr isc::dhcp::MySqlLeaseMgr::createContext | ( | ) | const |
Create a new context.
The database is opened with all the SQL commands pre-compiled.
isc::dhcp::NoDatabaseName | Mandatory database name not given. |
isc::db::DbOperationError | An operation on the open database has failed. |
Definition at line 2316 of file mysql_lease_mgr.cc.
References dbReconnect(), isc::dhcp::DHCPSRV_DBG_TRACE, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_NO_TLS, isc::dhcp::DHCPSRV_MYSQL_TLS_CIPHER, isc::dhcp::LeaseMgr::getIOService(), LOG_DEBUG, and LOG_ERROR.
Referenced by MySqlLeaseMgr().
|
static |
Attempts to reconnect the server to the lease DB backend manager.
This is a self-rescheduling function that attempts to reconnect to the server's lease DB backends after connectivity to one or more have been lost. Upon entry it will attempt to reconnect via LeaseMgrFactory::create. If this is successful, DHCP servicing is re-enabled and server returns to normal operation.
If reconnection fails and the maximum number of retries has not been exhausted, it will schedule a call to itself to occur at the configured retry interval. DHCP service remains disabled.
If the maximum number of retries has been exhausted an error is logged and the server shuts down.
This function is passed to the connection recovery mechanism. It will be invoked when a connection loss is detected.
db_reconnect_ctl | pointer to the ReconnectCtl containing the configured reconnect parameters. |
Definition at line 2247 of file mysql_lease_mgr.cc.
References isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_LEASE_DB_RECONNECT_ATTEMPT_FAILED, isc::dhcp::DHCPSRV_MYSQL_LEASE_DB_RECONNECT_ATTEMPT_SCHEDULE, isc::dhcp::DHCPSRV_MYSQL_LEASE_DB_RECONNECT_FAILED, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::TimerMgr::instance(), isc::db::DatabaseConnection::invokeDbFailedCallback(), isc::db::DatabaseConnection::invokeDbLostCallback(), isc::db::DatabaseConnection::invokeDbRecoveredCallback(), LOG_ERROR, LOG_INFO, isc::asiolink::IntervalTimer::ONE_SHOT, and isc::dhcp::LeaseMgrFactory::recreate().
Referenced by createContext().
|
overridevirtual |
Deletes all expired-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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3549 of file mysql_lease_mgr.cc.
References DELETE_LEASE4_STATE_EXPIRED, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4, and LOG_DEBUG.
|
overridevirtual |
Deletes all expired-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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3556 of file mysql_lease_mgr.cc.
References DELETE_LEASE6_STATE_EXPIRED, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6, and LOG_DEBUG.
|
overrideprotectedvirtual |
Extended information / Bulk Lease Query shared interface.
Delete lease6 extended info from tables.
addr | The address of the lease. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3879 of file mysql_lease_mgr.cc.
Referenced by updateLease6().
|
overridevirtual |
Deletes an IPv4 lease.
lease | IPv4 lease being deleted. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3428 of file mysql_lease_mgr.cc.
References isc::db::MySqlConnection::convertToDatabaseTime(), DELETE_LEASE4, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_DELETE_ADDR, isc::dhcp::TrackingLeaseMgr::hasCallbacks(), isc::dhcp::Lease::INFINITY_LFT, isc_throw, LOG_DEBUG, isc::db::MLM_TRUE, isc::asiolink::IOAddress::toText(), isc::asiolink::IOAddress::toUint32(), and isc::dhcp::TrackingLeaseMgr::trackDeleteLease().
|
overridevirtual |
Deletes an IPv6 lease.
lease | IPv6 lease being deleted. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3482 of file mysql_lease_mgr.cc.
References isc::dhcp::Lease6::ACTION_IGNORE, isc::db::MySqlConnection::convertToDatabaseTime(), DELETE_LEASE6, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_DELETE_ADDR, isc::dhcp::TrackingLeaseMgr::hasCallbacks(), isc::dhcp::Lease::INFINITY_LFT, isc_throw, LOG_DEBUG, isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::dhcp::TrackingLeaseMgr::trackDeleteLease().
|
static |
Local version of getDBVersion() class method.
Definition at line 2352 of file mysql_lease_mgr.cc.
References isc::db::MYSQL_SCHEMA_VERSION_MAJOR, and isc::db::MYSQL_SCHEMA_VERSION_MINOR.
Referenced by isc::dhcp::Dhcpv4Srv::getVersion(), and isc::dhcp::Dhcpv6Srv::getVersion().
|
overridevirtual |
Returns description of the backend.
This description may be multiline text that describes the backend.
Implements isc::dhcp::LeaseMgr.
Definition at line 3850 of file mysql_lease_mgr.cc.
|
overridevirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3179 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_EXPIRED4, GET_LEASE4_EXPIRE, and LOG_DEBUG.
|
overridevirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3187 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_EXPIRED6, GET_LEASE6_EXPIRE, and LOG_DEBUG.
|
overridevirtual |
Returns existing IPv4 leases 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 |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2697 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_CLIENTID, GET_LEASE4_CLIENTID, isc::dhcp::ClientId::getClientId(), LOG_DEBUG, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
Returns existing IPv4 lease for specified client-id.
There can be at most one lease for a given HW address in a single pool, so this method with either return a single lease or NULL.
clientid | client identifier |
subnet_id | identifier of the subnet that lease must belong to |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2733 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_SUBID_CLIENTID, GET_LEASE4_CLIENTID_SUBID, isc::dhcp::ClientId::getClientId(), LOG_DEBUG, isc::db::MLM_TRUE, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
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 |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2584 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_ADDR4, GET_LEASE4_ADDR, LOG_DEBUG, isc::db::MLM_TRUE, isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().
|
overridevirtual |
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 |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2610 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_HWADDR, GET_LEASE4_HWADDR, isc::dhcp::HWAddr::hwaddr_, LOG_DEBUG, and isc::dhcp::HWAddr::toText().
|
overridevirtual |
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 with either return a single lease or NULL.
hwaddr | hardware address of the client |
subnet_id | identifier of the subnet that lease must belong to |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2651 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_SUBID_HWADDR, GET_LEASE4_HWADDR_SUBID, isc::dhcp::HWAddr::hwaddr_, LOG_DEBUG, isc::db::MLM_TRUE, and isc::dhcp::HWAddr::toText().
|
overridevirtual |
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 |
isc::BadValue | record retrieved from database had an invalid lease type field. |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2883 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_ADDR6, GET_LEASE6_ADDR, isc_throw, LOG_DEBUG, isc::db::MLM_TRUE, isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toText().
|
overridevirtual |
Returns all IPv4 leases.
Implements isc::dhcp::LeaseMgr.
Definition at line 2826 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET4, GET_LEASE4, and LOG_DEBUG.
|
overridevirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2841 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_PAGE4, GET_LEASE4_PAGE, isc_throw, isc::asiolink::IOAddress::isV4(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().
|
overridevirtual |
Returns all IPv4 leases for the particular hostname.
hostname | hostname in lower case. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2800 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_HOSTNAME4, GET_LEASE4_HOSTNAME, and LOG_DEBUG.
|
overridevirtual |
Returns all IPv4 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2774 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_SUBID4, GET_LEASE4_SUBID, LOG_DEBUG, and isc::db::MLM_TRUE.
|
overridevirtual |
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.
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 |
Implements isc::dhcp::LeaseMgr.
Definition at line 4054 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_RELAYID4, GET_LEASE4_RELAYID, GET_LEASE4_RELAYID_QET, GET_LEASE4_RELAYID_QSET, GET_LEASE4_RELAYID_QST, isc_throw, isc::asiolink::IOAddress::isV4(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().
|
overridevirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4166 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_REMOTEID4, GET_LEASE4_REMOTEID, GET_LEASE4_REMOTEID_QET, GET_LEASE4_REMOTEID_QSET, GET_LEASE4_REMOTEID_QST, isc_throw, isc::asiolink::IOAddress::isV4(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().
|
overridevirtual |
Returns all IPv6 leases.
Implements isc::dhcp::LeaseMgr.
Definition at line 3061 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET6, GET_LEASE6, and LOG_DEBUG.
|
overridevirtual |
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. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3131 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_PAGE6, GET_LEASE6_PAGE, isc_throw, isc::asiolink::IOAddress::isV6(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toText().
|
overridevirtual |
Returns all IPv6 leases for the DUID.
Implements isc::dhcp::LeaseMgr.
Definition at line 3076 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_DUID, GET_LEASE6_DUID, isc::dhcp::DUID::getDuid(), LOG_DEBUG, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
Returns all IPv6 leases for the particular hostname.
hostname | hostname in lower case. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3105 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_HOSTNAME6, GET_LEASE6_HOSTNAME, and LOG_DEBUG.
|
overridevirtual |
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 |
isc::BadValue | record retrieved from database had an invalid lease type field. |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2922 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_IAID_DUID, GET_LEASE6_DUID_IAID, isc::dhcp::DUID::getDuid(), LOG_DEBUG, isc::db::MLM_TRUE, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
Returns existing IPv6 lease for a given DUID+IA combination.
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 |
isc::BadValue | record retrieved from database had an invalid lease type field. |
isc::dhcp::DataTruncation | Data was truncated on retrieval to fit into the space allocated for the result. This indicates a programming error. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 2985 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_IAID_SUBID_DUID, GET_LEASE6_DUID_IAID_SUBID, isc::dhcp::DUID::getDuid(), LOG_DEBUG, isc::db::MLM_TRUE, and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
Returns all IPv6 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3035 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_SUBID6, GET_LEASE6_SUBID, LOG_DEBUG, and isc::db::MLM_TRUE.
|
overridevirtual |
Returns existing IPv6 leases with on a given link.
link_addr | limit results to leases on this link (prefix). |
link_len | limit results to leases on this link (length). |
lower_bound_address | IPv4 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4629 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_LINKADDR6, isc::asiolink::firstAddrInPrefix(), GET_LEASE6_LINK, isc::asiolink::IOAddress::increase(), isc_throw, isc::asiolink::IOAddress::isV6(), isc::asiolink::lastAddrInPrefix(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toText().
|
overridevirtual |
Returns existing IPv6 leases with a given relay-id.
relay_id | DUID for relay_id of interest. |
link_addr | limit results to leases on this link (prefix). |
link_len | limit results to leases on this link (length). |
lower_bound_address | IPv4 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4367 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_RELAYID6, isc::asiolink::firstAddrInPrefix(), GET_RELAY_ID6, GET_RELAY_ID6_LINK, isc::dhcp::DUID::getDuid(), isc::asiolink::IOAddress::increase(), isc_throw, isc::asiolink::IOAddress::isV6(), isc::asiolink::lastAddrInPrefix(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::dhcp::IdentifierType< min_size, max_size >::toText().
|
overridevirtual |
Returns existing IPv6 leases with a given remote-id.
remote_id | remote-id option data of interest. |
link_addr | limit results to leases on this link (prefix). |
link_len | limit results to leases on this link (length). |
lower_bound_address | IPv4 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4498 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_REMOTEID6, isc::asiolink::firstAddrInPrefix(), GET_REMOTE_ID6, GET_REMOTE_ID6_LINK, isc::asiolink::IOAddress::increase(), isc_throw, isc::asiolink::IOAddress::isV6(), isc::asiolink::lastAddrInPrefix(), LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toText().
|
overridevirtual |
Returns backend name.
Each backend have specific name.
Implements isc::dhcp::LeaseMgr.
Definition at line 3835 of file mysql_lease_mgr.cc.
|
inlineoverridevirtual |
Return backend type.
Returns the type of the backend (e.g. "mysql", "memfile" etc.)
Implements isc::dhcp::LeaseMgr.
Definition at line 672 of file mysql_lease_mgr.h.
|
overridevirtual |
Returns backend version.
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3855 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_GET_VERSION, isc::db::MySqlConnection::getVersion(), and LOG_DEBUG.
Referenced by MySqlLeaseMgr().
|
overridevirtual |
Rollback Transactions.
Rolls back all pending database operations. On databases that don't support transactions, this is a no-op.
MySQL supports transactions but this manager does not use them.
Implements isc::dhcp::LeaseMgr.
Definition at line 3867 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_ROLLBACK, and LOG_DEBUG.
|
overridevirtual |
Creates and runs the IPv4 lease stats query.
It creates an instance of a MySqlLeaseStatsQuery4 and then invokes its start method, which fetches its statistical data result set by executing the ALL_LEASE_STATS4 query. The query object is then returned.
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3711 of file mysql_lease_mgr.cc.
References ALL_LEASE4_STATS.
|
overridevirtual |
Creates and runs the IPv6 lease stats query.
It creates an instance of a MySqlLeaseStatsQuery6 and then invokes its start method, which fetches its statistical data result set by executing the ALL_LEASE_STATS6 query. The query object is then returned.
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3767 of file mysql_lease_mgr.cc.
References ALL_LEASE6_STATS.
|
overridevirtual |
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 from isc::dhcp::LeaseMgr.
Definition at line 3724 of file mysql_lease_mgr.cc.
References ALL_POOL_LEASE4_STATS.
|
overridevirtual |
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 from isc::dhcp::LeaseMgr.
Definition at line 3780 of file mysql_lease_mgr.cc.
References ALL_POOL_LEASE6_STATS.
|
overridevirtual |
Creates and runs the IPv4 lease stats query for a single subnet.
It creates an instance of a MySqlLeaseStatsQuery4 for a single subnet query and then invokes its start method in which the query constructs its statistical data result set. The query object is then returned.
subnet_id | id of the subnet for which stats are desired |
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3737 of file mysql_lease_mgr.cc.
References SUBNET_LEASE4_STATS.
|
overridevirtual |
Creates and runs the IPv6 lease stats query for a single subnet.
It creates an instance of a MySqlLeaseStatsQuery6 for a single subnet query and then invokes its start method in which the query constructs its statistical data result set. The query object is then returned.
subnet_id | id of the subnet for which stats are desired |
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3793 of file mysql_lease_mgr.cc.
References SUBNET_LEASE6_STATS.
|
overridevirtual |
Creates and runs the IPv4 lease stats query for a single subnet.
It creates an instance of a MySqlLeaseStatsQuery4 for a subnet range query and then invokes its start method in which the query constructs its statistical data result set. The query object is then returned.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3751 of file mysql_lease_mgr.cc.
References SUBNET_RANGE_LEASE4_STATS.
|
overridevirtual |
Creates and runs the IPv6 lease stats query for a single subnet.
It creates an instance of a MySqlLeaseStatsQuery6 for a subnet range query and then invokes its start method in which the query constructs its statistical data result set. The query object is then returned.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented from isc::dhcp::LeaseMgr.
Definition at line 3807 of file mysql_lease_mgr.cc.
References SUBNET_RANGE_LEASE6_STATS.
|
overridevirtual |
Updates IPv4 lease.
Updates the record of the lease in the database (as identified by the address) with the data in the passed lease object.
lease4 | The lease to be updated. |
isc::dhcp::NoSuchLease | Attempt to update a lease that did not exist. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3273 of file mysql_lease_mgr.cc.
References isc::db::MySqlConnection::convertToDatabaseTime(), isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_UPDATE_ADDR4, isc::dhcp::TrackingLeaseMgr::hasCallbacks(), isc::dhcp::Lease::INFINITY_LFT, LOG_DEBUG, isc::db::MLM_TRUE, isc::dhcp::TrackingLeaseMgr::trackUpdateLease(), and UPDATE_LEASE4.
Referenced by upgradeExtendedInfo4().
|
overridevirtual |
Updates IPv6 lease.
Updates the record of the lease in the database (as identified by the address) with the data in the passed lease object.
lease6 | The lease to be updated. |
isc::dhcp::NoSuchLease | Attempt to update a lease that did not exist. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implements isc::dhcp::LeaseMgr.
Definition at line 3325 of file mysql_lease_mgr.cc.
References isc::dhcp::Lease6::ACTION_DELETE, isc::dhcp::Lease6::ACTION_IGNORE, isc::dhcp::Lease6::ACTION_UPDATE, isc::dhcp::LeaseMgr::addExtendedInfo6(), isc::db::MySqlConnection::convertToDatabaseTime(), deleteExtendedInfo6(), isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_UPDATE_ADDR6, isc::dhcp::LeaseMgr::getExtendedInfoTablesEnabled(), isc::dhcp::TrackingLeaseMgr::hasCallbacks(), isc::dhcp::Lease::INFINITY_LFT, isc_throw, LOG_DEBUG, isc::dhcp::TrackingLeaseMgr::trackUpdateLease(), and UPDATE_LEASE6.
Referenced by upgradeExtendedInfo6().
|
overridevirtual |
Upgrade extended info (v4).
For all leases with a not null user context.
page_size | The page size used for retrieval. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4278 of file mysql_lease_mgr.cc.
References isc::dhcp::DHCPSRV_DBG_TRACE, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_ERROR, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_PAGE, isc::dhcp::LeaseMgr::extractLease4ExtendedInfo(), GET_LEASE4_UCTX_PAGE, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::asiolink::IOAddress::IPV4_ZERO_ADDRESS(), LOG_DEBUG, LOG_INFO, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toText(), isc::asiolink::IOAddress::toUint32(), updateLease4(), and isc::dhcp::LeaseMgr::upgradeLease4ExtendedInfo().
|
overridevirtual |
Upgrade extended info (v6).
All leases with a not null user context.
page_size | The page size used for retrieval. |
Implements isc::dhcp::LeaseMgr.
Definition at line 4713 of file mysql_lease_mgr.cc.
References isc::dhcp::LeaseMgr::addExtendedInfo6(), isc::dhcp::DHCPSRV_DBG_TRACE, isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO6, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO6_ERROR, isc::dhcp::DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO6_PAGE, GET_LEASE6_UCTX_PAGE, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::LeaseMgr::getExtendedInfoTablesEnabled(), isc::dhcp::CfgMgr::instance(), isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS(), isc_throw, LOG_DEBUG, LOG_INFO, isc::db::MLM_TRUE, isc::dhcp::LeasePageSize::page_size_, isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), updateLease6(), isc::dhcp::LeaseMgr::upgradeLease6ExtendedInfo(), and wipeExtendedInfoTables6().
|
overridevirtual |
Wipe by-relay-id table (v6).
Implements isc::dhcp::LeaseMgr.
Definition at line 4804 of file mysql_lease_mgr.cc.
References isc::db::MysqlExecuteStatement(), WIPE_RELAY_ID6, and WIPE_REMOTE_ID6.
Referenced by upgradeExtendedInfo6().
|
overridevirtual |
Removes specified IPv4 leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet |
Implements isc::dhcp::LeaseMgr.
Definition at line 3823 of file mysql_lease_mgr.cc.
References isc_throw.
|
overridevirtual |
Removed specified IPv6 leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet |
Implements isc::dhcp::LeaseMgr.
Definition at line 3828 of file mysql_lease_mgr.cc.
References isc_throw.