]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
common: remove position from MOADNSParser::answers_t, it it used nowhere
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 22 Jul 2024 12:21:51 +0000 (14:21 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 22 Jul 2024 12:21:51 +0000 (14:21 +0200)
26 files changed:
pdns/axfr-retriever.cc
pdns/dnsbulktest.cc
pdns/dnsdistdist/dnsdist-tcp-downstream.cc
pdns/dnsdistdist/test-dnsdist-dnsparser.cc
pdns/dnsdistdist/test-dnsdist_cc.cc
pdns/dnspacket.cc
pdns/dnsparser.cc
pdns/dnsparser.hh
pdns/dnsproxy.cc
pdns/dnsrecords.cc
pdns/dnsreplay.cc
pdns/ixfr.cc
pdns/ixfrutils.cc
pdns/nsec3dig.cc
pdns/recursordist/lwres.cc
pdns/recursordist/rec-system-resolve.cc
pdns/resolver.cc
pdns/rfc2136handler.cc
pdns/saxfr.cc
pdns/sdig.cc
pdns/speedtest.cc
pdns/stubresolver.cc
pdns/tcpreceiver.cc
pdns/test-dnsrecords_cc.cc
pdns/test-tsig.cc
pdns/tsigverifier.cc

index 9b2a4bf92e1a5e679af3731d6c36fe9cd101a2cf..17891bf6ab6405a8e9f1510988d3139c9e420a72 100644 (file)
@@ -149,7 +149,7 @@ int AXFRRetriever::getChunk(Resolver::res_t &res, vector<DNSRecord>* records, ui
 
     if (!err) {
       for(const auto& answer :  mdp.d_answers)
-        if (answer.first.d_type == QType::SOA)
+        if (answer.d_type == QType::SOA)
           d_soacount++;
     }
   }
@@ -158,11 +158,11 @@ int AXFRRetriever::getChunk(Resolver::res_t &res, vector<DNSRecord>* records, ui
     records->reserve(mdp.d_answers.size());
 
     for(auto& r: mdp.d_answers) {
-      if (r.first.d_type == QType::SOA) {
+      if (r.d_type == QType::SOA) {
         d_soacount++;
       }
 
-      records->push_back(std::move(r.first));
+      records->push_back(std::move(r));
     }
   }
 
index fd1f6173f259d4f7f598bcdbbc807d3ee312cd59..49ad38ab49e464025df27190dc81505d6395d624 100644 (file)
@@ -161,15 +161,15 @@ struct SendReceive
       }
       dnsResult.rcode = mdp.d_header.rcode;
       for (auto i = mdp.d_answers.begin(); i != mdp.d_answers.end(); ++i) {
-        if (i->first.d_place == 1 && i->first.d_type == mdp.d_qtype) {
-          dnsResult.ips.emplace_back(i->first.getContent()->getZoneRepresentation());
+        if (i->d_place == 1 && i->d_type == mdp.d_qtype) {
+          dnsResult.ips.emplace_back(i->getContent()->getZoneRepresentation());
         }
-        if (i->first.d_place == 2 && i->first.d_type == QType::SOA) {
+        if (i->d_place == 2 && i->d_type == QType::SOA) {
           dnsResult.seenauthsoa = true;
         }
         if (!g_quiet) {
-          cout << i->first.d_place - 1 << "\t" << i->first.d_name << "\tIN\t" << DNSRecordContent::NumberToType(i->first.d_type);
-          cout << "\t" << i->first.d_ttl << "\t" << i->first.getContent()->getZoneRepresentation() << "\n";
+          cout << i->d_place - 1 << "\t" << i->d_name << "\tIN\t" << DNSRecordContent::NumberToType(i->d_type);
+          cout << "\t" << i->d_ttl << "\t" << i->getContent()->getZoneRepresentation() << "\n";
         }
       }
 
index 0e828939d5758e33c4f992775b543d2086cca02f..5c269695f689b581e938b480525942b8a9d780b6 100644 (file)
@@ -191,11 +191,11 @@ static bool getSerialFromIXFRQuery(TCPQuery& query)
     MOADNSParser parser(true, reinterpret_cast<const char*>(query.d_buffer.data() + sizeof(uint16_t) + proxyPayloadSize), payloadSize);
 
     for (const auto& record : parser.d_answers) {
-      if (record.first.d_place != DNSResourceRecord::AUTHORITY || record.first.d_class != QClass::IN || record.first.d_type != QType::SOA) {
+      if (record.d_place != DNSResourceRecord::AUTHORITY || record.d_class != QClass::IN || record.d_type != QType::SOA) {
         return false;
       }
 
-      auto unknownContent = getRR<UnknownRecordContent>(record.first);
+      auto unknownContent = getRR<UnknownRecordContent>(record);
       if (!unknownContent) {
         return false;
       }
@@ -815,11 +815,11 @@ bool TCPConnectionToBackend::isXFRFinished(const TCPResponse& response, TCPQuery
     }
     else {
       for (const auto& record : parser.d_answers) {
-        if (record.first.d_class != QClass::IN || record.first.d_type != QType::SOA) {
+        if (record.d_class != QClass::IN || record.d_type != QType::SOA) {
           continue;
         }
 
-        auto unknownContent = getRR<UnknownRecordContent>(record.first);
+        auto unknownContent = getRR<UnknownRecordContent>(record);
         if (!unknownContent) {
           continue;
         }
index a7bb4e37b39a48a94c3fbbc45434ef4c279f5bd1..caf5d42c5b90142c67bad557e09051a28ab02558 100644 (file)
@@ -117,14 +117,14 @@ BOOST_AUTO_TEST_CASE(test_Response)
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 2U);
 
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 3U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::A));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, newTarget);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::AAAA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, newTarget);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::A));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, newTarget);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::AAAA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, newTarget);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_name, g_rootdnsname);
   }
 
   {
@@ -156,14 +156,14 @@ BOOST_AUTO_TEST_CASE(test_Response)
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 2U);
 
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 3U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::A));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, newTarget);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::AAAA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, notTheTarget);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::A));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, newTarget);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::AAAA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, notTheTarget);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_name, g_rootdnsname);
   }
 
   {
@@ -194,18 +194,18 @@ BOOST_AUTO_TEST_CASE(test_Response)
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
 
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 3U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::CNAME));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, newTarget);
-    auto content = getRR<UnknownRecordContent>(mdp.d_answers.at(0).first);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::CNAME));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, newTarget);
+    auto content = getRR<UnknownRecordContent>(mdp.d_answers.at(0));
     BOOST_REQUIRE(content != nullptr);
     BOOST_CHECK_EQUAL(content->getRawContent().size(), notTheTarget.getStorage().size());
 
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::A));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, notTheTarget);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::A));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, notTheTarget);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(2).d_name, g_rootdnsname);
   }
 
   {
@@ -259,11 +259,11 @@ BOOST_AUTO_TEST_CASE(test_Response)
 
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 7U);
     for (const auto& answer : mdp.d_answers) {
-      if (answer.first.d_type == QType::OPT) {
+      if (answer.d_type == QType::OPT) {
         continue;
       }
-      BOOST_CHECK_EQUAL(answer.first.d_class, QClass::IN);
-      BOOST_CHECK_EQUAL(answer.first.d_name, newTarget);
+      BOOST_CHECK_EQUAL(answer.d_class, QClass::IN);
+      BOOST_CHECK_EQUAL(answer.d_name, newTarget);
     }
   }
 
@@ -322,11 +322,11 @@ BOOST_AUTO_TEST_CASE(test_Response)
 
       BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 8U);
       for (const auto& answer : mdp.d_answers) {
-        if (answer.first.d_type == QType::OPT) {
+        if (answer.d_type == QType::OPT) {
           continue;
         }
-        BOOST_CHECK_EQUAL(answer.first.d_class, QClass::IN);
-        BOOST_CHECK_EQUAL(answer.first.d_name, target);
+        BOOST_CHECK_EQUAL(answer.d_class, QClass::IN);
+        BOOST_CHECK_EQUAL(answer.d_name, target);
       }
     }
 
@@ -344,11 +344,11 @@ BOOST_AUTO_TEST_CASE(test_Response)
 
       BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 8U);
       for (const auto& answer : mdp.d_answers) {
-        if (answer.first.d_type == QType::OPT) {
+        if (answer.d_type == QType::OPT) {
           continue;
         }
-        BOOST_CHECK_EQUAL(answer.first.d_class, QClass::IN);
-        BOOST_CHECK_EQUAL(answer.first.d_name, newTarget);
+        BOOST_CHECK_EQUAL(answer.d_class, QClass::IN);
+        BOOST_CHECK_EQUAL(answer.d_name, newTarget);
       }
     }
   }
@@ -377,9 +377,9 @@ BOOST_AUTO_TEST_CASE(test_Response)
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
 
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 2U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::ALIAS));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, target);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::ALIAS));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, target);
   }
 }
 
index 0dfba46297924040d99b7f8cc904fcd182be7a81..10c67e5c1916afe2345cad60f3b06d73ac4d0127 100644 (file)
@@ -1987,9 +1987,9 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 0U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 1U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
   }
   {
     /* now with incoming EDNS */
@@ -2010,11 +2010,11 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 0U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 2U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 2U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, g_rootdnsname);
   }
 
   /* test No Data */
@@ -2037,9 +2037,9 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 0U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 1U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
   }
   {
     /* now with incoming EDNS */
@@ -2060,11 +2060,11 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 0U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 2U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 2U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, g_rootdnsname);
   }
 
   /* SOA in the authority section*/
@@ -2090,9 +2090,9 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 1U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 0U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 1U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
   }
   {
     /* now with incoming EDNS */
@@ -2113,11 +2113,11 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 1U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 2U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, g_rootdnsname);
   }
 
   /* test No Data */
@@ -2140,9 +2140,9 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 1U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 0U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 1U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
   }
   {
     /* now with incoming EDNS */
@@ -2163,11 +2163,11 @@ BOOST_AUTO_TEST_CASE(test_setNegativeAndAdditionalSOA)
     BOOST_CHECK_EQUAL(mdp.d_header.nscount, 1U);
     BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
     BOOST_REQUIRE_EQUAL(mdp.d_answers.size(), 2U);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::SOA));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_class, QClass::IN);
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, DNSName("zone."));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_type, static_cast<uint16_t>(QType::OPT));
-    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).first.d_name, g_rootdnsname);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::SOA));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_class, QClass::IN);
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, DNSName("zone."));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_type, static_cast<uint16_t>(QType::OPT));
+    BOOST_CHECK_EQUAL(mdp.d_answers.at(1).d_name, g_rootdnsname);
   }
 }
 
@@ -2282,8 +2282,8 @@ BOOST_AUTO_TEST_CASE(test_setEDNSOption)
   BOOST_CHECK_EQUAL(mdp.d_header.ancount, 0U);
   BOOST_CHECK_EQUAL(mdp.d_header.nscount, 0U);
   BOOST_CHECK_EQUAL(mdp.d_header.arcount, 1U);
-  BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_type, static_cast<uint16_t>(QType::OPT));
-  BOOST_CHECK_EQUAL(mdp.d_answers.at(0).first.d_name, g_rootdnsname);
+  BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_type, static_cast<uint16_t>(QType::OPT));
+  BOOST_CHECK_EQUAL(mdp.d_answers.at(0).d_name, g_rootdnsname);
 
   EDNS0Record edns0{};
   BOOST_REQUIRE(getEDNS0Record(dnsQuestion.getData(), edns0));
index 471af2a46ef00b3a659a464c3ef07fe634933d2d..5059c5b41501fee99cd0e9e9d1c371d09eafd2ec 100644 (file)
@@ -513,15 +513,15 @@ bool DNSPacket::getTSIGDetails(TSIGRecordContent* trc, DNSName* keyname, uint16_
 
   bool gotit=false;
   for(const auto & answer : mdp.d_answers) {
-    if(answer.first.d_type == QType::TSIG && answer.first.d_class == QType::ANY) {
+    if(answer.d_type == QType::TSIG && answer.d_class == QType::ANY) {
       // cast can fail, f.e. if d_content is an UnknownRecordContent.
-      auto content = getRR<TSIGRecordContent>(answer.first);
+      auto content = getRR<TSIGRecordContent>(answer);
       if (!content) {
         g_log<<Logger::Error<<"TSIG record has no or invalid content (invalid packet)"<<endl;
         return false;
       }
       *trc = *content;
-      *keyname = answer.first.d_name;
+      *keyname = answer.d_name;
       gotit=true;
     }
   }
@@ -546,15 +546,15 @@ bool DNSPacket::getTKEYRecord(TKEYRecordContent *tr, DNSName *keyname) const
       return false;
     }
 
-    if(answer.first.d_type == QType::TKEY) {
+    if(answer.d_type == QType::TKEY) {
       // cast can fail, f.e. if d_content is an UnknownRecordContent.
-      auto content = getRR<TKEYRecordContent>(answer.first);
+      auto content = getRR<TKEYRecordContent>(answer);
       if (!content) {
         g_log<<Logger::Error<<"TKEY record has no or invalid content (invalid packet)"<<endl;
         return false;
       }
       *tr = *content;
-      *keyname = answer.first.d_name;
+      *keyname = answer.d_name;
       gotit=true;
     }
   }
index ba4fd22982e5fde4973099101d823836ef8ccb6e..1eecaea630e80c8461f1e15b18c3ff04de2819d3 100644 (file)
@@ -305,7 +305,7 @@ void MOADNSParser::init(bool query, const std::string_view& packet)
         d_tsigPos = recordStartPos;
       }
 
-      d_answers.emplace_back(std::move(dr), pr.getPosition() - sizeof(dnsheader));
+      d_answers.emplace_back(std::move(dr));
     }
 
 #if 0
@@ -342,7 +342,7 @@ bool MOADNSParser::hasEDNS() const
   }
 
   for (const auto& record : d_answers) {
-    if (record.first.d_place == DNSResourceRecord::ADDITIONAL && record.first.d_type == QType::OPT) {
+    if (record.d_place == DNSResourceRecord::ADDITIONAL && record.d_type == QType::OPT) {
       return true;
     }
   }
index fa54d2a1c956beafe1600a46ca70d9435754cf78..07660b90ea335540d475dda2bd31ed3ba2b2274a 100644 (file)
@@ -482,10 +482,9 @@ public:
 
   DNSName d_qname;
   uint16_t d_qclass, d_qtype;
-  //uint8_t d_rcode;
   dnsheader d_header;
 
-  typedef vector<pair<DNSRecord, uint16_t > > answers_t;
+  using answers_t = vector<DNSRecord>;
 
   //! All answers contained in this packet (everything *but* the question section)
   answers_t d_answers;
index 26a0aa0805f4b8e4bd507a2592f85110cde2f6a8..19adff21cb16a1d441fee362517d97f4f3eba21e 100644 (file)
@@ -277,15 +277,15 @@ void DNSProxy::mainloop()
 
         if (mdp.d_header.rcode == RCode::NoError) {
           for (const auto& answer : mdp.d_answers) {
-            if (answer.first.d_place == DNSResourceRecord::ANSWER || (answer.first.d_place == DNSResourceRecord::AUTHORITY && answer.first.d_type == QType::SOA)) {
+            if (answer.d_place == DNSResourceRecord::ANSWER || (answer.d_place == DNSResourceRecord::AUTHORITY && answer.d_type == QType::SOA)) {
 
-              if (answer.first.d_type == iter->second.qtype || (iter->second.qtype == QType::ANY && (answer.first.d_type == QType::A || answer.first.d_type == QType::AAAA))) {
+              if (answer.d_type == iter->second.qtype || (iter->second.qtype == QType::ANY && (answer.d_type == QType::A || answer.d_type == QType::AAAA))) {
                 DNSZoneRecord dzr;
                 dzr.dr.d_name = iter->second.aname;
-                dzr.dr.d_type = answer.first.d_type;
-                dzr.dr.d_ttl = answer.first.d_ttl;
-                dzr.dr.d_place = answer.first.d_place;
-                dzr.dr.setContent(answer.first.getContent());
+                dzr.dr.d_type = answer.d_type;
+                dzr.dr.d_ttl = answer.d_ttl;
+                dzr.dr.d_place = answer.d_place;
+                dzr.dr.setContent(answer.getContent());
                 iter->second.complete->addRecord(std::move(dzr));
               }
             }
index a7c752be1fa95ab184a284596cc75598032f7c05..8f9c0512236882e4fc2b35f11f11ef972233968e 100644 (file)
@@ -884,18 +884,18 @@ bool getEDNSOpts(const MOADNSParser& mdp, EDNSOpts* eo)
   eo->d_extFlags=0;
   if(mdp.d_header.arcount && !mdp.d_answers.empty()) {
     for(const MOADNSParser::answers_t::value_type& val :  mdp.d_answers) {
-      if(val.first.d_place == DNSResourceRecord::ADDITIONAL && val.first.d_type == QType::OPT) {
-        eo->d_packetsize=val.first.d_class;
+      if(val.d_place == DNSResourceRecord::ADDITIONAL && val.d_type == QType::OPT) {
+        eo->d_packetsize=val.d_class;
 
         EDNS0Record stuff;
-        uint32_t ttl=ntohl(val.first.d_ttl);
+        uint32_t ttl=ntohl(val.d_ttl);
         static_assert(sizeof(EDNS0Record) == sizeof(uint32_t), "sizeof(EDNS0Record) must match sizeof(uint32_t)");
         memcpy(&stuff, &ttl, sizeof(stuff));
 
         eo->d_extRCode=stuff.extRCode;
         eo->d_version=stuff.version;
         eo->d_extFlags = ntohs(stuff.extFlags);
-        auto orc = getRR<OPTRecordContent>(val.first);
+        auto orc = getRR<OPTRecordContent>(val);
         if(orc == nullptr)
           return false;
         orc->getData(eo->d_options);
index 36f0db835b4f25df50c4ca13992cdd2c9509ffef..6426fba6ed39224e27605db25d80242695e75e2d 100644 (file)
@@ -242,8 +242,8 @@ static void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int
 static void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& compacted)
 {
   for(MOADNSParser::answers_t::const_iterator i=orig.begin(); i != orig.end(); ++i)
-    if(i->first.d_place==DNSResourceRecord::ANSWER)
-      compacted.insert(i->first);
+    if(i->d_place==DNSResourceRecord::ANSWER)
+      compacted.insert(*i);
 }
 
 static bool isRcodeOk(int rcode)
@@ -260,10 +260,10 @@ static bool isRootReferral(const MOADNSParser::answers_t& answers)
 
   bool ok=true;
   for(MOADNSParser::answers_t::const_iterator iter = answers.begin(); iter != answers.end(); ++iter) {
-    //    cerr<<(int)iter->first.d_place<<", "<<iter->first.d_name<<" "<<iter->first.d_type<<", # "<<answers.size()<<endl;
-    if(iter->first.d_place!=2)
+    //    cerr<<(int)iter->d_place<<", "<<iter->d_name<<" "<<iter->d_type<<", # "<<answers.size()<<endl;
+    if(iter->d_place!=2)
       ok=false;
-    if(!iter->first.d_name.isRoot() || iter->first.d_type!=QType::NS)
+    if(!iter->d_name.isRoot() || iter->d_type!=QType::NS)
       ok=false;
   }
   return ok;
index ac041cb0090566925727072a9d1ecba659ff43a9..0a7ee6d593d5af8ff9aefc67cb2311341c82b5e2 100644 (file)
@@ -259,11 +259,11 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord>>> getIXFRDeltas(const ComboAddr
     for (auto& r: mdp.d_answers) {
       if(!primarySOA) {
         // we have not seen the first SOA record yet
-        if (r.first.d_type != QType::SOA) {
-          throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"' is not a SOA ("+QType(r.first.d_type).toString()+")");
+        if (r.d_type != QType::SOA) {
+          throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"' is not a SOA ("+QType(r.d_type).toString()+")");
         }
 
-        auto sr = getRR<SOARecordContent>(r.first);
+        auto sr = getRR<SOARecordContent>(r);
         if (!sr) {
           throw std::runtime_error("Error getting the content of the first SOA record of the IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"'");
         }
@@ -274,8 +274,8 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord>>> getIXFRDeltas(const ComboAddr
         }
         primarySOA = std::move(sr);
         ++primarySOACount;
-      } else if (r.first.d_type == QType::SOA) {
-        auto sr = getRR<SOARecordContent>(r.first);
+      } else if (r.d_type == QType::SOA) {
+        auto sr = getRR<SOARecordContent>(r);
         if (!sr) {
           throw std::runtime_error("Error getting the content of SOA record of IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"'");
         }
@@ -287,7 +287,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord>>> getIXFRDeltas(const ComboAddr
       }
       // When we see the 2nd record, we can decide what the style is
       if (records.size() == 1 && style == Unknown) {
-        if (r.first.d_type != QType::SOA) {
+        if (r.d_type != QType::SOA) {
           // Non-empty AXFR style has a non-SOA record following the first SOA
           style = AXFR;
         }
@@ -301,18 +301,18 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord>>> getIXFRDeltas(const ComboAddr
         }
       }
 
-      if(r.first.d_place != DNSResourceRecord::ANSWER) {
-        if(r.first.d_type == QType::TSIG)
+      if(r.d_place != DNSResourceRecord::ANSWER) {
+        if(r.d_type == QType::TSIG)
           continue;
 
-        if(r.first.d_type == QType::OPT)
+        if(r.d_type == QType::OPT)
           continue;
 
-        throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).toString()+") in non-answer section ("+std::to_string(r.first.d_place)+") in IXFR response for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort());
+        throw std::runtime_error("Unexpected record (" +QType(r.d_type).toString()+") in non-answer section ("+std::to_string(r.d_place)+") in IXFR response for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort());
       }
 
-      r.first.d_name.makeUsRelative(zone);
-      records.push_back(r.first);
+      r.d_name.makeUsRelative(zone);
+      records.push_back(r);
     }
   }
 
index 385ac490b0a0a6e22387611969563f16cb6b5474..53e18313531d4e04c3986988cd5337b257e7f58d 100644 (file)
@@ -65,8 +65,8 @@ uint32_t getSerialFromPrimary(const ComboAddress& primary, const DNSName& zone,
     throw std::runtime_error("RCODE from response is not NoError but " + RCode::to_s(mdp.d_header.rcode));
   }
   for(const auto& r: mdp.d_answers) {
-    if(r.first.d_type == QType::SOA) {
-      sr = getRR<SOARecordContent>(r.first);
+    if(r.d_type == QType::SOA) {
+      sr = getRR<SOARecordContent>(r);
       if(sr != nullptr) {
         return sr->d_st.serial;
       }
index f47ed2c58b5e642cf05042db2ecc905c695f1cba..ea5a1fb8eb4ce52b9b92b48c933418063fb5e19f 100644 (file)
@@ -167,35 +167,35 @@ try
   string nsec3salt;
   int nsec3iters = 0;
   for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {     
-    if(i->first.d_type == QType::NSEC3)
+    if(i->d_type == QType::NSEC3)
     {
       // cerr<<"got nsec3 ["<<i->first.d_name<<"]"<<endl;
       // cerr<<i->first.d_content->getZoneRepresentation()<<endl;
-      const auto r = getRR<NSEC3RecordContent>(i->first);
+      const auto r = getRR<NSEC3RecordContent>(*i);
       if (!r) {
         continue;
       }
       // nsec3.insert(new nsec3()
       // cerr<<toBase32Hex(r.d_nexthash)<<endl;
-      nsec3s.emplace(toLower(i->first.d_name.getRawLabel(0)), toBase32Hex(r->d_nexthash));
+      nsec3s.emplace(toLower(i->d_name.getRawLabel(0)), toBase32Hex(r->d_nexthash));
       nsec3salt = r->d_salt;
       nsec3iters = r->d_iterations;
-      nsec3t.emplace(toLower(i->first.d_name.getRawLabel(0)), r->numberOfTypesSet());
+      nsec3t.emplace(toLower(i->d_name.getRawLabel(0)), r->numberOfTypesSet());
     }
     else
     {
-      // cerr<<"namesseen.insert('"<<i->first.d_name<<"')"<<endl;
-      names.insert(i->first.d_name);
-      namesseen.insert(i->first.d_name);
+      // cerr<<"namesseen.insert('"<<i->d_name<<"')"<<endl;
+      names.insert(i->d_name);
+      namesseen.insert(i->d_name);
     }
 
-    if(i->first.d_type == QType::CNAME)
+    if(i->d_type == QType::CNAME)
     {
-      namesseen.insert(DNSName(i->first.getContent()->getZoneRepresentation()));
+      namesseen.insert(DNSName(i->getContent()->getZoneRepresentation()));
     }
 
-    cout << i->first.d_place - 1 << "\t" << i->first.d_name.toString() << "\t" << i->first.d_ttl << "\tIN\t" << DNSRecordContent::NumberToType(i->first.d_type);
-    cout << "\t" << i->first.getContent()->getZoneRepresentation() << "\n";
+    cout << i->d_place - 1 << "\t" << i->d_name.toString() << "\t" << i->d_ttl << "\tIN\t" << DNSRecordContent::NumberToType(i->d_type);
+    cout << "\t" << i->getContent()->getZoneRepresentation() << "\n";
   }
 
 #if 0
index 04e29920d1d0d80b307ccbcc8fcc80ccc0935daf..238fa20d0a350e104ec3ea5cd49dc2d26676ce1d 100644 (file)
@@ -595,8 +595,9 @@ static LWResult::Result asyncresolve(const ComboAddress& address, const DNSName&
     }
 
     lwr->d_records.reserve(mdp.d_answers.size());
-    for (const auto& a : mdp.d_answers)
-      lwr->d_records.push_back(a.first);
+    for (const auto& answer : mdp.d_answers) {
+      lwr->d_records.push_back(answer);
+    }
 
     EDNSOpts edo;
     if (EDNS0Level > 0 && getEDNSOpts(mdp, &edo)) {
index 6f8fb1ec574094448f7d4254451b5273f605c528..b50057cf74e584fd66b06870ad92def5d4821844 100644 (file)
@@ -92,7 +92,7 @@ std::string serverID()
   if (parser.d_header.rcode != RCode::NoError || parser.d_answers.size() != 1) {
     return {};
   }
-  const auto& dnsrecord = parser.d_answers.at(0).first;
+  const auto& dnsrecord = parser.d_answers.at(0);
   if (dnsrecord.d_type == QType::TXT) {
     if (auto txt = getRR<TXTRecordContent>(dnsrecord); txt != nullptr) {
       const auto& text = txt->d_text;
index 28db4e65efd088cff3ed368c4a8afcb9d3ea17f1..9d8a27c47eac10fcd57d723e6e3e9c4241504efc 100644 (file)
@@ -214,10 +214,10 @@ namespace pdns {
       result->reserve(mdp.d_answers.size());
 
       for (const auto& i: mdp.d_answers) {
-        rr.qname = i.first.d_name;
-        rr.qtype = i.first.d_type;
-        rr.ttl = i.first.d_ttl;
-        rr.content = i.first.getContent()->getZoneRepresentation(true);
+        rr.qname = i.d_name;
+        rr.qtype = i.d_type;
+        rr.ttl = i.d_ttl;
+        rr.content = i.getContent()->getZoneRepresentation(true);
         result->push_back(rr);
       }
 
@@ -286,15 +286,15 @@ bool Resolver::tryGetSOASerial(DNSName *domain, ComboAddress* remote, uint32_t *
   *theirInception = *theirExpire = 0;
   bool gotSOA=false;
   for(const MOADNSParser::answers_t::value_type& drc :  mdp.d_answers) {
-    if(drc.first.d_type == QType::SOA && drc.first.d_name == *domain) {
-      auto src = getRR<SOARecordContent>(drc.first);
+    if(drc.d_type == QType::SOA && drc.d_name == *domain) {
+      auto src = getRR<SOARecordContent>(drc);
       if (src) {
         *theirSerial = src->d_st.serial;
         gotSOA = true;
       }
     }
-    if(drc.first.d_type == QType::RRSIG && drc.first.d_name == *domain) {
-      auto rrc = getRR<RRSIGRecordContent>(drc.first);
+    if(drc.d_type == QType::RRSIG && drc.d_name == *domain) {
+      auto rrc = getRR<RRSIGRecordContent>(drc);
       if(rrc && rrc->d_type == QType::SOA) {
         *theirInception= std::max(*theirInception, rrc->d_siginception);
         *theirExpire = std::max(*theirExpire, rrc->d_sigexpire);
index f0d6e9361a6b1e2c7d5a6a906b5eb4b9bcbe6a4d..0b6713fb5d779d7bf2c63236b47072e8b7e603c8 100644 (file)
@@ -768,7 +768,7 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
 
   // Check if all the records provided are within the zone
   for(const auto & answer : mdp.d_answers) {
-    const DNSRecord *rr = &answer.first;
+    const DNSRecord *rr = &answer;
     // Skip this check for other field types (like the TSIG -  which is in the additional section)
     // For a TSIG, the label is the dnskey, so it does not pass the endOn validation.
     if (! (rr->d_place == DNSResourceRecord::ANSWER || rr->d_place == DNSResourceRecord::AUTHORITY))
@@ -790,7 +790,7 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
 
   // 3.2.1 and 3.2.2 - Prerequisite check
   for(const auto & answer : mdp.d_answers) {
-    const DNSRecord *rr = &answer.first;
+    const DNSRecord *rr = &answer;
     if (rr->d_place == DNSResourceRecord::ANSWER) {
       int res = checkUpdatePrerequisites(rr, &di);
       if (res>0) {
@@ -807,7 +807,7 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
   typedef std::map<rrSetKey_t, rrVector_t> RRsetMap_t;
   RRsetMap_t preReqRRsets;
   for(const auto& i: mdp.d_answers) {
-    const DNSRecord* rr = &i.first;
+    const DNSRecord* rr = &i;
     if (rr->d_place == DNSResourceRecord::ANSWER) {
       // Last line of 3.2.3
       if (rr->d_class != QClass::IN && rr->d_class != QClass::NONE && rr->d_class != QClass::ANY)
@@ -855,7 +855,7 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
     uint changedRecords = 0;
     // 3.4.1 - Prescan section
     for(const auto & answer : mdp.d_answers) {
-      const DNSRecord *rr = &answer.first;
+      const DNSRecord *rr = &answer;
       if (rr->d_place == DNSResourceRecord::AUTHORITY) {
         int res = checkUpdatePrescan(rr);
         if (res>0) {
@@ -882,12 +882,12 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
     // Another special case is the addition of both a CNAME and a non-CNAME for the same name (#6270)
     set<DNSName> cn, nocn;
     for (const auto &rr : mdp.d_answers) {
-      if (rr.first.d_place == DNSResourceRecord::AUTHORITY && rr.first.d_class == QClass::IN && rr.first.d_ttl > 0) {
+      if (rr.d_place == DNSResourceRecord::AUTHORITY && rr.d_class == QClass::IN && rr.d_ttl > 0) {
         // Addition
-        if (rr.first.d_type == QType::CNAME) {
-          cn.insert(rr.first.d_name);
-        } else if (rr.first.d_type != QType::RRSIG) {
-          nocn.insert(rr.first.d_name);
+        if (rr.d_type == QType::CNAME) {
+          cn.insert(rr.d_name);
+        } else if (rr.d_type != QType::RRSIG) {
+          nocn.insert(rr.d_name);
         }
       }
     }
@@ -901,7 +901,7 @@ int PacketHandler::processUpdate(DNSPacket& packet) { // NOLINT(readability-func
 
     vector<const DNSRecord *> cnamesToAdd, nonCnamesToAdd;
     for(const auto & answer : mdp.d_answers) {
-      const DNSRecord *rr = &answer.first;
+      const DNSRecord *rr = &answer;
       if (rr->d_place == DNSResourceRecord::AUTHORITY) {
         /* see if it's permitted by policy */
         if (this->d_update_policy_lua != nullptr) {
index bd333095e955e96860dd4cc64e9ee1b21ccfaf82..99d83dac564031b354b73c58e48e466c9511d47b 100644 (file)
@@ -209,39 +209,39 @@ try
       throw PDNSException(string("Remote server refused: ") + std::to_string(mdp.d_header.rcode));
     }
     for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {
-      if (i->first.d_type == QType::TSIG) {
+      if (i->d_type == QType::TSIG) {
         string message;
         if (!tsig) {
           std::cerr<<"Unexpected TSIG signature in data"<<endl;
         }
-        trc = TSIGRecordContent(i->first.getContent()->getZoneRepresentation());
+        trc = TSIGRecordContent(i->getContent()->getZoneRepresentation());
         continue;
       }
-      if(i->first.d_type == QType::SOA)
+      if(i->d_type == QType::SOA)
       {
         ++soacount;
       }
-      else if (i->first.d_type == QType::NSEC3PARAM) {
-        ns3pr = NSEC3PARAMRecordContent(i->first.getContent()->getZoneRepresentation());
+      else if (i->d_type == QType::NSEC3PARAM) {
+        ns3pr = NSEC3PARAMRecordContent(i->getContent()->getZoneRepresentation());
         isNSEC3 = true;
       }
 
       ostringstream o;
-      o<<"\t"<<i->first.d_ttl<<"\tIN\t"<<DNSRecordContent::NumberToType(i->first.d_type);
+      o<<"\t"<<i->d_ttl<<"\tIN\t"<<DNSRecordContent::NumberToType(i->d_type);
       if(showdetails)
       {
-        o<<"\t"<<i->first.getContent()->getZoneRepresentation();
+        o<<"\t"<<i->getContent()->getZoneRepresentation();
       }
-      else if(i->first.d_type == QType::RRSIG)
+      else if(i->d_type == QType::RRSIG)
       {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         o<<"\t"<<parts[0]<<" "<<parts[1]<<" "<<parts[2]<<" "<<parts[3]<<" [expiry] [inception] [keytag] "<<parts[7]<<" ...";
       }
-      else if(i->first.d_type == QType::NSEC3)
+      else if(i->d_type == QType::NSEC3)
       {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         o<<"\t"<<parts[0]<<" ";
@@ -253,21 +253,21 @@ try
         for(vector<string>::iterator iter = parts.begin()+5; iter != parts.end(); ++iter)
           o<<" "<<*iter;
       }
-      else if(i->first.d_type == QType::DNSKEY)
+      else if(i->d_type == QType::DNSKEY)
       {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         o<<"\t"<<parts[0]<<" "<<parts[1]<<" "<<parts[2]<<" ...";
       }
       else
       {
-        o<<"\t"<<i->first.getContent()->getZoneRepresentation();
+        o<<"\t"<<i->getContent()->getZoneRepresentation();
       }
 
-      records.emplace_back(i->first.d_name, o.str());
+      records.emplace_back(i->d_name, o.str());
 
-      DNSName shorter(i->first.d_name);
+      DNSName shorter(i->d_name);
       do {
         labels.insert(shorter);
         if (shorter == DNSName(argv[3]))
index 7362cc8164e0d5e3ff69bd6e5c2bcec5f748851c..66fc26603e7ceeea06721f6a25e086f85d63cff0 100644 (file)
@@ -104,16 +104,16 @@ static void printReply(const string& reply, bool showflags, bool hidesoadetails,
 
   for (MOADNSParser::answers_t::const_iterator i = mdp.d_answers.begin();
        i != mdp.d_answers.end(); ++i) {
-    cout << i->first.d_place - 1 << "\t" << i->first.d_name.toString() << "\t"
-         << ttl(i->first.d_ttl) << "\t" << nameForClass(i->first.d_class, i->first.d_type) << "\t"
-         << DNSRecordContent::NumberToType(i->first.d_type);
+    cout << i->d_place - 1 << "\t" << i->d_name.toString() << "\t"
+         << ttl(i->d_ttl) << "\t" << nameForClass(i->d_class, i->d_type) << "\t"
+         << DNSRecordContent::NumberToType(i->d_type);
     if (dumpluaraw) {
-      cout<<"\t"<< makeLuaString(i->first.getContent()->serialize(DNSName(), true))<<endl;
+      cout<<"\t"<< makeLuaString(i->getContent()->serialize(DNSName(), true))<<endl;
       continue;
     }
-    if (i->first.d_class == QClass::IN) {
-      if (i->first.d_type == QType::RRSIG) {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+    if (i->d_class == QClass::IN) {
+      if (i->d_type == QType::RRSIG) {
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         cout << "\t" << parts[0] << " "
@@ -121,8 +121,8 @@ static void printReply(const string& reply, bool showflags, bool hidesoadetails,
              << " [expiry] [inception] [keytag] " << parts[7] << " ...\n";
         continue;
       }
-      if (!showflags && i->first.d_type == QType::NSEC3) {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+      if (!showflags && i->d_type == QType::NSEC3) {
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         cout << "\t" << parts[0] << " [flags] "
@@ -133,16 +133,16 @@ static void printReply(const string& reply, bool showflags, bool hidesoadetails,
         cout << "\n";
         continue;
       }
-      if (i->first.d_type == QType::DNSKEY) {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+      if (i->d_type == QType::DNSKEY) {
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         cout << "\t" << parts[0] << " "
              << parts[1] << " " << parts[2] << " ...\n";
         continue;
       }
-      if (i->first.d_type == QType::SOA && hidesoadetails) {
-        string zoneRep = i->first.getContent()->getZoneRepresentation();
+      if (i->d_type == QType::SOA && hidesoadetails) {
+        string zoneRep = i->getContent()->getZoneRepresentation();
         vector<string> parts;
         stringtok(parts, zoneRep);
         cout << "\t" << parts[0] << " "
@@ -151,7 +151,7 @@ static void printReply(const string& reply, bool showflags, bool hidesoadetails,
         continue;
       }
     }
-    cout << "\t" << i->first.getContent()->getZoneRepresentation() << "\n";
+    cout << "\t" << i->getContent()->getZoneRepresentation() << "\n";
   }
 
   EDNSOpts edo;
index f8188b0ab2aee6208c9c9c7028c16320020f81dc..976275c3a1a1ce56d434189e5b772cba23e309d9 100644 (file)
@@ -669,11 +669,11 @@ struct ParsePacketTest
     } lwr;
     for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {
       DNSResourceRecord rr;
-      rr.qtype=i->first.d_type;
-      rr.qname=i->first.d_name;
+      rr.qtype=i->d_type;
+      rr.qname=i->d_name;
 
-      rr.ttl=i->first.d_ttl;
-      rr.content=i->first.getContent()->getZoneRepresentation();  // this should be the serialised form
+      rr.ttl=i->d_ttl;
+      rr.content=i->getContent()->getZoneRepresentation();  // this should be the serialised form
       lwr.d_result.push_back(rr);
     }
 
index 84cdca32058089a3f6a380d0ca15f7c1cb9b4886..5c8df331111497d7177208b3ab23029035192f80 100644 (file)
@@ -177,9 +177,9 @@ int stubDoResolve(const DNSName& qname, uint16_t qtype, vector<DNSZoneRecord>& r
     }
 
     for (const auto& answer : mdp.d_answers) {
-      if (answer.first.d_place == 1 && answer.first.d_type == qtype) {
+      if (answer.d_place == 1 && answer.d_type == qtype) {
         DNSZoneRecord zrr;
-        zrr.dr = answer.first;
+        zrr.dr = answer;
         zrr.auth = true;
         ret.push_back(zrr);
       }
index e290571458f7338fd17a3fc75bb0a360572f9c77..396e012d0c55558c663c6cd0b301138d097fdce6 100644 (file)
@@ -1189,7 +1189,7 @@ int TCPNameserver::doIXFR(std::unique_ptr<DNSPacket>& q, int outsock)
   uint32_t serial = 0;
   MOADNSParser mdp(false, q->getString());
   for(const auto & answer : mdp.d_answers) {
-    const DNSRecord *rr = &answer.first;
+    const DNSRecord *rr = &answer;
     if (rr->d_type == QType::SOA && rr->d_place == DNSResourceRecord::AUTHORITY) {
       vector<string>parts;
       stringtok(parts, rr->getContent()->getZoneRepresentation());
index c790b89a9134ce084a119f363fa6ee9f557f3f19..48b8c502558780e292f79572eb292acb8588be3d 100644 (file)
@@ -701,7 +701,7 @@ BOOST_AUTO_TEST_CASE(test_nsec3_records_types) {
 
     MOADNSParser parser(false, reinterpret_cast<const char*>(packet.data()), packet.size());
     BOOST_REQUIRE_EQUAL(parser.d_answers.size(), 1U);
-    const auto& record = parser.d_answers.at(0).first;
+    const auto& record = parser.d_answers.at(0);
     BOOST_REQUIRE(record.d_type == QType::NSEC3);
     BOOST_REQUIRE(record.d_class == QClass::IN);
     auto content = getRR<NSEC3RecordContent>(record);
index 08c90828dea95fc74d4b6700d92ca1fbbd222e44..55e92936d01da050c55c96e7a2bd4836dfe55de7 100644 (file)
@@ -82,17 +82,17 @@ static void checkTSIG(const DNSName& tsigName, const DNSName& tsigAlgo, const st
   TSIGRecordContent trc;
 
   for(const auto& answer: mdp.d_answers) {
-    if(answer.first.d_type == QType::TSIG) {
-      BOOST_CHECK_EQUAL(answer.first.d_place, DNSResourceRecord::ADDITIONAL);
-      BOOST_CHECK_EQUAL(answer.first.d_class, QClass::ANY);
-      BOOST_CHECK_EQUAL(answer.first.d_ttl, 0U);
+    if(answer.d_type == QType::TSIG) {
+      BOOST_CHECK_EQUAL(answer.d_place, DNSResourceRecord::ADDITIONAL);
+      BOOST_CHECK_EQUAL(answer.d_class, QClass::ANY);
+      BOOST_CHECK_EQUAL(answer.d_ttl, 0U);
       BOOST_CHECK_EQUAL(tsigFound, false);
 
-      auto rectrc = getRR<TSIGRecordContent>(answer.first);
+      auto rectrc = getRR<TSIGRecordContent>(answer);
       if (rectrc) {
         trc = *rectrc;
         theirMac = rectrc->d_mac;
-        keyName = answer.first.d_name;
+        keyName = answer.d_name;
         tsigFound = true;
       }
     }
index b5300179751730f8d4bfbc2e6a44b2b2395eaf81..603a69b5d171e0818a849e6695ed3f413a2ea2b0 100644 (file)
@@ -22,13 +22,13 @@ bool TSIGTCPVerifier::check(const string& data, const MOADNSParser& mdp)
   }
 
   for(const auto& answer :  mdp.d_answers) {
-    if (answer.first.d_type == QType::SOA) {
+    if (answer.d_type == QType::SOA) {
       // A SOA is either the first or the last record. We need to check TSIG if that's the case.
       checkTSIG = true;
     }
 
-    if(answer.first.d_type == QType::TSIG) {
-      auto trc = getRR<TSIGRecordContent>(answer.first);
+    if(answer.d_type == QType::TSIG) {
+      auto trc = getRR<TSIGRecordContent>(answer);
       if(trc) {
         theirMac = trc->d_mac;
         d_trc.d_time = trc->d_time;