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() << ")");
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
}
// Set known-clients
- KnownClients kc = getKnownClients();
+ ServedClientKind kc = getServedClientKind();
if (kc != SERVE_BOTH) {
map->set("known-clients",
Element::create(kc == SERVE_KNOWN ? "only" : "never"));
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
}
/// @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;
}
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_;
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 ?
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 ?
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
// 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.
// 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.
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
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);
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);
// 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.
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);
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);
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);
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.
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.
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")));
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));
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));
}
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),
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);
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));
}