2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 04:57:52 +00:00

[#3119] replace const auto with auto const

This commit is contained in:
Razvan Becheriu 2023-12-20 21:16:01 +02:00
parent 54dd674d0d
commit 72f330320b
93 changed files with 332 additions and 332 deletions

View File

@ -1495,7 +1495,7 @@ Dhcpv4Srv::processDhcp4Query(Pkt4Ptr& query, Pkt4Ptr& rsp,
}
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)) {
@ -3748,9 +3748,9 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release, AllocEngine::ClientContext4Ptr& cont
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(),
@ -3920,9 +3920,9 @@ Dhcpv4Srv::declineLease(const Lease4Ptr& lease, const Pkt4Ptr& decline,
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(),
@ -4021,9 +4021,9 @@ Dhcpv4Srv::serverDecline(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr& query
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(),

View File

@ -764,7 +764,7 @@ public:
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;

View File

@ -2995,7 +2995,7 @@ Dhcpv4SrvTest::checkConfigFiles() {
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);

View File

@ -3518,7 +3518,7 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) {
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());
@ -3878,7 +3878,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) {
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());

View File

@ -1153,7 +1153,7 @@ Dhcpv6Srv::processDhcp6Query(Pkt6Ptr& query, Pkt6Ptr& rsp) {
}
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.
@ -1426,7 +1426,7 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question,
// 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,
@ -2019,7 +2019,7 @@ Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer,
// 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,
@ -3009,7 +3009,7 @@ Dhcpv6Srv::extendLeases(const Pkt6Ptr& query, Pkt6Ptr& reply,
// 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,
@ -3061,7 +3061,7 @@ Dhcpv6Srv::releaseLeases(const Pkt6Ptr& release, Pkt6Ptr& reply,
// 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: {
@ -3289,9 +3289,9 @@ Dhcpv6Srv::releaseIA_NA(const DuidPtr& duid, const Pkt6Ptr& query,
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(),
@ -3497,9 +3497,9 @@ Dhcpv6Srv::releaseIA_PD(const DuidPtr& duid, const Pkt6Ptr& query,
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(),
@ -3876,7 +3876,7 @@ Dhcpv6Srv::declineLeases(const Pkt6Ptr& decline, Pkt6Ptr& reply,
// 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,
@ -4125,9 +4125,9 @@ Dhcpv6Srv::declineLease(const Pkt6Ptr& decline, const Lease6Ptr lease,
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(),
@ -4209,7 +4209,7 @@ Dhcpv6Srv::processDhcp4Query(const Pkt6Ptr& dhcp4_query) {
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;
@ -4331,7 +4331,7 @@ Dhcpv6Srv::requiredClassify(const Pkt6Ptr& pkt, AllocEngine::ClientContext6& ctx
}
// 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,

View File

@ -492,7 +492,7 @@ public:
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;

View File

@ -144,7 +144,7 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) {
// 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.
@ -152,8 +152,8 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) {
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);
@ -873,7 +873,7 @@ Dhcp6Client::getTeeTimes(const uint32_t iaid, uint32_t& t1, uint32_t& t2) const
}
// 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.

View File

@ -366,7 +366,7 @@ Dhcpv6SrvTest::checkConfigFiles() {
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);

View File

@ -5705,7 +5705,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) {
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());

View File

@ -861,7 +861,7 @@ TestControl::address6Uniqueness(const Pkt6Ptr& pkt6, ExchangeType xchg_type) {
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

View File

@ -375,7 +375,7 @@ public:
}
}
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();

View File

@ -100,7 +100,7 @@ HAConfigParser::parseAll(const HAConfigMapperPtr& config_storage,
}
// 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");
}
@ -258,7 +258,7 @@ HAConfigParser::parseOne(const HAConfigMapperPtr& config_storage,
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) {
@ -338,7 +338,7 @@ HAConfigParser::parseOne(const HAConfigMapperPtr& config_storage,
// 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;

View File

@ -2195,7 +2195,7 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client,
}
// 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())

View File

@ -420,7 +420,7 @@ QueryFilter::loadBalance(const dhcp::Pkt4Ptr& query4) const {
// 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 {
@ -452,7 +452,7 @@ QueryFilter::loadBalance(const dhcp::Pkt6Ptr& query6) const {
// 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 {

View File

@ -58,7 +58,7 @@ TEST(HARelationshipMapper, mapGetAll) {
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]);

View File

@ -483,7 +483,7 @@ LeaseCmdsImpl::updateStatsOnAdd(const Lease4Ptr& lease) {
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) {
@ -524,7 +524,7 @@ LeaseCmdsImpl::updateStatsOnAdd(const Lease6Ptr& lease) {
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) {
@ -653,7 +653,7 @@ LeaseCmdsImpl::updateStatsOnUpdate(const Lease4Ptr& existing,
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) {
@ -789,7 +789,7 @@ LeaseCmdsImpl::updateStatsOnUpdate(const Lease6Ptr& existing,
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) {
@ -833,7 +833,7 @@ LeaseCmdsImpl::updateStatsOnDelete(const Lease4Ptr& lease) {
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) {
@ -874,7 +874,7 @@ LeaseCmdsImpl::updateStatsOnDelete(const Lease6Ptr& lease) {
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) {
@ -1329,14 +1329,14 @@ LeaseCmdsImpl::leaseGetAllHandler(CalloutHandle& handle) {
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);
}
@ -1347,13 +1347,13 @@ LeaseCmdsImpl::leaseGetAllHandler(CalloutHandle& handle) {
// 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);
}
@ -1456,7 +1456,7 @@ LeaseCmdsImpl::leaseGetPageHandler(CalloutHandle& handle) {
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);
}
@ -1467,7 +1467,7 @@ LeaseCmdsImpl::leaseGetPageHandler(CalloutHandle& handle) {
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);
}
@ -1526,7 +1526,7 @@ LeaseCmdsImpl::leaseGetByHwAddressHandler(CalloutHandle& handle) {
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);
}
@ -1576,7 +1576,7 @@ LeaseCmdsImpl::leaseGetByClientIdHandler(CalloutHandle& handle) {
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);
}
@ -1626,7 +1626,7 @@ LeaseCmdsImpl::leaseGetByDuidHandler(CalloutHandle& handle) {
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);
}
@ -1685,7 +1685,7 @@ LeaseCmdsImpl::leaseGetByHostnameHandler(CalloutHandle& handle) {
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);
}
@ -1693,7 +1693,7 @@ LeaseCmdsImpl::leaseGetByHostnameHandler(CalloutHandle& handle) {
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);
}
@ -1836,7 +1836,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) {
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);
@ -1853,7 +1853,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) {
// 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;
@ -1872,7 +1872,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) {
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.
@ -1924,7 +1924,7 @@ LeaseCmdsImpl::lease6BulkApplyHandler(CalloutHandle& handle) {
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;
@ -2244,7 +2244,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) {
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")));
@ -2269,7 +2269,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) {
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(
@ -2280,7 +2280,7 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) {
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")));
@ -2367,7 +2367,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
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")));
@ -2383,7 +2383,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
}
}
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")));
@ -2401,7 +2401,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
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(
@ -2416,7 +2416,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
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")));
@ -2432,7 +2432,7 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
}
}
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")));

View File

@ -1035,7 +1035,7 @@ public:
// 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) {
@ -1161,14 +1161,14 @@ public:
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);
@ -1203,7 +1203,7 @@ public:
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);
@ -1798,7 +1798,7 @@ public:
// (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);
@ -2721,7 +2721,7 @@ public:
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()),
@ -2747,7 +2747,7 @@ public:
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());
@ -2757,7 +2757,7 @@ public:
// (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);
@ -2922,7 +2922,7 @@ public:
}
// 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)) {

View File

@ -1277,7 +1277,7 @@ public:
// 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) {
@ -1412,20 +1412,20 @@ public:
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);
@ -1461,7 +1461,7 @@ public:
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);
@ -1512,7 +1512,7 @@ public:
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);
@ -2137,7 +2137,7 @@ public:
// (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);
@ -3148,7 +3148,7 @@ public:
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()),
@ -3174,7 +3174,7 @@ public:
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());
@ -3184,7 +3184,7 @@ public:
// (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);
@ -3349,7 +3349,7 @@ public:
}
// 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)) {

View File

@ -974,9 +974,9 @@ MySqlConfigBackendImpl::attachElementToServers(const int index,
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()));
}
}

View File

@ -633,7 +633,7 @@ public:
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) {

View File

@ -1001,14 +1001,14 @@ public:
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);
@ -1048,7 +1048,7 @@ public:
// 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);
@ -1574,7 +1574,7 @@ public:
// (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);
@ -2522,7 +2522,7 @@ public:
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);
@ -2548,7 +2548,7 @@ public:
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());
@ -2558,7 +2558,7 @@ public:
// (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);
@ -2725,7 +2725,7 @@ public:
}
// 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)) {

View File

@ -1170,20 +1170,20 @@ public:
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);
@ -1223,7 +1223,7 @@ public:
// 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);
@ -1277,7 +1277,7 @@ public:
// 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);
@ -1811,7 +1811,7 @@ public:
// (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);
@ -2844,7 +2844,7 @@ public:
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);
@ -2870,7 +2870,7 @@ public:
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());
@ -2880,7 +2880,7 @@ public:
// (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);
@ -3047,7 +3047,7 @@ public:
}
// 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)) {

View File

@ -1099,9 +1099,9 @@ void
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()));
}
}

View File

@ -600,7 +600,7 @@ public:
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) {

View File

@ -406,7 +406,7 @@ LeaseStatCmdsImpl::makeResultSet4(const ElementPtr& result_wrapper,
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();
@ -537,7 +537,7 @@ LeaseStatCmdsImpl::makeResultSet6(const ElementPtr& result_wrapper,
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();

View File

@ -114,7 +114,7 @@ IoServiceThreadPool::checkPermissions(State state) {
bool
IoServiceThreadPool::checkThreadId(std::thread::id id) {
for (const auto& thread : threads_) {
for (auto const& thread : threads_) {
if (id == thread->get_id()) {
return (true);
}

View File

@ -248,7 +248,7 @@ TEST(AddrUtilitiesTest, addrsInRange6) {
// 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")));
@ -279,7 +279,7 @@ TEST(AddrUtilitiesTest, prefixLengthFromRange4) {
// 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("::")));

View File

@ -213,7 +213,7 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) {
// 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) &&

View File

@ -1122,7 +1122,7 @@ MapElement::equals(const Element& other) const {
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))) {
@ -1156,7 +1156,7 @@ removeIdentical(ElementPtr a, ConstElementPtr b) {
// 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))) {
@ -1178,7 +1178,7 @@ removeIdentical(ConstElementPtr a, ConstElementPtr b) {
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))) {
@ -1196,7 +1196,7 @@ merge(ElementPtr element, ConstElementPtr other) {
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) {
@ -1249,7 +1249,7 @@ mergeDiffAdd(ElementPtr& element, ElementPtr& other,
}
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) {
@ -1318,7 +1318,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other,
// 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) {
@ -1349,7 +1349,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other,
}
// 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);
}
}
@ -1389,7 +1389,7 @@ extend(const std::string& container, const std::string& extension,
}
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) {
@ -1428,7 +1428,7 @@ copy(ConstElementPtr from, int level) {
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 {
@ -1438,7 +1438,7 @@ copy(ConstElementPtr from, int level) {
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) {
@ -1517,7 +1517,7 @@ isEquivalent0(ConstElementPtr a, ConstElementPtr b, unsigned level) {
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)) {
@ -1565,7 +1565,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out,
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()) {
@ -1597,7 +1597,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out,
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

View File

@ -24,7 +24,7 @@ namespace data {
void
SimpleParser::checkRequired(const SimpleRequiredKeywords& required,
ConstElementPtr scope) {
for (const auto& name : required) {
for (auto const& name : required) {
if (scope->contains(name)) {
continue;
}
@ -36,7 +36,7 @@ void
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;

View File

@ -38,7 +38,7 @@ StampedElement::getMetadata() const {
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()));
}

View File

@ -171,7 +171,7 @@ protected:
// 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;
@ -182,7 +182,7 @@ protected:
// 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;
@ -312,7 +312,7 @@ protected:
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;
@ -322,7 +322,7 @@ protected:
} 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;
@ -382,7 +382,7 @@ protected:
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;
@ -392,7 +392,7 @@ protected:
} 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;
@ -609,7 +609,7 @@ protected:
}
// 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) &&

View File

@ -56,7 +56,7 @@ public:
/// @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);
}
@ -72,7 +72,7 @@ public:
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);
@ -89,7 +89,7 @@ public:
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);
}

View File

@ -46,10 +46,10 @@ void
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));
}
};

View File

@ -37,7 +37,7 @@ void
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));
}
@ -47,7 +47,7 @@ void
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);
}
@ -57,7 +57,7 @@ void
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);
}

View File

@ -28,7 +28,7 @@ D2StatTest::~D2StatTest() {
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;

View File

@ -220,7 +220,7 @@ isc::data::ElementPtr
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;

View File

@ -270,7 +270,7 @@ DbAccessParser::getDbAccessString() const {
// 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).

View File

@ -24,7 +24,7 @@ ServerSelector::MULTIPLE(const std::set<std::string>& server_tags) {
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));
}

View File

@ -243,7 +243,7 @@ public:
// 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");
@ -266,7 +266,7 @@ TEST_F(AuditEntryCollectionTest, getByObjectType) {
// 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));
@ -313,7 +313,7 @@ TEST_F(AuditEntryCollectionTest, getByModificationTime) {
// 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);
@ -337,7 +337,7 @@ TEST_F(AuditEntryCollectionTest, getByModificationTimeAndId) {
// 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);

View File

@ -828,7 +828,7 @@ IfaceCollection::getIfaceInternal(const unsigned int ifindex, const bool need_lo
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
@ -855,7 +855,7 @@ IfaceCollection::getIfaceInternal(const std::string& ifname, const bool need_loc
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

View File

@ -693,7 +693,7 @@ void
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();
@ -752,7 +752,7 @@ extendVivco(OptionCollection& options) {
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();

View File

@ -380,7 +380,7 @@ DnrInstance::getDnrInstanceAsText() const {
<< "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();
}

View File

@ -41,7 +41,7 @@ Option6Dnr::pack(util::OutputBuffer& buf, bool check) const {
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");

View File

@ -53,7 +53,7 @@ Pkt::addOption(const OptionPtr& opt) {
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);
}
@ -62,7 +62,7 @@ Pkt::getNonCopiedOption(const uint16_t type) const {
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();
@ -102,7 +102,7 @@ Pkt::getOptions(const uint16_t opt_type) {
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

View File

@ -60,7 +60,7 @@ Pkt4::len() {
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();
}
@ -447,7 +447,7 @@ Pkt4::toText() const {
if (!options_.empty()) {
tmp << "," << endl << "options:";
for (const auto& opt : options_) {
for (auto const& opt : options_) {
try {
tmp << endl << opt.second->toText(2);
} catch (...) {

View File

@ -44,7 +44,7 @@ std::string Pkt6::RelayInfo::toText() const {
<< "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());
@ -346,7 +346,7 @@ uint16_t Pkt6::getRelayOverhead(const RelayInfo& relay) const {
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();
}
@ -368,7 +368,7 @@ uint16_t Pkt6::calculateRelaySizes() {
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();
}
@ -422,7 +422,7 @@ Pkt6::packUDP() {
// 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_);
}
@ -738,7 +738,7 @@ Pkt6::toText() const {
if (!options_.empty()) {
tmp << "," << endl << "options:";
for (const auto& opt : options_) {
for (auto const& opt : options_) {
try {
tmp << endl << opt.second->toText(2);
} catch (...) {
@ -754,7 +754,7 @@ Pkt6::toText() const {
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 {

View File

@ -1543,9 +1543,9 @@ AllocEngine::removeNonmatchingReservedLeases6(ClientContext6& ctx,
"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(),
@ -1602,9 +1602,9 @@ AllocEngine::removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
"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(),
@ -1685,9 +1685,9 @@ AllocEngine::removeNonreservedLeases6(ClientContext6& ctx,
"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(),
@ -1814,7 +1814,7 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx,
// 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();
}
@ -2007,7 +2007,7 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx,
// 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();
}
@ -2222,7 +2222,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) {
"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(),
@ -2358,7 +2358,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) {
// 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();
}
@ -2378,7 +2378,7 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) {
"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(),
@ -2476,7 +2476,7 @@ AllocEngine::updateLeaseData(ClientContext6& ctx, const Lease6Collection& leases
"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(),
@ -2910,9 +2910,9 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
"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(),
@ -2935,9 +2935,9 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
"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(),
@ -3049,9 +3049,9 @@ AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease,
"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(),
@ -3139,9 +3139,9 @@ AllocEngine::reclaimDeclined(const Lease4Ptr& lease) {
"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(),
@ -3211,9 +3211,9 @@ AllocEngine::reclaimDeclined(const Lease6Ptr& lease) {
"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(),
@ -4135,9 +4135,9 @@ AllocEngine::requestLease4(AllocEngine::ClientContext4& ctx) {
"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(),
@ -4333,7 +4333,7 @@ AllocEngine::createLease4(const ClientContext4& ctx, const IOAddress& addr,
}
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();
}
@ -4467,7 +4467,7 @@ AllocEngine::renewLease4(const Lease4Ptr& lease,
}
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();
}
@ -4595,7 +4595,7 @@ AllocEngine::reuseExpiredLease4(Lease4Ptr& expired,
}
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();
}

View File

@ -44,14 +44,14 @@ protected:
/// 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());
}
}

View File

@ -66,7 +66,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector,
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) {

View File

@ -64,7 +64,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector
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) {

View File

@ -1100,7 +1100,7 @@ CfgHosts::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr) {
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) {
@ -1136,10 +1136,10 @@ CfgHosts::del4(const SubnetID& subnet_id,
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) {
@ -1186,10 +1186,10 @@ CfgHosts::del6(const SubnetID& 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;) {

View File

@ -162,7 +162,7 @@ CfgOption::createOptions(CfgOptionDefPtr cfg_def) {
// 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.
@ -372,7 +372,7 @@ CfgOption::del(const std::string& option_space, const uint16_t option_code) {
(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();

View File

@ -14,7 +14,7 @@ namespace dhcp {
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());
}

View File

@ -106,7 +106,7 @@ public:
/// @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);
@ -122,7 +122,7 @@ public:
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());
@ -186,7 +186,7 @@ public:
// 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) {

View File

@ -155,7 +155,7 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks,
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);
}
@ -185,21 +185,21 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks,
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());
}
@ -535,7 +535,7 @@ CfgSubnets4::removeStatistics() {
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")));
@ -592,7 +592,7 @@ CfgSubnets4::updateStatistics() {
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")));

View File

@ -152,12 +152,12 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks,
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);
}
@ -187,14 +187,14 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks,
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());
}
@ -433,7 +433,7 @@ CfgSubnets6::removeStatistics() {
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")));
@ -459,7 +459,7 @@ CfgSubnets6::removeStatistics() {
"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")));
@ -520,7 +520,7 @@ CfgSubnets6::updateStatistics() {
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")));
@ -538,7 +538,7 @@ CfgSubnets6::updateStatistics() {
}
}
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")));

View File

@ -97,7 +97,7 @@ IterativeAllocator::pickAddressInternal(const ClientClasses& client_classes,
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");
@ -210,7 +210,7 @@ IterativeAllocator::pickPrefixInternal(const ClientClasses& client_classes,
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");

View File

@ -129,7 +129,7 @@ LeaseMgr::recountLeaseStats4() {
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")));
@ -353,7 +353,7 @@ LeaseMgr::recountLeaseStats6() {
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")));
@ -383,7 +383,7 @@ LeaseMgr::recountLeaseStats6() {
}
}
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")));

View File

@ -3321,7 +3321,7 @@ Memfile_LeaseMgr::buildExtendedInfoTables6() {
size_t modified = 0;
size_t processed = 0;
for (const auto& lease : storage6_) {
for (auto const& lease : storage6_) {
++leases;
try {
if (upgradeLease6ExtendedInfo(lease, check)) {
@ -3397,7 +3397,7 @@ Memfile_LeaseMgr::writeLeases4Internal(const std::string& filename) {
::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();
@ -3434,7 +3434,7 @@ Memfile_LeaseMgr::writeLeases6Internal(const std::string& filename) {
::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();

View File

@ -4580,7 +4580,7 @@ MySqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
++pages;
start_addr = leases.back()->addr_;
for (const auto& lease : leases) {
for (auto const& lease : leases) {
try {
bool modified = upgradeLease6ExtendedInfo(lease, check);
if (modified) {

View File

@ -251,7 +251,7 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary,
}
// 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

View File

@ -651,7 +651,7 @@ SubnetConfigParser::createSubnet(ConstElementPtr params) {
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) {

View File

@ -3622,7 +3622,7 @@ PgSqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
++pages;
start_addr = leases.back()->addr_;
for (const auto& lease : leases) {
for (auto const& lease : leases) {
try {
bool modified = upgradeLease6ExtendedInfo(lease, check);
if (modified) {

View File

@ -28,7 +28,7 @@ RandomAllocator::pickAddressInternal(const ClientClasses& client_classes,
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
@ -91,7 +91,7 @@ RandomAllocator::pickPrefixInternal(const ClientClasses& client_classes,
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

View File

@ -158,7 +158,7 @@ public:
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);
@ -183,7 +183,7 @@ public:
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);
@ -245,7 +245,7 @@ public:
// 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

View File

@ -333,7 +333,7 @@ SrvConfig::applyDefaultsConfiguredGlobals(const SimpleDefaults& defaults) {
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*.

View File

@ -406,7 +406,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress&
// 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;
@ -442,7 +442,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress&
void
Subnet::initAllocatorsAfterConfigure() {
for (const auto& allocator : allocators_) {
for (auto const& allocator : allocators_) {
allocator.second->initAfterConfigure();
}
}
@ -453,7 +453,7 @@ const PoolPtr Subnet::getPool(Lease::Type type,
// 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;
@ -543,8 +543,8 @@ Subnet::inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const {
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);
}
@ -563,8 +563,8 @@ Subnet::inPool(Lease::Type type,
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;
}
@ -578,7 +578,7 @@ Subnet::inPool(Lease::Type type,
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()) {
@ -599,7 +599,7 @@ Subnet::poolOverlaps(const Lease::Type& pool_type, const PoolPtr& pool) const {
// 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);
@ -810,9 +810,9 @@ Subnet4::toElement() const {
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());
}
@ -918,18 +918,18 @@ Subnet6::toElement() const {
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());
}

View File

@ -174,7 +174,7 @@ public:
/// @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)) {
@ -195,7 +195,7 @@ public:
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) {

View File

@ -187,7 +187,7 @@ public:
/// @brief Remove other files.
void removeOtherFiles() const {
for (const auto& file : extra_files_) {
for (auto const& file : extra_files_) {
LeaseFileIO io(file);
io.removeFile();
}

View File

@ -404,7 +404,7 @@ TEST(SharedNetwork4Test, getNextSubnet) {
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.
@ -1154,7 +1154,7 @@ TEST(SharedNetwork6Test, getNextSubnet) {
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.

View File

@ -144,7 +144,7 @@ GenericBackendTest::testNewAuditEntry(const std::string& exp_object_type,
// 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";
@ -191,7 +191,7 @@ GenericBackendTest::testNewAuditEntry(const std::vector<ExpAuditEntry>& exp_entr
// 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()

View File

@ -886,7 +886,7 @@ GenericConfigBackendDHCPv4Test::getAllGlobalParameters4Test() {
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());
@ -939,7 +939,7 @@ GenericConfigBackendDHCPv4Test::getModifiedGlobalParameters4Test() {
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());

View File

@ -918,7 +918,7 @@ GenericConfigBackendDHCPv6Test::getAllGlobalParameters6Test() {
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());
@ -971,7 +971,7 @@ GenericConfigBackendDHCPv6Test::getModifiedGlobalParameters6Test() {
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());

View File

@ -5352,7 +5352,7 @@ HostMgrTest::testDelete6ByIDAndIdentifier(BaseHostDataSource& data_source1,
}
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;
}

View File

@ -179,7 +179,7 @@ MemHostDataSource::getPage6(size_t& /*source_index*/,
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);
}
@ -250,7 +250,7 @@ ConstHostCollection
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);
@ -296,7 +296,7 @@ ConstHostCollection
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;
}
@ -315,7 +315,7 @@ MemHostDataSource::getAll6(const SubnetID& subnet_id,
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) {

View File

@ -37,7 +37,7 @@ TestConfigBackendDHCPv4::unregisterBackendType(ConfigBackendDHCPv4Mgr& mgr,
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());
@ -61,7 +61,7 @@ TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
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());
@ -118,7 +118,7 @@ TestConfigBackendDHCPv4::getAllSubnets4(const db::ServerSelector& server_selecto
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) {
@ -197,7 +197,7 @@ TestConfigBackendDHCPv4::getSharedNetworkSubnets4(const db::ServerSelector& serv
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());
@ -254,7 +254,7 @@ TestConfigBackendDHCPv4::getAllSharedNetworks4(const db::ServerSelector& server_
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) {
@ -293,7 +293,7 @@ TestConfigBackendDHCPv4::getOptionDef4(const db::ServerSelector& server_selector
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;
@ -348,7 +348,7 @@ TestConfigBackendDHCPv4::getModifiedOptionDefs4(const db::ServerSelector& server
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;
@ -375,7 +375,7 @@ TestConfigBackendDHCPv4::getOption4(const db::ServerSelector& server_selector,
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;
@ -423,7 +423,7 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& server_se
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;
@ -449,7 +449,7 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se
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) {
@ -495,7 +495,7 @@ TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector&
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;
@ -658,7 +658,7 @@ TestConfigBackendDHCPv4::getAllServers4() const {
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());
}

View File

@ -36,7 +36,7 @@ TestConfigBackendDHCPv6::unregisterBackendType(ConfigBackendDHCPv6Mgr& mgr,
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());
@ -60,7 +60,7 @@ TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
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());
@ -117,7 +117,7 @@ TestConfigBackendDHCPv6::getAllSubnets6(const db::ServerSelector& server_selecto
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) {
@ -196,7 +196,7 @@ TestConfigBackendDHCPv6::getSharedNetworkSubnets6(const db::ServerSelector& serv
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());
@ -253,7 +253,7 @@ TestConfigBackendDHCPv6::getAllSharedNetworks6(const db::ServerSelector& server_
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) {
@ -292,7 +292,7 @@ TestConfigBackendDHCPv6::getOptionDef6(const db::ServerSelector& server_selector
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;
@ -347,7 +347,7 @@ TestConfigBackendDHCPv6::getModifiedOptionDefs6(const db::ServerSelector& server
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;
@ -374,7 +374,7 @@ TestConfigBackendDHCPv6::getOption6(const db::ServerSelector& server_selector,
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;
@ -422,7 +422,7 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& server_se
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;
@ -448,7 +448,7 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se
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) {
@ -494,7 +494,7 @@ TestConfigBackendDHCPv6::getModifiedGlobalParameters6(const db::ServerSelector&
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;
@ -657,7 +657,7 @@ TestConfigBackendDHCPv6::getAllServers6() const {
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());
}

View File

@ -362,7 +362,7 @@ BasicHttpAuthConfig::checkAuth(const HttpResponseCreator& creator,
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);

View File

@ -213,7 +213,7 @@ public:
}
// Stop all listeners.
for (const auto& listener : listeners_) {
for (auto const& listener : listeners_) {
listener->stop();
}
@ -518,7 +518,7 @@ public:
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());
}
@ -713,7 +713,7 @@ public:
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());
}

View File

@ -162,7 +162,7 @@ public:
/// @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);
@ -238,7 +238,7 @@ public:
/// @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;

View File

@ -269,7 +269,7 @@ protected:
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) {
@ -346,7 +346,7 @@ protected:
// 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();
}
@ -370,7 +370,7 @@ protected:
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);
}

View File

@ -46,7 +46,7 @@ redact(ElementPtrType const& element, list<string> json_path) {
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);

View File

@ -51,7 +51,7 @@ public:
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.

View File

@ -80,7 +80,7 @@ StatContext::getAll() const {
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);
}

View File

@ -61,7 +61,7 @@ inline void checkNoStat(const std::string& name) {
///
/// @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);
}
}

View File

@ -113,8 +113,8 @@ TcpConnectionPool::usedByRemoteIpInternal(const IOAddress& remote_ip,
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;

View File

@ -101,7 +101,7 @@ namespace test {
#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; \
@ -111,7 +111,7 @@ namespace test {
#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"; \
} \

View File

@ -154,7 +154,7 @@ MultiThreadingMgr::apply(bool enabled, uint32_t thread_count, uint32_t queue_siz
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) {
@ -177,7 +177,7 @@ MultiThreadingMgr::checkCallbacksPermissions() {
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_)();
@ -193,7 +193,7 @@ MultiThreadingMgr::callEntryCallbacks() {
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_)();

View File

@ -365,7 +365,7 @@ typedef boost::shared_ptr<StringSanitizer> StringSanitizerPtr;
/// @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);
}
@ -380,7 +380,7 @@ isPrintable(const std::string& content) {
/// @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);
}

View File

@ -130,7 +130,7 @@ public:
// 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
@ -172,7 +172,7 @@ public:
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);

View File

@ -242,7 +242,7 @@ private:
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();
@ -252,7 +252,7 @@ private:
///
/// @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);
}

View File

@ -280,7 +280,7 @@ void sanityCheckConfig(const string& model, const YRTree& tree) {
// 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);
}
}