// Let's wait up to 15s for the server's response. The response
// should arrive sooner assuming that the timeout mechanism for
// the server is working properly.
- const unsigned int timeout = 15;
- ASSERT_TRUE(client->getResponse(response, timeout));
+ const unsigned int timeout_15 = 15;
+ ASSERT_TRUE(client->getResponse(response, timeout_15));
// Explicitly close the client's connection.
client->disconnectFromServer();
// Let's wait up to 15s for the server's response. The response
// should arrive sooner assuming that the timeout mechanism for
// the server is working properly.
- const unsigned int timeout = 15;
- ASSERT_TRUE(client->getResponse(response, timeout));
+ const unsigned int timeout_15 = 15;
+ ASSERT_TRUE(client->getResponse(response, timeout_15));
// Explicitly close the client's connection.
client->disconnectFromServer();
try {
createNameChangeRequests(lease, ctx->old_lease_,
*ex.getContext()->getDdnsParams());
- } catch (const Exception& ex) {
+ } catch (const Exception& exception) {
LOG_ERROR(ddns4_logger, DHCP4_NCR_CREATION_FAILED)
.arg(query->getLabel())
- .arg(ex.what());
+ .arg(exception.what());
}
}
// Matching: add the class
query->addClass(cclass);
}
- } catch (const Exception& ex) {
+ } catch (const Exception& exception) {
LOG_ERROR(dhcp4_logger, DHCP4_ADDITIONAL_CLASS_EVAL_ERROR)
.arg(query->getLabel())
.arg(cclass)
- .arg(ex.what());
+ .arg(exception.what());
}
}
}
db2_.reset(new TestConfigBackendDHCPv4(params));
ConfigBackendDHCPv4Mgr::instance().registerBackendFactory("memfile",
- [this](const DatabaseConnection::ParameterMap& params)
+ [this](const DatabaseConnection::ParameterMap& parameters)
-> ConfigBackendDHCPv4Ptr {
- auto host = params.find("host");
- if (host != params.end()) {
+ auto host = parameters.find("host");
+ if (host != parameters.end()) {
if (host->second == "db1") {
return (db1_);
} else if (host->second == "db2") {
}
// Apparently we're looking for a new one.
- return (TestConfigBackendDHCPv4Ptr(new TestConfigBackendDHCPv4(params)));
+ return (TestConfigBackendDHCPv4Ptr(new TestConfigBackendDHCPv4(parameters)));
});
}
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendUnixCommand(os.str(), response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* pf) {
+ reinterpret_cast<PIDFile*>(pf)->deleteFile();
+ });
// Now tell Kea to reload its config.
sendUnixCommand("{ \"command\": \"config-reload\" }", response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendHttpCommand(os.str(), response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendHttpCommand(os.str(), response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
-
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* pf) {
+ reinterpret_cast<PIDFile*>(pf)->deleteFile();
+ });
// This command should reload test8.json config.
sendHttpCommand("{ \"command\": \"config-reload\" }", response);
TEST_F(Dhcpv4SharedNetworkTest, authoritative) {
// Each scenario will be defined using those parameters.
- typedef struct scenario {
+ struct scenario {
bool exp_success;
AuthoritativeFlag global;
AuthoritativeFlag subnet1;
AuthoritativeFlag subnet2;
- } scenario;
+ };
// We have the following scenarios. The default is no.
// The only allowed combinations are those that end up with
db2_.reset(new TestConfigBackendDHCPv6(params));
ConfigBackendDHCPv6Mgr::instance().registerBackendFactory("memfile",
- [this](const DatabaseConnection::ParameterMap& params)
+ [this](const DatabaseConnection::ParameterMap& parameters)
-> ConfigBackendDHCPv6Ptr {
- auto host = params.find("host");
- if (host != params.end()) {
+ auto host = parameters.find("host");
+ if (host != parameters.end()) {
if (host->second == "db1") {
return (db1_);
} else if (host->second == "db2") {
}
// Apparently we're looking for a new one.
- return (TestConfigBackendDHCPv6Ptr(new TestConfigBackendDHCPv6(params)));
+ return (TestConfigBackendDHCPv6Ptr(new TestConfigBackendDHCPv6(parameters)));
});
}
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendUnixCommand(os.str(), response);
" { \"subnet\": \"2001:db8:2::/64\", \"id\": 2 }"
" ],"
" \"lease-database\": {"
- " \"type\": \"memfile\", \"persist\": false }"
"} }";
ofstream f("test8.json", ios::trunc);
f << cfg_txt;
f.close();
- // Create the backend configuration.
+ // Creuate the backend configuration.
DatabaseConnection::ParameterMap pmap;
- pmap["type"] = "memfile";
+ pmap["teype"] = "memfile";
pmap["universe"] = "6";
pmap["name"] = getLeaseFilePath("kea-leases6.csv");
pmap["lfc-interval"] = "1";
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* pf) {
+ reinterpret_cast<PIDFile*>(pf)->deleteFile();
+ });
// Now tell Kea to reload its config.
sendUnixCommand("{ \"command\": \"config-reload\" }", response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendHttpCommand(os.str(), response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* f) {
+ reinterpret_cast<PIDFile*>(f)->deleteFile();
+ });
// Send the config-set command
sendHttpCommand(os.str(), response);
PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID));
pid_file.write();
- std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(&pid_file), [](void* p) { reinterpret_cast<PIDFile*>(p)->deleteFile(); });
-
+ std::unique_ptr<void, void (*)(void*)> p(static_cast<void*>(&pid_file), [](void* pf) {
+ reinterpret_cast<PIDFile*>(pf)->deleteFile();
+ });
// This command should reload test8.json config.
sendHttpCommand("{ \"command\": \"config-reload\" }", response);
char* ktname = getenv("KRB5_CLIENT_KTNAME");
ASSERT_TRUE(ktname);
EXPECT_EQ("foo", string(ktname));
- char* ccname = getenv("KRB5CCNAME");
- ASSERT_TRUE(ccname);
- EXPECT_EQ("bar", string(ccname));
+ char* krb5ccname = getenv("KRB5CCNAME");
+ ASSERT_TRUE(krb5ccname);
+ EXPECT_EQ("bar", string(krb5ccname));
}
/// @brief Tests status-get command processed handler.
request, response,
[this, weak_query, parking_lot, config]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// Get the shared pointer of the query. The server should keep the
// pointer to the query and then park it. Therefore, we don't really
// expect it to be null. If it is null, something is really wrong.
- QueryPtrType query = weak_query.lock();
- if (!query) {
+ QueryPtrType query_ptr = weak_query.lock();
+ if (!query_ptr) {
isc_throw(Unexpected, "query is null while receiving response from"
" HA peer. This is programmatic error");
}
if (ec || !error_str.empty()) {
LOG_WARN(ha_logger, HA_LEASE_UPDATE_COMMUNICATIONS_FAILED)
.arg(config_->getThisServerName())
- .arg(query->getLabel())
+ .arg(query_ptr->getLabel())
.arg(config->getLogLabel())
.arg(ec ? ec.message() : error_str);
try {
int rcode = 0;
- auto args = verifyAsyncResponse(response, rcode);
+ auto args = verifyAsyncResponse(http_response, rcode);
// In the v6 case the server may return a list of failed lease
// updates and we should log them.
- logFailedLeaseUpdates(query, args);
+ logFailedLeaseUpdates(query_ptr, args);
} catch (const ConflictError& ex) {
// Handle forth group of errors.
lease_update_conflict = true;
lease_update_success = false;
- communication_state_->reportRejectedLeaseUpdate(query);
+ communication_state_->reportRejectedLeaseUpdate(query_ptr);
LOG_WARN(ha_logger, HA_LEASE_UPDATE_CONFLICT)
.arg(config_->getThisServerName())
- .arg(query->getLabel())
+ .arg(query_ptr->getLabel())
.arg(config->getLogLabel())
.arg(ex.what());
// Handle third group of errors.
LOG_WARN(ha_logger, HA_LEASE_UPDATE_FAILED)
.arg(config_->getThisServerName())
- .arg(query->getLabel())
+ .arg(query_ptr->getLabel())
.arg(config->getLogLabel())
.arg(ex.what());
} else {
// Lease update successful and we may need to clear some previously
// rejected lease updates.
- communication_state_->reportSuccessfulLeaseUpdate(query);
+ communication_state_->reportSuccessfulLeaseUpdate(query_ptr);
}
}
// case the DHCP exchange fails.
if (!lease_update_success) {
if (parking_lot) {
- parking_lot->drop(query);
+ parking_lot->drop(query_ptr);
}
}
} else {
return;
}
- if (leaseUpdateComplete(query, parking_lot)) {
+ if (leaseUpdateComplete(query_ptr, parking_lot)) {
// If we have finished sending the lease updates we need to run the
// state machine until the state machine finds that additional events
// are required, such as next heartbeat or a lease update. The runModel()
// Instead of duplicating the code between the failed-deleted-leases and
// failed-leases, let's just have one function that does it for both.
- auto log_proc = [](const PktPtr query, const ConstElementPtr& args,
- const std::string& param_name, const log::MessageID& mesid) {
-
+ auto log_proc = [query, args](const std::string& param_name, const log::MessageID& mesid) {
// Check if there are any failed leases.
auto failed_leases = args->get(param_name);
};
// Process "failed-deleted-leases"
- log_proc(query, args, "failed-deleted-leases", HA_LEASE_UPDATE_DELETE_FAILED_ON_PEER);
+ log_proc("failed-deleted-leases", HA_LEASE_UPDATE_DELETE_FAILED_ON_PEER);
// Process "failed-leases".
- log_proc(query, args, "failed-leases", HA_LEASE_UPDATE_CREATE_UPDATE_FAILED_ON_PEER);
+ log_proc("failed-leases", HA_LEASE_UPDATE_CREATE_UPDATE_FAILED_ON_PEER);
}
ConstElementPtr
request, response,
[this, partner_config, sync_complete_notified]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// There are three possible groups of errors during the heartbeat.
// Response must contain arguments and the arguments must
// be a map.
int rcode = 0;
- ConstElementPtr args = verifyAsyncResponse(response, rcode);
+ ConstElementPtr args = verifyAsyncResponse(http_response, rcode);
if (!args || args->getType() != Element::map) {
isc_throw(CtrlChannelError, "returned arguments in the response"
" must be a map");
request, response,
[this, remote_config, post_request_action]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// There are three possible groups of errors during the heartbeat.
// Handle third group of errors.
try {
- static_cast<void>(verifyAsyncResponse(response, rcode));
+ static_cast<void>(verifyAsyncResponse(http_response, rcode));
} catch (const std::exception& ex) {
error_message = ex.what();
request, response,
[this, remote_config, post_request_action]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// There are three possible groups of errors during the heartbeat.
// Handle third group of errors.
try {
- static_cast<void>(verifyAsyncResponse(response, rcode));
+ static_cast<void>(verifyAsyncResponse(http_response, rcode));
} catch (const std::exception& ex) {
error_message = ex.what();
request, response,
[this, remote_config, post_sync_action, &http_client, max_period, dhcp_disabled]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// Holds last lease received on the page of leases. If the last
// page was hit, this value remains null.
- LeasePtr last_lease;
+ LeasePtr last_lease_in_callback;
// There are three possible groups of errors during the heartbeat.
// One is the IO error causing issues in communication with the peer.
// Handle third group of errors.
try {
int rcode = 0;
- ConstElementPtr args = verifyAsyncResponse(response, rcode);
+ ConstElementPtr args = verifyAsyncResponse(http_response, rcode);
// Arguments must be a map.
if (args && (args->getType() != Element::map)) {
// lease4-get-page command.
if ((leases_element.size() >= config_->getSyncPageLimit()) &&
(l + 1 == leases_element.end())) {
- last_lease = boost::dynamic_pointer_cast<Lease>(lease);
+ last_lease_in_callback = boost::dynamic_pointer_cast<Lease>(lease);
}
if (!lease_sync_filter_.shouldSync(lease)) {
// lease6-get-page command.
if ((leases_element.size() >= config_->getSyncPageLimit()) &&
(l + 1 == leases_element.end())) {
- last_lease = boost::dynamic_pointer_cast<Lease>(lease);
+ last_lease_in_callback = boost::dynamic_pointer_cast<Lease>(lease);
}
if (!lease_sync_filter_.shouldSync(lease)) {
if (!error_message.empty()) {
communication_state_->setPartnerUnavailable();
- } else if (last_lease) {
+ } else if (last_lease_in_callback) {
// This indicates that there are more leases to be fetched.
// Therefore, we have to send another leaseX-get-page command.
- asyncSyncLeases(http_client, remote_config, max_period, last_lease,
+ asyncSyncLeases(http_client, remote_config, max_period, last_lease_in_callback,
post_sync_action, dhcp_disabled);
return;
}
// partner.
if (success) {
asyncSyncCompleteNotify(client, remote_config,
- [&](const bool success,
- const std::string& error_message,
+ [&](const bool /* success */,
+ const std::string& error_message_1,
const int rcode) {
// This command may not be supported by the partner when it
// runs an older Kea version. In that case, send the dhcp-enable
// command as in previous Kea version.
if (rcode == CONTROL_RESULT_COMMAND_UNSUPPORTED) {
asyncEnableDHCPService(client, remote_config,
- [&](const bool success,
- const std::string& error_message,
+ [&](const bool is_success,
+ const std::string& error_message_2,
const int) {
// It is possible that we have already recorded an error
// message while synchronizing the lease database. Don't
// override the existing error message.
- if (!success && status_message.empty()) {
- status_message = error_message;
+ if (!is_success && status_message.empty()) {
+ status_message = error_message_2;
}
// The synchronization process is completed, so let's break
// ha-sync-complete-notify command was delivered to the partner.
// The synchronization process ends here.
if (!success && status_message.empty()) {
- status_message = error_message;
+ status_message = error_message_1;
}
io_service->stop();
// ha-sync-complete-notify command in this case. It is only sent in
// the case when synchronization ends successfully.
asyncEnableDHCPService(client, remote_config,
- [&](const bool success,
- const std::string& error_message,
+ [&](const bool is_success,
+ const std::string& error_message_1,
const int) {
- if (!success && status_message.empty()) {
- status_message = error_message;
+ if (!is_success && status_message.empty()) {
+ status_message = error_message_1;
}
// The synchronization process is completed, so let's break
request, response,
[this, &http_client, config, post_request_action]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
int rcode = 0;
} else {
// Handle third group of errors.
try {
- auto args = verifyAsyncResponse(response, rcode);
+ auto args = verifyAsyncResponse(http_response, rcode);
} catch (const std::exception& ex) {
error_message = ex.what();
LOG_WARN(ha_logger, HA_LEASES_BACKLOG_FAILED)
request, response,
[this, config, post_request_action]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
int rcode = 0;
} else {
// Handle third group of errors.
try {
- auto args = verifyAsyncResponse(response, rcode);
+ auto args = verifyAsyncResponse(http_response, rcode);
} catch (const std::exception& ex) {
error_message = ex.what();
LOG_WARN(ha_logger, HA_RESET_FAILED)
[this, remote_config, &io_service, &captured_ec, &captured_error_message,
&captured_rcode]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
io_service->stop();
// Handle third group of errors.
try {
- static_cast<void>(verifyAsyncResponse(response, captured_rcode));
+ static_cast<void>(verifyAsyncResponse(http_response, captured_rcode));
} catch (const std::exception& ex) {
error_message = ex.what();
request, response,
[this, remote_config, &io_service, &error_message]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
io_service->stop();
// Handle third group of errors.
try {
int rcode = 0;
- ConstElementPtr args = verifyAsyncResponse(response, rcode);
+ ConstElementPtr args = verifyAsyncResponse(http_response, rcode);
// Partner's state has changed after the notification. However, we don't know
// its new state. We'll check if the partner returned its state. If it didn't,
request, response,
[this, remote_config, post_request_action]
(const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& error_str) {
// There are three possible groups of errors. One is the IO error
// Handle third group of errors.
try {
- static_cast<void>(verifyAsyncResponse(response, rcode));
+ static_cast<void>(verifyAsyncResponse(http_response, rcode));
} catch (const CommandUnsupportedError& ex) {
rcode = CONTROL_RESULT_COMMAND_UNSUPPORTED;
// reporting the parsing error. The dependency check is performed later
// at the database level.
parser.parse(expression, Element::create(client_class->getTest()), AF_INET,
- [&dependencies, &depend_on_known](const ClientClass& client_class) -> bool {
- if (isClientClassBuiltIn(client_class)) {
- if ((client_class == "KNOWN") || (client_class == "UNKNOWN")) {
+ [&dependencies, &depend_on_known](const ClientClass& cc) -> bool {
+ if (isClientClassBuiltIn(cc)) {
+ if ((cc == "KNOWN") || (cc == "UNKNOWN")) {
depend_on_known = true;
}
} else {
- dependencies.push_back(client_class);
+ dependencies.push_back(cc);
}
return (true);
});
// reporting the parsing error. The dependency check is performed later
// at the database level.
parser.parse(expression, Element::create(client_class->getTest()), AF_INET6,
- [&dependencies, &depend_on_known](const ClientClass& client_class) -> bool {
- if (isClientClassBuiltIn(client_class)) {
- if ((client_class == "KNOWN") || (client_class == "UNKNOWN")) {
+ [&dependencies, &depend_on_known](const ClientClass& cc) -> bool {
+ if (isClientClassBuiltIn(cc)) {
+ if ((cc == "KNOWN") || (cc == "UNKNOWN")) {
depend_on_known = true;
}
} else {
- dependencies.push_back(client_class);
+ dependencies.push_back(cc);
}
return (true);
});
// tag is provided), it takes precedence over the same parameter
// specified for all servers. Therefore, we check if the given
// parameter already exists and belongs to 'all'.
- auto& index = local_parameters.get<StampedValueNameIndexTag>();
- auto existing = index.find(name);
- if (existing != index.end()) {
+ auto& name_index = local_parameters.get<StampedValueNameIndexTag>();
+ auto existing = name_index.find(name);
+ if (existing != name_index.end()) {
// This parameter was already fetched. Let's check if we should
// replace it or not.
if (!last_param_server_tag.amAll() && (*existing)->hasAllServerTag()) {
// If there is no such parameter yet or the existing parameter
// belongs to a different server and the inserted parameter is
// not for all servers.
- if ((existing == index.end()) ||
+ if ((existing == name_index.end()) ||
(!(*existing)->hasServerTag(last_param_server_tag) &&
!last_param_server_tag.amAll())) {
local_parameters.insert(last_param);
// the same option definition specified for all servers.
// Therefore, we check if the given option already exists and
// belongs to 'all'.
- auto& index = local_option_defs.get<1>();
- auto existing_it_pair = index.equal_range(last_def->getCode());
+ auto& code_index = local_option_defs.get<1>();
+ auto existing_it_pair = code_index.equal_range(last_def->getCode());
auto existing_it = existing_it_pair.first;
bool found = false;
for ( ; existing_it != existing_it_pair.second; ++existing_it) {
// This option definition was already fetched. Let's check
// if we should replace it or not.
if (!last_def_server_tag.amAll() && (*existing_it)->hasAllServerTag()) {
- index.replace(existing_it, last_def);
+ code_index.replace(existing_it, last_def);
return;
}
break;
// tag is provided), it takes precedence over the same option
// specified for all servers. Therefore, we check if the given
// option already exists and belongs to 'all'.
- auto& index = local_options.get<1>();
- auto existing_it_pair = index.equal_range(desc->option_->getType());
+ auto& type_index = local_options.get<1>();
+ auto existing_it_pair = type_index.equal_range(desc->option_->getType());
auto existing_it = existing_it_pair.first;
bool found = false;
for ( ; existing_it != existing_it_pair.second; ++existing_it) {
// This option was already fetched. Let's check if we should
// replace it or not.
if (!last_option_server_tag.amAll() && existing_it->hasAllServerTag()) {
- index.replace(existing_it, *desc);
+ type_index.replace(existing_it, *desc);
return;
}
break;
-// Copyright (C) 2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2024-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
using namespace isc::util;
using namespace boost::posix_time;
-PerfMonMgr::PerfMonMgr(uint16_t family_)
- : PerfMonConfig(family_), mutex_(new std::mutex) {
+PerfMonMgr::PerfMonMgr(uint16_t family)
+ : PerfMonConfig(family), mutex_(new std::mutex) {
init();
}
// specified for all servers. Therefore, we check if the given
// parameter already exists and belongs to 'all'.
ServerTag last_param_server_tag(server_tag_str);
- auto& index = local_parameters.get<StampedValueNameIndexTag>();
- auto existing = index.find(name);
- if (existing != index.end()) {
+ auto& name_index = local_parameters.get<StampedValueNameIndexTag>();
+ auto existing = name_index.find(name);
+ if (existing != name_index.end()) {
// This parameter was already fetched. Let's check if we should
// replace it or not.
if (!last_param_server_tag.amAll() && (*existing)->hasAllServerTag()) {
// If there is no such parameter yet or the existing parameter
// belongs to a different server and the inserted parameter is
// not for all servers.
- if ((existing == index.end()) ||
+ if ((existing == name_index.end()) ||
(!(*existing)->hasServerTag(last_param_server_tag) &&
!last_param_server_tag.amAll())) {
local_parameters.insert(last_param);
// the same option definition specified for all servers.
// Therefore, we check if the given option already exists and
// belongs to 'all'.
- auto& index = local_option_defs.get<1>();
- auto existing_it_pair = index.equal_range(last_def->getCode());
+ auto& code_index = local_option_defs.get<1>();
+ auto existing_it_pair = code_index.equal_range(last_def->getCode());
auto existing_it = existing_it_pair.first;
bool found = false;
for ( ; existing_it != existing_it_pair.second; ++existing_it) {
// This option definition was already fetched. Let's check
// if we should replace it or not.
if (!last_def_server_tag.amAll() && (*existing_it)->hasAllServerTag()) {
- index.replace(existing_it, last_def);
+ code_index.replace(existing_it, last_def);
return;
}
break;
// tag is provided), it takes precedence over the same option
// specified for all servers. Therefore, we check if the given
// option already exists and belongs to 'all'.
- auto& index = local_options.get<1>();
- auto existing_it_pair = index.equal_range(desc->option_->getType());
+ auto& type_index = local_options.get<1>();
+ auto existing_it_pair = type_index.equal_range(desc->option_->getType());
auto existing_it = existing_it_pair.first;
bool found = false;
for ( ; existing_it != existing_it_pair.second; ++existing_it) {
// This option was already fetched. Let's check if we should
// replace it or not.
if (!last_option_server_tag.amAll() && existing_it->hasAllServerTag()) {
- index.replace(existing_it, *desc);
+ type_index.replace(existing_it, *desc);
return;
}
break;
IntervalTimer::ONE_SHOT);
// Get the requests.
- auto receive_handler = [this](boost::system::error_code ec, size_t size) {
+ auto receive_handler = [this](boost::system::error_code erc, size_t size) {
lock_guard<mutex> lock(mutex_);
- error_codes_.push_back(ec);
+ error_codes_.push_back(erc);
sizes_.push_back(size);
};
vector<boost::asio::ip::udp::endpoint> clients(expected_received_);
IntervalTimer::ONE_SHOT);
// Get the requests.
- auto receive_handler = [this](boost::system::error_code ec, size_t size) {
+ auto receive_handler = [this](boost::system::error_code erc, size_t size) {
lock_guard<mutex> lock(mutex_);
- error_codes_.push_back(ec);
+ error_codes_.push_back(erc);
sizes_.push_back(size);
};
vector<boost::asio::ip::udp::endpoint> clients(expected_received_);
bool
AttributeTest::compare(const Attributes& first, const Attributes& second) {
- auto f = [&](ConstAttributePtr first, ConstAttributePtr second) {
- return (AttributeTest::compare(first, second));
+ auto f = [&](ConstAttributePtr first_attr, ConstAttributePtr second_attr) {
+ return (AttributeTest::compare(first_attr, second_attr));
};
return (std::equal(first.cbegin(), first.cend(), second.cbegin(), second.cend(), f));
}
/// @brief function which returns true if the pair of option elements
/// refer to the same option in the configuration.
auto const& option_match = [&](ElementPtr& left, ElementPtr& right) -> bool {
- std::string space = space_;
std::string left_space = space;
std::string right_space = space;
if (left->get("space")) {
-// Copyright (C) 2016-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
{
boost::asio::async_read(socket_,
boost::asio::buffer(reply_, length),
- [this](const boost::system::error_code& error, std::size_t length)
+ [this](const boost::system::error_code& error, std::size_t len)
{
if (!error)
{
std::cout << "Reply: ";
- std::cout.write(reply_, length);
+ std::cout.write(reply_, len);
std::cout << "\n";
}
else
{
boost::asio::async_read(socket_,
boost::asio::buffer(reply_, length),
- [this](const boost::system::error_code& error, std::size_t length)
+ [this](const boost::system::error_code& error, std::size_t len)
{
if (!error)
{
std::cout << "Reply: ";
- std::cout.write(reply_, length);
+ std::cout.write(reply_, len);
std::cout << "\n";
}
else
defer_shutdown_ = true;
- std::unique_ptr<Connection, void(*)(Connection*)> p(this, [](Connection* p) { p->defer_shutdown_ = false; });
+ std::unique_ptr<Connection, void (*)(Connection*)> p(this, [](Connection* c) {
+ c->defer_shutdown_ = false;
+ });
// Cancel the timer to make sure that long lasting command
// processing doesn't cause the timeout.
-// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
mgr().registerPacketQueueFactory(queue_type,
[](data::ConstElementPtr parameters)
-> PacketQueue4Ptr {
- std::string queue_type ;
+ std::string queue_type_from_parameters;
try {
- queue_type = data::SimpleParser::getString(parameters, "queue-type");
+ queue_type_from_parameters = data::SimpleParser::getString(parameters, "queue-type");
} catch (const std::exception& ex) {
isc_throw(InvalidQueueParameter,
"queue-type missing or invalid: " << ex.what());
"'capacity' missing or invalid: " << ex.what());
}
- return (PacketQueue4Ptr(new PacketQueueRing4(queue_type, capacity)));
+ return (PacketQueue4Ptr(new PacketQueueRing4(queue_type_from_parameters, capacity)));
});
return did_it;
-// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
mgr().registerPacketQueueFactory(queue_type,
[](data::ConstElementPtr parameters)
-> PacketQueue6Ptr {
- std::string queue_type ;
+ std::string queue_type_from_parameters;
try {
- queue_type = data::SimpleParser::getString(parameters, "queue-type");
+ queue_type_from_parameters = data::SimpleParser::getString(parameters, "queue-type");
} catch (const std::exception& ex) {
isc_throw(InvalidQueueParameter,
"queue-type missing or invalid: " << ex.what());
"'capacity' missing or invalid: " << ex.what());
}
- return (PacketQueue6Ptr(new PacketQueueRing6(queue_type, capacity)));
+ return (PacketQueue6Ptr(new PacketQueueRing6(queue_type_from_parameters, capacity)));
});
return did_it;
-// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
if (amListening()) {
try {
receiveNext();
- } catch (const isc::Exception& ex) {
+ } catch (const isc::Exception& isc_ex) {
// It is possible though unlikely, for doReceive to fail without
// scheduling the read. While, unlikely, it does mean the callback
// will not get called with a failure. A throw here would surface
// close the window by invoking the application handler with
// a failed result, and let the application layer sort it out.
LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_RECV_NEXT_ERROR)
- .arg(ex.what());
+ .arg(isc_ex.what());
// Call the registered application layer handler.
// Surround the invocation with a try-catch. The invoked handler is
try {
io_pending_ = false;
(*recv_handler_)(ERROR, empty);
- } catch (const std::exception& ex) {
+ } catch (const std::exception& std_ex) {
LOG_ERROR(dhcp_ddns_logger,
DHCP_DDNS_UNCAUGHT_NCR_RECV_HANDLER_ERROR)
- .arg(ex.what());
+ .arg(std_ex.what());
}
}
}
if (amSending()) {
sendNext();
}
- } catch (const isc::Exception& ex) {
+ } catch (const isc::Exception& isc_ex) {
// It is possible though unlikely, for sendNext to fail without
// scheduling the send. While, unlikely, it does mean the callback
// will not get called with a failure. A throw here would surface
// close the window by invoking the application handler with
// a failed result, and let the application layer sort it out.
LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_SEND_NEXT_ERROR)
- .arg(ex.what());
+ .arg(isc_ex.what());
// Invoke the completion handler passing in failed result.
// Surround the invocation with a try-catch. The invoked handler is
// report it.
try {
(*send_handler_)(ERROR, ncr_to_send_);
- } catch (const std::exception& ex) {
+ } catch (const std::exception& std_ex) {
LOG_ERROR(dhcp_ddns_logger,
- DHCP_DDNS_UNCAUGHT_NCR_SEND_HANDLER_ERROR).arg(ex.what());
+ DHCP_DDNS_UNCAUGHT_NCR_SEND_HANDLER_ERROR).arg(std_ex.what());
}
}
}
SCOPED_TRACE(test_case_name);
// Test fetching subnet by id.
- Subnet4Ptr returned_subnet;
- ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet4(server_selector, subnet->getID()));
- ASSERT_TRUE(returned_subnet);
+ Subnet4Ptr returned_subnet_2;
+ ASSERT_NO_THROW_LOG(
+ returned_subnet_2 = cbptr_->getSubnet4(server_selector, subnet->getID()));
+ ASSERT_TRUE(returned_subnet_2);
- ASSERT_EQ(1, returned_subnet->getServerTags().size());
- EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag)));
+ ASSERT_EQ(1, returned_subnet_2->getServerTags().size());
+ EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag)));
- ASSERT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str());
+ ASSERT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str());
// Test fetching subnet by prefix.
- ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet4(server_selector,
- subnet->toText()));
- ASSERT_TRUE(returned_subnet);
+ ASSERT_NO_THROW_LOG(
+ returned_subnet_2 = cbptr_->getSubnet4(server_selector, subnet->toText()));
+ ASSERT_TRUE(returned_subnet_2);
- ASSERT_EQ(1, returned_subnet->getServerTags().size());
- EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag)));
+ ASSERT_EQ(1, returned_subnet_2->getServerTags().size());
+ EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag)));
- EXPECT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str());
+ EXPECT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str());
};
{
isc::InvalidOperation);
// Test that this subnet will be fetched for various server selectors.
- auto test_get_subnet = [this, &subnet] (const std::string& test_case_name,
- const ServerSelector& server_selector,
- const std::string& expected_tag = ServerTag::ALL) {
+ auto test_get_subnet = [this, &subnet](const std::string& test_case_name,
+ const ServerSelector& server_selector,
+ const std::string& expected_tag = ServerTag::ALL) {
SCOPED_TRACE(test_case_name);
// Test fetching subnet by id.
- Subnet6Ptr returned_subnet;
- ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet6(server_selector, subnet->getID()));
- ASSERT_TRUE(returned_subnet);
+ Subnet6Ptr returned_subnet_2;
+ ASSERT_NO_THROW_LOG(
+ returned_subnet_2 = cbptr_->getSubnet6(server_selector, subnet->getID()));
+ ASSERT_TRUE(returned_subnet_2);
- ASSERT_EQ(1, returned_subnet->getServerTags().size());
- EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag)));
+ ASSERT_EQ(1, returned_subnet_2->getServerTags().size());
+ EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag)));
- ASSERT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str());
+ ASSERT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str());
// Test fetching subnet by prefix.
- ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet6(server_selector,
- subnet->toText()));
- ASSERT_TRUE(returned_subnet);
+ ASSERT_NO_THROW_LOG(
+ returned_subnet_2 = cbptr_->getSubnet6(server_selector, subnet->toText()));
+ ASSERT_TRUE(returned_subnet_2);
- ASSERT_EQ(1, returned_subnet->getServerTags().size());
- EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag)));
+ ASSERT_EQ(1, returned_subnet_2->getServerTags().size());
+ EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag)));
- EXPECT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str());
+ EXPECT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str());
};
{
-// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// toRawText is not supposed to do any sanity checks.
// Let's try with a very weird name.
- Name n2("xtra\tchars\n.in.name");
- LabelSequence l2(n2);
+ Name name2("xtra\tchars\n.in.name");
+ LabelSequence l2(name2);
EXPECT_EQ("xtra\tchars\n.in.name.", l2.toRawText(false));
}
-// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// If QSTRING is specified in option, '"' is regarded as a beginning of
// a quoted string.
- const MasterLexer::Options options = common_options | MasterLexer::QSTRING;
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ const MasterLexer::Options my_options = common_options | MasterLexer::QSTRING;
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
EXPECT_FALSE(s_string.wasLastEOL(lexer)); // EOL is canceled due to '"'
s_qstring.handle(lexer);
stringTokenCheck("quoted string", s_string.getToken(lexer), true);
// Empty string is okay as qstring
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("", s_string.getToken(lexer), true);
// Also checks other separator characters within a qstring
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("quoted()\t\rstring", s_string.getToken(lexer), true);
// escape character mostly doesn't have any effect in the qstring
// processing
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("escape\\ in quote", s_string.getToken(lexer), true);
// The only exception is the quotation mark itself. Note that the escape
// only works on the quotation mark immediately after it.
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("escaped\"", s_string.getToken(lexer), true);
// quoted '\' then '"'. Unlike the previous case '"' shouldn't be
// escaped.
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("escaped backslash\\\\", s_string.getToken(lexer), true);
// ';' has no meaning in a quoted string (not indicating a comment)
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("no;comment", s_string.getToken(lexer), true);
}
lexer.pushSource(ss);
// EOL is encountered without closing the quote
- const MasterLexer::Options options = common_options | MasterLexer::QSTRING;
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ const MasterLexer::Options my_options = common_options | MasterLexer::QSTRING;
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
ASSERT_EQ(Token::ERROR, s_qstring.getToken(lexer).getType());
EXPECT_EQ(Token::UNBALANCED_QUOTES,
s_qstring.getToken(lexer).getErrorCode());
// We can resume after the error from the '\n'
- EXPECT_EQ(s_null, State::start(lexer, options));
+ EXPECT_EQ(s_null, State::start(lexer, my_options));
EXPECT_EQ(Token::END_OF_LINE, s_crlf.getToken(lexer).getType());
// \n is okay in a quoted string if escaped
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
stringTokenCheck("quoted\\\n", s_string.getToken(lexer), true);
// EOF is encountered without closing the quote
- EXPECT_EQ(&s_qstring, State::start(lexer, options));
+ EXPECT_EQ(&s_qstring, State::start(lexer, my_options));
s_qstring.handle(lexer);
ASSERT_EQ(Token::ERROR, s_qstring.getToken(lexer).getType());
EXPECT_EQ(Token::UNEXPECTED_END, s_qstring.getToken(lexer).getErrorCode());
// If we continue we'll simply see the EOF
- EXPECT_EQ(s_null, State::start(lexer, options));
+ EXPECT_EQ(s_null, State::start(lexer, my_options));
EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType());
}
lexer.pushSource(ss);
// Ask the lexer to recognize numbers as well
- const MasterLexer::Options options = common_options | MasterLexer::NUMBER;
+ const MasterLexer::Options my_options = common_options | MasterLexer::NUMBER;
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(0, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(1, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(12345, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(4294967295u, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(Token::NUMBER_OUT_OF_RANGE,
s_number.getToken(lexer).getErrorCode());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(Token::NUMBER_OUT_OF_RANGE,
s_number.getToken(lexer).getErrorCode());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(5, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(42, s_number.getToken(lexer).getNumber());
- EXPECT_EQ(s_null, State::start(lexer, options));
+ EXPECT_EQ(s_null, State::start(lexer, my_options));
EXPECT_TRUE(s_crlf.wasLastEOL(lexer));
EXPECT_EQ(Token::END_OF_LINE, s_crlf.getToken(lexer).getType());
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
EXPECT_EQ(37, s_number.getToken(lexer).getNumber());
// If we continue we'll simply see the EOF
- EXPECT_EQ(s_null, State::start(lexer, options));
+ EXPECT_EQ(s_null, State::start(lexer, my_options));
EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType());
}
stringTokenCheck("123", s_string.getToken(lexer), false);
// Ask the lexer to recognize numbers as well
- const MasterLexer::Options options = common_options | MasterLexer::NUMBER;
+ const MasterLexer::Options my_options = common_options | MasterLexer::NUMBER;
- EXPECT_EQ(&s_string, State::start(lexer, options));
+ EXPECT_EQ(&s_string, State::start(lexer, my_options));
s_string.handle(lexer);
stringTokenCheck("-1", s_string.getToken(lexer), false);
// Starts out as a number, but ends up being a string
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
stringTokenCheck("123abc456", s_number.getToken(lexer), false);
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer);
stringTokenCheck("123\\456", s_number.getToken(lexer), false);
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("3scaped\\ space", s_number.getToken(lexer));
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("3scaped\\\ttab", s_number.getToken(lexer));
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("3scaped\\(paren", s_number.getToken(lexer));
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("3scaped\\)close", s_number.getToken(lexer));
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("3scaped\\;comment", s_number.getToken(lexer));
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' in mid
stringTokenCheck("3scaped\\\\", s_number.getToken(lexer));
// Confirm the word that follows the escaped '\' is correctly recognized.
- EXPECT_EQ(&s_number, State::start(lexer, options));
+ EXPECT_EQ(&s_number, State::start(lexer, my_options));
s_number.handle(lexer); // recognize str, see ' ' at end
stringTokenCheck("8ackslash", s_number.getToken(lexer));
// If we continue we'll simply see the EOF
- EXPECT_EQ(s_null, State::start(lexer, options));
+ EXPECT_EQ(s_null, State::start(lexer, my_options));
EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType());
}
-// Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2021-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
matchWireData(&expect_key[0], expect_key.size(),
tkey.getKey(), tkey.getKeyLen());
- vector<uint8_t> expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' };
+ expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' };
matchWireData(&expect_data[0], expect_data.size(),
tkey.getOtherData(), tkey.getOtherLen());
}
EXPECT_EQ(0, tkey.getKeyLen());
EXPECT_FALSE(tkey.getKey());
- vector<uint8_t> expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' };
+ expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' };
matchWireData(&expect_data[0], expect_data.size(),
tkey.getOtherData(), tkey.getOtherLen());
}
-// Copyright (C) 2011-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
TEST_F(TSIGTest, signBadData) {
// some specific bad data should be rejected proactively.
- const unsigned char dummy_data = 0;
+ const unsigned char dummy = 0;
EXPECT_THROW(tsig_ctx->sign(0, 0, 10), InvalidParameter);
- EXPECT_THROW(tsig_ctx->sign(0, &dummy_data, 0), InvalidParameter);
+ EXPECT_THROW(tsig_ctx->sign(0, &dummy, 0), InvalidParameter);
}
TEST_F(TSIGTest, verifyBadData) {
ASSERT_NO_THROW(label.reset(new TokenLabel(123)));
TokenPtr left;
TokenPtr right;
- bool result_(false);
+ bool result(false);
// False or false == false.
ASSERT_NO_THROW(left.reset(new TokenString("false")));
e_.push_back(branch);
e_.push_back(right);
e_.push_back(label);
- ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_));
- EXPECT_FALSE(result_);
+ ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_));
+ EXPECT_FALSE(result);
e_.clear();
// False or true == true.
ASSERT_NO_THROW(label.reset(new TokenLabel(123)));
TokenPtr left;
TokenPtr right;
- bool result_(false);
+ bool result(false);
// True and true == true.
ASSERT_NO_THROW(left.reset(new TokenString("true")));
e_.push_back(branch);
e_.push_back(right);
e_.push_back(label);
- ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_));
- EXPECT_TRUE(result_);
+ ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_));
+ EXPECT_TRUE(result);
e_.clear();
// True and false == false.
e_.push_back(branch);
e_.push_back(right);
e_.push_back(label);
- ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_));
- EXPECT_FALSE(result_);
+ ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_));
+ EXPECT_FALSE(result);
e_.clear();
// False and any thing == false.
e_.push_back(branch);
e_.push_back(right);
e_.push_back(label);
- EXPECT_NO_THROW(result_ = evaluateBool(e_, *pkt6_));
- EXPECT_FALSE(result_);
+ EXPECT_NO_THROW(result = evaluateBool(e_, *pkt6_));
+ EXPECT_FALSE(result);
}
// Tests the pop and branch when false / lazy if.
ASSERT_NO_THROW(bar.reset(new TokenString("bar")));
TokenPtr extra;
ASSERT_NO_THROW(extra.reset(new TokenString("extra token")));
- string result_("");
+ string result("");
// if true then foo else bar == foo
ASSERT_NO_THROW(test.reset(new TokenString("true")));
e_.push_back(bar);
e_.push_back(extra);
e_.push_back(label2);
- ASSERT_NO_THROW(result_ = evaluateString(e_, *pkt4_));
- EXPECT_EQ("foo", result_);
+ ASSERT_NO_THROW(result = evaluateString(e_, *pkt4_));
+ EXPECT_EQ("foo", result);
e_.clear();
// if false then foo else bar == bar
e_.push_back(label1);
e_.push_back(bar);
e_.push_back(label2);
- ASSERT_NO_THROW(result_ = evaluateString(e_, *pkt6_));
- EXPECT_EQ("bar", result_);
+ ASSERT_NO_THROW(result = evaluateString(e_, *pkt6_));
+ EXPECT_EQ("bar", result);
}
}
defer_shutdown_ = true;
- std::unique_ptr<HttpConnection, void(*)(HttpConnection*)> p(this, [](HttpConnection* p) { p->defer_shutdown_ = false; });
+ std::unique_ptr<HttpConnection, void (*)(HttpConnection*)> p(this, [](HttpConnection* c) {
+ c->defer_shutdown_ = false;
+ });
// Create the response from the received request using the custom
// response creator.
}
// Get stringified thread-id.
- std::stringstream ss;
- ss << std::this_thread::get_id();
+ std::stringstream tid_ss;
+ tid_ss << std::this_thread::get_id();
// Create the ClientRR.
ClientRRPtr clientRR(new ClientRR());
- clientRR->thread_id_ = ss.str();
+ clientRR->thread_id_ = tid_ss.str();
clientRR->request_ = request_json;
clientRR->response_ = response_json;
ASSERT_FALSE(ec) << "asyncSendRequest failed, ec: " << ec;
// Get stringified thread-id.
- std::stringstream ss;
- ss << std::this_thread::get_id();
+ std::stringstream tid_ss;
+ tid_ss << std::this_thread::get_id();
// Create the ClientRR.
ClientRRPtr clientRR(new ClientRR());
- clientRR->thread_id_ = ss.str();
+ clientRR->thread_id_ = tid_ss.str();
clientRR->request_ = request_json;
clientRR->response_ = response_json;
-// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
ASSERT_NO_THROW(client.asyncSendRequest(url, client_context_,
request, response,
[this](const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string& parsing_error) {
io_service_->stop();
// There should be no IO error (answer from the server is received).
ADD_FAILURE() << "asyncSendRequest failed: " << ec.message();
}
// The response object is NULL because it couldn't be finalized.
- EXPECT_FALSE(response);
+ EXPECT_FALSE(http_response);
// The message parsing error should be returned.
EXPECT_FALSE(parsing_error.empty());
}));
ASSERT_NO_THROW(client.asyncSendRequest(url, client_context_,
request, response,
[this, &cb_num](const boost::system::error_code& ec,
- const HttpResponsePtr& response,
+ const HttpResponsePtr& http_response,
const std::string&) {
if (++cb_num > 1) {
io_service_->stop();
// error code.
EXPECT_TRUE(ec.value() == boost::asio::error::timed_out);
// There should be no response returned.
- EXPECT_FALSE(response);
+ EXPECT_FALSE(http_response);
},
HttpClient::RequestTimeout(100),
}
}
stream_.async_handshake(roleToImpl(TlsRole::CLIENT),
- [this, request](const boost::system::error_code& ec) {
- if (ec) {
+ [this, request](const boost::system::error_code& erc) {
+ if (erc) {
ADD_FAILURE() << "error occurred during handshake: "
- << ec.message();
+ << erc.message();
io_service_->stop();
return;
}
}
if (useTls()) {
- SocketCallback socket_cb(
- [this](boost::system::error_code ec, size_t /*length */) {
- if (ec) {
+ SocketCallback tls_socket_cb(
+ [this](boost::system::error_code erc, size_t /*length */) {
+ if (erc) {
handshake_failed_ = true;
done_callback_();
} else {
}
});
- tls_socket_->handshake(socket_cb);
+ tls_socket_->handshake(tls_socket_cb);
} else {
sendNextRequest();
}