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

[master] Finishing merge of trac5469 (lease6-get-all)

This commit is contained in:
Francis Dupont
2018-03-31 16:49:15 +02:00
22 changed files with 901 additions and 304 deletions

View File

@@ -153,6 +153,14 @@ tagged_statements = { {
"WHERE state != ? AND expire < ? "
"ORDER BY expire ASC "
"LIMIT ?"},
{MySqlLeaseMgr::GET_LEASE6,
"SELECT address, duid, valid_lifetime, "
"expire, subnet_id, pref_lifetime, "
"lease_type, iaid, prefix_len, "
"fqdn_fwd, fqdn_rev, hostname, "
"hwaddr, hwtype, hwaddr_source, "
"state "
"FROM lease6"},
{MySqlLeaseMgr::GET_LEASE6_ADDR,
"SELECT address, duid, valid_lifetime, "
"expire, subnet_id, pref_lifetime, "
@@ -181,6 +189,15 @@ tagged_statements = { {
"FROM lease6 "
"WHERE duid = ? AND iaid = ? AND subnet_id = ? "
"AND lease_type = ?"},
{MySqlLeaseMgr::GET_LEASE6_SUBID,
"SELECT address, duid, valid_lifetime, "
"expire, subnet_id, pref_lifetime, "
"lease_type, iaid, prefix_len, "
"fqdn_fwd, fqdn_rev, hostname, "
"hwaddr, hwtype, hwaddr_source, "
"state "
"FROM lease6 "
"WHERE subnet_id = ?"},
{MySqlLeaseMgr::GET_LEASE6_EXPIRE,
"SELECT address, duid, valid_lifetime, "
"expire, subnet_id, pref_lifetime, "
@@ -1900,6 +1917,37 @@ MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
return (result);
}
Lease6Collection
MySqlLeaseMgr::getLeases6(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_SUBID6)
.arg(subnet_id);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
memset(inbind, 0, sizeof(inbind));
// Subnet ID
inbind[0].buffer_type = MYSQL_TYPE_LONG;
inbind[0].buffer = reinterpret_cast<char*>(&subnet_id);
inbind[0].is_unsigned = MLM_TRUE;
// ... and get the data
Lease6Collection result;
getLeaseCollection(GET_LEASE6_SUBID, inbind, result);
return (result);
}
Lease6Collection
MySqlLeaseMgr::getLeases6() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET6);
Lease6Collection result;
getLeaseCollection(GET_LEASE6, 0, result);
return (result);
}
void
MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const {