]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2324] Changes after review (including compilation fixes for Sol, Fedora and Mac OS)
authorTomek Mrugalski <tomasz@isc.org>
Mon, 29 Oct 2012 11:02:24 +0000 (12:02 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 29 Oct 2012 11:02:24 +0000 (12:02 +0100)
ChangeLog
src/lib/dhcp/alloc_engine.h
src/lib/dhcp/lease_mgr.h
src/lib/dhcp/tests/alloc_engine_unittest.cc
src/lib/dhcp/tests/memfile_lease_mgr.cc
src/lib/dhcp/tests/memfile_lease_mgr.h

index 9e76a18744f4c3c0526a6fd0e72f23c196103ab7..6ec7aec8bb068790f8ee90c291df654aead57770 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+4XX.   [func]          tomek
+       DHCPv6 Allocation Engine implemented. It allows address allocation
+       from the configured subnets/pools. It currently features a single
+       allocator: IterativeAllocator, which assigns addresses iteratively.
+       Other allocators (hashed, random) are planned.
+       (Trac #2324, git TBD)
+
 494.   [bug]           jinmei
        Fixed a problem that shutting down BIND 10 kept some of the
        processes alive.  It was two-fold: when the main bind10 process
index 74e30dd8b028568dff80c2c29fdc378336acb8db..496703a96c57ed7e8ba2b11aead1beb2b73f106d 100644 (file)
@@ -67,6 +67,10 @@ protected:
         virtual isc::asiolink::IOAddress
         pickAddress(const Subnet6Ptr& subnet, const DuidPtr& duid,
                     const isc::asiolink::IOAddress& hint) = 0;
+
+        /// @brief virtual destructor
+        virtual ~Allocator() {
+        }
     protected:
     };
 
index 7541a15f7b191a498212d4597607ebe0f2348ca2..e859deaf64a6cfa235c66d669e30d3c61c53684b 100644 (file)
@@ -398,7 +398,7 @@ public:
     /// @param addr address of the searched lease
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(isc::asiolink::IOAddress addr) const = 0;
+    virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const = 0;
 
     /// @brief Returns existing IPv6 leases for a given DUID+IA combination
     ///
@@ -450,7 +450,7 @@ public:
     /// @param addr IPv4 address of the lease to be deleted.
     ///
     /// @return true if deletion was successful, false if no such lease exists
-    virtual bool deleteLease6(isc::asiolink::IOAddress addr) = 0;
+    virtual bool deleteLease6(const isc::asiolink::IOAddress& addr) = 0;
 
     /// @brief Returns backend name.
     ///
index b50a2c56ae239ec72aacfc25d81c0eaa46ac0031..bbb4bbd9e99a5ee937594650b8fa5a9d15409c24 100644 (file)
@@ -22,6 +22,7 @@
 #include <boost/shared_ptr.hpp>
 #include <iostream>
 #include <sstream>
+#include <map>
 #include <gtest/gtest.h>
 
 using namespace std;
@@ -35,6 +36,9 @@ namespace {
 
 class NakedAllocEngine : public AllocEngine {
 public:
+    NakedAllocEngine(AllocEngine::AllocType engine_type, unsigned int attempts)
+        :AllocEngine(engine_type, attempts) {
+    }
     using AllocEngine::Allocator;
     using AllocEngine::IterativeAllocator;
 };
@@ -308,7 +312,7 @@ TEST_F(AllocEngineTest, IterativeAllocator_manyPools) {
                           // there are 8 extra pools with 9 addresses in each.
 
     // Let's keep picked addresses here and check their uniqueness.
-    map<IOAddress, int> generated_addrs;
+    std::map<IOAddress, int> generated_addrs;
     int cnt = 0;
     while (++cnt) {
         IOAddress candidate = alloc->pickAddress(subnet_, duid_, IOAddress("::"));
index ac3316d6ca44512c1881b74551dccc2f00184f19..195fd8bb97e9f9bc53ce0ee8474f1e014e6ced8d 100644 (file)
@@ -65,7 +65,7 @@ Lease4Collection Memfile_LeaseMgr::getLease4(const ClientId& ) const {
     return (Lease4Collection());
 }
 
-Lease6Ptr Memfile_LeaseMgr::getLease6(isc::asiolink::IOAddress addr) const {
+Lease6Ptr Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
     Lease6Storage::iterator l = storage6_.find(addr);
     if (l == storage6_.end()) {
         return (Lease6Ptr());
@@ -95,7 +95,7 @@ bool Memfile_LeaseMgr::deleteLease4(uint32_t ) {
     return (false);
 }
 
-bool Memfile_LeaseMgr::deleteLease6(isc::asiolink::IOAddress addr) {
+bool Memfile_LeaseMgr::deleteLease6(const isc::asiolink::IOAddress& addr) {
     Lease6Storage::iterator l = storage6_.find(addr);
     if (l == storage6_.end()) {
         // no such lease
index 666db6ace7ca4cb327adea8f149dd3e132695d42..c5a41e6c7fe9780e9af5b6ddaaec94b34b22ac9a 100644 (file)
@@ -132,7 +132,7 @@ public:
     /// @param addr address of the searched lease
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    Lease6Ptr getLease6(isc::asiolink::IOAddress addr) const;
+    Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const;
 
     /// @brief Returns existing IPv6 lease for a given DUID+IA combination
     ///
@@ -187,12 +187,12 @@ public:
     /// @param addr IPv4 address of the lease to be deleted.
     ///
     /// @return true if deletion was successful, false if no such lease exists
-    bool deleteLease6(isc::asiolink::IOAddress addr);
+    bool deleteLease6(const isc::asiolink::IOAddress& addr);
 
     /// @brief Returns backend name.
     ///
     /// Each backend have specific name, e.g. "mysql" or "sqlite".
-    std::string getName() const { return "memfile"; }
+    std::string getName() const { return ("memfile"); }
 
     /// @brief Returns description of the backend.
     ///
@@ -200,7 +200,7 @@ public:
     std::string getDescription() const;
 
     /// @brief Returns backend version.
-    std::string getVersion() const { return "test-version"; }
+    std::string getVersion() const { return ("test-version"); }
 
     using LeaseMgr::getParameter;