From: Francis Dupont Date: Thu, 14 Dec 2017 07:54:09 +0000 (+0100) Subject: [5425] Renamed KnowClients X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eab80eb4bc0d63ee05bb28575ab23597fa2a1947;p=thirdparty%2Fkea.git [5425] Renamed KnowClients --- diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index a384dbf135..7e248ee92b 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -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 diff --git a/src/lib/dhcpsrv/pool.cc b/src/lib/dhcpsrv/pool.cc index 9e6aca6389..2f5a0728eb 100644 --- a/src/lib/dhcpsrv/pool.cc +++ b/src/lib/dhcpsrv/pool.cc @@ -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")); diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h index cf7aed3e80..df1488df14 100644 --- a/src/lib/dhcpsrv/pool.h +++ b/src/lib/dhcpsrv/pool.h @@ -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_; diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc index 31d285c7ed..0854c52d82 100644 --- a/src/lib/dhcpsrv/subnet.cc +++ b/src/lib/dhcpsrv/subnet.cc @@ -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 ? diff --git a/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc index d0f3600d04..9dc72a0e41 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc @@ -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. diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc index 2b833ec8da..8b5d2b30e0 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc @@ -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. diff --git a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc index c97c7bee84..7307be7113 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc @@ -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); diff --git a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc index d12cada956..acf368441c 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc @@ -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); diff --git a/src/lib/dhcpsrv/tests/pool_unittest.cc b/src/lib/dhcpsrv/tests/pool_unittest.cc index bc54a7ed0b..45f1b601d2 100644 --- a/src/lib/dhcpsrv/tests/pool_unittest.cc +++ b/src/lib/dhcpsrv/tests/pool_unittest.cc @@ -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. diff --git a/src/lib/dhcpsrv/tests/subnet_unittest.cc b/src/lib/dhcpsrv/tests/subnet_unittest.cc index 272600088d..1d61d76d7a 100644 --- a/src/lib/dhcpsrv/tests/subnet_unittest.cc +++ b/src/lib/dhcpsrv/tests/subnet_unittest.cc @@ -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)); }