}
if (parked_packet_limit) {
- const auto& parking_lot =
+ auto const& parking_lot =
ServerHooks::getServerHooks().getParkingLotPtr(hook_label);
if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-addresses"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
StatsMgr::generateName("subnet", lease->subnet_id_, "declined-addresses"),
static_cast<int64_t>(1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
static_cast<int64_t>(1));
}
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
checkSubnet(const CollectionType& col, std::string subnet,
uint32_t t1, uint32_t t2, uint32_t valid,
uint32_t min_valid = 0, uint32_t max_valid = 0) {
- const auto& index = col.template get<SubnetPrefixIndexTag>();
+ auto const& index = col.template get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet);
if (subnet_it == index.cend()) {
ADD_FAILURE() << "Unable to find expected subnet " << subnet;
string file = path + "/" + example;
files.push_back(file);
}
- for (const auto& file : files) {
+ for (auto const& file : files) {
string label("Checking configuration from file: ");
label += file;
SCOPED_TRACE(label);
ASSERT_FALSE(client.getContext().response_);
// Verify we have a packet parked.
- const auto& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("leases4_committed");
+ auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("leases4_committed");
ASSERT_TRUE(parking_lot);
ASSERT_EQ(1, parking_lot->size());
ASSERT_FALSE(client.getContext().response_);
// Verify we have a packet parked.
- const auto& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("lease4_offer");
+ auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("lease4_offer");
ASSERT_TRUE(parking_lot);
ASSERT_EQ(1, parking_lot->size());
}
if (parked_packet_limit) {
- const auto& parking_lot = ServerHooks::getServerHooks().
+ auto const& parking_lot = ServerHooks::getServerHooks().
getParkingLotPtr("leases6_committed");
if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
// We can't park it so we're going to throw it on the floor.
// Secondly, pool specific options. Pools are defined within a subnet, so
// if there is no subnet, there is nothing to do.
if (ctx.subnet_) {
- for (const auto& resource : ctx.allocated_resources_) {
+ for (auto const& resource : ctx.allocated_resources_) {
PoolPtr pool =
ctx.subnet_->getPool(resource.getPrefixLength() == 128 ?
Lease::TYPE_NA : Lease::TYPE_PD,
// responses in answer message (ADVERTISE or REPLY).
//
// @todo: IA_TA once we implement support for temporary addresses.
- for (const auto& opt : question->options_) {
+ for (auto const& opt : question->options_) {
switch (opt.second->getType()) {
case D6O_IA_NA: {
OptionPtr answer_opt = assignIA_NA(question, ctx,
// Save the originally selected subnet.
Subnet6Ptr orig_subnet = ctx.subnet_;
- for (const auto& opt : query->options_) {
+ for (auto const& opt : query->options_) {
switch (opt.second->getType()) {
case D6O_IA_NA: {
OptionPtr answer_opt = extendIA_NA(query, ctx,
// handled properly. Therefore the releaseIA_NA and releaseIA_PD options
// may turn the status code to some error, but can't turn it back to success.
int general_status = STATUS_Success;
- for (const auto& opt : release->options_) {
+ for (auto const& opt : release->options_) {
Lease6Ptr old_lease;
switch (opt.second->getType()) {
case D6O_IA_NA: {
StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-nas"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
StatsMgr::generateName("subnet", lease->subnet_id_, "assigned-pds"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_PD, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_PD, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
// may turn the status code to some error, but can't turn it back to success.
int general_status = STATUS_Success;
- for (const auto& opt : decline->options_) {
+ for (auto const& opt : decline->options_) {
switch (opt.second->getType()) {
case D6O_IA_NA: {
OptionPtr answer_opt = declineIA(decline, ctx.duid_, general_status,
StatsMgr::generateName("subnet", lease->subnet_id_, "declined-addresses"),
static_cast<int64_t>(1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_NA, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
void Dhcpv6Srv::classifyByVendor(const Pkt6Ptr& pkt) {
OptionVendorClassPtr vclass;
- for (const auto& opt : pkt->getOptions(D6O_VENDOR_CLASS)) {
+ for (auto const& opt : pkt->getOptions(D6O_VENDOR_CLASS)) {
vclass = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
if (!vclass || vclass->getTuplesNum() == 0) {
continue;
}
// And finish by pools
- for (const auto& resource : ctx.allocated_resources_) {
+ for (auto const& resource : ctx.allocated_resources_) {
PoolPtr pool =
ctx.subnet_->getPool(resource.getPrefixLength() == 128 ?
Lease::TYPE_NA : Lease::TYPE_PD,
uint32_t t1, uint32_t t2, uint32_t pref, uint32_t valid,
uint32_t min_pref = 0, uint32_t max_pref = 0,
uint32_t min_valid = 0, uint32_t max_valid = 0) {
- const auto& index = col.template get<SubnetPrefixIndexTag>();
+ auto const& index = col.template get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet);
if (subnet_it == index.cend()) {
ADD_FAILURE() << "Unable to find expected subnet " << subnet;
// Get all options in the reply message and pick IA_NA, IA_PD and
// Status code.
- for (const auto& opt : reply->options_) {
+ for (auto const& opt : reply->options_) {
Option6IAPtr ia = boost::dynamic_pointer_cast<Option6IA>(opt.second);
if (!ia) {
// This is not IA, so let's just store it.
continue;
}
- const auto& ia_opts = ia->getOptions();
- for (const auto& iter_ia_opt : ia_opts) {
+ auto const& ia_opts = ia->getOptions();
+ for (auto const& iter_ia_opt : ia_opts) {
OptionPtr ia_opt = iter_ia_opt.second;
Lease6 lease;
lease.type_ = (ia->getType() == D6O_IA_NA ? Lease::TYPE_NA : Lease::TYPE_PD);
}
// Get all options in the response message and pick IA_NA, IA_PD.
- for (const auto& opt : context_.response_->options_) {
+ for (auto const& opt : context_.response_->options_) {
Option6IAPtr ia = boost::dynamic_pointer_cast<Option6IA>(opt.second);
if (!ia) {
// This is not IA, so let's just skip it.
string file = path + "/" + example;
files.push_back(file);
}
- for (const auto& file : files) {
+ for (auto const& file : files) {
string label("Checking configuration from file: ");
label += file;
SCOPED_TRACE(label);
ASSERT_NO_THROW(configure(config, *srv_));
// Verify we have no packets parked.
- const auto& parking_lot = ServerHooks::getServerHooks()
+ auto const& parking_lot = ServerHooks::getServerHooks()
.getParkingLotPtr("leases6_committed");
ASSERT_TRUE(parking_lot);
ASSERT_EQ(0, parking_lot->size());
std::set<std::string> current;
// addresses were already checked in validateIA
// we can safely assume that those are correct
- for (const auto& opt : pkt6->options_) {
+ for (auto const& opt : pkt6->options_) {
switch (opt.second->getType()) {
case D6O_IA_PD: {
// add address and check if it has not been already assigned
}
}
for (auto const& pair : getSubOptionConfigMap()) {
- for (const auto& sub_pair : pair.second) {
+ for (auto const& sub_pair : pair.second) {
const SubOptionConfigPtr& sub_cfg = sub_pair.second;
uint16_t sub_code = sub_cfg->getCode();
uint16_t opt_code = sub_cfg->getContainerCode();
}
// Get the HA configuration.
- const auto& config_vec = config->listValue();
+ auto const& config_vec = config->listValue();
if (config_vec.empty()) {
isc_throw(ConfigError, "a list of HA configurations must not be empty");
}
rel_config->setRestrictCommands(getBoolean(config, "restrict-commands"));
// Peers configuration parsing.
- const auto& peers_vec = peers->listValue();
+ auto const& peers_vec = peers->listValue();
// Go over configuration of each peer.
for (auto p = peers_vec.begin(); p != peers_vec.end(); ++p) {
// Per state configuration is optional.
if (states_list) {
- const auto& states_vec = states_list->listValue();
+ auto const& states_vec = states_list->listValue();
std::set<int> configured_states;
}
// Iterate over the leases and update the database as appropriate.
- const auto& leases_element = leases->listValue();
+ auto const& leases_element = leases->listValue();
LOG_INFO(ha_logger, HA_LEASES_SYNC_LEASE_PAGE_RECEIVED)
.arg(config_->getThisServerName())
// identifier has been specified.
OptionPtr opt_client_id = query4->getOption(DHO_DHCP_CLIENT_IDENTIFIER);
if (opt_client_id && !opt_client_id->getData().empty()) {
- const auto& client_id_key = opt_client_id->getData();
+ auto const& client_id_key = opt_client_id->getData();
lb_hash = loadBalanceHash(&client_id_key[0], client_id_key.size());
} else {
// Compute the hash by DUID if the DUID.
OptionPtr opt_duid = query6->getOption(D6O_CLIENTID);
if (opt_duid && !opt_duid->getData().empty()) {
- const auto& duid_key = opt_duid->getData();
+ auto const& duid_key = opt_duid->getData();
lb_hash = loadBalanceHash(&duid_key[0], duid_key.size());
} else {
EXPECT_NO_THROW(mapper.map("server3", rel2));
EXPECT_NO_THROW(mapper.map("server4", rel2));
- const auto& all = mapper.getAll();
+ auto const& all = mapper.getAll();
EXPECT_EQ(2, all.size());
EXPECT_EQ(rel1, all[0]);
EXPECT_EQ(rel2, all[1]);
static_cast<int64_t>(1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
static_cast<int64_t>(1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
static_cast<int64_t>(1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
static_cast<int64_t>(1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
static_cast<int64_t>(-1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
static_cast<int64_t>(-1));
PoolPtr pool;
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
if (v4) {
Lease4Collection leases =
LeaseMgrFactory::instance().getLeases4((*subnet_id)->intValue());
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
} else {
Lease6Collection leases =
LeaseMgrFactory::instance().getLeases6((*subnet_id)->intValue());
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
// There is no 'subnets' argument so let's return all leases.
if (v4) {
Lease4Collection leases = LeaseMgrFactory::instance().getLeases4();
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
} else {
Lease6Collection leases = LeaseMgrFactory::instance().getLeases6();
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
LeasePageSize(page_limit_value));
// Convert leases into JSON list.
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
LeaseMgrFactory::instance().getLeases6(*from_address,
LeasePageSize(page_limit_value));
// Convert leases into JSON list.
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
Lease4Collection leases =
LeaseMgrFactory::instance().getLease4(hwaddr);
ElementPtr leases_json = Element::createList();
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
Lease4Collection leases =
LeaseMgrFactory::instance().getLease4(*clientid);
ElementPtr leases_json = Element::createList();
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
Lease6Collection leases =
LeaseMgrFactory::instance().getLeases6(duid_);
ElementPtr leases_json = Element::createList();
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
Lease4Collection leases =
LeaseMgrFactory::instance().getLeases4(hostname_);
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
Lease6Collection leases =
LeaseMgrFactory::instance().getLeases6(hostname_);
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
ElementPtr lease_json = lease->toElement();
leases_json->add(lease_json);
}
auto leases_list = deleted_leases->listValue();
// Iterate over leases to be deleted.
- for (const auto& lease_params : leases_list) {
+ for (auto const& lease_params : leases_list) {
// Parsing the lease may throw and it means that the lease
// information is malformed.
Parameters p = getParameters(true, lease_params);
// Iterate over all leases.
auto leases_list = leases->listValue();
- for (const auto& lease_params : leases_list) {
+ for (auto const& lease_params : leases_list) {
Lease6Parser parser;
bool force_update;
if (!parsed_deleted_list.empty()) {
// Iterate over leases to be deleted.
- for (const auto& lease_params_pair : parsed_deleted_list) {
+ for (auto const& lease_params_pair : parsed_deleted_list) {
// This part is outside of the try-catch because an exception
// indicates that the command is malformed.
ConstSrvConfigPtr config = CfgMgr::instance().getCurrentCfg();
// Iterate over all leases.
- for (const auto& lease : parsed_leases_list) {
+ for (auto const& lease : parsed_leases_list) {
auto result = CONTROL_RESULT_SUCCESS;
std::ostringstream text;
auto const& sub = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(id);
if (sub) {
- for (const auto& pool : sub->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_V4)) {
const std::string& name_aa(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pool", pool->getID(),
"assigned-addresses")));
const Subnet4Collection* subs = subnets->getAll();
// Go over all subnets and wipe leases in each of them.
- for (const auto& sub : *subs) {
+ for (auto const& sub : *subs) {
num += LeaseMgrFactory::instance().wipeLeases4(sub->getID());
ids << " " << sub->getID();
StatsMgr::instance().setValue(
StatsMgr::generateName("subnet", sub->getID(), "declined-addresses"),
static_cast<int64_t>(0));
- for (const auto& pool : sub->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_V4)) {
const std::string& name_aa(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pool", pool->getID(),
"assigned-addresses")));
auto const& sub = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(id);
if (sub) {
- for (const auto& pool : sub->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_NA)) {
const std::string& name_anas(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pool", pool->getID(),
"assigned-nas")));
}
}
- for (const auto& pool : sub->getPools(Lease::TYPE_PD)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_PD)) {
const std::string& name_apds(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pd-pool", pool->getID(),
"assigned-pds")));
const Subnet6Collection* subs = subnets->getAll();
// Go over all subnets and wipe leases in each of them.
- for (const auto& sub : *subs) {
+ for (auto const& sub : *subs) {
num += LeaseMgrFactory::instance().wipeLeases6(sub->getID());
ids << " " << sub->getID();
StatsMgr::instance().setValue(
StatsMgr::generateName("subnet", sub->getID(), "declined-addresses"),
static_cast<int64_t>(0));
- for (const auto& pool : sub->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_NA)) {
const std::string& name_anas(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pool", pool->getID(),
"assigned-nas")));
}
}
- for (const auto& pool : sub->getPools(Lease::TYPE_PD)) {
+ for (auto const& pool : sub->getPools(Lease::TYPE_PD)) {
const std::string& name_apds(StatsMgr::generateName("subnet", sub->getID(),
StatsMgr::generateName("pd-pool", pool->getID(),
"assigned-pds")));
// Create JSON list of required classes.
ElementPtr required_classes_element = Element::createList();
- const auto& required_classes = subnet->getRequiredClasses();
+ auto const& required_classes = subnet->getRequiredClasses();
for (auto required_class = required_classes.cbegin();
required_class != required_classes.cend();
++required_class) {
MySqlBinding::createTimestamp(subnet->getModificationTime()));
// (Re)create pools.
- for (const auto& pool : subnet->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : subnet->getPools(Lease::TYPE_V4)) {
createPool4(server_selector, boost::dynamic_pointer_cast<Pool4>(pool),
subnet);
}
// (Re)create options.
auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
uint64_t pool_id = mysql_insert_id(conn_.mysql_);
auto option_spaces = pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// (Re)create options.
auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
MySqlBinding::createTimestamp(client_class->getModificationTime()));
// Iterate over the captured dependencies and try to insert them into the database.
- for (const auto& dependency : dependencies) {
+ for (auto const& dependency : dependencies) {
try {
MySqlBindingCollection in_dependency_bindings = {
MySqlBinding::createString(client_class->getName()),
if (client_class->getCfgOptionDef()) {
auto option_defs = client_class->getCfgOptionDef()->getContainer();
auto option_spaces = option_defs.getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionDefContainerPtr defs = option_defs.getItems(option_space);
for (auto def = defs->begin(); def != defs->end(); ++def) {
createUpdateOptionDef4(server_selector, *def, client_class->getName());
// (Re)create options.
auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
}
// Iterate over the configured DBs and instantiate them.
- for (const auto& db : config_ctl->getConfigDatabases()) {
+ for (auto const& db : config_ctl->getConfigDatabases()) {
const std::string& access = db.getAccessString();
auto parameters = db.getParameters();
if (ConfigBackendDHCPv4Mgr::instance().delBackend(parameters["type"], access, true)) {
// Create JSON list of required classes.
ElementPtr required_classes_element = Element::createList();
- const auto& required_classes = subnet->getRequiredClasses();
+ auto const& required_classes = subnet->getRequiredClasses();
for (auto required_class = required_classes.cbegin();
required_class != required_classes.cend();
++required_class) {
MySqlBinding::createTimestamp(subnet->getModificationTime()));
// (Re)create pools.
- for (const auto& pool : subnet->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : subnet->getPools(Lease::TYPE_NA)) {
createPool6(server_selector, boost::dynamic_pointer_cast<Pool6>(pool),
subnet);
}
// (Re)create pd pools.
- for (const auto& pd_pool : subnet->getPools(Lease::TYPE_PD)) {
+ for (auto const& pd_pool : subnet->getPools(Lease::TYPE_PD)) {
createPdPool6(server_selector, boost::dynamic_pointer_cast<Pool6>(pd_pool),
subnet);
}
// (Re)create options.
auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
uint64_t pool_id = mysql_insert_id(conn_.mysql_);
auto option_spaces = pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
uint64_t pd_pool_id = mysql_insert_id(conn_.mysql_);
auto option_spaces = pd_pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pd_pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// (Re)create options.
auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
MySqlBinding::createTimestamp(client_class->getModificationTime()));
// Iterate over the captured dependencies and try to insert them into the database.
- for (const auto& dependency : dependencies) {
+ for (auto const& dependency : dependencies) {
try {
MySqlBindingCollection in_dependency_bindings = {
MySqlBinding::createString(client_class->getName()),
if (client_class->getCfgOptionDef()) {
auto option_defs = client_class->getCfgOptionDef()->getContainer();
auto option_spaces = option_defs.getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionDefContainerPtr defs = option_defs.getItems(option_space);
for (auto def = defs->begin(); def != defs->end(); ++def) {
createUpdateOptionDef6(server_selector, *def, client_class->getName());
// (Re)create options.
auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
}
// Iterate over the configured DBs and instantiate them.
- for (const auto& db : config_ctl->getConfigDatabases()) {
+ for (auto const& db : config_ctl->getConfigDatabases()) {
const std::string& access = db.getAccessString();
auto parameters = db.getParameters();
if (ConfigBackendDHCPv6Mgr::instance().delBackend(parameters["type"], access, true)) {
MySqlBindingPtr
MySqlConfigBackendImpl::createInputRelayBinding(const NetworkPtr& network) {
ElementPtr relay_element = Element::createList();
- const auto& addresses = network->getRelayAddresses();
+ auto const& addresses = network->getRelayAddresses();
if (!addresses.empty()) {
- for (const auto& address : addresses) {
+ for (auto const& address : addresses) {
relay_element->add(Element::create(address.toText()));
}
}
db::MySqlBindingPtr createInputRequiredClassesBinding(const T& object) {
// Create JSON list of required classes.
data::ElementPtr required_classes_element = data::Element::createList();
- const auto& required_classes = object->getRequiredClasses();
+ auto const& required_classes = object->getRequiredClasses();
for (auto required_class = required_classes.cbegin();
required_class != required_classes.cend();
++required_class) {
server_selector, attach_bindings);
// (Re)create pools.
- for (const auto& pool : subnet->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : subnet->getPools(Lease::TYPE_V4)) {
createPool4(server_selector, boost::dynamic_pointer_cast<Pool4>(pool),
subnet);
}
// (Re)create options.
auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// Add the pool's options.
auto option_spaces = pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// (Re)create options.
auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
server_selector, attach_bindings);
// Iterate over the captured dependencies and try to insert them into the database.
- for (const auto& dependency : dependencies) {
+ for (auto const& dependency : dependencies) {
try {
PsqlBindArray in_dependency_bindings;
in_dependency_bindings.add(class_name);
if (client_class->getCfgOptionDef()) {
auto option_defs = client_class->getCfgOptionDef()->getContainer();
auto option_spaces = option_defs.getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionDefContainerPtr defs = option_defs.getItems(option_space);
for (auto def = defs->begin(); def != defs->end(); ++def) {
createUpdateOptionDef4(server_selector, *def, client_class->getName());
// (Re)create options.
auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
}
// Iterate over the configured DBs and instantiate them.
- for (const auto& db : config_ctl->getConfigDatabases()) {
+ for (auto const& db : config_ctl->getConfigDatabases()) {
const std::string& access = db.getAccessString();
auto parameters = db.getParameters();
if (ConfigBackendDHCPv4Mgr::instance().delBackend(parameters["type"], access, true)) {
server_selector, attach_bindings);
// (Re)create pools.
- for (const auto& pool : subnet->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : subnet->getPools(Lease::TYPE_NA)) {
createPool6(server_selector, boost::dynamic_pointer_cast<Pool6>(pool),
subnet);
}
// (Re)create pd pools.
- for (const auto& pd_pool : subnet->getPools(Lease::TYPE_PD)) {
+ for (auto const& pd_pool : subnet->getPools(Lease::TYPE_PD)) {
createPdPool6(server_selector, boost::dynamic_pointer_cast<Pool6>(pd_pool),
subnet);
}
// (Re)create options.
auto option_spaces = subnet->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = subnet->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// Add the pool's options.
auto option_spaces = pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// Add the pool's options.
auto option_spaces = pd_pool->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = pd_pool->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
// (Re)create options.
auto option_spaces = shared_network->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = shared_network->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
server_selector, attach_bindings);
// Iterate over the captured dependencies and try to insert them into the database.
- for (const auto& dependency : dependencies) {
+ for (auto const& dependency : dependencies) {
try {
PsqlBindArray in_dependency_bindings;
in_dependency_bindings.add(class_name);
if (client_class->getCfgOptionDef()) {
auto option_defs = client_class->getCfgOptionDef()->getContainer();
auto option_spaces = option_defs.getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionDefContainerPtr defs = option_defs.getItems(option_space);
for (auto def = defs->begin(); def != defs->end(); ++def) {
createUpdateOptionDef6(server_selector, *def, client_class->getName());
// (Re)create options.
auto option_spaces = client_class->getCfgOption()->getOptionSpaceNames();
- for (const auto& option_space : option_spaces) {
+ for (auto const& option_space : option_spaces) {
OptionContainerPtr options = client_class->getCfgOption()->getAll(option_space);
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy = OptionDescriptor::create(*desc);
}
// Iterate over the configured DBs and instantiate them.
- for (const auto& db : config_ctl->getConfigDatabases()) {
+ for (auto const& db : config_ctl->getConfigDatabases()) {
const std::string& access = db.getAccessString();
auto parameters = db.getParameters();
if (ConfigBackendDHCPv6Mgr::instance().delBackend(parameters["type"], access, true)) {
PgSqlConfigBackendImpl::addRelayBinding(PsqlBindArray& bindings,
const NetworkPtr& network) {
ElementPtr relay_element = Element::createList();
- const auto& addresses = network->getRelayAddresses();
+ auto const& addresses = network->getRelayAddresses();
if (!addresses.empty()) {
- for (const auto& address : addresses) {
+ for (auto const& address : addresses) {
relay_element->add(Element::create(address.toText()));
}
}
void addRequiredClassesBinding(db::PsqlBindArray& bindings, const T& object) {
// Create JSON list of required classes.
data::ElementPtr required_classes_element = data::Element::createList();
- const auto& required_classes = object->getRequiredClasses();
+ auto const& required_classes = object->getRequiredClasses();
for (auto required_class = required_classes.cbegin();
required_class != required_classes.cend();
++required_class) {
CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
// Set the bounds on the selected subnet range
- const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
+ auto const& idx = subnets->get<SubnetSubnetIdIndexTag>();
// Init to ALL so we can use auto
auto lower = idx.begin();
CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll();
// Set the bounds on the selected subnet range
- const auto& idx = subnets->get<SubnetSubnetIdIndexTag>();
+ auto const& idx = subnets->get<SubnetSubnetIdIndexTag>();
// Init to ALL so we can use auto
auto lower = idx.begin();
bool
IoServiceThreadPool::checkThreadId(std::thread::id id) {
- for (const auto& thread : threads_) {
+ for (auto const& thread : threads_) {
if (id == thread->get_id()) {
return (true);
}
// Checks if IPv4 address ranges can be converted to prefix / prefix_len
TEST(AddrUtilitiesTest, prefixLengthFromRange4) {
// Use a shorter name
- const auto& plfr = prefixLengthFromRange;
+ auto const& plfr = prefixLengthFromRange;
// Let's start with something simple
EXPECT_EQ(32, plfr(IOAddress("192.0.2.0"), IOAddress("192.0.2.0")));
// Checks if IPv6 address ranges can be converted to prefix / prefix_len
TEST(AddrUtilitiesTest, prefixLengthFromRange6) {
// Use a shorter name
- const auto& plfr = prefixLengthFromRange;
+ auto const& plfr = prefixLengthFromRange;
// Let's start with something simple
EXPECT_EQ(128, plfr(IOAddress("::"), IOAddress("::")));
// Make sure that all specified parameters are supported.
auto const& command_params = command->mapValue();
- for (const auto& param : command_params) {
+ for (auto const& param : command_params) {
if ((param.first != CONTROL_COMMAND) &&
(param.first != CONTROL_ARGUMENTS) &&
(param.first != CONTROL_SERVICE) &&
if (size() != other.size()) {
return (false);
}
- for (const auto& kv : mapValue()) {
+ for (auto const& kv : mapValue()) {
auto key = kv.first;
if (other.contains(key)) {
if (!get(key)->equals(*other.get(key))) {
// over a checking for identical entries in b or vice-versa. As elements
// are removed from a if a match is found, we choose to iterate over b to
// avoid problems with element removal affecting the iterator.
- for (const auto& kv : b->mapValue()) {
+ for (auto const& kv : b->mapValue()) {
auto key = kv.first;
if (a->contains(key)) {
if (a->get(key)->equals(*b->get(key))) {
isc_throw(TypeError, "Non-map Elements passed to removeIdentical");
}
- for (const auto& kv : a->mapValue()) {
+ for (auto const& kv : a->mapValue()) {
auto key = kv.first;
if (!b->contains(key) ||
!a->get(key)->equals(*b->get(key))) {
isc_throw(TypeError, "merge arguments not MapElements");
}
- for (const auto& kv : other->mapValue()) {
+ for (auto const& kv : other->mapValue()) {
auto key = kv.first;
auto value = kv.second;
if (value && value->getType() != Element::null) {
}
if (element->getType() == Element::map) {
- for (const auto& kv : other->mapValue()) {
+ for (auto const& kv : other->mapValue()) {
auto current_key = kv.first;
auto value = boost::const_pointer_cast<Element>(kv.second);
if (value && value->getType() != Element::null) {
// If the resulting element still contains data, we need to restore the
// key parameters, so we store them here.
ElementPtr new_elements = Element::createMap();
- for (const auto& kv : other->mapValue()) {
+ for (auto const& kv : other->mapValue()) {
auto current_key = kv.first;
auto value = boost::const_pointer_cast<Element>(kv.second);
if (value && value->getType() != Element::null) {
}
// If the element still contains data, restore the key elements.
if (element->size()) {
- for (const auto& kv : new_elements->mapValue()) {
+ for (auto const& kv : new_elements->mapValue()) {
element->set(kv.first, kv.second);
}
}
}
if (element->getType() == Element::map) {
- for (const auto& kv : other->mapValue()) {
+ for (auto const& kv : other->mapValue()) {
auto current_key = kv.first;
auto value = boost::const_pointer_cast<Element>(kv.second);
if (value && value->getType() != Element::null) {
return (ElementPtr(new StringElement(from->stringValue())));
} else if (from_type == Element::list) {
ElementPtr result = ElementPtr(new ListElement());
- for (const auto& elem : from->listValue()) {
+ for (auto const& elem : from->listValue()) {
if (level == 0) {
result->add(elem);
} else {
return (result);
} else if (from_type == Element::map) {
ElementPtr result = ElementPtr(new MapElement());
- for (const auto& kv : from->mapValue()) {
+ for (auto const& kv : from->mapValue()) {
auto key = kv.first;
auto value = kv.second;
if (level == 0) {
return (false);
}
// iterate on the first map
- for (const auto& kv : a->mapValue()) {
+ for (auto const& kv : a->mapValue()) {
// get the b value for the given keyword and recurse
ConstElementPtr item = b->get(kv.first);
if (!item || !isEquivalent0(kv.second, item, level - 1)) {
out << "[" << (complex ? "\n" : " ");
// iterate on items
- const auto& l = element->listValue();
+ auto const& l = element->listValue();
for (auto it = l.begin(); it != l.end(); ++it) {
// add the separator if not the first item
if (it != l.begin()) {
out << "{\n";
// iterate on keyword: value
- const auto& m = element->mapValue();
+ auto const& m = element->mapValue();
bool first = true;
for (auto it = m.begin(); it != m.end(); ++it) {
// add the separator if not the first item
void
SimpleParser::checkRequired(const SimpleRequiredKeywords& required,
ConstElementPtr scope) {
- for (const auto& name : required) {
+ for (auto const& name : required) {
if (scope->contains(name)) {
continue;
}
SimpleParser::checkKeywords(const SimpleKeywords& keywords,
ConstElementPtr scope) {
string spurious;
- for (const auto& entry : scope->mapValue()) {
+ for (auto const& entry : scope->mapValue()) {
if (keywords.count(entry.first) == 0) {
if (spurious.empty()) {
spurious = entry.first;
ElementPtr metadata = Element::createMap();
ElementPtr tags = Element::createList();
- for (const auto& server_tag : server_tags_) {
+ for (auto const& server_tag : server_tags_) {
tags->add(Element::create(server_tag.get()));
}
// If no particular backend is selected, call each backend and return
// the first non-null (non zero) value.
if (backend_selector.amUnspecified()) {
- for (const auto& backend : backends_) {
+ for (auto const& backend : backends_) {
property = ((*backend).*MethodPointer)(server_selector, input...);
if (property) {
break;
// Backend selected, find the one that matches selection.
auto backends = selectBackends(backend_selector);
if (!backends.empty()) {
- for (const auto& backend : backends) {
+ for (auto const& backend : backends) {
property = ((*backend).*MethodPointer)(server_selector, input...);
if (property) {
break;
PropertyCollectionType& properties,
Args... input) const {
if (backend_selector.amUnspecified()) {
- for (const auto& backend : backends_) {
+ for (auto const& backend : backends_) {
properties = ((*backend).*MethodPointer)(server_selector, input...);
if (!properties.empty()) {
break;
} else {
auto backends = selectBackends(backend_selector);
if (!backends.empty()) {
- for (const auto& backend : backends) {
+ for (auto const& backend : backends) {
properties = ((*backend).*MethodPointer)(server_selector, input...);
if (!properties.empty()) {
break;
const db::ServerSelector& server_selector,
PropertyCollectionType& properties) const {
if (backend_selector.amUnspecified()) {
- for (const auto& backend : backends_) {
+ for (auto const& backend : backends_) {
properties = ((*backend).*MethodPointer)(server_selector);
if (!properties.empty()) {
break;
} else {
auto backends = selectBackends(backend_selector);
if (!backends.empty()) {
- for (const auto& backend : backends) {
+ for (auto const& backend : backends) {
properties = ((*backend).*MethodPointer)(server_selector);
if (!properties.empty()) {
break;
}
// Go over all backends.
- for (const auto& backend : backends_) {
+ for (auto const& backend : backends_) {
// If backend type is specified and it is not matching,
// do not select this backend.
if ((backend_selector.getBackendType() != db::BackendSelector::Type::UNSPEC) &&
/// @return Value of the property or 0 if property doesn't exist.
virtual int getProperty(const ServerSelector&,
const std::string& property_name) const {
- for (const auto& property : properties_) {
+ for (auto const& property : properties_) {
if (property.first == property_name) {
return (property.second);
}
virtual int getProperty(const ServerSelector&,
const std::string& property_name,
const int property_value) const {
- for (const auto& property : properties_) {
+ for (auto const& property : properties_) {
if ((property.first == property_name) &&
(property.second == property_value)) {
return (property.second);
virtual PropertiesList getProperties(const ServerSelector&,
const std::string& property_name) const {
PropertiesList properties;
- for (const auto& property : properties_) {
+ for (auto const& property : properties_) {
if (property.first == property_name) {
properties.push_back(property);
}
D2Stats::init() {
StatsMgr& stats_mgr = isc::stats::StatsMgr::instance();
stats_mgr.setMaxSampleCountDefault(0);
- for (const auto& name : D2Stats::ncr) {
+ for (auto const& name : D2Stats::ncr) {
stats_mgr.setValue(name, static_cast<int64_t>(0));
}
- for (const auto& name : D2Stats::update) {
+ for (auto const& name : D2Stats::update) {
stats_mgr.setValue(name, static_cast<int64_t>(0));
}
};
D2TsigKey::initStats() {
StatsMgr& stats_mgr = StatsMgr::instance();
const string& kname = getKeyName().toText();
- for (const auto& name : D2Stats::key) {
+ for (auto const& name : D2Stats::key) {
const string& sname = StatsMgr::generateName("key", kname, name);
stats_mgr.setValue(sname, static_cast<int64_t>(0));
}
D2TsigKey::removeStats() {
StatsMgr& stats_mgr = StatsMgr::instance();
const string& kname = getKeyName().toText();
- for (const auto& name : D2Stats::key) {
+ for (auto const& name : D2Stats::key) {
string sname = StatsMgr::generateName("key", kname, name);
stats_mgr.del(sname);
}
D2TsigKey::resetStats() {
StatsMgr& stats_mgr = StatsMgr::instance();
const string& kname = getKeyName().toText();
- for (const auto& name : D2Stats::key) {
+ for (auto const& name : D2Stats::key) {
string sname = StatsMgr::generateName("key", kname, name);
stats_mgr.reset(sname);
}
void
checkStats(const string& key_name, const StatMap& expected_stats) {
StatMap key_stats;
- for (const auto& it : expected_stats) {
+ for (auto const& it : expected_stats) {
const string& stat_name =
StatsMgr::generateName("key", key_name, it.first);
key_stats[stat_name] = it.second;
DatabaseConnection::toElement(const ParameterMap& params) {
isc::data::ElementPtr result = isc::data::Element::createMap();
- for (const auto& param : params) {
+ for (auto const& param : params) {
std::string keyword = param.first;
std::string value = param.second;
// Construct the database access string from all keywords and values in the
// parameter map where the value is not null.
string dbaccess;
- for (const auto& keyval : values_) {
+ for (auto const& keyval : values_) {
if (!keyval.second.empty()) {
// Separate keyword/value pair from predecessor (if there is one).
std::set<ServerTag> tags;
// Create a set of tags from strings.
- for (const auto& tag : server_tags) {
+ for (auto const& tag : server_tags) {
tags.insert(ServerTag(tag));
}
// Checks that entries can be found by object type.
TEST_F(AuditEntryCollectionTest, getByObjectType) {
- const auto& object_type_idx = audit_entries_.get<AuditEntryObjectTypeTag>();
+ auto const& object_type_idx = audit_entries_.get<AuditEntryObjectTypeTag>();
// Search for "dhcp4_subnet" objects.
auto range = object_type_idx.equal_range("dhcp4_subnet");
// Checks that entries can be found by modification time.
TEST_F(AuditEntryCollectionTest, getByModificationTime) {
- const auto& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeIdTag>();
+ auto const& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeIdTag>();
// Search for objects later than fixed time - 10s.
auto lb = mod_time_idx.lower_bound(diffTime(-10));
// Checks that entries can be found by modification time and id.
TEST_F(AuditEntryCollectionTest, getByModificationTimeAndId) {
- const auto& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeIdTag>();
+ auto const& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeIdTag>();
// Search for objects later than added added subnet 10.
auto mod = boost::make_tuple(diffTime(-5), 100 + 1);
// Checks that entries can be found by object id.
TEST_F(AuditEntryCollectionTest, getByObjectId) {
- const auto& object_id_idx = audit_entries_.get<AuditEntryObjectIdTag>();
+ auto const& object_id_idx = audit_entries_.get<AuditEntryObjectIdTag>();
// Search for object id 10.
auto range = object_id_idx.equal_range(10);
return (cache_);
}
}
- const auto& idx = ifaces_container_.get<1>();
+ auto const& idx = ifaces_container_.get<1>();
auto it = idx.find(ifindex);
if (it == idx.end()) {
return (IfacePtr()); // not found
return (cache_);
}
}
- const auto& idx = ifaces_container_.get<2>();
+ auto const& idx = ifaces_container_.get<2>();
auto it = idx.find(ifname);
if (it == idx.end()) {
return (IfacePtr()); // not found
extendVivco(OptionCollection& options) {
typedef vector<OpaqueDataTuple> TuplesCollection;
map<uint32_t, TuplesCollection> vendors_tuples;
- const auto& range = options.equal_range(DHO_VIVCO_SUBOPTIONS);
+ auto const& range = options.equal_range(DHO_VIVCO_SUBOPTIONS);
for (auto it = range.first; it != range.second; ++it) {
uint32_t offset = 0;
auto const& data = it->second->getData();
void
extendVivso(OptionCollection& options) {
map<uint32_t, OptionCollection> vendors_data;
- const auto& range = options.equal_range(DHO_VIVSO_SUBOPTIONS);
+ auto const& range = options.equal_range(DHO_VIVSO_SUBOPTIONS);
for (auto it = range.first; it != range.second; ++it) {
uint32_t offset = 0;
auto const& data = it->second->getData();
<< "adn='" << getAdnAsText() << "'";
if (!adn_only_mode_) {
stream << ", addr_length=" << addr_length_ << ", address(es):";
- for (const auto& address : ip_addresses_) {
+ for (auto const& address : ip_addresses_) {
stream << " " << address.toText();
}
void
Option6Dnr::packAddresses(util::OutputBuffer& buf) const {
- for (const auto& address : ip_addresses_) {
+ for (auto const& address : ip_addresses_) {
if (!address.isV6()) {
isc_throw(isc::BadValue, getLogPrefix()
<< address.toText() << " is not an IPv6 address");
OptionPtr
Pkt::getNonCopiedOption(const uint16_t type) const {
- const auto& x = options_.find(type);
+ auto const& x = options_.find(type);
if (x != options_.end()) {
return (x->second);
}
OptionPtr
Pkt::getOption(const uint16_t type) {
- const auto& x = options_.find(type);
+ auto const& x = options_.find(type);
if (x != options_.end()) {
if (copy_retrieved_options_) {
OptionPtr option_copy = x->second->clone();
bool
Pkt::delOption(uint16_t type) {
- const auto& x = options_.find(type);
+ auto const& x = options_.find(type);
if (x != options_.end()) {
options_.erase(x);
return (true); // delete successful
size_t length = DHCPV4_PKT_HDR_LEN; // DHCPv4 header
// ... and sum of lengths of all options
- for (const auto& it : options_) {
+ for (auto const& it : options_) {
length += it.second->len();
}
if (!options_.empty()) {
tmp << "," << endl << "options:";
- for (const auto& opt : options_) {
+ for (auto const& opt : options_) {
try {
tmp << endl << opt.second->toText(2);
} catch (...) {
<< "link-address=" << linkaddr_.toText()
<< ", peer-address=" << peeraddr_.toText() << ", "
<< options_.size() << " option(s)" << endl;
- for (const auto& option : options_) {
+ for (auto const& option : options_) {
tmp << option.second->toText() << endl;
}
return (tmp.str());
uint16_t len = DHCPV6_RELAY_HDR_LEN // fixed header
+ Option::OPTION6_HDR_LEN; // header of the relay-msg option
- for (const auto& opt : relay.options_) {
+ for (auto const& opt : relay.options_) {
len += (opt.second)->len();
}
uint16_t Pkt6::directLen() const {
uint16_t length = DHCPV6_PKT_HDR_LEN; // DHCPv6 header
- for (const auto& it : options_) {
+ for (auto const& it : options_) {
length += it.second->len();
}
// present here as well (vendor-opts for Cable modems,
// subscriber-id, remote-id, options echoed back from Echo
// Request Option, etc.)
- for (const auto& opt : relay->options_) {
+ for (auto const& opt : relay->options_) {
(opt.second)->pack(buffer_out_);
}
if (!options_.empty()) {
tmp << "," << endl << "options:";
- for (const auto& opt : options_) {
+ for (auto const& opt : options_) {
try {
tmp << endl << opt.second->toText(2);
} catch (...) {
if (!relay_info_.empty()) {
tmp << endl << relay_info_.size() << " relay(s):" << endl;
int cnt = 0;
- for (const auto& relay : relay_info_) {
+ for (auto const& relay : relay_info_) {
tmp << "relay[" << cnt++ << "]: " << relay.toText();
}
} else {
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(candidate->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(candidate->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(ctx.currentIA().type_, candidate->addr_, false);
+ auto const& pool = subnet->getPool(ctx.currentIA().type_, candidate->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(candidate->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(candidate->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(candidate->type_, candidate->addr_, false);
+ auto const& pool = subnet->getPool(candidate->type_, candidate->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId((*lease)->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId((*lease)->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(ctx.currentIA().type_, (*lease)->addr_, false);
+ auto const& pool = subnet->getPool(ctx.currentIA().type_, (*lease)->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
// Add (update) the extended information on the lease.
updateLease6ExtendedInfo(expired, ctx);
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, expired->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, expired->addr_, false);
if (pool) {
expired->pool_id_ = pool->getID();
}
// Add (update) the extended information on the lease.
updateLease6ExtendedInfo(lease, ctx);
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
if (pool) {
lease->pool_id_ = pool->getID();
}
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(-1));
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(),
// Now that the lease has been reclaimed, we can go ahead and update it
// in the lease database.
if (lease->reuseable_valid_lft_ == 0) {
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
if (pool) {
lease->pool_id_ = pool->getID();
}
"cumulative-assigned-nas" : "cumulative-assigned-pds"),
static_cast<int64_t>(1));
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(),
"cumulative-assigned-nas" : "cumulative-assigned-pds"),
static_cast<int64_t>(1));
- const auto& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(ctx.currentIA().type_, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(),
"assigned-nas"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(lease->type_, lease->addr_, false);
+ auto const& pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
"assigned-pds"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(lease->type_, lease->addr_, false);
+ auto const& pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
"reclaimed-leases"),
static_cast<int64_t>(1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
"reclaimed-declined-addresses"),
static_cast<int64_t>(1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
stats_mgr.addValue(StatsMgr::generateName("subnet", subnet->getID(),
StatsMgr::generateName("pool" , pool->getID(),
"reclaimed-declined-addresses"),
static_cast<int64_t>(1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getBySubnetId(lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(lease->type_, lease->addr_, false);
+ auto const& pool = subnet->getPool(lease->type_, lease->addr_, false);
if (pool) {
stats_mgr.addValue(StatsMgr::generateName("subnet", subnet->getID(),
StatsMgr::generateName("pool" , pool->getID(),
"assigned-addresses"),
static_cast<int64_t>(-1));
- const auto& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(client_lease->subnet_id_);
+ auto const& subnet = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getBySubnetId(client_lease->subnet_id_);
if (subnet) {
- const auto& pool = subnet->getPool(Lease::TYPE_V4, client_lease->addr_, false);
+ auto const& pool = subnet->getPool(Lease::TYPE_V4, client_lease->addr_, false);
if (pool) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", subnet->getID(),
}
if (!ctx.fake_allocation_ || ctx.offer_lft_) {
- const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
lease->pool_id_ = pool->getID();
}
}
if ((!ctx.fake_allocation_ || ctx.offer_lft_) && !skip && (lease->reuseable_valid_lft_ == 0)) {
- const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, lease->addr_, false);
if (pool) {
lease->pool_id_ = pool->getID();
}
}
if (!ctx.fake_allocation_ || ctx.offer_lft_) {
- const auto& pool = ctx.subnet_->getPool(Lease::TYPE_V4, expired->addr_, false);
+ auto const& pool = ctx.subnet_->getPool(Lease::TYPE_V4, expired->addr_, false);
if (pool) {
expired->pool_id_ = pool->getID();
}
/// backend
void addGlobalsToConfig(SrvConfigPtr external_cfg,
data::StampedValueCollection& cb_globals) const {
- const auto& index = cb_globals.get<data::StampedValueNameIndexTag>();
+ auto const& index = cb_globals.get<data::StampedValueNameIndexTag>();
for (auto cb_global = index.begin(); cb_global != index.end(); ++cb_global) {
if ((*cb_global)->amNull()) {
continue;
}
- external_cfg->addConfiguredGlobal((*cb_global)->getName(),
+ external_cfg->addConfiguredGlobal((*cb_global)->getName(),
(*cb_global)->getElementValue());
}
}
auto external_cfg = CfgMgr::instance().createExternalCfg();
// Get audit entries for deleted global parameters.
- const auto& index = audit_entries.get<AuditEntryObjectTypeTag>();
+ auto const& index = audit_entries.get<AuditEntryObjectTypeTag>();
auto range = index.equal_range(boost::make_tuple("dhcp4_global_parameter",
AuditEntry::ModificationType::DELETE));
if (range.first != range.second) {
auto external_cfg = CfgMgr::instance().createExternalCfg();
// Get audit entries for deleted global parameters.
- const auto& index = audit_entries.get<AuditEntryObjectTypeTag>();
+ auto const& index = audit_entries.get<AuditEntryObjectTypeTag>();
auto range = index.equal_range(boost::make_tuple("dhcp6_global_parameter",
AuditEntry::ModificationType::DELETE));
if (range.first != range.second) {
HostContainer6Index1& idx6 = hosts6_.get<1>();
HostContainerIndex4& idx = hosts_.get<4>();
// Delete IPv6 reservations.
- const auto& range = idx6.equal_range(boost::make_tuple(subnet_id, addr));
+ auto const& range = idx6.equal_range(boost::make_tuple(subnet_id, addr));
erased_addresses = boost::distance(range);
// Delete hosts.
for (auto key = range.first; key != range.second; ++key) {
const uint8_t* identifier_begin,
const size_t identifier_len) {
HostContainerIndex0& idx = hosts_.get<0>();
- const auto t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
+ auto const t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
identifier_begin + identifier_len),
identifier_type);
- const auto& range = idx.equal_range(t);
+ auto const& range = idx.equal_range(t);
size_t erased = 0;
for (auto key = range.first; key != range.second;) {
if ((*key)->getIPv4SubnetID() != subnet_id) {
HostContainerIndex0& idx = hosts_.get<0>();
HostContainer6Index3& idx6 = hosts6_.get<3>();
- const auto t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
+ auto const t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
identifier_begin + identifier_len),
identifier_type);
- const auto& range = idx.equal_range(t);
+ auto const& range = idx.equal_range(t);
size_t erased_hosts = 0;
size_t erased_reservations = 0;
for (auto key = range.first; key != range.second;) {
// Iterate over all the option descriptors in
// all the spaces and instantiate the options
// based on the given definitions.
- for (const auto& space : getOptionSpaceNames()) {
+ for (auto const& space : getOptionSpaceNames()) {
for (auto opt_desc : *(getAll(space))) {
if (createDescriptorOption(cfg_def, space, opt_desc)) {
// Option was recreated, let's replace the descriptor.
(option_space != DHCP6_OPTION_SPACE)) {
// For each option space name iterate over the existing options.
auto option_space_names = getOptionSpaceNames();
- for (const auto& option_space_from_list : option_space_names) {
+ for (auto const& option_space_from_list : option_space_names) {
// Get all options within the particular option space.
auto options_in_space = getAll(option_space_from_list);
for (auto option_it = options_in_space->begin();
bool
CfgSharedNetworks4::hasNetworkWithServerId(const IOAddress& server_id) const {
- const auto& index = networks_.get<SharedNetworkServerIdIndexTag>();
+ auto const& index = networks_.get<SharedNetworkServerIdIndexTag>();
auto network_it = index.find(server_id);
return (network_it != index.cend());
}
/// @return Pointer to the shared network or null pointer if the network
/// is not found.
SharedNetworkPtrType getByName(const std::string& name) const {
- const auto& index = networks_.template get<SharedNetworkNameIndexTag>();
+ auto const& index = networks_.template get<SharedNetworkNameIndexTag>();
auto shared_network = index.find(name);
if (shared_network != index.cend()) {
return (*shared_network);
data::ElementPtr list = data::Element::createList();
// Insert shared networks sorted by their names into the list.
- const auto& index = networks_.template get<SharedNetworkNameIndexTag>();
+ auto const& index = networks_.template get<SharedNetworkNameIndexTag>();
for (auto shared_network = index.begin(); shared_network != index.end();
++shared_network) {
list->add((*shared_network)->toElement());
// Network exists, which means we're updating it.
// First we need to move its subnets to the new
// version of the network.
- const auto subnets = (*existing_network)->getAllSubnets();
+ auto const subnets = (*existing_network)->getAllSubnets();
auto copy_subnets(*subnets);
for (auto subnet = copy_subnets.cbegin(); subnet != copy_subnets.cend(); ++subnet) {
other_subnet->getCfgOption()->createOptions(cfg_def);
// Create the options for pool based on the given definitions.
- for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) {
+ for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) {
pool->getCfgOption()->createOptions(cfg_def);
}
ConstSubnet4Ptr
CfgSubnets4::getBySubnetId(const SubnetID& subnet_id) const {
- const auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(subnet_id);
return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr());
}
ConstSubnet4Ptr
CfgSubnets4::getByPrefix(const std::string& subnet_text) const {
- const auto& index = subnets_.get<SubnetPrefixIndexTag>();
+ auto const& index = subnets_.get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet_text);
return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr());
}
bool
CfgSubnets4::hasSubnetWithServerId(const asiolink::IOAddress& server_id) const {
- const auto& index = subnets_.get<SubnetServerIdIndexTag>();
+ auto const& index = subnets_.get<SubnetServerIdIndexTag>();
auto subnet_it = index.find(server_id);
return (subnet_it != index.cend());
}
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-leases"));
- for (const auto& pool : subnet4->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"total-addresses")));
stats_mgr.setValue(name_conflicts, static_cast<int64_t>(0));
}
- for (const auto& pool : subnet4->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
const std::string& name_total(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"total-addresses")));
other_subnet->getCfgOption()->createOptions(cfg_def);
// Create the options for pool based on the given definitions.
- for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) {
+ for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) {
pool->getCfgOption()->createOptions(cfg_def);
}
// Create the options for pd pool based on the given definitions.
- for (const auto& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) {
+ for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) {
pool->getCfgOption()->createOptions(cfg_def);
}
ConstSubnet6Ptr
CfgSubnets6::getBySubnetId(const SubnetID& subnet_id) const {
- const auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(subnet_id);
return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr());
}
ConstSubnet6Ptr
CfgSubnets6::getByPrefix(const std::string& subnet_text) const {
- const auto& index = subnets_.get<SubnetPrefixIndexTag>();
+ auto const& index = subnets_.get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet_text);
return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr());
}
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-leases"));
- for (const auto& pool : subnet6->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) {
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"total-nas")));
"reclaimed-leases")));
}
- for (const auto& pool : subnet6->getPools(Lease::TYPE_PD)) {
+ for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) {
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pd-pool", pool->getID(),
"total-pds")));
stats_mgr.setValue(name_ia_pd_reuses, int64_t(0));
}
- for (const auto& pool : subnet6->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) {
const std::string& name_total_nas(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"total-nas")));
}
}
- for (const auto& pool : subnet6->getPools(Lease::TYPE_PD)) {
+ for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) {
const std::string& name_total_pds(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pd-pool", pool->getID(),
"total-pds")));
bool valid = true;
bool retrying = false;
- const auto& pools = subnet_.lock()->getPools(pool_type_);
+ auto const& pools = subnet_.lock()->getPools(pool_type_);
if (pools.empty()) {
isc_throw(AllocFailed, "No pools defined in selected subnet");
bool valid = true;
bool retrying = false;
- const auto& pools = subnet_.lock()->getPools(pool_type_);
+ auto const& pools = subnet_.lock()->getPools(pool_type_);
if (pools.empty()) {
isc_throw(AllocFailed, "No pools defined in selected subnet");
stats_mgr.setValue(name_rec, zero);
}
- for (const auto& pool : (*subnet)->getPools(Lease::TYPE_V4)) {
+ for (auto const& pool : (*subnet)->getPools(Lease::TYPE_V4)) {
const std::string name_aa(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"assigned-addresses")));
zero);
}
- for (const auto& pool : (*subnet)->getPools(Lease::TYPE_NA)) {
+ for (auto const& pool : (*subnet)->getPools(Lease::TYPE_NA)) {
const std::string& name_anas(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pool", pool->getID(),
"assigned-nas")));
}
}
- for (const auto& pool : (*subnet)->getPools(Lease::TYPE_PD)) {
+ for (auto const& pool : (*subnet)->getPools(Lease::TYPE_PD)) {
const std::string& name_apds(StatsMgr::generateName("subnet", subnet_id,
StatsMgr::generateName("pd-pool", pool->getID(),
"assigned-pds")));
size_t modified = 0;
size_t processed = 0;
- for (const auto& lease : storage6_) {
+ for (auto const& lease : storage6_) {
++leases;
try {
if (upgradeLease6ExtendedInfo(lease, check)) {
::rename(filename.c_str(), old.str().c_str());
CSVLeaseFile4 backup(filename);
backup.open();
- for (const auto& lease : storage4_) {
+ for (auto const& lease : storage4_) {
backup.append(*lease);
}
backup.close();
::rename(filename.c_str(), old.str().c_str());
CSVLeaseFile6 backup(filename);
backup.open();
- for (const auto& lease : storage6_) {
+ for (auto const& lease : storage6_) {
backup.append(*lease);
}
backup.close();
++pages;
start_addr = leases.back()->addr_;
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
try {
bool modified = upgradeLease6ExtendedInfo(lease, check);
if (modified) {
}
// Sanity checks on built-in classes
- for (const auto& bn : builtinNames) {
+ for (auto const& bn : builtinNames) {
if (name == bn) {
if (required) {
isc_throw(DhcpConfigError, "built-in class '" << name
initSubnet(params, addr, len);
// Add pools to it.
- for (const auto& pool : *pools_) {
+ for (auto const& pool : *pools_) {
try {
subnet_->addPool(pool);
} catch (const BadValue& ex) {
++pages;
start_addr = leases.back()->addr_;
- for (const auto& lease : leases) {
+ for (auto const& lease : leases) {
try {
bool modified = upgradeLease6ExtendedInfo(lease, check);
if (modified) {
const IdentifierBaseTypePtr&,
const IOAddress&) {
auto subnet = subnet_.lock();
- const auto& pools = subnet->getPools(pool_type_);
+ auto const& pools = subnet->getPools(pool_type_);
// Let's first iterate over the pools and identify the ones that
// meet client class criteria. Then, segregate these pools into
const IOAddress&,
uint8_t hint_prefix_length) {
auto subnet = subnet_.lock();
- const auto& pools = subnet->getPools(pool_type_);
+ auto const& pools = subnet->getPools(pool_type_);
// Let's first iterate over the pools and identify the ones that
// meet client class criteria. Then, segragate these pools into
template<typename SubnetPtrType, typename SubnetCollectionType>
static SubnetPtrType getSubnet(const SubnetCollectionType& subnets,
const SubnetID& subnet_id) {
- const auto& index = subnets.template get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets.template get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(subnet_id);
if (subnet_it != index.cend()) {
return (*subnet_it);
template<typename SubnetPtrType, typename SubnetCollectionType>
static SubnetPtrType getSubnet(const SubnetCollectionType& subnets,
const std::string& subnet_prefix) {
- const auto& index = subnets.template get<SubnetPrefixIndexTag>();
+ auto const& index = subnets.template get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet_prefix);
if (subnet_it != index.cend()) {
return (*subnet_it);
// Need to retrieve an iterator to the current subnet first. The
// subnet must exist in this container, thus we throw if the iterator
// is not found.
- const auto& index = subnets.template get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets.template get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(current_subnet);
if (subnet_it == index.cend()) {
isc_throw(BadValue, "no such subnet " << current_subnet
const Element::Position pos("<default-value>", 0, 0);
// Let's go over all parameters we have defaults for.
- for (const auto& def_value : defaults) {
+ for (auto const& def_value : defaults) {
// Try if such a parameter is there. If it is, let's
// skip it, because user knows best *cough*.
// check if the type is valid (and throw if it isn't)
checkType(type);
- const auto& pools = getPools(type);
+ auto const& pools = getPools(type);
PoolPtr candidate;
void
Subnet::initAllocatorsAfterConfigure() {
- for (const auto& allocator : allocators_) {
+ for (auto const& allocator : allocators_) {
allocator.second->initAfterConfigure();
}
}
// check if the type is valid (and throw if it isn't)
checkType(type);
- const auto& pools = getPools(type);
+ auto const& pools = getPools(type);
PoolPtr candidate;
return (false);
}
- const auto& pools = getPools(type);
- for (const auto& pool : pools) {
+ auto const& pools = getPools(type);
+ for (auto const& pool : pools) {
if (pool->inRange(addr)) {
return (true);
}
return (false);
}
- const auto& pools = getPools(type);
- for (const auto& pool : pools) {
+ auto const& pools = getPools(type);
+ for (auto const& pool : pools) {
if (!pool->clientSupported(client_classes)) {
continue;
}
bool
Subnet::poolOverlaps(const Lease::Type& pool_type, const PoolPtr& pool) const {
- const auto& pools = getPools(pool_type);
+ auto const& pools = getPools(pool_type);
// If no pools, we don't overlap. Nothing to do.
if (pools.empty()) {
// greater than F2). prefixLessThanPoolAddress with the first argument
// set to "true" is the custom comparison function for upper_bound, which
// compares F2 with the first addresses of the existing pools.
- const auto pool3_it =
+ auto const pool3_it =
std::upper_bound(pools.begin(), pools.end(), pool->getFirstAddress(),
prefixLessThanFirstAddress);
isc::data::merge(map, d4o6.toElement());
// Set pools
- const auto& pools = getPools(Lease::TYPE_V4);
+ auto const& pools = getPools(Lease::TYPE_V4);
ElementPtr pool_list = Element::createList();
- for (const auto& pool : pools) {
+ for (auto const& pool : pools) {
// Add the formatted pool to the list
pool_list->add(pool->toElement());
}
merge(map, network_map);
// Set pools
- const auto& pools = getPools(Lease::TYPE_NA);
+ auto const& pools = getPools(Lease::TYPE_NA);
ElementPtr pool_list = Element::createList();
- for (const auto& pool : pools) {
+ for (auto const& pool : pools) {
// Add the formatted pool to the list
pool_list->add(pool->toElement());
}
map->set("pools", pool_list);
// Set pd-pools
- const auto& pdpools = getPools(Lease::TYPE_PD);
+ auto const& pdpools = getPools(Lease::TYPE_PD);
ElementPtr pdpool_list = Element::createList();
- for (const auto& pool : pdpools) {
+ for (auto const& pool : pdpools) {
// Add the formatted pool to the list
pdpool_list->add(pool->toElement());
}
/// @param object_type Object type.
bool hasConfigElement(const std::string& object_type) const {
if (!audit_entries_.empty()) {
- const auto& index = audit_entries_.get<AuditEntryObjectTypeTag>();
+ auto const& index = audit_entries_.get<AuditEntryObjectTypeTag>();
auto range = index.equal_range(object_type);
for (auto it = range.first; it != range.second; ++it) {
if (((*it)->getModificationType() != AuditEntry::ModificationType::DELETE)) {
bool deleteConfigElement(const std::string& object_type,
const uint64_t object_id) const {
if (!audit_entries_.empty()) {
- const auto& index = audit_entries_.get<AuditEntryObjectTypeTag>();
+ auto const& index = audit_entries_.get<AuditEntryObjectTypeTag>();
auto range = index.equal_range(boost::make_tuple(object_type,
AuditEntry::ModificationType::DELETE));
for (auto it = range.first; it != range.second; ++it) {
/// @brief Remove other files.
void removeOtherFiles() const {
- for (const auto& file : extra_files_) {
+ for (auto const& file : extra_files_) {
LeaseFileIO io(file);
io.removeFile();
}
if (j < subnets.size() - 1) {
ASSERT_TRUE(s) << "retrieving next subnet failed for pair of"
" indexes (i, j) = (" << i << ", " << j << ")";
- const auto expected_subnet_id = (i + j + 1) % subnets.size() + 1;
+ auto const expected_subnet_id = (i + j + 1) % subnets.size() + 1;
EXPECT_EQ(expected_subnet_id, s->getID());
} else {
// Null subnet returned for a last iteration.
if (j < subnets.size() - 1) {
ASSERT_TRUE(s) << "retrieving next subnet failed for pair of"
" indexes (i, j) = (" << i << ", " << j << ")";
- const auto expected_subnet_id = (i + j + 1) % subnets.size() + 1;
+ auto const expected_subnet_id = (i + j + 1) % subnets.size() + 1;
EXPECT_EQ(expected_subnet_id, s->getID());
} else {
// Null subnet returned for a last iteration.
// Server tag is 'all'.
tag = "all";
} else {
- const auto& tags = server_selector.getTags();
+ auto const& tags = server_selector.getTags();
// This test is not meant to handle multiple server tags all at once.
if (tags.size() > 1) {
ADD_FAILURE() << "Test error: do not use multiple server tags";
// Server tag is 'all'.
tag = "all";
} else {
- const auto& tags = server_selector.getTags();
+ auto const& tags = server_selector.getTags();
// This test is not meant to handle multiple server tags all at once.
if (tags.size() != 1) {
ADD_FAILURE() << "Test error: tags.size(): " << tags.size()
auto parameters = cbptr_->getAllGlobalParameters4(ServerSelector::ALL());
ASSERT_EQ(5, parameters.size());
- const auto& parameters_index = parameters.get<StampedValueNameIndexTag>();
+ auto const& parameters_index = parameters.get<StampedValueNameIndexTag>();
// Verify their values.
EXPECT_EQ("value1", (*parameters_index.find("name1"))->getValue());
auto parameters = cbptr_->getModifiedGlobalParameters4(ServerSelector::ALL(),
timestamps_["after today"]);
- const auto& parameters_index = parameters.get<StampedValueNameIndexTag>();
+ auto const& parameters_index = parameters.get<StampedValueNameIndexTag>();
// It should be the one modified "tomorrow".
ASSERT_EQ(1, parameters_index.size());
auto parameters = cbptr_->getAllGlobalParameters6(ServerSelector::ALL());
ASSERT_EQ(5, parameters.size());
- const auto& parameters_index = parameters.get<StampedValueNameIndexTag>();
+ auto const& parameters_index = parameters.get<StampedValueNameIndexTag>();
// Verify their values.
EXPECT_EQ("value1", (*parameters_index.find("name1"))->getValue());
auto parameters = cbptr_->getModifiedGlobalParameters6(ServerSelector::ALL(),
timestamps_["after today"]);
- const auto& parameters_index = parameters.get<StampedValueNameIndexTag>();
+ auto const& parameters_index = parameters.get<StampedValueNameIndexTag>();
// It should be the one modified "tomorrow".
ASSERT_EQ(1, parameters_index.size());
}
bool HostMgrTest::isPrimaryDataSource(const BaseHostDataSource& data_source) const {
- const auto ptr = dynamic_cast<const CfgHosts*>(&data_source);
+ auto const ptr = dynamic_cast<const CfgHosts*>(&data_source);
return ptr != nullptr;
}
ConstHostCollection
MemHostDataSource::getAll4(const asiolink::IOAddress& address) const {
ConstHostCollection hosts;
- for (const auto & h : store_) {
+ for (auto const & h : store_) {
if (h->getIPv4Reservation() == address) {
hosts.push_back(h);
}
MemHostDataSource::getAll4(const SubnetID& subnet_id,
const asiolink::IOAddress& address) const {
ConstHostCollection hosts;
- for (const auto & h : store_) {
+ for (auto const & h : store_) {
if (h->getIPv4SubnetID() == subnet_id &&
h->getIPv4Reservation() == address) {
hosts.push_back(h);
MemHostDataSource::getAll6(const SubnetID& subnet_id,
const asiolink::IOAddress& address) const {
ConstHostCollection hosts;
- for (const auto & h : store_) {
+ for (auto const & h : store_) {
if (h->getIPv6SubnetID() != subnet_id) {
continue;
}
ConstHostCollection
MemHostDataSource::getAll6(const asiolink::IOAddress& address) const {
ConstHostCollection hosts;
- for (const auto & h : store_) {
+ for (auto const & h : store_) {
auto resrvs = h->getIPv6Reservations();
for (auto r = resrvs.first; r != resrvs.second; ++r) {
if ((*r).second.getPrefix() == address) {
Subnet4Ptr
TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
const std::string& subnet_prefix) const{
- const auto& index = subnets_.get<SubnetPrefixIndexTag>();
+ auto const& index = subnets_.get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet_prefix);
if (subnet_it == index.cend()) {
return (Subnet4Ptr());
Subnet4Ptr
TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
const SubnetID& subnet_id) const {
- const auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(subnet_id);
if (subnet_it == index.cend()) {
return (Subnet4Ptr());
Subnet4Collection
TestConfigBackendDHCPv4::getModifiedSubnets4(const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time) const {
- const auto& index = subnets_.get<SubnetModificationTimeIndexTag>();
+ auto const& index = subnets_.get<SubnetModificationTimeIndexTag>();
Subnet4Collection subnets;
auto lb = index.lower_bound(modification_time);
for (auto subnet = lb; subnet != index.end(); ++subnet) {
SharedNetwork4Ptr
TestConfigBackendDHCPv4::getSharedNetwork4(const db::ServerSelector& server_selector,
const std::string& name) const {
- const auto& index = shared_networks_.get<SharedNetworkNameIndexTag>();
+ auto const& index = shared_networks_.get<SharedNetworkNameIndexTag>();
auto network_it = index.find(name);
if (network_it == index.cend()) {
return (SharedNetwork4Ptr());
SharedNetwork4Collection
TestConfigBackendDHCPv4::getModifiedSharedNetworks4(const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time) const {
- const auto& index = shared_networks_.get<SharedNetworkModificationTimeIndexTag>();
+ auto const& index = shared_networks_.get<SharedNetworkModificationTimeIndexTag>();
SharedNetwork4Collection shared_networks;
auto lb = index.lower_bound(modification_time);
for (auto shared_network = lb; shared_network != index.end(); ++shared_network) {
const std::string& space) const {
auto tags = server_selector.getTags();
auto candidate = OptionDefinitionPtr();
- const auto& index = option_defs_.get<1>();
+ auto const& index = option_defs_.get<1>();
auto option_def_it_pair = index.equal_range(code);
for (auto option_def_it = option_def_it_pair.first;
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
OptionDefContainer option_defs;
- const auto& index = option_defs_.get<3>();
+ auto const& index = option_defs_.get<3>();
auto lb = index.lower_bound(modification_time);
for (auto option_def = lb; option_def != index.end(); ++option_def) {
bool got = false;
const std::string& space) const {
auto tags = server_selector.getTags();
auto candidate = OptionDescriptorPtr();
- const auto& index = options_.get<1>();
+ auto const& index = options_.get<1>();
auto option_it_pair = index.equal_range(code);
for (auto option_it = option_it_pair.first; option_it != option_it_pair.second;
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
OptionContainer options;
- const auto& index = options_.get<3>();
+ auto const& index = options_.get<3>();
auto lb = index.lower_bound(modification_time);
for (auto option = lb; option != index.end(); ++option) {
bool got = false;
const std::string& name) const {
auto tags = server_selector.getTags();
auto candidate = StampedValuePtr();
- const auto& index = globals_.get<StampedValueNameIndexTag>();
+ auto const& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
++global_it) {
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
StampedValueCollection globals;
- const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
+ auto const& index = globals_.get<StampedValueModificationTimeIndexTag>();
auto lb = index.lower_bound(modification_time);
for (auto global = lb; global != index.end(); ++global) {
bool got = false;
ServerPtr
TestConfigBackendDHCPv4::getServer4(const ServerTag& server_tag) const {
- const auto& index = servers_.get<ServerTagIndexTag>();
+ auto const& index = servers_.get<ServerTagIndexTag>();
auto server_it = index.find(server_tag.get());
return ((server_it != index.cend()) ? (*server_it) : ServerPtr());
}
Subnet6Ptr
TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
const std::string& subnet_prefix) const{
- const auto& index = subnets_.get<SubnetPrefixIndexTag>();
+ auto const& index = subnets_.get<SubnetPrefixIndexTag>();
auto subnet_it = index.find(subnet_prefix);
if (subnet_it == index.cend()) {
return (Subnet6Ptr());
Subnet6Ptr
TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
const SubnetID& subnet_id) const {
- const auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
auto subnet_it = index.find(subnet_id);
if (subnet_it == index.cend()) {
return (Subnet6Ptr());
Subnet6Collection
TestConfigBackendDHCPv6::getModifiedSubnets6(const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time) const {
- const auto& index = subnets_.get<SubnetModificationTimeIndexTag>();
+ auto const& index = subnets_.get<SubnetModificationTimeIndexTag>();
Subnet6Collection subnets;
auto lb = index.lower_bound(modification_time);
for (auto subnet = lb; subnet != index.end(); ++subnet) {
SharedNetwork6Ptr
TestConfigBackendDHCPv6::getSharedNetwork6(const db::ServerSelector& server_selector,
const std::string& name) const {
- const auto& index = shared_networks_.get<SharedNetworkNameIndexTag>();
+ auto const& index = shared_networks_.get<SharedNetworkNameIndexTag>();
auto network_it = index.find(name);
if (network_it == index.cend()) {
return (SharedNetwork6Ptr());
SharedNetwork6Collection
TestConfigBackendDHCPv6::getModifiedSharedNetworks6(const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time) const {
- const auto& index = shared_networks_.get<SharedNetworkModificationTimeIndexTag>();
+ auto const& index = shared_networks_.get<SharedNetworkModificationTimeIndexTag>();
SharedNetwork6Collection shared_networks;
auto lb = index.lower_bound(modification_time);
for (auto shared_network = lb; shared_network != index.end(); ++shared_network) {
const std::string& space) const {
auto tags = server_selector.getTags();
auto candidate = OptionDefinitionPtr();
- const auto& index = option_defs_.get<1>();
+ auto const& index = option_defs_.get<1>();
auto option_def_it_pair = index.equal_range(code);
for (auto option_def_it = option_def_it_pair.first;
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
OptionDefContainer option_defs;
- const auto& index = option_defs_.get<3>();
+ auto const& index = option_defs_.get<3>();
auto lb = index.lower_bound(modification_time);
for (auto option_def = lb; option_def != index.end(); ++option_def) {
bool got = false;
const std::string& space) const {
auto tags = server_selector.getTags();
auto candidate = OptionDescriptorPtr();
- const auto& index = options_.get<1>();
+ auto const& index = options_.get<1>();
auto option_it_pair = index.equal_range(code);
for (auto option_it = option_it_pair.first; option_it != option_it_pair.second;
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
OptionContainer options;
- const auto& index = options_.get<3>();
+ auto const& index = options_.get<3>();
auto lb = index.lower_bound(modification_time);
for (auto option = lb; option != index.end(); ++option) {
bool got = false;
const std::string& name) const {
auto tags = server_selector.getTags();
auto candidate = StampedValuePtr();
- const auto& index = globals_.get<StampedValueNameIndexTag>();
+ auto const& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
++global_it) {
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
StampedValueCollection globals;
- const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
+ auto const& index = globals_.get<StampedValueModificationTimeIndexTag>();
auto lb = index.lower_bound(modification_time);
for (auto global = lb; global != index.end(); ++global) {
bool got = false;
ServerPtr
TestConfigBackendDHCPv6::getServer6(const ServerTag& server_tag) const {
- const auto& index = servers_.get<ServerTagIndexTag>();
+ auto const& index = servers_.get<ServerTagIndexTag>();
auto server_it = index.find(server_tag.get());
return ((server_it != index.cend()) ? (*server_it) : ServerPtr());
}
value = value.substr(5);
value = str::trim(value);
// Verify the credential is in the list.
- const auto it = credentials.find(value);
+ auto const it = credentials.find(value);
if (it != credentials.end()) {
LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_AUTHORIZED)
.arg(it->second);
}
// Stop all listeners.
- for (const auto& listener : listeners_) {
+ for (auto const& listener : listeners_) {
listener->stop();
}
ASSERT_NO_THROW(client_->stop());
// Listeners should stop without issue.
- for (const auto& listener : listeners_) {
+ for (auto const& listener : listeners_) {
ASSERT_NO_THROW(listener->stop());
}
ASSERT_NO_THROW(client_->stop());
// Listeners should stop without issue.
- for (const auto& listener : listeners_) {
+ for (auto const& listener : listeners_) {
ASSERT_NO_THROW(listener->stop());
}
/// @param insert_rows Collection of rows of data to insert. Note that
/// each row is inserted as a separate statement execution.
void testInsert(const TestRowSet& insert_rows) {
- for (const auto& row : insert_rows) {
+ for (auto const& row : insert_rows) {
// Set the insert parameters based on the current insert row.
PsqlBindArray in_bindings;
in_bindings.add(row.int_col);
/// @param update_rows Collection of rows of data to update.
void testUpdate(const TestRowSet& update_rows) {
size_t update_count = 0;
- for (const auto& row : update_rows) {
+ for (auto const& row : update_rows) {
// Set the text value and where clause parameters based on the
// this row's values.
PsqlBindArray in_bindings;
fetchConfigElement(const db::AuditEntryCollection& audit_entries,
const std::string& object_type) const {
db::AuditEntryCollection result;
- const auto& index = audit_entries.get<db::AuditEntryObjectTypeTag>();
+ auto const& index = audit_entries.get<db::AuditEntryObjectTypeTag>();
auto range = index.equal_range(object_type);
for (auto it = range.first; it != range.second; ++it) {
if ((*it)->getModificationType() != db::AuditEntry::ModificationType::DELETE) {
// Get the audit entries sorted by modification time and id,
// and pick the latest entry.
- const auto& index = audit_entries.get<db::AuditEntryModificationTimeIdTag>();
+ auto const& index = audit_entries.get<db::AuditEntryModificationTimeIdTag>();
last_audit_revision_time_ = (*index.rbegin())->getModificationTime();
last_audit_revision_id_ = (*index.rbegin())->getRevisionId();
}
inline bool
hasObjectId(const db::AuditEntryCollection& audit_entries,
const uint64_t& object_id) {
- const auto& object_id_idx = audit_entries.get<db::AuditEntryObjectIdTag>();
+ auto const& object_id_idx = audit_entries.get<db::AuditEntryObjectIdTag>();
return (object_id_idx.count(object_id) > 0);
}
if (next_key == "*" || json_path.empty()) {
// Then iterate through all the children.
result = Element::createMap();
- for (const auto& kv : element->mapValue()) {
+ for (auto const& kv : element->mapValue()) {
std::string const& key(kv.first);
ConstElementPtr const& value(kv.second);
db::AuditEntryCollection filtered_entries;
// Use the index which orders the audit entries by timestamps.
- const auto& index = audit_entries_.get<AuditEntryModificationTimeIdTag>();
+ auto const& index = audit_entries_.get<AuditEntryModificationTimeIdTag>();
// Locate the first audit entry after the last one having the
// specified modification time and id.
void
StatContext::setMaxSampleCountAll(uint32_t max_samples) {
// Let's iterate over all stored statistics...
- for (const auto& s : stats_) {
+ for (auto const& s : stats_) {
// ... and set count limit for each statistic.
s.second->setMaxSampleCount(max_samples);
}
///
/// @param expected_stats Map of expected static names and values.
inline void checkStats(const StatMap& expected_stats) {
- for (const auto& it : expected_stats) {
+ for (auto const& it : expected_stats) {
checkStat(it.first, it.second);
}
}
size_t& total_connections) {
total_connections = connections_.size();
size_t cnt = 0;
- for (const auto& conn : connections_) {
- const auto& ep = conn->getRemoteEndpoint();
+ for (auto const& conn : connections_) {
+ auto const& ep = conn->getRemoteEndpoint();
if ((ep != TcpConnection::NO_ENDPOINT()) &&
(IOAddress(ep.address()) == remote_ip)) {
++cnt;
#define SKIP_IF(expression) \
{ \
if (expression) { \
- const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \
+ auto const info = ::testing::UnitTest::GetInstance()->current_test_info(); \
std::cerr << "SKIPPING: " << info->test_case_name() << ":" << info->name() \
<< ": '" << #expression << "' is true" << std::endl; \
return; \
#define SKIP_IF(expression) \
{ \
if (expression) { \
- const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \
+ auto const info = ::testing::UnitTest::GetInstance()->current_test_info(); \
GTEST_SKIP() << "SKIPPING: " << info->test_case_name() << ":" << info->name() \
<< ": '" << #expression << "' is true"; \
} \
void
MultiThreadingMgr::checkCallbacksPermissions() {
if (getMode()) {
- for (const auto& cb : cs_callbacks_.getCallbackSets()) {
+ for (auto const& cb : cs_callbacks_.getCallbackSets()) {
try {
(cb.check_cb_)();
} catch (const isc::MultiThreadingInvalidOperation& ex) {
void
MultiThreadingMgr::callEntryCallbacks() {
if (getMode()) {
- const auto& callbacks = cs_callbacks_.getCallbackSets();
+ auto const& callbacks = cs_callbacks_.getCallbackSets();
for (auto cb_it = callbacks.begin(); cb_it != callbacks.end(); cb_it++) {
try {
(cb_it->entry_cb_)();
void
MultiThreadingMgr::callExitCallbacks() {
if (getMode()) {
- const auto& callbacks = cs_callbacks_.getCallbackSets();
+ auto const& callbacks = cs_callbacks_.getCallbackSets();
for (auto cb_it = callbacks.rbegin(); cb_it != callbacks.rend(); cb_it++) {
try {
(cb_it->exit_cb_)();
/// @return True if empty or contains only printable characters, False otherwise
inline bool
isPrintable(const std::string& content) {
- for (const auto& ch : content) {
+ for (auto const& ch : content) {
if (isprint(static_cast<int>(ch)) == 0) {
return (false);
}
/// @return True if empty or contains only printable characters, False otherwise
inline bool
isPrintable(const std::vector<uint8_t>& content) {
- for (const auto& ch : content) {
+ for (auto const& ch : content) {
if (isprint(static_cast<int>(ch)) == 0) {
return (false);
}
// signal threads that are waiting
signalThreads();
// wait for all test threads to exit
- for (const auto& thread : threads_) {
+ for (auto const& thread : threads_) {
thread->join();
}
// reset all threads
void checkRunHistory(uint32_t items_count) {
uint32_t count = 0;
// iterate over all threads history and count all the processed tasks
- for (const auto& element : history_) {
+ for (auto const& element : history_) {
count += element.second.size();
}
ASSERT_EQ(count, items_count);
isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread");
}
queue_.disable();
- for (const auto& thread : threads_) {
+ for (auto const& thread : threads_) {
thread->join();
}
threads_.clear();
///
/// @return true if thread is owned, false otherwise
bool checkThreadId(std::thread::id id) {
- for (const auto& thread : threads_) {
+ for (auto const& thread : threads_) {
if (id == thread->get_id()) {
return (true);
}
// This is test environment sanity check. It verifies that all configuration
// defined in yang_configs.h are sane.
TEST(YangReprTest, verifyConfigs) {
- for (const auto& x : TEST_CONFIGS) {
+ for (auto const& x : TEST_CONFIGS) {
sanityCheckConfig(x.first, x.second);
}
}