]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5425] Renamed KnowClients
authorFrancis Dupont <fdupont@isc.org>
Thu, 14 Dec 2017 07:54:09 +0000 (08:54 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 14 Dec 2017 07:54:09 +0000 (08:54 +0100)
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/pool.cc
src/lib/dhcpsrv/pool.h
src/lib/dhcpsrv/subnet.cc
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
src/lib/dhcpsrv/tests/pool_unittest.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc

index a384dbf135b49fb47a91f55ccaa3daf89bef0d12..7e248ee92b5bdc76e628f63e772f53f64d4f7f67 100644 (file)
@@ -393,9 +393,9 @@ PoolParser::parse(PoolStoragePtr pools,
     if (known_clients) {
         string kc = known_clients->stringValue();
         if (kc == "only") {
-            pool->setKnownClients(Pool::SERVE_KNOWN);
+            pool->setServedClientKind(Pool::SERVE_KNOWN);
         } else if (kc == "never") {
-            pool->setKnownClients(Pool::SERVE_UNKNOWN);
+            pool->setServedClientKind(Pool::SERVE_UNKNOWN);
         } else
             isc_throw(DhcpConfigError, "invalid known-clients value: " << kc
                       << " (" << known_clients->getPosition() << ")");
@@ -912,9 +912,9 @@ PdPoolParser::parse(PoolStoragePtr pools, ConstElementPtr pd_pool_) {
     if (known_clients_) {
         string kc = known_clients_->stringValue();
         if (kc == "only") {
-            pool_->setKnownClients(Pool::SERVE_KNOWN);
+            pool_->setServedClientKind(Pool::SERVE_KNOWN);
         } else if (kc == "never") {
-            pool_->setKnownClients(Pool::SERVE_UNKNOWN);
+            pool_->setServedClientKind(Pool::SERVE_UNKNOWN);
         } else
             isc_throw(isc::dhcp::DhcpConfigError,
                       "invalid known-clients value: " << kc
index 9e6aca638963a5979a268d0db23b6436da830ff6..2f5a0728eb1e41d164e3dfb0f6dfef31e5e486f4 100644 (file)
@@ -141,7 +141,7 @@ Pool::toElement() const {
     }
 
     // Set known-clients
-    KnownClients kc = getKnownClients();
+    ServedClientKind kc = getServedClientKind();
     if (kc != SERVE_BOTH) {
         map->set("known-clients",
                  Element::create(kc == SERVE_KNOWN ? "only" : "never"));
index cf7aed3e8091b6b084933644d2367690ad88c771..df1488df14f7db7dd8bf3faa057f5e0f4ec44fb3 100644 (file)
@@ -33,7 +33,7 @@ public:
         SERVE_BOTH = 0,   ///< the pool serves both known and unknown clients
         SERVE_KNOWN = 1,  ///< the pool serves only known clients
         SERVE_UNKNOWN = 2 ///< the pool never serves known clients
-    } KnownClients;
+    } ServedClientKind;
 
     /// @note:
     /// PoolType enum was removed. Please use Lease::Type instead
@@ -144,12 +144,12 @@ public:
     }
 
     /// @brief Returns the value of known clients
-    KnownClients getKnownClients() const {
+    ServedClientKind getServedClientKind() const {
         return (known_clients_);
     }
 
     /// @brief Sets the value of known clients
-    void setKnownClients(KnownClients known_clients) {
+    void setServedClientKind(ServedClientKind known_clients) {
         known_clients_ = known_clients;
     }
 
@@ -243,7 +243,7 @@ protected:
     ClientClasses white_list_;
 
     /// @brief Value of known clients
-    KnownClients known_clients_;
+    ServedClientKind known_clients_;
 
     /// @brief Pointer to the user context (may be NULL)
     data::ConstElementPtr user_context_;
index 31d285c7edb393698b13260789335b3cfa5e8847..0854c52d8203a60332613bdc9fa50ef73c25d811 100644 (file)
@@ -748,7 +748,7 @@ Subnet6::toElement() const {
             pool_map->set("client-class", Element::create(*cclasses.cbegin()));
         }
         // Set known-clients
-        Pool::KnownClients kc = (*pool)->getKnownClients();
+        Pool::ServedClientKind kc = (*pool)->getServedClientKind();
         if (kc != Pool::SERVE_BOTH) {
             pool_map->set("known-clients",
                           Element::create(kc == Pool::SERVE_KNOWN ?
@@ -817,7 +817,7 @@ Subnet6::toElement() const {
             pool_map->set("client-class", Element::create(*cclasses.cbegin()));
         }
         // Set known-clients
-        Pool::KnownClients kc = pdpool->getKnownClients();
+        Pool::ServedClientKind kc = pdpool->getServedClientKind();
         if (kc != Pool::SERVE_BOTH) {
             pool_map->set("known-clients",
                           Element::create(kc == Pool::SERVE_KNOWN ?
index d0f3600d04971f6f8198a6a0beca46d35b51830e..9dc72a0e419f018953318e2d41071f1ef3850f5a 100644 (file)
@@ -365,10 +365,10 @@ TEST_F(AllocEngine4Test, IterativeAllocator_unknown) {
         alloc(new NakedAllocEngine::IterativeAllocator(Lease::TYPE_V4));
 
     // Restrict pool_ to known clients. Add a second pool for unknown clients.
-    pool_->setKnownClients(Pool::SERVE_KNOWN);
+    pool_->setServedClientKind(Pool::SERVE_KNOWN);
     Pool4Ptr pool(new Pool4(IOAddress("192.0.2.200"),
                             IOAddress("192.0.2.209")));
-    pool->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool->setServedClientKind(Pool::SERVE_UNKNOWN);
     subnet_->addPool(pool);
 
     // Clients are unknown
@@ -758,7 +758,7 @@ TEST_F(SharedNetworkAlloc4Test, discoverSharedNetworkPoolKnown) {
 
     // Apply restrictions on the pool1. This should be only assigned
     // to clients which have a reservation.
-    pool1_->setKnownClients(Pool::SERVE_KNOWN);
+    pool1_->setServedClientKind(Pool::SERVE_KNOWN);
 
     // The allocation engine should determine that the pool1 is not
     // available for the client without a reservation.
@@ -1054,7 +1054,7 @@ TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkPoolKnown) {
 
     // Apply restrictions on the pool1. This should be only assigned
     // to clients which have a reservation.
-    pool1_->setKnownClients(Pool::SERVE_KNOWN);
+    pool1_->setServedClientKind(Pool::SERVE_KNOWN);
 
     // The allocation engine should determine that the pool1 is not
     // available for the client without a reservation.
index 2b833ec8da4a24adb59bd73c3d5146add4132ffe..8b5d2b30e0519ee1be4dcda2e3aeb58eaaaba7d2 100644 (file)
@@ -226,10 +226,10 @@ TEST_F(AllocEngine6Test, IterativeAllocator_unknown) {
         alloc(new NakedAllocEngine::IterativeAllocator(Lease::TYPE_NA));
 
     // Restrict pool_ to known clients. Add a second pool for unknown clients.
-    pool_->setKnownClients(Pool::SERVE_KNOWN);
+    pool_->setServedClientKind(Pool::SERVE_KNOWN);
     Pool6Ptr pool(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::100"),
                             IOAddress("2001:db8:1::109")));
-    pool->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool->setServedClientKind(Pool::SERVE_UNKNOWN);
     subnet_->addPool(pool);
 
     // Clients are unknown
@@ -427,9 +427,9 @@ TEST_F(AllocEngine6Test, IterativeAllocatorAddrStepKnown) {
                              IOAddress("2001:db8:1::106")));
     // The pool1 serves everybody, pool2 known clients, pool3 unknown clients.
     // Set pool1 and pool3 but not pool2 in foo class
-    pool1->setKnownClients(Pool::SERVE_BOTH);
-    pool2->setKnownClients(Pool::SERVE_KNOWN);
-    pool3->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool1->setServedClientKind(Pool::SERVE_BOTH);
+    pool2->setServedClientKind(Pool::SERVE_KNOWN);
+    pool3->setServedClientKind(Pool::SERVE_UNKNOWN);
     subnet_->addPool(pool1);
     subnet_->addPool(pool2);
     subnet_->addPool(pool3);
@@ -785,9 +785,9 @@ TEST_F(AllocEngine6Test, IterativeAllocatorPrefixKnown) {
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
     Pool6Ptr pool3(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:2::"), 56, 64));
     // Set pool2 in foo
-    pool1->setKnownClients(Pool::SERVE_BOTH);
-    pool2->setKnownClients(Pool::SERVE_UNKNOWN);
-    pool3->setKnownClients(Pool::SERVE_KNOWN);
+    pool1->setServedClientKind(Pool::SERVE_BOTH);
+    pool2->setServedClientKind(Pool::SERVE_UNKNOWN);
+    pool3->setServedClientKind(Pool::SERVE_KNOWN);
     subnet_->addPool(pool1);
     subnet_->addPool(pool2);
     subnet_->addPool(pool3);
@@ -2853,7 +2853,7 @@ TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkPoolKnown) {
 
     // Apply restrictions on the pool1. This should be only assigned
     // to clients with have a reservation.
-    pool1_->setKnownClients(Pool::SERVE_KNOWN);
+    pool1_->setServedClientKind(Pool::SERVE_KNOWN);
 
     // The allocation engine should determine that the pool1 is not
     // available for the client without a reservation.
index c97c7bee84050ffdd669b37dbc5c5730fe10b9f6..7307be711331441176ccaa5619c0822856fa2f71 100644 (file)
@@ -813,7 +813,7 @@ TEST(CfgSubnets4Test, unparsePool) {
     Pool4Ptr pool1(new Pool4(IOAddress("192.0.2.1"), IOAddress("192.0.2.10")));
     Pool4Ptr pool2(new Pool4(IOAddress("192.0.2.64"), 26));
     pool2->allowClientClass("bar");
-    pool2->setKnownClients(Pool::SERVE_KNOWN);
+    pool2->setServedClientKind(Pool::SERVE_KNOWN);
 
     subnet->addPool(pool1);
     subnet->addPool(pool2);
index d12cada9569224c8266d3e7d1eeb0f58c46305e2..acf368441c473808548b41ce9202e555661c5820 100644 (file)
@@ -504,7 +504,7 @@ TEST(CfgSubnets6Test, unparsePool) {
                              IOAddress("2001:db8:1::199")));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 64));
     pool2->allowClientClass("bar");
-    pool2->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool2->setServedClientKind(Pool::SERVE_UNKNOWN);
 
     subnet->addPool(pool1);
     subnet->addPool(pool2);
@@ -552,7 +552,7 @@ TEST(CfgSubnets6Test, unparsePdPool) {
     Pool6Ptr pdpool2(new Pool6(IOAddress("2001:db8:3::"), 48, 56,
                                IOAddress("2001:db8:3::"), 64));
     pdpool2->allowClientClass("bar");
-    pdpool2->setKnownClients(Pool::SERVE_KNOWN);
+    pdpool2->setServedClientKind(Pool::SERVE_KNOWN);
 
     subnet->addPool(pdpool1);
     subnet->addPool(pdpool2);
index bc54a7ed0b25276af205c8cba524004daf1669e6..45f1b601d25ba3055c42986ce453dab5c2dba7ab 100644 (file)
@@ -275,11 +275,11 @@ TEST(Pool4Test, knownClients) {
                             IOAddress("192.0.2.255")));
 
     // This pool serves everybody by default.
-    EXPECT_EQ(Pool::SERVE_BOTH, pool->getKnownClients());
+    EXPECT_EQ(Pool::SERVE_BOTH, pool->getServedClientKind());
 
     // Set it to only known clients.
-    pool->setKnownClients(Pool::SERVE_KNOWN);
-    EXPECT_EQ(Pool::SERVE_KNOWN,pool->getKnownClients());
+    pool->setServedClientKind(Pool::SERVE_KNOWN);
+    EXPECT_EQ(Pool::SERVE_KNOWN,pool->getServedClientKind());
 }
 
 // This test checks that handling for last allocated address/prefix is valid.
@@ -693,11 +693,11 @@ TEST(Pool6Test, knownClients) {
                IOAddress("2001:db8::2"));
 
     // This pool serves everybody by default.
-    EXPECT_EQ(Pool::SERVE_BOTH, pool.getKnownClients());
+    EXPECT_EQ(Pool::SERVE_BOTH, pool.getServedClientKind());
 
     // Set it to only known clients.
-    pool.setKnownClients(Pool::SERVE_KNOWN);
-    EXPECT_EQ(Pool::SERVE_KNOWN,pool.getKnownClients());
+    pool.setServedClientKind(Pool::SERVE_KNOWN);
+    EXPECT_EQ(Pool::SERVE_KNOWN,pool.getServedClientKind());
 }
 
 // This test checks that handling for last allocated address/prefix is valid.
index 272600088dd9e7a3cb2e01624cf26f085819b28d..1d61d76d7ad896aa4a0f1bcb96475f32f6fcfa03 100644 (file)
@@ -267,10 +267,10 @@ TEST(Subnet4Test, pool4InSubnet4) {
     EXPECT_EQ(mypool, pool3);
 
     // And now known clients
-    EXPECT_EQ(Pool::SERVE_BOTH, pool1->getKnownClients());
-    pool2->setKnownClients(Pool::SERVE_KNOWN);
-    pool3->setKnownClients(Pool::SERVE_UNKNOWN);
-    pool4->setKnownClients(Pool::SERVE_UNKNOWN);
+    EXPECT_EQ(Pool::SERVE_BOTH, pool1->getServedClientKind());
+    pool2->setServedClientKind(Pool::SERVE_KNOWN);
+    pool3->setServedClientKind(Pool::SERVE_UNKNOWN);
+    pool4->setServedClientKind(Pool::SERVE_UNKNOWN);
 
     ASSERT_NO_THROW(mypool = subnet->getPool(Lease::TYPE_V4, no_class, false,
                                              IOAddress("192.1.2.64")));
@@ -363,9 +363,9 @@ TEST(Subnet4Test, getCapacity) {
     EXPECT_EQ(200, subnet->getPoolCapacity(Lease::TYPE_V4, three_classes, false));
 
     // And now known clients
-    EXPECT_EQ(Pool::SERVE_BOTH, pool1->getKnownClients());
-    pool2->setKnownClients(Pool::SERVE_KNOWN);
-    pool3->setKnownClients(Pool::SERVE_UNKNOWN);
+    EXPECT_EQ(Pool::SERVE_BOTH, pool1->getServedClientKind());
+    pool2->setServedClientKind(Pool::SERVE_KNOWN);
+    pool3->setServedClientKind(Pool::SERVE_UNKNOWN);
 
     EXPECT_EQ(132, subnet->getPoolCapacity(Lease::TYPE_V4, no_class, false));
     EXPECT_EQ(196, subnet->getPoolCapacity(Lease::TYPE_V4, no_class, true));
@@ -609,7 +609,7 @@ TEST(Subnet4Test, inRangeinPool) {
     EXPECT_TRUE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.3.4"), three_classes, false));
 
     // Add known clients
-    pool1->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool1->setServedClientKind(Pool::SERVE_UNKNOWN);
     EXPECT_TRUE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.3.4"), three_classes, false));
     EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.3.4"), three_classes, true));
 }
@@ -843,7 +843,7 @@ TEST(Subnet6Test, Pool6getCapacity) {
               subnet->getPoolCapacity(Lease::TYPE_NA, three_classes, false));
 
     // Add known clients
-    pool2->setKnownClients(Pool::SERVE_KNOWN);
+    pool2->setServedClientKind(Pool::SERVE_KNOWN);
     EXPECT_EQ(uint64_t(65536),
               subnet->getPoolCapacity(Lease::TYPE_NA, no_class, false));
     EXPECT_EQ(uint64_t(4294967296ull + 65536),
@@ -964,7 +964,7 @@ TEST(Subnet6Test, Pool6InSubnet6) {
     EXPECT_EQ(mypool, pool3);
 
     // Add know cients
-    pool3->setKnownClients(Pool::SERVE_UNKNOWN);
+    pool3->setServedClientKind(Pool::SERVE_UNKNOWN);
     mypool = subnet->getPool(Lease::TYPE_NA, no_class, false,
                              IOAddress("2001:db8:1:3::dead:beef"));    
     EXPECT_FALSE(mypool);
@@ -1502,7 +1502,7 @@ TEST(Subnet6Test, inRangeinPool) {
     EXPECT_TRUE(subnet->inPool(Lease::TYPE_NA, IOAddress("2001:db8::18"), three_classes, false));
 
     // Add known clients
-    pool1->setKnownClients(Pool::SERVE_KNOWN);
+    pool1->setServedClientKind(Pool::SERVE_KNOWN);
     EXPECT_FALSE(subnet->inPool(Lease::TYPE_NA, IOAddress("2001:db8::18"), three_classes, false));
     EXPECT_TRUE(subnet->inPool(Lease::TYPE_NA, IOAddress("2001:db8::18"), three_classes, true));
 }