Commit 95729b09 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3146] getLease6() methods now have extra param: LeaseType

parent 9b97fd86
...@@ -1316,7 +1316,8 @@ Dhcpv6Srv::renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid, ...@@ -1316,7 +1316,8 @@ Dhcpv6Srv::renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
return (ia_rsp); return (ia_rsp);
} }
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(*duid, ia->getIAID(), Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
*duid, ia->getIAID(),
subnet->getID()); subnet->getID());
if (!lease) { if (!lease) {
...@@ -1579,7 +1580,8 @@ Dhcpv6Srv::releaseIA_NA(const DuidPtr& duid, const Pkt6Ptr& query, ...@@ -1579,7 +1580,8 @@ Dhcpv6Srv::releaseIA_NA(const DuidPtr& duid, const Pkt6Ptr& query,
return (ia_rsp); return (ia_rsp);
} }
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(release_addr->getAddress()); Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
release_addr->getAddress());
if (!lease) { if (!lease) {
// client releasing a lease that we don't know about. // client releasing a lease that we don't know about.
......
...@@ -1024,7 +1024,8 @@ TEST_F(Dhcpv6SrvTest, RenewBasic) { ...@@ -1024,7 +1024,8 @@ TEST_F(Dhcpv6SrvTest, RenewBasic) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set and not using // Check that T1, T2, preferred, valid and cltt really set and not using
...@@ -1116,7 +1117,8 @@ TEST_F(Dhcpv6SrvTest, RenewReject) { ...@@ -1116,7 +1117,8 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
OptionPtr clientid = generateClientId(); OptionPtr clientid = generateClientId();
// Check that the lease is NOT in the database // Check that the lease is NOT in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// Let's create a RENEW // Let's create a RENEW
...@@ -1147,7 +1149,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) { ...@@ -1147,7 +1149,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
checkIA_NAStatusCode(ia, STATUS_NoBinding); checkIA_NAStatusCode(ia, STATUS_NoBinding);
// Check that there is no lease added // Check that there is no lease added
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// CASE 2: Lease is known and belongs to this client, but to a different IAID // CASE 2: Lease is known and belongs to this client, but to a different IAID
...@@ -1189,7 +1191,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) { ...@@ -1189,7 +1191,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
ASSERT_TRUE(ia); ASSERT_TRUE(ia);
checkIA_NAStatusCode(ia, STATUS_NoBinding); checkIA_NAStatusCode(ia, STATUS_NoBinding);
lease = LeaseMgrFactory::instance().getLease6(addr); lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_TRUE(lease); ASSERT_TRUE(lease);
// Verify that the lease was not updated. // Verify that the lease was not updated.
EXPECT_EQ(123, lease->cltt_); EXPECT_EQ(123, lease->cltt_);
...@@ -1226,7 +1228,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) { ...@@ -1226,7 +1228,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Let's create a RELEASE // Let's create a RELEASE
...@@ -1265,11 +1268,12 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) { ...@@ -1265,11 +1268,12 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
// Check that the lease is really gone in the database // Check that the lease is really gone in the database
// get lease by address // get lease by address
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// get lease by subnetid/duid/iaid combination // get lease by subnetid/duid/iaid combination
l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID()); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
subnet_->getID());
ASSERT_FALSE(l); ASSERT_FALSE(l);
} }
...@@ -1301,7 +1305,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) { ...@@ -1301,7 +1305,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
OptionPtr clientid = generateClientId(); OptionPtr clientid = generateClientId();
// Check that the lease is NOT in the database // Check that the lease is NOT in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// Let's create a RELEASE // Let's create a RELEASE
...@@ -1334,7 +1339,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) { ...@@ -1334,7 +1339,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
checkMsgStatusCode(reply, STATUS_NoBinding); checkMsgStatusCode(reply, STATUS_NoBinding);
// Check that the lease is not there // Check that the lease is not there
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// CASE 2: Lease is known and belongs to this client, but to a different IAID // CASE 2: Lease is known and belongs to this client, but to a different IAID
...@@ -1356,7 +1361,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) { ...@@ -1356,7 +1361,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
checkMsgStatusCode(reply, STATUS_NoBinding); checkMsgStatusCode(reply, STATUS_NoBinding);
// Check that the lease is still there // Check that the lease is still there
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// CASE 3: Lease belongs to a client with different client-id // CASE 3: Lease belongs to a client with different client-id
...@@ -1379,7 +1384,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) { ...@@ -1379,7 +1384,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
checkMsgStatusCode(reply, STATUS_NoBinding); checkMsgStatusCode(reply, STATUS_NoBinding);
// Check that the lease is still there // Check that the lease is still there
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Finally, let's cleanup the database // Finally, let's cleanup the database
......
...@@ -377,7 +377,8 @@ public: ...@@ -377,7 +377,8 @@ public:
boost::shared_ptr<Option6IAAddr> addr) { boost::shared_ptr<Option6IAAddr> addr) {
boost::shared_ptr<Option6IA> ia = boost::dynamic_pointer_cast<Option6IA>(ia_na); boost::shared_ptr<Option6IA> ia = boost::dynamic_pointer_cast<Option6IA>(ia_na);
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(addr->getAddress()); Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr->getAddress());
if (!lease) { if (!lease) {
std::cout << "Lease for " << addr->getAddress().toText() std::cout << "Lease for " << addr->getAddress().toText()
<< " not found in the database backend."; << " not found in the database backend.";
......
...@@ -1076,7 +1076,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_renew) { ...@@ -1076,7 +1076,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_renew) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set and not using // Check that T1, T2, preferred, valid and cltt really set and not using
...@@ -1172,7 +1173,8 @@ TEST_F(HooksDhcpv6SrvTest, leaseUpdate_lease6_renew) { ...@@ -1172,7 +1173,8 @@ TEST_F(HooksDhcpv6SrvTest, leaseUpdate_lease6_renew) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set and not using // Check that T1, T2, preferred, valid and cltt really set and not using
...@@ -1262,7 +1264,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) { ...@@ -1262,7 +1264,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set and not using // Check that T1, T2, preferred, valid and cltt really set and not using
...@@ -1293,7 +1296,7 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) { ...@@ -1293,7 +1296,7 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) {
// Check that our callback was called // Check that our callback was called
EXPECT_EQ("lease6_renew", callback_name_); EXPECT_EQ("lease6_renew", callback_name_);
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
// Check that the old values are still there and they were not // Check that the old values are still there and they were not
// updated by the renewal // updated by the renewal
...@@ -1337,7 +1340,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) { ...@@ -1337,7 +1340,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Let's create a RELEASE // Let's create a RELEASE
...@@ -1375,11 +1379,12 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) { ...@@ -1375,11 +1379,12 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) {
// Check that the lease is really gone in the database // Check that the lease is really gone in the database
// get lease by address // get lease by address
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
ASSERT_FALSE(l); ASSERT_FALSE(l);
// Get lease by subnetid/duid/iaid combination // Get lease by subnetid/duid/iaid combination
l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID()); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
subnet_->getID());
ASSERT_FALSE(l); ASSERT_FALSE(l);
} }
...@@ -1416,7 +1421,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) { ...@@ -1416,7 +1421,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) {
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease)); ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Check that the lease is really in the database // Check that the lease is really in the database
Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Let's create a RELEASE // Let's create a RELEASE
...@@ -1442,11 +1448,13 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) { ...@@ -1442,11 +1448,13 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) {
// Check that the lease is still there // Check that the lease is still there
// get lease by address // get lease by address
l = LeaseMgrFactory::instance().getLease6(addr); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
addr);
ASSERT_TRUE(l); ASSERT_TRUE(l);
// Get lease by subnetid/duid/iaid combination // Get lease by subnetid/duid/iaid combination
l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID()); l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
subnet_->getID());
ASSERT_TRUE(l); ASSERT_TRUE(l);
} }
......
...@@ -222,7 +222,9 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet, ...@@ -222,7 +222,9 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
} }
// check if there's existing lease for that subnet/duid/iaid combination. // check if there's existing lease for that subnet/duid/iaid combination.
Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(*duid, iaid, subnet->getID()); /// @todo: Make this generic
Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
Lease6::LEASE_IA_NA, *duid, iaid, subnet->getID());
if (existing) { if (existing) {
// we have a lease already. This is a returning client, probably after // we have a lease already. This is a returning client, probably after
// his reboot. // his reboot.
...@@ -231,7 +233,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet, ...@@ -231,7 +233,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
// check if the hint is in pool and is available // check if the hint is in pool and is available
if (subnet->inPool(hint)) { if (subnet->inPool(hint)) {
existing = LeaseMgrFactory::instance().getLease6(hint); existing = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
hint);
if (!existing) { if (!existing) {
/// @todo: check if the hint is reserved once we have host support /// @todo: check if the hint is reserved once we have host support
/// implemented /// implemented
...@@ -284,7 +287,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet, ...@@ -284,7 +287,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
/// @todo: check if the address is reserved once we have host support /// @todo: check if the address is reserved once we have host support
/// implemented /// implemented
Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(candidate); Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
Lease6::LEASE_IA_NA, candidate);
if (!existing) { if (!existing) {
// there's no existing lease for selected candidate, so it is // there's no existing lease for selected candidate, so it is
// free. Let's allocate it. // free. Let's allocate it.
...@@ -795,7 +799,8 @@ Lease6Ptr AllocEngine::createLease6(const Subnet6Ptr& subnet, ...@@ -795,7 +799,8 @@ Lease6Ptr AllocEngine::createLease6(const Subnet6Ptr& subnet,
// It is for advertise only. We should not insert the lease into LeaseMgr, // It is for advertise only. We should not insert the lease into LeaseMgr,
// but rather check that we could have inserted it. // but rather check that we could have inserted it.
Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(addr); Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
Lease6::LEASE_IA_NA, addr);
if (!existing) { if (!existing) {
return (lease); return (lease);
} else { } else {
......
...@@ -318,9 +318,9 @@ struct Lease6 : public Lease { ...@@ -318,9 +318,9 @@ struct Lease6 : public Lease {
/// @brief Type of lease contents /// @brief Type of lease contents
typedef enum { typedef enum {
LEASE_IA_NA, /// the lease contains non-temporary IPv6 address LEASE_IA_NA = 0, /// the lease contains non-temporary IPv6 address
LEASE_IA_TA, /// the lease contains temporary IPv6 address LEASE_IA_TA = 1, /// the lease contains temporary IPv6 address
LEASE_IA_PD /// the lease contains IPv6 prefix (for prefix delegation) LEASE_IA_PD = 2 /// the lease contains IPv6 prefix (for prefix delegation)
} LeaseType; } LeaseType;
/// @brief Lease type /// @brief Lease type
...@@ -533,10 +533,12 @@ public: ...@@ -533,10 +533,12 @@ public:
/// The assumption here is that there will not be site or link-local /// The assumption here is that there will not be site or link-local
/// addresses used, so there is no way of having address duplication. /// addresses used, so there is no way of having address duplication.
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param addr address of the searched lease /// @param addr address of the searched lease
/// ///
/// @return smart pointer to the lease (or NULL if a lease is not found) /// @return smart pointer to the lease (or NULL if a lease is not found)
virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const = 0; virtual Lease6Ptr getLease6(Lease6::LeaseType type,
const isc::asiolink::IOAddress& addr) const = 0;
/// @brief Returns existing IPv6 leases for a given DUID+IA combination /// @brief Returns existing IPv6 leases for a given DUID+IA combination
/// ///
...@@ -545,22 +547,24 @@ public: ...@@ -545,22 +547,24 @@ public:
/// can be more than one. Thus return type is a container, not a single /// can be more than one. Thus return type is a container, not a single
/// pointer. /// pointer.
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param duid client DUID /// @param duid client DUID
/// @param iaid IA identifier /// @param iaid IA identifier
/// ///
/// @return smart pointer to the lease (or NULL if a lease is not found) /// @return smart pointer to the lease (or NULL if a lease is not found)
virtual Lease6Collection getLease6(const DUID& duid, virtual Lease6Collection getLease6(Lease6::LeaseType type, const DUID& duid,
uint32_t iaid) const = 0; uint32_t iaid) const = 0;
/// @brief Returns existing IPv6 lease for a given DUID+IA combination /// @brief Returns existing IPv6 lease for a given DUID+IA combination
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param duid client DUID /// @param duid client DUID
/// @param iaid IA identifier /// @param iaid IA identifier
/// @param subnet_id subnet id of the subnet the lease belongs to /// @param subnet_id subnet id of the subnet the lease belongs to
/// ///
/// @return smart pointer to the lease (or NULL if a lease is not found) /// @return smart pointer to the lease (or NULL if a lease is not found)
virtual Lease6Ptr getLease6(const DUID& duid, uint32_t iaid, virtual Lease6Ptr getLease6(Lease6::LeaseType type, const DUID& duid,
SubnetID subnet_id) const = 0; uint32_t iaid, SubnetID subnet_id) const = 0;
/// @brief Updates IPv4 lease. /// @brief Updates IPv4 lease.
/// ///
......
...@@ -46,7 +46,7 @@ Memfile_LeaseMgr::addLease(const Lease6Ptr& lease) { ...@@ -46,7 +46,7 @@ Memfile_LeaseMgr::addLease(const Lease6Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_ADD_ADDR6).arg(lease->addr_.toText()); DHCPSRV_MEMFILE_ADD_ADDR6).arg(lease->addr_.toText());
if (getLease6(lease->addr_)) { if (getLease6(lease->type_, lease->addr_)) {
// there is a lease with specified address already // there is a lease with specified address already
return (false); return (false);
} }
...@@ -186,7 +186,8 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id, ...@@ -186,7 +186,8 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id,
} }
Lease6Ptr Lease6Ptr
Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const { Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
const isc::asiolink::IOAddress& addr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_GET_ADDR6).arg(addr.toText()); DHCPSRV_MEMFILE_GET_ADDR6).arg(addr.toText());
...@@ -199,7 +200,8 @@ Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const { ...@@ -199,7 +200,8 @@ Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
} }
Lease6Collection Lease6Collection
Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const { Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
const DUID& duid, uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_GET_IAID_DUID).arg(iaid).arg(duid.toText()); DHCPSRV_MEMFILE_GET_IAID_DUID).arg(iaid).arg(duid.toText());
...@@ -207,7 +209,8 @@ Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const { ...@@ -207,7 +209,8 @@ Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const {
} }
Lease6Ptr Lease6Ptr
Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid, Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
const DUID& duid, uint32_t iaid,
SubnetID subnet_id) const { SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_GET_IAID_SUBID_DUID) DHCPSRV_MEMFILE_GET_IAID_SUBID_DUID)
......
...@@ -140,33 +140,38 @@ public: ...@@ -140,33 +140,38 @@ public:
/// This function returns a copy of the lease. The modification in the /// This function returns a copy of the lease. The modification in the
/// return lease does not affect the instance held in the lease storage. /// return lease does not affect the instance held in the lease storage.
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param addr An address of the searched lease. /// @param addr An address of the searched lease.
/// ///
/// @return smart pointer to the lease (or NULL if a lease is not found) /// @return smart pointer to the lease (or NULL if a lease is not found)
virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const; virtual Lease6Ptr getLease6(Lease6::LeaseType type,
const isc::asiolink::IOAddress& addr) const;
/// @brief Returns existing IPv6 lease for a given DUID+IA combination /// @brief Returns existing IPv6 lease for a given DUID+IA combination
/// ///
/// @todo Not implemented yet /// @todo Not implemented yet
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param duid client DUID /// @param duid client DUID
/// @param iaid IA identifier /// @param iaid IA identifier
/// ///
/// @return collection of IPv6 leases /// @return collection of IPv6 leases
virtual Lease6Collection getLease6(const DUID& duid, uint32_t iaid) const; virtual Lease6Collection getLease6(Lease6::LeaseType type,
const DUID& duid, uint32_t iaid) const;
/// @brief Returns existing IPv6 lease for a given DUID/IA/subnet-id tuple /// @brief Returns existing IPv6 lease for a given DUID/IA/subnet-id tuple
/// ///
/// This function returns a copy of the lease. The modification in the /// This function returns a copy of the lease. The modification in the
/// return lease does not affect the instance held in the lease storage. /// return lease does not affect the instance held in the lease storage.
/// ///
/// @param type specifies lease type: (NA, TA or PD)
/// @param duid client DUID /// @param duid client DUID
/// @param iaid IA identifier /// @param iaid IA identifier
/// @param subnet_id identifier of the subnet the lease must belong to /// @param subnet_id identifier of the subnet the lease must belong to
/// ///
/// @return smart pointer to the lease (or NULL if a lease is not found) /// @return smart pointer to the lease (or NULL if a lease is not found)
virtual Lease6Ptr getLease6(const DUID& duid, uint32_t iaid, virtual Lease6Ptr getLease6(Lease6::LeaseType type, const DUID& duid,
SubnetID subnet_id) const; uint32_t iaid, SubnetID subnet_id) const;
/// @brief Updates IPv4 lease. /// @brief Updates IPv4 lease.
/// ///
......
...@@ -984,8 +984,9 @@ public: ...@@ -984,8 +984,9 @@ public:
default: default:
isc_throw(BadValue, "invalid lease type returned (" << isc_throw(BadValue, "invalid lease type returned (" <<
lease_type_ << ") for lease with address " << static_cast<int>(lease_type_) << ") for lease with "
address << ". Only 0, 1, or 2 are allowed."); << "address " << address << ". Only 0, 1, or 2 are "
<< "allowed.");
} }
// Set up DUID, // Set up DUID,
...@@ -1650,7 +1651,8 @@ MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const { ...@@ -1650,7 +1651,8 @@ MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
Lease6Ptr Lease6Ptr
MySqlLeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const { MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */,
const isc::asiolink::IOAddress& addr) const {