if ((rc = mdb_env_open(env, filename.c_str(), MDB_NOSUBDIR | MDB_RDONLY, 0600)) != 0) {
if (rc == ENOENT) {
// we don't have a database yet! report schema 0, with 0 shards
- return std::make_pair(0, 0);
+ return {0u, 0u};
}
mdb_env_close(env);
throw std::runtime_error("mdb_env_open failed");
// we pretend this means 5
mdb_txn_abort(txn);
mdb_env_close(env);
- return std::make_pair(5, 0);
+ return {5u, 0u};
}
mdb_txn_abort(txn);
mdb_env_close(env);
// we pretend this means 5
mdb_txn_abort(txn);
mdb_env_close(env);
- return std::make_pair(5, 0);
+ return {5u, 0u};
}
throw std::runtime_error("mdb_get pdns.schemaversion failed");
mdb_txn_abort(txn);
mdb_env_close(env);
- return std::make_pair(schemaversion, shards);
+ return {schemaversion, shards};
}
namespace
di.id = iter.getID();
di.backend = this;
- if (!zonemap.insert(std::make_pair(di.zone, di)).second) {
+ if (!zonemap.emplace(di.zone, di).second) {
dups.insert(di.zone);
}
}
while (res == 0) {
if (bpf_lookup_elem(map.d_fd.getHandle(), &nextKey, &value) == 0) {
nextKey.qname[sizeof(nextKey.qname) - 1 ] = '\0';
- result.push_back(std::make_tuple(DNSName(reinterpret_cast<const char*>(nextKey.qname), sizeof(nextKey.qname), 0, false), value.qtype, value.counter));
+ result.emplace_back(DNSName(reinterpret_cast<const char*>(nextKey.qname), sizeof(nextKey.qname), 0, false), value.qtype, value.counter);
}
res = bpf_get_next_key(map.d_fd.getHandle(), &nextKey, &nextKey);
while (res == 0) {
if (bpf_lookup_elem(map.d_fd.getHandle(), &nextKey, &value) == 0) {
nextKey.qname[sizeof(nextKey.qname) - 1 ] = '\0';
- result.push_back(std::make_tuple(DNSName(reinterpret_cast<const char*>(nextKey.qname), sizeof(nextKey.qname), 0, false), key.qtype, value.counter));
+ result.emplace_back(DNSName(reinterpret_cast<const char*>(nextKey.qname), sizeof(nextKey.qname), 0, false), key.qtype, value.counter);
}
res = bpf_get_next_key(map.d_fd.getHandle(), &nextKey, &nextKey);
setPipeBufferSize(receiver.getHandle(), pipeBufferSize);
}
- return std::pair(Sender<T, D>(std::move(sender)), Receiver<T, D>(std::move(receiver), throwOnEOF));
+ return {Sender<T, D>(std::move(sender)), Receiver<T, D>(std::move(receiver), throwOnEOF)};
}
}
}
for (const auto& stat : stats) {
const container_t::iterator it = data->d_entries.find(stat.first);
if (it != data->d_entries.end()) {
- result.push_back(std::make_tuple(stat.first, stat.second, it->d_until));
+ result.emplace_back(stat.first, stat.second, it->d_until);
}
}
return result;
LuaArray<std::shared_ptr<DownstreamState>> ret;
int count = 1;
for (const auto& s : g_dstates.getCopy()) {
- ret.push_back(make_pair(count++, s));
+ ret.emplace_back(count++, s);
}
return ret;
});
const auto localPools = g_pools.getCopy();
for (const auto& entry : localPools) {
const string& name = entry.first;
- ret.push_back(make_pair(count++, name));
+ ret.emplace_back(count++, name);
}
return ret;
});
LuaAssociativeTable<std::string> customResponseHeaders;
if (getOptionalValue<decltype(customResponseHeaders)>(vars, "customResponseHeaders", customResponseHeaders) > 0) {
for (auto const& headerMap : customResponseHeaders) {
- std::pair<std::string, std::string> headerResponse = std::make_pair(boost::to_lower_copy(headerMap.first), headerMap.second);
+ auto headerResponse = std::pair(boost::to_lower_copy(headerMap.first), headerMap.second);
frontend->d_customResponseHeaders.insert(headerResponse);
}
}
size_t usableServers = 0;
for (const auto& d : servers) {
if (d.second->isUp()) {
- poss[usableServers] = std::make_pair(std::make_tuple(d.second->outstanding.load(), d.second->d_config.order, d.second->getRelevantLatencyUsec()), d.first);
+ poss[usableServers] = std::pair(std::tuple(d.second->outstanding.load(), d.second->d_config.order, d.second->getRelevantLatencyUsec()), d.first);
usableServers++;
}
}
sum += d.second->d_config.d_weight;
}
- poss[usableServers] = std::make_pair(sum, d.first);
+ poss[usableServers] = std::pair(sum, d.first);
usableServers++;
}
}
#ifndef ENABLE_GSS_TSIG
-std::tuple<size_t, size_t, size_t> GssContext::getCounts() { return std::make_tuple<size_t, size_t, size_t>(0, 0, 0); }
+std::tuple<size_t, size_t, size_t> GssContext::getCounts() { return std::tuple<size_t, size_t, size_t>(0, 0, 0); }
bool GssContext::supported() { return false; }
GssContext::GssContext() :
d_error(GSS_CONTEXT_UNSUPPORTED), d_type(GSS_CONTEXT_NONE) {}
std::tuple<size_t, size_t, size_t> GssContext::getCounts()
{
- return std::make_tuple(s_gss_init_creds.lock()->size(), s_gss_accept_creds.lock()->size(), s_gss_sec_context.lock()->size());
+ return {s_gss_init_creds.lock()->size(), s_gss_accept_creds.lock()->size(), s_gss_sec_context.lock()->size()};
}
void GssContext::processError(const std::string& method, OM_uint32 maj, OM_uint32 min)
}
#endif /* HAVE_SSL_CTX_SET_CIPHERSUITES */
- return std::make_pair(std::move(ctx), std::move(warnings));
+ return {std::move(ctx), std::move(warnings)};
}
#ifdef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK
d_lw->registerFunction<DNSPacket, Netmask()>("getRealRemote", [](DNSPacket &p) { return p.getRealRemote(); });
d_lw->registerFunction<DNSPacket, ComboAddress()>("getLocal", [](DNSPacket &p) { return p.getLocal(); });
d_lw->registerFunction<DNSPacket, unsigned int()>("getRemotePort", [](DNSPacket &p) { return p.getInnerRemote().getPort(); });
- d_lw->registerFunction<DNSPacket, std::tuple<const std::string, unsigned int>()>("getQuestion", [](DNSPacket &p) { return std::make_tuple(p.qdomain.toString(), static_cast<unsigned int>(p.qtype.getCode())); });
+ d_lw->registerFunction<DNSPacket, std::tuple<const std::string, unsigned int>()>("getQuestion", [](DNSPacket &p) { return std::tuple(p.qdomain.toString(), static_cast<unsigned int>(p.qtype.getCode())); });
d_lw->registerFunction<DNSPacket, void(bool)>("setA", [](DNSPacket &p, bool a) { return p.setA(a); });
d_lw->registerFunction<DNSPacket, void(unsigned int)>("setID", [](DNSPacket &p, unsigned int id) { return p.setID(static_cast<uint16_t>(id)); });
d_lw->registerFunction<DNSPacket, void(bool)>("setRA", [](DNSPacket &p, bool ra) { return p.setRA(ra); });
for(const auto& m : rhs.opts)
rhsoopts[m.first]=m.second;
- return std::make_tuple(rem, url, oopts) <
- std::make_tuple(rhs.rem, rhs.url, rhsoopts);
+ return std::tuple(rem, url, oopts) <
+ std::tuple(rhs.rem, rhs.url, rhsoopts);
}
};
struct CheckState
}
svcbAliases.insert(rr.qname);
}
- svcbTargets.emplace(std::make_tuple(rr.qname, svcbrc->getPriority(), svcbrc->getTarget(), svcbrc->autoHint(SvcParam::ipv4hint), svcbrc->autoHint(SvcParam::ipv6hint)));
+ svcbTargets.emplace(rr.qname, svcbrc->getPriority(), svcbrc->getTarget(), svcbrc->autoHint(SvcParam::ipv4hint), svcbrc->autoHint(SvcParam::ipv6hint));
svcbRecords.insert(rr.qname);
break;
case QType::HTTPS:
}
httpsAliases.insert(rr.qname);
}
- httpsTargets.emplace(std::make_tuple(rr.qname, svcbrc->getPriority(), svcbrc->getTarget(), svcbrc->autoHint(SvcParam::ipv4hint), svcbrc->autoHint(SvcParam::ipv6hint)));
+ httpsTargets.emplace(rr.qname, svcbrc->getPriority(), svcbrc->getTarget(), svcbrc->autoHint(SvcParam::ipv4hint), svcbrc->autoHint(SvcParam::ipv6hint));
httpsRecords.insert(rr.qname);
break;
}
exit(1); // FIXME proper exit code?
}
- delayedThreads.rpzPrimaryThreads.push_back(std::make_tuple(primaries, defpol, defpolOverrideLocal, maxTTL, zoneIdx, tt, maxReceivedXFRMBytes, localAddress, axfrTimeout, refresh, sr, dumpFile));
+ delayedThreads.rpzPrimaryThreads.emplace_back(primaries, defpol, defpolOverrideLocal, maxTTL, zoneIdx, tt, maxReceivedXFRMBytes, localAddress, axfrTimeout, refresh, sr, dumpFile);
}
// A wrapper class that loads the standard Lua defintions into the context, so that we can use things like pdns.A
if (nsecs.records.size() > 0 && nsecs.signatures.size() > 0) {
// Valdidate the NSEC
nsecValidationStatus = validateWithKeySet(d_now, d_zone, nsecs.records, nsecs.signatures, validKeys, std::nullopt);
- csp.emplace(std::make_pair(d_zone, QType::NSEC), nsecs);
+ csp.emplace(std::pair(d_zone, QType::NSEC), nsecs);
}
else if (nsec3s.records.size() > 0 && nsec3s.signatures.size() > 0) {
// Validate NSEC3PARAMS
}
// Valdidate the NSEC3
nsecValidationStatus = validateWithKeySet(d_now, zonemd.getNSEC3Label(), nsec3s.records, nsec3s.signatures, validKeys, std::nullopt);
- csp.emplace(std::make_pair(zonemd.getNSEC3Label(), QType::NSEC3), nsec3s);
+ csp.emplace(std::pair(zonemd.getNSEC3Label(), QType::NSEC3), nsec3s);
}
else {
d_log->info("No NSEC(3) records and/or RRSIGS found to deny ZONEMD");
}
}
else {
- states.emplace(std::make_pair(config.first, State{0, 0, mygeneration}));
+ states.emplace(config.first, State{0, 0, mygeneration});
}
}
}
auto ret = new ProxyMappingStats_t;
if (t_proxyMapping) {
for (const auto& [key, entry] : *t_proxyMapping) {
- ret->emplace(std::make_pair(key, ProxyMappingCounts{entry.stats.netmaskMatches, entry.stats.suffixMatches}));
+ ret->emplace(key, ProxyMappingCounts{entry.stats.netmaskMatches, entry.stats.suffixMatches});
}
}
return ret;
if (t_protobufServers.servers) {
for (const auto& server : *t_protobufServers.servers) {
- ret->emplace(std::make_pair(server->address(), server->getStats()));
+ ret->emplace(server->address(), server->getStats());
}
}
return ret.release();
if (t_outgoingProtobufServers.servers) {
for (const auto& server : *t_outgoingProtobufServers.servers) {
- ret->emplace(std::make_pair(server->address(), server->getStats()));
+ ret->emplace(server->address(), server->getStats());
}
}
return ret.release();
if (t_frameStreamServersInfo.servers) {
for (const auto& server : *t_frameStreamServersInfo.servers) {
- ret->emplace(std::make_pair(server->address(), server->getStats()));
+ ret->emplace(server->address(), server->getStats());
}
}
return ret.release();
if (t_nodFrameStreamServersInfo.servers) {
for (const auto& server : *t_nodFrameStreamServersInfo.servers) {
- ret->emplace(std::make_pair(server->address(), server->getStats()));
+ ret->emplace(server->address(), server->getStats());
}
}
return ret.release();
/* we have nothing more specific for you */
break;
}
- auto key = std::make_tuple(qname, qtype, boost::none, best);
+ auto key = std::tuple(qname, qtype, boost::none, best);
auto entry = map.d_map.find(key);
if (entry == map.d_map.end()) {
/* ecsIndex is not up-to-date */
}
/* we have nothing specific, let's see if we have a generic one */
- auto key = std::make_tuple(qname, qtype, boost::none, Netmask());
+ auto key = std::tuple(qname, qtype, boost::none, Netmask());
auto entry = map.d_map.find(key);
if (entry != map.d_map.end()) {
handleServeStaleBookkeeping(now, serveStale, entry);
// We only store with a tag if we have an ednsmask and the tag is available
// We only store an ednsmask if we do not have a tag and we do have a mask.
- auto key = std::make_tuple(qname, qt.getCode(), ednsmask ? routingTag : boost::none, (ednsmask && !routingTag) ? *ednsmask : Netmask());
+ auto key = std::tuple(qname, qt.getCode(), ednsmask ? routingTag : boost::none, (ednsmask && !routingTag) ? *ednsmask : Netmask());
bool isNew = false;
cache_t::iterator stored = lockedShard->d_map.find(key);
if (stored == lockedShard->d_map.end()) {
if (isNew || stored->d_ttd <= now) {
/* don't bother building an ecsIndex if we don't have any netmask-specific entries */
if (!routingTag && ednsmask && !ednsmask->empty()) {
- auto ecsIndexKey = std::make_tuple(qname, qt.getCode());
+ auto ecsIndexKey = std::tuple(qname, qt.getCode());
auto ecsIndex = lockedShard->d_ecsIndex.find(ecsIndexKey);
if (ecsIndex == lockedShard->d_ecsIndex.end()) {
ecsIndex = lockedShard->d_ecsIndex.insert(ECSIndexEntry(qname, qt.getCode())).first;
//! This is the 'out of band resolver', in other words, the authoritative server
void SyncRes::AuthDomain::addSOA(std::vector<DNSRecord>& records) const
{
- SyncRes::AuthDomain::records_t::const_iterator ziter = d_records.find(std::make_tuple(getName(), QType::SOA));
+ SyncRes::AuthDomain::records_t::const_iterator ziter = d_records.find(std::tuple(getName(), QType::SOA));
if (ziter != d_records.end()) {
DNSRecord dr = *ziter;
dr.d_place = DNSResourceRecord::AUTHORITY;
DNSName wcarddomain(qname);
while (wcarddomain != getName() && wcarddomain.chopOff()) {
- range = d_records.equal_range(std::make_tuple(g_wildcarddnsname + wcarddomain));
+ range = d_records.equal_range(std::tuple(g_wildcarddnsname + wcarddomain));
if (range.first == range.second)
continue;
/* Nothing for this name, no wildcard, let's see if there is some NS */
DNSName nsdomain(qname);
while (nsdomain.chopOff() && nsdomain != getName()) {
- range = d_records.equal_range(std::make_tuple(nsdomain, QType::NS));
+ range = d_records.equal_range(std::tuple(nsdomain, QType::NS));
if (range.first == range.second)
continue;
bool SyncRes::isThrottled(time_t now, const ComboAddress& server, const DNSName& target, QType qtype)
{
- return s_throttle.lock()->shouldThrottle(now, std::make_tuple(server, target, qtype));
+ return s_throttle.lock()->shouldThrottle(now, std::tuple(server, target, qtype));
}
bool SyncRes::isThrottled(time_t now, const ComboAddress& server)
{
- return s_throttle.lock()->shouldThrottle(now, std::make_tuple(server, g_rootdnsname, 0));
+ return s_throttle.lock()->shouldThrottle(now, std::tuple(server, g_rootdnsname, 0));
}
void SyncRes::doThrottle(time_t now, const ComboAddress& server, time_t duration, unsigned int tries)
{
- s_throttle.lock()->throttle(now, std::make_tuple(server, g_rootdnsname, 0), duration, tries);
+ s_throttle.lock()->throttle(now, std::tuple(server, g_rootdnsname, 0), duration, tries);
}
void SyncRes::doThrottle(time_t now, const ComboAddress& server, const DNSName& name, QType qtype, time_t duration, unsigned int tries)
{
- s_throttle.lock()->throttle(now, std::make_tuple(server, name, qtype), duration, tries);
+ s_throttle.lock()->throttle(now, std::tuple(server, name, qtype), duration, tries);
}
uint64_t SyncRes::doDumpThrottleMap(int fd)
void pdns::orderAndShuffle(vector<DNSRecord>& rrs, bool includingAdditionals)
{
std::stable_sort(rrs.begin(), rrs.end(), [](const DNSRecord& a, const DNSRecord& b) {
- return std::make_tuple(a.d_place, mapTypesToOrder(a.d_type)) < std::make_tuple(b.d_place, mapTypesToOrder(b.d_type));
+ return std::tuple(a.d_place, mapTypesToOrder(a.d_type)) < std::tuple(b.d_place, mapTypesToOrder(b.d_type));
});
shuffle(rrs, includingAdditionals);
}
bool
dedupLessThan(const DNSZoneRecord& a, const DNSZoneRecord &b)
{
- return std::make_tuple(a.dr.getContent()->getZoneRepresentation(), a.dr.d_ttl) < std::make_tuple(b.dr.getContent()->getZoneRepresentation(), b.dr.d_ttl); // XXX SLOW SLOW SLOW
+ return std::tuple(a.dr.getContent()->getZoneRepresentation(), a.dr.d_ttl) < std::tuple(b.dr.getContent()->getZoneRepresentation(), b.dr.d_ttl); // XXX SLOW SLOW SLOW
}
bool dedupEqual(const DNSZoneRecord& a, const DNSZoneRecord &b)
{
- return std::make_tuple(a.dr.getContent()->getZoneRepresentation(), a.dr.d_ttl) == std::make_tuple(b.dr.getContent()->getZoneRepresentation(), b.dr.d_ttl); // XXX SLOW SLOW SLOW
+ return std::tuple(a.dr.getContent()->getZoneRepresentation(), a.dr.d_ttl) == std::tuple(b.dr.getContent()->getZoneRepresentation(), b.dr.d_ttl); // XXX SLOW SLOW SLOW
}
}
{
shuffle(dni.di.masters.begin(), dni.di.masters.end(), pdns::dns_random_engine());
try {
- return std::make_tuple(dni.di.zone,
+ return {dni.di.zone,
*dni.di.masters.begin(),
d_resolver.sendResolve(*dni.di.masters.begin(),
dni.localaddr,
QType::SOA,
nullptr,
dni.dnssecOk, dni.tsigkeyname, dni.tsigalgname, dni.tsigsecret)
- );
+ };
}
catch(PDNSException& e) {
throw runtime_error("While attempting to query freshness of '"+dni.di.zone.toLogString()+"': "+e.reason);
if (it == d_dnsnameqtyperings.end()) {
throw runtime_error("Attempting to account to nonexistent dnsname+qtype ring '"+std::string(name)+"'");
}
- it->second.lock()->account(std::make_tuple(dnsname, qtype));
+ it->second.lock()->account(std::tuple(dnsname, qtype));
}
}
d_end = range.second;
}
else {
- auto range = idx.equal_range(std::make_tuple(qdomain, qtype.getCode()));
+ auto range = idx.equal_range(std::tuple(qdomain, qtype.getCode()));
d_iter = range.first;
d_end = range.second;
}
bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override
{
const auto& idx = boost::multi_index::get<OrderedNameKindTag>(s_metadata.at(d_backendId));
- auto it = idx.find(std::make_tuple(name, kind));
+ auto it = idx.find(std::tuple(name, kind));
if (it == idx.end()) {
/* funnily enough, we are expected to return true even though we might not know that zone */
return true;
bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta) override
{
auto& idx = boost::multi_index::get<OrderedNameKindTag>(s_metadata.at(d_backendId));
- auto it = idx.find(std::make_tuple(name, kind));
+ auto it = idx.find(std::tuple(name, kind));
if (it == idx.end()) {
s_metadata.at(d_backendId).insert(SimpleMetaData(name, kind, meta));
return true;
}
auto& idx = records->get<OrderedNameTypeTag>();
- auto range = idx.equal_range(std::make_tuple(best, QType::SOA));
+ auto range = idx.equal_range(std::tuple(best, QType::SOA));
if (range.first == range.second) {
return false;
}
{
// check that it has not been updated in the second backend
- const auto& it = SimpleBackend::s_metadata[2].find(std::make_tuple(DNSName("powerdns.org."), "test-data-b"));
+ const auto& it = SimpleBackend::s_metadata[2].find(std::tuple(DNSName("powerdns.org."), "test-data-b"));
BOOST_REQUIRE(it != SimpleBackend::s_metadata[2].end());
BOOST_REQUIRE_EQUAL(it->d_values.size(), 2U);
BOOST_CHECK_EQUAL(it->d_values.at(0), "value1");
return result;
}
- auto key = std::make_tuple(qname, nsec3.d_salt, nsec3.d_iterations);
+ auto key = std::tuple(qname, nsec3.d_salt, nsec3.d_iterations);
auto iter = cache.find(key);
if (iter != cache.end())
{