2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[3966] Implemented methods to retrieve expired leases in MySQL.

This commit is contained in:
Marcin Siodelski
2015-09-07 13:29:17 +02:00
parent d337f113cb
commit 54a90126ec
2 changed files with 114 additions and 22 deletions

View File

@@ -455,6 +455,14 @@ public:
/// the lease file - which may be read by the user - it is the expiry time
/// of the lease.
/// @brief Convert time_t value to database time.
///
/// @param input_time A time_t value representing time.
/// @param output_time Reference to MYSQL_TIME object where converted time
/// will be put.
static
void convertToDatabaseTime(const time_t input_time, MYSQL_TIME& output_time);
/// @brief Convert Lease Time to Database Times
///
/// Within the DHCP servers, times are stored as client last transmit time
@@ -511,9 +519,11 @@ public:
GET_LEASE4_CLIENTID_SUBID, // Get lease4 by client ID & subnet ID
GET_LEASE4_HWADDR, // Get lease4 by HW address
GET_LEASE4_HWADDR_SUBID, // Get lease4 by HW address & subnet ID
GET_LEASE4_EXPIRE, // Get lease4 by expiration.
GET_LEASE6_ADDR, // Get lease6 by address
GET_LEASE6_DUID_IAID, // Get lease6 by DUID and IAID
GET_LEASE6_DUID_IAID_SUBID, // Get lease6 by DUID, IAID and subnet ID
GET_LEASE6_EXPIRE, // Get lease6 by expiration.
GET_VERSION, // Obtain version number
INSERT_LEASE4, // Add entry to lease4 table
INSERT_LEASE6, // Add entry to lease6 table
@@ -665,6 +675,26 @@ private:
void getLease(StatementIndex stindex, MYSQL_BIND* bind,
Lease6Ptr& result) const;
/// @brief Get expired leases common code.
///
/// This method retrieves expired and not reclaimed leases from the
/// lease database. The returned leases are ordered by the expiration
/// time. The maximum number of leases to be returned is specified
/// as an argument.
///
/// @param [out] expired_leases Reference to the container where the
/// retrieved leases are put.
/// @param max_leases Maximum number of leases to be returned.
/// @param statement_index One of the @c GET_LEASE4_EXPIRE or
/// @c GET_LEASE6_EXPIRE.
///
/// @tparam One of the @c Lease4Collection or @c Lease6Collection.
template<typename LeaseCollection>
void getExpiredLeasesCommon(LeaseCollection& expired_leases,
const size_t max_leases,
StatementIndex statement_index) const;
/// @brief Update lease common code
///
/// Holds the common code for updating a lease. It binds the parameters