]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Replace more boost classes with their std equivalent
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 9 Feb 2022 10:36:33 +0000 (11:36 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 9 Feb 2022 10:36:33 +0000 (11:36 +0100)
31 files changed:
modules/bindbackend/bindbackend2.hh
pdns/anadns.hh
pdns/dnsdemog.cc
pdns/dnsgram.cc
pdns/dnsrecords.cc
pdns/dnsrecords.hh
pdns/dnsscope.cc
pdns/dnssecinfra.cc
pdns/dnsseckeeper.hh
pdns/lua-recursor4.cc
pdns/pdns_hw.cc
pdns/rec-snmp.cc
pdns/rec_channel.hh
pdns/rec_channel_rec.cc
pdns/recpacketcache.hh
pdns/recursor_cache.cc
pdns/recursor_cache.hh
pdns/recursordist/taskqueue.hh
pdns/reczones.cc
pdns/signingpipe.cc
pdns/syncres.cc
pdns/syncres.hh
pdns/test-base32_cc.cc
pdns/test-signers.cc
pdns/test-statbag_cc.cc
pdns/test-ueberbackend_cc.cc
pdns/test-zoneparser_tng_cc.cc
pdns/ws-api.hh
pdns/ws-auth.cc
pdns/ws-auth.hh
pdns/ws-recursor.cc

index ef5e2f0c25cadba398bc95d3099d40c609a17476..dc461e9a3be4dffb74d18c1148c9afec82a7cf5b 100644 (file)
@@ -29,8 +29,6 @@
 #include <mutex>
 #include <boost/utility.hpp>
 
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/ordered_index.hpp>
@@ -69,7 +67,7 @@ struct Bind2DNSRecord
       return false;
     if (qtype == QType::SOA && rhs.qtype != QType::SOA)
       return true;
-    return tie(qtype, content, ttl) < tie(rhs.qtype, rhs.content, rhs.ttl);
+    return std::tie(qtype, content, ttl) < std::tie(rhs.qtype, rhs.content, rhs.ttl);
   }
 };
 
index 0ac51aebab8aa8e94134a04c66647ff93f77d623..8c2e168890bb2e48758c907c4a5887086f73d0c7 100644 (file)
@@ -20,8 +20,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #pragma once
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <string>
 #include <netinet/ip.h>
 #include <netinet/udp.h>
index cc9cc2b494024bc06e663c5bb3b2a860456da0b6..6c400fa1ac71f8c34b248f201373b8036c7fd0e1 100644 (file)
@@ -26,8 +26,6 @@
 #include "statbag.hh"
 #include "dnspcap.hh"
 #include "dnsparser.hh"
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <map>
 #include <set>
 #include <fstream>
index 6cda63b3f073b60011722a6352463352d8943504..2b93f43eb8f558ac6f2f8634209a08e420b92aa2 100644 (file)
@@ -27,8 +27,6 @@
 #include "dnspcap.hh"
 #include "dnsrecords.hh"
 #include "dnsparser.hh"
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <map>
 #include <set>
 #include <fstream>
index eac821493c4d3d04d692eb838915b6ed6b879f28..5e0d5333d0ee19de69902726676a529884278309 100644 (file)
@@ -82,8 +82,8 @@ bool DNSResourceRecord::operator==(const DNSResourceRecord& rhs)
   string rcontent=toLower(rhs.content);
 
   return
-    tie(qname, qtype, lcontent, ttl) ==
-    tie(rhs.qname, rhs.qtype, rcontent, rhs.ttl);
+    std::tie(qname, qtype, lcontent, ttl) ==
+    std::tie(rhs.qname, rhs.qtype, rcontent, rhs.ttl);
 }
 
 boilerplate_conv(A, conv.xfrIP(d_ip));
index 7a2315f5176127592e33061d6cde766ef495e3e5..7d5b2272bd0f60851c98f7417f2bdb8bd9da3e27 100644 (file)
@@ -359,8 +359,8 @@ public:
   string d_key;
   bool operator<(const DNSKEYRecordContent& rhs) const
   {
-    return tie(d_flags, d_protocol, d_algorithm, d_key) < 
-      tie(rhs.d_flags, rhs.d_protocol, rhs.d_algorithm, rhs.d_key);
+    return std::tie(d_flags, d_protocol, d_algorithm, d_key) < 
+      std::tie(rhs.d_flags, rhs.d_protocol, rhs.d_algorithm, rhs.d_key);
   }
 };
 
@@ -386,13 +386,13 @@ public:
     if(typeid(*this) != typeid(rhs))
       return false;
     auto rrhs =dynamic_cast<const decltype(this)>(&rhs);
-    return tie(d_tag, d_algorithm, d_digesttype, d_digest) ==
-      tie(rrhs->d_tag, rrhs->d_algorithm, rrhs->d_digesttype, rrhs->d_digest);
+    return std::tie(d_tag, d_algorithm, d_digesttype, d_digest) ==
+      std::tie(rrhs->d_tag, rrhs->d_algorithm, rrhs->d_digesttype, rrhs->d_digest);
   }
   bool operator<(const DSRecordContent& rhs) const
   {
-    return tie(d_tag, d_algorithm, d_digesttype, d_digest) <
-      tie(rhs.d_tag, rhs.d_algorithm, rhs.d_digesttype, rhs.d_digest);
+    return std::tie(d_tag, d_algorithm, d_digesttype, d_digest) <
+      std::tie(rhs.d_tag, rhs.d_algorithm, rhs.d_digesttype, rhs.d_digest);
   }
 
   includeboilerplate(DS)
index dd6e2ca2cbd4ae8481e46d3eb8ef353062313bd2..6e7e5c4955dfbedc27d745992a76593be23d5de0 100644 (file)
@@ -31,8 +31,6 @@
 #include "dnspcap.hh"
 #include "dnsparser.hh"
 #include "dnsname.hh"
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <map>
 #include <set>
 #include <fstream>
index b805cdc042800a57020ab6361939c577dc94631f..a5b5f786d023aa6bbb78c8b45aa441165f6c3b54 100644 (file)
@@ -102,7 +102,7 @@ std::unique_ptr<DNSCryptoKeyEngine> DNSCryptoKeyEngine::makeFromISCString(DNSKEY
   map<string, string> stormap;
 
   while (std::getline(str, sline)) {
-    tie(key,value) = splitField(sline, ':');
+    std::tie(key,value) = splitField(sline, ':');
     boost::trim(value);
 
     toLowerInPlace(key);
@@ -303,7 +303,7 @@ void DNSCryptoKeyEngine::testMakers(unsigned int algo, maker_t* creator, maker_t
     map<string, string> stormap;
 
     while(std::getline(str, sline)) {
-      tie(key,value)=splitField(sline, ':');
+      std::tie(key,value)=splitField(sline, ':');
       boost::trim(value);
       if(pdns_iequals(key,"algorithm")) {
         algorithm = pdns_stou(value);
index 29f2fd0cbb8991c66a5515c4f0895baf82240c56..4dfe4c1b1db80af73ddeae70f59e76b35fb5ce69 100644 (file)
@@ -27,7 +27,6 @@
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/ordered_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include "dnssecinfra.hh"
index 31b6a296f9e98cff99110aeac5a3dc9db33b67b0..1c8cbcb8a02552f3387bad18d35a5a5bee2ec427 100644 (file)
@@ -414,7 +414,7 @@ void RecursorLua4::postPrepareContext()
 
   d_lw->writeFunction("getStat", [](const std::string& str) {
       uint64_t result = 0;
-      boost::optional<uint64_t> value = getStatByName(str);
+      auto value = getStatByName(str);
       if (value) {
         result = *value;
       }
index 01411cf466da4b9b0f348eb8048269aa29df086d..3d8576a771585e7c3a7056b5ea1e748efa53f817 100644 (file)
@@ -24,7 +24,6 @@
 #endif
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 
index e312135dc7772028e17acbe78f2b2aea50bb4214..0f76cadd838cb602237a6438b8211907e18c321e 100644 (file)
@@ -172,7 +172,7 @@ static int handleCounter64Stats(netsnmp_mib_handler* handler,
     return SNMP_ERR_GENERR;
   }
 
-  boost::optional<uint64_t> value = getStatByName(it->second);
+  auto value = getStatByName(it->second);
   if (value) {
     return RecursorSNMPAgent::setCounter64Value(requests, *value);
   }
index 14d5e392bc4ace76866507cb7863fa85ac439cab..0ad0545f1baf3272e1687815fa046eb1db653110 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <string>
 #include <map>
+#include <optional>
 #include <vector>
 #include <inttypes.h>
 #include <sys/un.h>
@@ -33,7 +34,6 @@
 #include "dnsname.hh"
 #include "sholder.hh"
 #include <atomic>
-#include <boost/optional.hpp>
 
 extern GlobalStateHolder<SuffixMatchNode> g_dontThrottleNames;
 extern GlobalStateHolder<NetmaskGroup> g_dontThrottleNetmasks;
@@ -134,7 +134,7 @@ std::vector<ComboAddress>* pleaseGetLargeAnswerRemotes();
 std::vector<ComboAddress>* pleaseGetTimeouts();
 DNSName getRegisteredName(const DNSName& dom);
 std::atomic<unsigned long>* getDynMetric(const std::string& str, const std::string& prometheusName);
-boost::optional<uint64_t> getStatByName(const std::string& name);
+std::optional<uint64_t> getStatByName(const std::string& name);
 bool isStatDisabled(StatComponent component, const std::string& name);
 void disableStat(StatComponent component, const string& name);
 void disableStats(StatComponent component, const string& stats);
index f94817890563d098dd34c26c588662fec9424c3a..b5d41b77dd5192ad695df85c7f0b8abc13d0aa45 100644 (file)
@@ -12,9 +12,6 @@
 #include "recursor_cache.hh"
 #include "syncres.hh"
 #include "negcache.hh"
-#include <boost/function.hpp>
-#include <boost/optional.hpp>
-#include <boost/tuple/tuple.hpp>
 #include <boost/format.hpp>
 #include <boost/algorithm/string.hpp>
 
@@ -158,9 +155,9 @@ std::atomic<unsigned long>* getDynMetric(const std::string& str, const std::stri
   return ret.d_ptr;
 }
 
-static boost::optional<uint64_t> get(const string& name)
+static std::optional<uint64_t> get(const string& name)
 {
-  boost::optional<uint64_t> ret;
+  std::optional<uint64_t> ret;
 
   if (d_get32bitpointers.count(name))
     return *d_get32bitpointers.find(name)->second;
@@ -188,7 +185,7 @@ static boost::optional<uint64_t> get(const string& name)
   return ret;
 }
 
-boost::optional<uint64_t> getStatByName(const std::string& name)
+std::optional<uint64_t> getStatByName(const std::string& name)
 {
   return get(name);
 }
@@ -248,7 +245,7 @@ static string doGet(T begin, T end)
   string ret;
 
   for (T i = begin; i != end; ++i) {
-    boost::optional<uint64_t> num = get(*i);
+    std::optional<uint64_t> num = get(*i);
     if (num)
       ret += std::to_string(*num) + "\n";
     else
@@ -1497,8 +1494,8 @@ vector<pair<DNSName, uint16_t>>* pleaseGetBogusQueryRing()
   return ret;
 }
 
-typedef boost::function<vector<ComboAddress>*()> pleaseremotefunc_t;
-typedef boost::function<vector<pair<DNSName, uint16_t>>*()> pleasequeryfunc_t;
+typedef std::function<vector<ComboAddress>*()> pleaseremotefunc_t;
+typedef std::function<vector<pair<DNSName, uint16_t>>*()> pleasequeryfunc_t;
 
 vector<ComboAddress>* pleaseGetRemotes()
 {
@@ -1632,7 +1629,7 @@ static DNSName nopFilter(const DNSName& name)
   return name;
 }
 
-static string doGenericTopQueries(pleasequeryfunc_t func, boost::function<DNSName(const DNSName&)> filter = nopFilter)
+static string doGenericTopQueries(pleasequeryfunc_t func, std::function<DNSName(const DNSName&)> filter = nopFilter)
 {
   typedef pair<DNSName, uint16_t> query_t;
   typedef map<query_t, int> counts_t;
index df27be11ce5e0348f4aa1a3ab3059b174210fff4..d1084bbf6336f981086ffde693f56109db94df18 100644 (file)
@@ -28,7 +28,6 @@
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 #include <boost/optional.hpp>
index fa740b6110ff301aacd6eb570588d122cecc9d9d..596ccbea91cf5029edc35d8979dd77974ede43de 100644 (file)
@@ -165,7 +165,7 @@ MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSInde
         /* we have nothing more specific for you */
         break;
       }
-      auto key = boost::make_tuple(qname, qtype, boost::none, best);
+      auto key = std::make_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 */
@@ -197,7 +197,7 @@ MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSInde
   }
 
   /* we have nothing specific, let's see if we have a generic one */
-  auto key = boost::make_tuple(qname, qtype, boost::none, Netmask());
+  auto key = std::make_tuple(qname, qtype, boost::none, Netmask());
   auto entry = map.d_map.find(key);
   if (entry != map.d_map.end()) {
     if (entry->d_ttd > now) {
@@ -404,7 +404,7 @@ void MemRecursorCache::replace(time_t now, const DNSName& qname, const QType qt,
 
   // 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 = boost::make_tuple(qname, qt.getCode(), ednsmask ? routingTag : boost::none, (ednsmask && !routingTag) ? *ednsmask : Netmask());
+  auto key = std::make_tuple(qname, qt.getCode(), ednsmask ? routingTag : boost::none, (ednsmask && !routingTag) ? *ednsmask : Netmask());
   bool isNew = false;
   cache_t::iterator stored = map->d_map.find(key);
   if (stored == map->d_map.end()) {
@@ -421,7 +421,7 @@ void MemRecursorCache::replace(time_t now, const DNSName& qname, const QType qt,
   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 = boost::make_tuple(qname, qt.getCode());
+      auto ecsIndexKey = std::make_tuple(qname, qt.getCode());
       auto ecsIndex = map->d_ecsIndex.find(ecsIndexKey);
       if (ecsIndex == map->d_ecsIndex.end()) {
         ecsIndex = map->d_ecsIndex.insert(ECSIndexEntry(qname, qt.getCode())).first;
index 51265b0a4329803710f991f1d0855ec076ec49e3..56c6991914b4fb1b747b71d12c699937f0afde27 100644 (file)
@@ -32,7 +32,6 @@
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <boost/version.hpp>
@@ -73,8 +72,8 @@ public:
 private:
   struct CacheEntry
   {
-    CacheEntry(const boost::tuple<DNSName, QType, OptTag, Netmask>& key, bool auth) :
-      d_qname(key.get<0>()), d_netmask(key.get<3>().getNormalized()), d_rtag(key.get<2>()), d_state(vState::Indeterminate), d_ttd(0), d_qtype(key.get<1>()), d_auth(auth), d_submitted(false)
+    CacheEntry(const std::tuple<DNSName, QType, OptTag, Netmask>& key, bool auth) :
+      d_qname(std::get<0>(key)), d_netmask(std::get<3>(key).getNormalized()), d_rtag(std::get<2>(key)), d_state(vState::Indeterminate), d_ttd(0), d_qtype(std::get<1>(key)), d_auth(auth), d_submitted(false)
     {
     }
 
index 55c307a9021a3d579014682cb38591cf7e7d955a..9db1d42218affc76b4f6b15f797996b84bf57040 100644 (file)
@@ -30,7 +30,6 @@
 #include <boost/multi_index/member.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/tag.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 
 #include "dnsname.hh"
 #include "qtype.hh"
index 384c7661f94e1622b9d7d5cbf15e96de1f07d766..c0770bfdb785698816e0f3ca2660cad6fee55004 100644 (file)
@@ -467,7 +467,7 @@ std::tuple<std::shared_ptr<SyncRes::domainmap_t>, std::shared_ptr<notifyset_t>>
       if (line[0] == '#') // Comment line, skip to the next line
         continue;
       string domain, instructions;
-      tie(domain, instructions) = splitField(line, '=');
+      std::tie(domain, instructions) = splitField(line, '=');
       instructions = splitField(instructions, '#').first; // Remove EOL comments
       boost::trim(domain);
       boost::trim(instructions);
index 7ee3634f1082d6148d0d18fda13c396f481b1805..0f1bfd17b230af0227286957149f6cbea2ed1218 100644 (file)
@@ -100,12 +100,12 @@ namespace {
 bool
 dedupLessThan(const DNSZoneRecord& a, const DNSZoneRecord &b)
 {
-  return make_tuple(a.dr.d_content->getZoneRepresentation(), a.dr.d_ttl) < make_tuple(b.dr.d_content->getZoneRepresentation(), b.dr.d_ttl);  // XXX SLOW SLOW SLOW
+  return std::make_tuple(a.dr.d_content->getZoneRepresentation(), a.dr.d_ttl) < std::make_tuple(b.dr.d_content->getZoneRepresentation(), b.dr.d_ttl);  // XXX SLOW SLOW SLOW
 }
 
 bool dedupEqual(const DNSZoneRecord& a, const DNSZoneRecord &b)
 {
-  return make_tuple(a.dr.d_content->getZoneRepresentation(), a.dr.d_ttl) == make_tuple(b.dr.d_content->getZoneRepresentation(), b.dr.d_ttl);  // XXX SLOW SLOW SLOW
+  return std::make_tuple(a.dr.d_content->getZoneRepresentation(), a.dr.d_ttl) == std::make_tuple(b.dr.d_content->getZoneRepresentation(), b.dr.d_ttl);  // XXX SLOW SLOW SLOW
 }
 }
 
index e2c3f573e52c8b771b7777812b377f4e897c186b..05cd2af101c543ee6249cd675ee56034005a13fa 100644 (file)
@@ -303,7 +303,7 @@ bool SyncRes::doSpecialNamesResolve(const DNSName &qname, const QType qtype, con
 //! 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(boost::make_tuple(getName(), QType::SOA));
+  SyncRes::AuthDomain::records_t::const_iterator ziter = d_records.find(std::make_tuple(getName(), QType::SOA));
   if (ziter != d_records.end()) {
     DNSRecord dr = *ziter;
     dr.d_place = DNSResourceRecord::AUTHORITY;
@@ -358,7 +358,7 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, const QType qtype, std
   DNSName wcarddomain(qname);
   while(wcarddomain != getName() && wcarddomain.chopOff()) {
     // cerr<<qname<<": trying '*."<<wcarddomain<<"' in "<<getName()<<endl;
-    range = d_records.equal_range(boost::make_tuple(g_wildcarddnsname + wcarddomain));
+    range = d_records.equal_range(std::make_tuple(g_wildcarddnsname + wcarddomain));
     if (range.first==range.second)
       continue;
 
@@ -383,7 +383,7 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, const QType qtype, std
   /* 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(boost::make_tuple(nsdomain,QType::NS));
+    range = d_records.equal_range(std::make_tuple(nsdomain,QType::NS));
     if(range.first == range.second)
       continue;
 
@@ -516,7 +516,7 @@ uint64_t SyncRes::doDumpThrottleMap(int fd)
     count++;
     char tmp[26];
     // remote IP, dns name, qtype, count, ttd
-    fprintf(fp.get(), "%s\t%s\t%d\t%u\t%s", i.thing.get<0>().toString().c_str(), i.thing.get<1>().toLogString().c_str(), i.thing.get<2>(), i.count, ctime_r(&i.ttd, tmp));
+    fprintf(fp.get(), "%s\t%s\t%d\t%u\t%s", std::get<0>(i.thing).toString().c_str(), std::get<1>(i.thing).toLogString().c_str(), std::get<2>(i.thing), i.count, ctime_r(&i.ttd, tmp));
   }
 
   return count;
@@ -2414,12 +2414,12 @@ vector<ComboAddress> SyncRes::retrieveAddressesForNS(const std::string& prefix,
 
 bool SyncRes::throttledOrBlocked(const std::string& prefix, const ComboAddress& remoteIP, const DNSName& qname, const QType qtype, bool pierceDontQuery)
 {
-  if(t_sstorage.throttle.shouldThrottle(d_now.tv_sec, boost::make_tuple(remoteIP, "", 0))) {
+  if(t_sstorage.throttle.shouldThrottle(d_now.tv_sec, std::make_tuple(remoteIP, g_rootdnsname, 0))) {
     LOG(prefix<<qname<<": server throttled "<<endl);
     s_throttledqueries++; d_throttledqueries++;
     return true;
   }
-  else if(t_sstorage.throttle.shouldThrottle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()))) {
+  else if(t_sstorage.throttle.shouldThrottle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()))) {
     LOG(prefix<<qname<<": query throttled "<<remoteIP.toString()<<", "<<qname<<"; "<<qtype<<endl);
     s_throttledqueries++; d_throttledqueries++;
     return true;
@@ -4069,15 +4069,15 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname,
       if (s_serverdownmaxfails > 0 && (auth != g_rootdnsname) && s_fails.lock()->incr(remoteIP, d_now) >= s_serverdownmaxfails) {
         LOG(prefix<<qname<<": Max fails reached resolving on "<< remoteIP.toString() <<". Going full throttle for "<< s_serverdownthrottletime <<" seconds" <<endl);
         // mark server as down
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, "", 0), s_serverdownthrottletime, 10000);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, g_rootdnsname, 0), s_serverdownthrottletime, 10000);
       }
       else if (resolveret == LWResult::Result::Timeout) {
         // unreachable, 1 minute or 100 queries
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 60, 100);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 60, 100);
       }
       else {
         // timeout, 10 seconds or 5 queries
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 10, 5);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 10, 5);
       }
     }
 
@@ -4093,10 +4093,10 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname,
 
       if (doTCP) {
         // we can be more heavy-handed over TCP
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 60, 10);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 60, 10);
       }
       else {
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 10, 2);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 10, 2);
       }
     }
     return false;
@@ -4113,7 +4113,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname,
           t_sstorage.nsSpeeds[nsName.empty()? DNSName(remoteIP.toStringWithPort()) : nsName].submit(remoteIP, 1000000, d_now); // 1 sec
         }
         else {
-          t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 60, 3);
+          t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 60, 3);
         }
       }
       return false;
@@ -4132,7 +4132,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname,
       LOG(prefix<<qname<<": truncated bit set, over TCP?"<<endl);
       if (!dontThrottle) {
         /* let's treat that as a ServFail answer from this server */
-        t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()), 60, 3);
+        t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(remoteIP, qname, qtype.getCode()), 60, 3);
       }
       return false;
     }
@@ -4527,7 +4527,7 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con
             break;
           }
           /* was lame */
-          t_sstorage.throttle.throttle(d_now.tv_sec, boost::make_tuple(*remoteIP, qname, qtype.getCode()), 60, 100);
+          t_sstorage.throttle.throttle(d_now.tv_sec, std::make_tuple(*remoteIP, qname, qtype.getCode()), 60, 100);
         }
 
         if (gotNewServers) {
index b9d9ffac692ccb387dd113733a447078650dd2df..5eb3732a108d064be0d7c0c73b8aa2c5cd83c719 100644 (file)
@@ -40,9 +40,7 @@
 #include "sstuff.hh"
 #include "recursor_cache.hh"
 #include "recpacketcache.hh"
-#include <boost/tuple/tuple.hpp>
 #include <boost/optional.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include "mtasker.hh"
 #include "iputils.hh"
 #include "validate-recursor.hh"
@@ -376,7 +374,7 @@ public:
   };
 
   typedef std::unordered_map<DNSName, AuthDomain> domainmap_t;
-  typedef Throttle<boost::tuple<ComboAddress,DNSName,uint16_t> > throttle_t;
+  typedef Throttle<std::tuple<ComboAddress,DNSName,uint16_t> > throttle_t;
 
   struct EDNSStatus {
     EDNSStatus(const ComboAddress &arg) : address(arg) {}
@@ -532,15 +530,15 @@ public:
   }
   static bool isThrottled(time_t now, const ComboAddress& server, const DNSName& target, uint16_t qtype)
   {
-    return t_sstorage.throttle.shouldThrottle(now, boost::make_tuple(server, target, qtype));
+    return t_sstorage.throttle.shouldThrottle(now, std::make_tuple(server, target, qtype));
   }
   static bool isThrottled(time_t now, const ComboAddress& server)
   {
-    return t_sstorage.throttle.shouldThrottle(now, boost::make_tuple(server, "", 0));
+    return t_sstorage.throttle.shouldThrottle(now, std::make_tuple(server, g_rootdnsname, 0));
   }
   static void doThrottle(time_t now, const ComboAddress& server, time_t duration, unsigned int tries)
   {
-    t_sstorage.throttle.throttle(now, boost::make_tuple(server, "", 0), duration, tries);
+    t_sstorage.throttle.throttle(now, std::make_tuple(server, g_rootdnsname, 0), duration, tries);
   }
   static uint64_t getFailedServersSize()
   {
index 891f405b8f7f29264bec0456bdcf239ac20d455c..1680bc460391c8016dc56c76e35e27aa4c3c4c79 100644 (file)
@@ -6,13 +6,12 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/assign/list_of.hpp>
 
-#include <boost/tuple/tuple.hpp>
 #include "base32.hh"
 
 BOOST_AUTO_TEST_SUITE(test_base32_cc)
 
 BOOST_AUTO_TEST_CASE(test_base32_basic) {
-  typedef boost::tuple<const std::string, const std::string> case_t;
+  typedef std::tuple<const std::string, const std::string> case_t;
   typedef std::list<case_t> cases_t;
 
   // RFC test vectors
@@ -28,10 +27,10 @@ BOOST_AUTO_TEST_CASE(test_base32_basic) {
 
   for(const case_t& val :  cases) {
      std::string res;
-     res = toBase32Hex(val.get<0>());
-     BOOST_CHECK_EQUAL(res, val.get<1>());
-     res = fromBase32Hex(val.get<1>());
-     BOOST_CHECK_EQUAL(res, val.get<0>());
+     res = toBase32Hex(std::get<0>(val));
+     BOOST_CHECK_EQUAL(res, std::get<1>(val));
+     res = fromBase32Hex(std::get<1>(val));
+     BOOST_CHECK_EQUAL(res, std::get<0>(val));
   }
 };
 
index 6302462b88a42b44b1df7096f02c03ab0f2019f9..4e2da007381f6395517d06e66da161425b909bf8 100644 (file)
@@ -6,8 +6,6 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/assign/list_of.hpp>
 
-#include <boost/tuple/tuple.hpp>
-
 #include "base32.hh"
 #include "base64.hh"
 #include "dnsseckeeper.hh"
index d551ca6546172327bee860374d36d51f6aec66a2..4a36d38fc232482414ed26eb2ea0dda2a1fc6964 100644 (file)
@@ -7,7 +7,6 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/assign/list_of.hpp>
 
-#include <boost/tuple/tuple.hpp>
 #include <stdint.h>
 #include <thread>
 #include "misc.hh"
index 2085b128591f791addb123630d800bd5e33e2d47..ea8f97f50e1f2ff8e8fb577c36cf00437d834908 100644 (file)
@@ -12,7 +12,6 @@
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 
 #include "arguments.hh"
@@ -153,7 +152,7 @@ public:
         d_end = range.second;
       }
       else {
-        auto range = idx.equal_range(boost::make_tuple(qdomain, qtype.getCode()));
+        auto range = idx.equal_range(std::make_tuple(qdomain, qtype.getCode()));
         d_iter = range.first;
         d_end = range.second;
       }
@@ -200,7 +199,7 @@ public:
   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(boost::make_tuple(name, kind));
+    auto it = idx.find(std::make_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;
@@ -213,7 +212,7 @@ public:
   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(boost::make_tuple(name, kind));
+    auto it = idx.find(std::make_tuple(name, kind));
     if (it == idx.end()) {
       s_metadata.at(d_backendId).insert(SimpleMetaData(name, kind, meta));
       return true;
@@ -258,7 +257,7 @@ public:
       }
 
       auto& idx = records->get<OrderedNameTypeTag>();
-      auto range = idx.equal_range(boost::make_tuple(best, QType::SOA));
+      auto range = idx.equal_range(std::make_tuple(best, QType::SOA));
       if (range.first == range.second) {
         return false;
       }
@@ -1155,7 +1154,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_metadata) {
 
     {
       // check that it has not been updated in the second backend
-      const auto& it = SimpleBackend::s_metadata[2].find(boost::make_tuple(DNSName("powerdns.org."), "test-data-b"));
+      const auto& it = SimpleBackend::s_metadata[2].find(std::make_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");
index 751645b2289904815d84fb42d83f47f592684342..2b579d5c69663d6e8441041c3e7b9c0e61df14b5 100644 (file)
@@ -6,7 +6,6 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/assign/list_of.hpp>
 
-#include <boost/tuple/tuple.hpp>
 #include <boost/iostreams/device/file.hpp>
 #include "dns.hh"
 #include "zoneparser-tng.hh"
index 461411b1ace2410c33d5970312867105595a111f..a9315b10fe52b649523650cdd39845981219b492 100644 (file)
@@ -21,6 +21,7 @@
  */
 #pragma once
 #include <map>
+#include <optional>
 #include "webserver.hh"
 
 void apiDiscovery(HttpRequest* req, HttpResponse* resp);
@@ -39,4 +40,4 @@ DNSName apiNameToDNSName(const string& name);
 
 // To be provided by product code.
 void productServerStatisticsFetch(std::map<string,string>& out);
-boost::optional<uint64_t> productServerStatisticsFetch(const std::string& name);
+std::optional<uint64_t> productServerStatisticsFetch(const std::string& name);
index 87333179d83f7fa8e8a2acfadf2bac9595ffe90c..c409923f975a7c81cb18d91a1800c840a3bebf76 100644 (file)
@@ -504,14 +504,14 @@ void productServerStatisticsFetch(map<string,string>& out)
   out["uptime"] = std::to_string(time(nullptr) - s_starttime);
 }
 
-boost::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
+std::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
 {
   try {
     // ::read() calls ::exists() which throws a PDNSException when the key does not exist
     return S.read(name);
   }
-  catch(...) {
-    return boost::none;
+  catch (...) {
+    return std::nullopt;
   }
 }
 
index c2b37734ebc0860cba0bc16a398a68e7ddee6ae8..9807c2f5e39027a2c0b5f67023fca3d4cc604660 100644 (file)
@@ -21,7 +21,6 @@
  */
 #pragma once
 #include <string>
-#include <tuple>
 #include <map>
 #include <time.h>
 #include <pthread.h>
index 1e3f628c44c05dcbe1e461b232b27eebfb721cf5..17f0b85369e2f50f1fafbdf607a527169b1f37c4 100644 (file)
@@ -57,7 +57,7 @@ void productServerStatisticsFetch(map<string, string>& out)
   out.swap(ret);
 }
 
-boost::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
+std::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
 {
   return getStatByName(name);
 }