From: Remi Gacogne Date: Wed, 9 Feb 2022 10:36:33 +0000 (+0100) Subject: Replace more boost classes with their std equivalent X-Git-Tag: auth-4.7.0-alpha1~12^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a09e47b04cf56ff0f3212427c27d2059873e1b6;p=thirdparty%2Fpdns.git Replace more boost classes with their std equivalent --- diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index ef5e2f0c25..dc461e9a3b 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -29,8 +29,6 @@ #include #include -#include -#include #include #include #include @@ -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); } }; diff --git a/pdns/anadns.hh b/pdns/anadns.hh index 0ac51aebab..8c2e168890 100644 --- a/pdns/anadns.hh +++ b/pdns/anadns.hh @@ -20,8 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once -#include -#include #include #include #include diff --git a/pdns/dnsdemog.cc b/pdns/dnsdemog.cc index cc9cc2b494..6c400fa1ac 100644 --- a/pdns/dnsdemog.cc +++ b/pdns/dnsdemog.cc @@ -26,8 +26,6 @@ #include "statbag.hh" #include "dnspcap.hh" #include "dnsparser.hh" -#include -#include #include #include #include diff --git a/pdns/dnsgram.cc b/pdns/dnsgram.cc index 6cda63b3f0..2b93f43eb8 100644 --- a/pdns/dnsgram.cc +++ b/pdns/dnsgram.cc @@ -27,8 +27,6 @@ #include "dnspcap.hh" #include "dnsrecords.hh" #include "dnsparser.hh" -#include -#include #include #include #include diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index eac821493c..5e0d5333d0 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -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)); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 7a2315f517..7d5b2272bd 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -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(&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) diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index dd6e2ca2cb..6e7e5c4955 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -31,8 +31,6 @@ #include "dnspcap.hh" #include "dnsparser.hh" #include "dnsname.hh" -#include -#include #include #include #include diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index b805cdc042..a5b5f786d0 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -102,7 +102,7 @@ std::unique_ptr DNSCryptoKeyEngine::makeFromISCString(DNSKEY map 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 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); diff --git a/pdns/dnsseckeeper.hh b/pdns/dnsseckeeper.hh index 29f2fd0cbb..4dfe4c1b1d 100644 --- a/pdns/dnsseckeeper.hh +++ b/pdns/dnsseckeeper.hh @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include "dnssecinfra.hh" diff --git a/pdns/lua-recursor4.cc b/pdns/lua-recursor4.cc index 31b6a296f9..1c8cbcb8a0 100644 --- a/pdns/lua-recursor4.cc +++ b/pdns/lua-recursor4.cc @@ -414,7 +414,7 @@ void RecursorLua4::postPrepareContext() d_lw->writeFunction("getStat", [](const std::string& str) { uint64_t result = 0; - boost::optional value = getStatByName(str); + auto value = getStatByName(str); if (value) { result = *value; } diff --git a/pdns/pdns_hw.cc b/pdns/pdns_hw.cc index 01411cf466..3d8576a771 100644 --- a/pdns/pdns_hw.cc +++ b/pdns/pdns_hw.cc @@ -24,7 +24,6 @@ #endif #include #include -#include #include #include diff --git a/pdns/rec-snmp.cc b/pdns/rec-snmp.cc index e312135dc7..0f76cadd83 100644 --- a/pdns/rec-snmp.cc +++ b/pdns/rec-snmp.cc @@ -172,7 +172,7 @@ static int handleCounter64Stats(netsnmp_mib_handler* handler, return SNMP_ERR_GENERR; } - boost::optional value = getStatByName(it->second); + auto value = getStatByName(it->second); if (value) { return RecursorSNMPAgent::setCounter64Value(requests, *value); } diff --git a/pdns/rec_channel.hh b/pdns/rec_channel.hh index 14d5e392bc..0ad0545f1b 100644 --- a/pdns/rec_channel.hh +++ b/pdns/rec_channel.hh @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include "dnsname.hh" #include "sholder.hh" #include -#include extern GlobalStateHolder g_dontThrottleNames; extern GlobalStateHolder g_dontThrottleNetmasks; @@ -134,7 +134,7 @@ std::vector* pleaseGetLargeAnswerRemotes(); std::vector* pleaseGetTimeouts(); DNSName getRegisteredName(const DNSName& dom); std::atomic* getDynMetric(const std::string& str, const std::string& prometheusName); -boost::optional getStatByName(const std::string& name); +std::optional 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); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index f948178905..b5d41b77dd 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -12,9 +12,6 @@ #include "recursor_cache.hh" #include "syncres.hh" #include "negcache.hh" -#include -#include -#include #include #include @@ -158,9 +155,9 @@ std::atomic* getDynMetric(const std::string& str, const std::stri return ret.d_ptr; } -static boost::optional get(const string& name) +static std::optional get(const string& name) { - boost::optional ret; + std::optional ret; if (d_get32bitpointers.count(name)) return *d_get32bitpointers.find(name)->second; @@ -188,7 +185,7 @@ static boost::optional get(const string& name) return ret; } -boost::optional getStatByName(const std::string& name) +std::optional 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 num = get(*i); + std::optional num = get(*i); if (num) ret += std::to_string(*num) + "\n"; else @@ -1497,8 +1494,8 @@ vector>* pleaseGetBogusQueryRing() return ret; } -typedef boost::function*()> pleaseremotefunc_t; -typedef boost::function>*()> pleasequeryfunc_t; +typedef std::function*()> pleaseremotefunc_t; +typedef std::function>*()> pleasequeryfunc_t; vector* pleaseGetRemotes() { @@ -1632,7 +1629,7 @@ static DNSName nopFilter(const DNSName& name) return name; } -static string doGenericTopQueries(pleasequeryfunc_t func, boost::function filter = nopFilter) +static string doGenericTopQueries(pleasequeryfunc_t func, std::function filter = nopFilter) { typedef pair query_t; typedef map counts_t; diff --git a/pdns/recpacketcache.hh b/pdns/recpacketcache.hh index df27be11ce..d1084bbf63 100644 --- a/pdns/recpacketcache.hh +++ b/pdns/recpacketcache.hh @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index fa740b6110..596ccbea91 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -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; diff --git a/pdns/recursor_cache.hh b/pdns/recursor_cache.hh index 51265b0a43..56c6991914 100644 --- a/pdns/recursor_cache.hh +++ b/pdns/recursor_cache.hh @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -73,8 +72,8 @@ public: private: struct CacheEntry { - CacheEntry(const boost::tuple& 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& 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) { } diff --git a/pdns/recursordist/taskqueue.hh b/pdns/recursordist/taskqueue.hh index 55c307a902..9db1d42218 100644 --- a/pdns/recursordist/taskqueue.hh +++ b/pdns/recursordist/taskqueue.hh @@ -30,7 +30,6 @@ #include #include #include -#include #include "dnsname.hh" #include "qtype.hh" diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 384c7661f9..c0770bfdb7 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -467,7 +467,7 @@ std::tuple, std::shared_ptr> 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); diff --git a/pdns/signingpipe.cc b/pdns/signingpipe.cc index 7ee3634f10..0f1bfd17b2 100644 --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@ -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 } } diff --git a/pdns/syncres.cc b/pdns/syncres.cc index e2c3f573e5..05cd2af101 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -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& 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<().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 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< 0 && (auth != g_rootdnsname) && s_fails.lock()->incr(remoteIP, d_now) >= s_serverdownmaxfails) { LOG(prefix< #include -#include #include "mtasker.hh" #include "iputils.hh" #include "validate-recursor.hh" @@ -376,7 +374,7 @@ public: }; typedef std::unordered_map domainmap_t; - typedef Throttle > throttle_t; + typedef Throttle > 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() { diff --git a/pdns/test-base32_cc.cc b/pdns/test-base32_cc.cc index 891f405b8f..1680bc4603 100644 --- a/pdns/test-base32_cc.cc +++ b/pdns/test-base32_cc.cc @@ -6,13 +6,12 @@ #include #include -#include #include "base32.hh" BOOST_AUTO_TEST_SUITE(test_base32_cc) BOOST_AUTO_TEST_CASE(test_base32_basic) { - typedef boost::tuple case_t; + typedef std::tuple case_t; typedef std::list 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)); } }; diff --git a/pdns/test-signers.cc b/pdns/test-signers.cc index 6302462b88..4e2da00738 100644 --- a/pdns/test-signers.cc +++ b/pdns/test-signers.cc @@ -6,8 +6,6 @@ #include #include -#include - #include "base32.hh" #include "base64.hh" #include "dnsseckeeper.hh" diff --git a/pdns/test-statbag_cc.cc b/pdns/test-statbag_cc.cc index d551ca6546..4a36d38fc2 100644 --- a/pdns/test-statbag_cc.cc +++ b/pdns/test-statbag_cc.cc @@ -7,7 +7,6 @@ #include #include -#include #include #include #include "misc.hh" diff --git a/pdns/test-ueberbackend_cc.cc b/pdns/test-ueberbackend_cc.cc index 2085b12859..ea8f97f50e 100644 --- a/pdns/test-ueberbackend_cc.cc +++ b/pdns/test-ueberbackend_cc.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #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& meta) override { const auto& idx = boost::multi_index::get(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& meta) override { auto& idx = boost::multi_index::get(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(); - 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"); diff --git a/pdns/test-zoneparser_tng_cc.cc b/pdns/test-zoneparser_tng_cc.cc index 751645b228..2b579d5c69 100644 --- a/pdns/test-zoneparser_tng_cc.cc +++ b/pdns/test-zoneparser_tng_cc.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include "dns.hh" #include "zoneparser-tng.hh" diff --git a/pdns/ws-api.hh b/pdns/ws-api.hh index 461411b1ac..a9315b10fe 100644 --- a/pdns/ws-api.hh +++ b/pdns/ws-api.hh @@ -21,6 +21,7 @@ */ #pragma once #include +#include #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& out); -boost::optional productServerStatisticsFetch(const std::string& name); +std::optional productServerStatisticsFetch(const std::string& name); diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 87333179d8..c409923f97 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -504,14 +504,14 @@ void productServerStatisticsFetch(map& out) out["uptime"] = std::to_string(time(nullptr) - s_starttime); } -boost::optional productServerStatisticsFetch(const std::string& name) +std::optional 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; } } diff --git a/pdns/ws-auth.hh b/pdns/ws-auth.hh index c2b37734eb..9807c2f5e3 100644 --- a/pdns/ws-auth.hh +++ b/pdns/ws-auth.hh @@ -21,7 +21,6 @@ */ #pragma once #include -#include #include #include #include diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 1e3f628c44..17f0b85369 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -57,7 +57,7 @@ void productServerStatisticsFetch(map& out) out.swap(ret); } -boost::optional productServerStatisticsFetch(const std::string& name) +std::optional productServerStatisticsFetch(const std::string& name) { return getStatByName(name); }