]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rename QType.getName() to QType.toString() 10282/head
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 9 Apr 2021 12:46:26 +0000 (14:46 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Tue, 18 May 2021 15:43:55 +0000 (17:43 +0200)
56 files changed:
modules/bindbackend/bindbackend2.cc
modules/ldapbackend/ldapbackend.cc
modules/ldapbackend/native.cc
modules/lmdbbackend/lmdbbackend.cc
modules/lua2backend/lua2api2.hh
modules/pipebackend/pipebackend.cc
modules/remotebackend/remotebackend.cc
modules/tinydnsbackend/tinydnsbackend.cc
pdns/backends/gsql/gsqlbackend.cc
pdns/common_startup.cc
pdns/dnsdist-cache.cc
pdns/dnsdist-dynblocks.hh
pdns/dnsdist-lua-actions.cc
pdns/dnsdist-lua-inspection.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdistdist/dnsdist-healthchecks.cc
pdns/dnsdistdist/dnsdist-rules.hh
pdns/dnsdistdist/dnsdist-secpoll.cc
pdns/dnsdistdist/doh.cc
pdns/dnspcap2calidns.cc
pdns/dnsproxy.cc
pdns/filterpo.cc
pdns/ixfr.cc
pdns/ixfrdist.cc
pdns/lua-auth4.cc
pdns/lua-base4.cc
pdns/lua-record.cc
pdns/nameserver.cc
pdns/packethandler.cc
pdns/pdns_recursor.cc
pdns/pdnsutil.cc
pdns/qtype.cc
pdns/qtype.hh
pdns/recursordist/aggressive_nsec.cc
pdns/recursordist/negcache.cc
pdns/recursordist/taskqueue.cc
pdns/recursordist/test-negcache_cc.cc
pdns/recursordist/test-syncres_cc3.cc
pdns/reczones.cc
pdns/resolver.cc
pdns/rfc2136handler.cc
pdns/slavecommunicator.cc
pdns/statbag.cc
pdns/stubresolver.cc
pdns/syncres.cc
pdns/tcpreceiver.cc
pdns/test-dnsrecords_cc.cc
pdns/test-ueberbackend_cc.cc
pdns/test-zoneparser_tng_cc.cc
pdns/validate.cc
pdns/ws-auth.cc
pdns/zone2json.cc
pdns/zone2ldap.cc
pdns/zone2sql.cc
pdns/zoneparser-tng.cc

index 1d3312ed2d1c620b5abecc1ec01b011bb6ae7ad9..cf2c85cb21620b869f0fc7bb9dacc525d70d8f45 100644 (file)
@@ -304,7 +304,7 @@ bool Bind2Backend::feedRecord(const DNSResourceRecord& rr, const DNSName& ordern
     // fallthrough
   default:
     if (d_of && *d_of) {
-      *d_of << qname << "\t" << rr.ttl << "\t" << rr.qtype.getName() << "\t" << content << endl;
+      *d_of << qname << "\t" << rr.ttl << "\t" << rr.qtype.toString() << "\t" << content << endl;
     }
   }
   return true;
@@ -521,7 +521,7 @@ void Bind2Backend::insertRecord(std::shared_ptr<recordstorage_t>& records, const
   else if (bdr.qname.isPartOf(zoneName))
     bdr.qname.makeUsRelative(zoneName);
   else {
-    string msg = "Trying to insert non-zone data, name='" + bdr.qname.toLogString() + "', qtype=" + qtype.getName() + ", zone='" + zoneName.toLogString() + "'";
+    string msg = "Trying to insert non-zone data, name='" + bdr.qname.toLogString() + "', qtype=" + qtype.toString() + ", zone='" + zoneName.toLogString() + "'";
     if (s_ignore_broken_records) {
       g_log << Logger::Warning << msg << " ignored" << endl;
       return;
@@ -805,7 +805,7 @@ void Bind2Backend::fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records,
       records->replace(iter, bdr);
     }
 
-    // cerr<<iter->qname<<"\t"<<QType(iter->qtype).getName()<<"\t"<<iter->nsec3hash<<"\t"<<iter->auth<<endl;
+    // cerr<<iter->qname<<"\t"<<QType(iter->qtype).toString()<<"\t"<<iter->nsec3hash<<"\t"<<iter->auth<<endl;
   }
 }
 
@@ -857,7 +857,7 @@ void Bind2Backend::doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records
       hashed = toBase32Hex(hashQNameWithSalt(ns3pr, rr.qname));
     insertRecord(records, zoneName, rr.qname, rr.qtype, rr.content, rr.ttl, hashed, &nt.second);
 
-    // cerr<<rr.qname<<"\t"<<rr.qtype.getName()<<"\t"<<hashed<<"\t"<<nt.second<<endl;
+    // cerr<<rr.qname<<"\t"<<rr.qtype.toString()<<"\t"<<hashed<<"\t"<<nt.second<<endl;
   }
 }
 
@@ -1142,7 +1142,7 @@ void Bind2Backend::lookup(const QType& qtype, const DNSName& qname, int zoneId,
   BB2DomainInfo bbd;
 
   if (mustlog)
-    g_log << Logger::Warning << "Lookup for '" << qtype.getName() << "' of '" << qname << "' within zoneID " << zoneId << endl;
+    g_log << Logger::Warning << "Lookup for '" << qtype.toString() << "' of '" << qname << "' within zoneID " << zoneId << endl;
 
   if (zoneId >= 0) {
     if ((found = (safeGetBBDomainInfo(zoneId, &bbd) && qname.isPartOf(bbd.d_name)))) {
@@ -1228,7 +1228,7 @@ bool Bind2Backend::get(DNSResourceRecord& r)
     return false;
   }
   if (d_handle.mustlog)
-    g_log << Logger::Warning << "Returning: '" << r.qtype.getName() << "' of '" << r.qname << "', content: '" << r.content << "'" << endl;
+    g_log << Logger::Warning << "Returning: '" << r.qtype.toString() << "' of '" << r.qname << "', content: '" << r.content << "'" << endl;
   return true;
 }
 
@@ -1250,14 +1250,14 @@ void Bind2Backend::handle::reset()
 //#define DLOG(x) x
 bool Bind2Backend::handle::get_normal(DNSResourceRecord& r)
 {
-  DLOG(g_log << "Bind2Backend get() was called for " << qtype.getName() << " record for '" << qname << "' - " << d_records->size() << " available in total!" << endl);
+  DLOG(g_log << "Bind2Backend get() was called for " << qtype.toString() << " record for '" << qname << "' - " << d_records->size() << " available in total!" << endl);
 
   if (d_iter == d_end_iter) {
     return false;
   }
 
   while (d_iter != d_end_iter && !(qtype.getCode() == QType::ANY || (d_iter)->qtype == qtype.getCode())) {
-    DLOG(g_log << Logger::Warning << "Skipped " << qname << "/" << QType(d_iter->qtype).getName() << ": '" << d_iter->content << "'" << endl);
+    DLOG(g_log << Logger::Warning << "Skipped " << qname << "/" << QType(d_iter->qtype).toString() << ": '" << d_iter->content << "'" << endl);
     d_iter++;
   }
   if (d_iter == d_end_iter) {
@@ -1273,7 +1273,7 @@ bool Bind2Backend::handle::get_normal(DNSResourceRecord& r)
   r.ttl = (d_iter)->ttl;
 
   //if(!d_iter->auth && r.qtype.getCode() != QType::A && r.qtype.getCode()!=QType::AAAA && r.qtype.getCode() != QType::NS)
-  //  cerr<<"Warning! Unauth response for qtype "<< r.qtype.getName() << " for '"<<r.qname<<"'"<<endl;
+  //  cerr<<"Warning! Unauth response for qtype "<< r.qtype.toString() << " for '"<<r.qname<<"'"<<endl;
   r.auth = d_iter->auth;
 
   d_iter++;
index 1ad9bc359a7e74b815e36c0a86bf8f0cdb1b8e4a..175c719ff5b2a342289792683de51b2d630d8f6b 100644 (file)
@@ -204,7 +204,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult&
               continue;
 
             qtype2 = rdata.substr(0, pos);
-            if (qtype2 != QType(local_result.qtype).getName())
+            if (qtype2 != QType(local_result.qtype).toString())
               continue;
 
             local_result.ttl = pdns_stou(rdata.substr(pos + 1));
@@ -214,7 +214,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult&
         // Not authoritative
         if (d_result.count("PdnsRecordNoAuth") && !d_result["PdnsRecordNoAuth"].empty()) {
           for (const auto& rdata : d_result["PdnsRecordNoAuth"]) {
-            if (rdata == QType(local_result.qtype).getName())
+            if (rdata == QType(local_result.qtype).toString())
               local_result.auth = false;
           }
         }
@@ -233,7 +233,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult&
             }
 
             qtype2 = rdata.substr(0, pos);
-            if (qtype2 != QType(local_result.qtype).getName())
+            if (qtype2 != QType(local_result.qtype).toString())
               continue;
 
             local_result.ordername = rdata.substr(pos + 1);
index bb86ea67c3410f15140c13c1ee4c336eb7aaa488..0b24a28411a98d05279291c5fdece105f05b044d 100644 (file)
@@ -111,7 +111,7 @@ void LdapBackend::lookup(const QType& qtype, const DNSName& qname, int zoneid, D
     d_results_cache.clear();
 
     if (d_qlog) {
-      g_log.log("Query: '" + qname.toStringRootDot() + "|" + qtype.getName() + "'", Logger::Error);
+      g_log.log("Query: '" + qname.toStringRootDot() + "|" + qtype.toString() + "'", Logger::Error);
     }
     (this->*d_lookup_fcnt)(qtype, qname, dnspkt, zoneid);
   }
@@ -146,7 +146,7 @@ void LdapBackend::lookup_simple(const QType& qtype, const DNSName& qname, DNSPac
   filter = "associatedDomain=" + qesc;
 
   if (qtype.getCode() != QType::ANY) {
-    attr = qtype.getName() + "Record";
+    attr = qtype.toString() + "Record";
     filter = "&(" + filter + ")(" + attr + "=*)";
     attronly[0] = attr.c_str();
     attributes = attronly;
@@ -154,7 +154,7 @@ void LdapBackend::lookup_simple(const QType& qtype, const DNSName& qname, DNSPac
 
   filter = strbind(":target:", filter, getArg("filter-lookup"));
 
-  g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl;
+  g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl;
   d_search = d_pldap->search(getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, attributes);
 }
 
@@ -188,7 +188,7 @@ void LdapBackend::lookup_strict(const QType& qtype, const DNSName& qname, DNSPac
   }
 
   if (qtype.getCode() != QType::ANY) {
-    attr = qtype.getName() + "Record";
+    attr = qtype.toString() + "Record";
     filter = "&(" + filter + ")(" + attr + "=*)";
     attronly[0] = attr.c_str();
     attributes = attronly;
@@ -196,7 +196,7 @@ void LdapBackend::lookup_strict(const QType& qtype, const DNSName& qname, DNSPac
 
   filter = strbind(":target:", filter, getArg("filter-lookup"));
 
-  g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl;
+  g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl;
   d_search = d_pldap->search(getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, attributes);
 }
 
@@ -211,7 +211,7 @@ void LdapBackend::lookup_tree(const QType& qtype, const DNSName& qname, DNSPacke
   filter = "associatedDomain=" + qesc;
 
   if (qtype.getCode() != QType::ANY) {
-    attr = qtype.getName() + "Record";
+    attr = qtype.toString() + "Record";
     filter = "&(" + filter + ")(" + attr + "=*)";
     attronly[0] = attr.c_str();
     attributes = attronly;
@@ -224,7 +224,7 @@ void LdapBackend::lookup_tree(const QType& qtype, const DNSName& qname, DNSPacke
     dn = "dc=" + *i + "," + dn;
   }
 
-  g_log << Logger::Debug << d_myname << " Search = basedn: " << dn + getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl;
+  g_log << Logger::Debug << d_myname << " Search = basedn: " << dn + getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl;
   d_search = d_pldap->search(dn + getArg("basedn"), LDAP_SCOPE_BASE, filter, attributes);
 }
 
@@ -314,7 +314,7 @@ bool LdapBackend::get(DNSResourceRecord& rr)
   rr.content = result.value;
   rr.auth = result.auth;
 
-  g_log << Logger::Debug << d_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl;
+  g_log << Logger::Debug << d_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).toString() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl;
   return true;
 }
 
index 03b0d5438a84cd22666d79e8e99d5820fe1e08d8..ef6b8f325ffee3295343ce4f6bd5ead2b5c404c6 100644 (file)
@@ -706,7 +706,7 @@ bool LMDBBackend::list(const DNSName& target, int id, bool include_disabled)
 void LMDBBackend::lookup(const QType& type, const DNSName& qdomain, int zoneId, DNSPacket* p)
 {
   if (d_dolog) {
-    g_log << Logger::Warning << "Got lookup for " << qdomain << "|" << type.getName() << " in zone " << zoneId << endl;
+    g_log << Logger::Warning << "Got lookup for " << qdomain << "|" << type.toString() << " in zone " << zoneId << endl;
     d_dtime.set();
   }
 
@@ -736,7 +736,7 @@ void LMDBBackend::lookup(const QType& type, const DNSName& qdomain, int zoneId,
   }
 
   DNSName relqname = qdomain.makeRelative(hunt);
-  // cout<<"get will look for "<<relqname<< " in zone "<<hunt<<" with id "<<zoneId<<" and type "<<type.getName()<<endl;
+  // cout<<"get will look for "<<relqname<< " in zone "<<hunt<<" with id "<<zoneId<<" and type "<<type.toString()<<endl;
   d_rotxn = getRecordsROTransaction(zoneId, d_rwtxn);
 
   compoundOrdername co;
@@ -1475,11 +1475,11 @@ bool LMDBBackend::getBeforeAndAfterNames(uint32_t id, const DNSName& zonenameU,
     serFromString(val.get<StringView>(), lrr);
     if (co.getQType(key.get<string_view>()).getCode() && (lrr.auth || co.getQType(key.get<string_view>()).getCode() == QType::NS)) {
       after = co.getQName(key.get<string_view>()) + zonename;
-      // cout <<"Found auth ("<<lrr.auth<<") or an NS record "<<after<<", type: "<<co.getQType(key.get<string_view>()).getName()<<", ttl = "<<lrr.ttl<<endl;
+      // cout <<"Found auth ("<<lrr.auth<<") or an NS record "<<after<<", type: "<<co.getQType(key.get<string_view>()).toString()<<", ttl = "<<lrr.ttl<<endl;
       // cout << makeHexDump(val.get<string>()) << endl;
       break;
     }
-    // cout <<"  oops, " << co.getQName(key.get<string_view>()) << " was not auth "<<lrr.auth<< " type=" << lrr.qtype.getName()<<" or NS, so need to skip ahead a bit more" << endl;
+    // cout <<"  oops, " << co.getQName(key.get<string_view>()) << " was not auth "<<lrr.auth<< " type=" << lrr.qtype.toString()<<" or NS, so need to skip ahead a bit more" << endl;
     int rc = cursor.next(key, val);
     if (!rc)
       ++skips;
index a1bab41b688cba3ceaf1fa35f4e5e9fe85354cbc..a17a90c5d9afb42a916bae0377c1a413f3ae3300 100644 (file)
@@ -169,7 +169,7 @@ public:
         else
           g_log << Logger::Warning << "Unsupported key '" << item.first << "' in lookup or list result" << endl;
       }
-      logResult(rec.qname << " IN " << rec.qtype.getName() << " " << rec.ttl << " " << rec.getZoneRepresentation());
+      logResult(rec.qname << " IN " << rec.qtype.toString() << " " << rec.ttl << " " << rec.getZoneRepresentation());
       d_result.push_back(rec);
     }
     if (d_result.empty() && d_debug_log)
@@ -208,7 +208,7 @@ public:
       ctx.emplace_back(lookup_context_t::value_type{"real_source_address", p->getRealRemote().toString()});
     }
 
-    logCall("lookup", "qtype=" << qtype.getName() << ",qname=" << qname << ",domain_id=" << domain_id);
+    logCall("lookup", "qtype=" << qtype.toString() << ",qname=" << qname << ",domain_id=" << domain_id);
     lookup_result_t result = f_lookup(qtype, qname, domain_id, ctx);
     parseLookup(result);
   }
index c16852103fc887b2679f07cf5897184add676ad8..a5981c797d7ef85487a890fd228fdca54963ce18 100644 (file)
@@ -176,7 +176,7 @@ void PipeBackend::lookup(const QType& qtype, const DNSName& qname, int zoneId, D
       }
       // abi-version = 1
       // type    qname           qclass  qtype   id      remote-ip-address
-      query << "Q\t" << qname.toStringRootDot() << "\tIN\t" << qtype.getName() << "\t" << zoneId << "\t" << remoteIP;
+      query << "Q\t" << qname.toStringRootDot() << "\tIN\t" << qtype.toString() << "\t" << zoneId << "\t" << remoteIP;
 
       // add the local-ip-address if abi-version is set to 2
       if (d_abiVersion >= 2)
index 64a5d41caaa503c167b9b5f505a5a3532c236e92..dc30d2cc22f96a01ad707cc6847340c34ef33af0 100644 (file)
@@ -208,7 +208,7 @@ void RemoteBackend::lookup(const QType& qtype, const DNSName& qdomain, int zoneI
 
   Json query = Json::object{
     {"method", "lookup"},
-    {"parameters", Json::object{{"qtype", qtype.getName()}, {"qname", qdomain.toString()}, {"remote", remoteIP}, {"local", localIP}, {"real-remote", realRemote}, {"zone-id", zoneId}}}};
+    {"parameters", Json::object{{"qtype", qtype.toString()}, {"qname", qdomain.toString()}, {"remote", remoteIP}, {"local", localIP}, {"real-remote", realRemote}, {"zone-id", zoneId}}}};
 
   if (this->send(query) == false || this->recv(d_result) == false) {
     return;
@@ -634,7 +634,7 @@ bool RemoteBackend::superMasterBackend(const string& ip, const DNSName& domain,
 
   for (const auto& ns : nsset) {
     rrset.push_back(Json::object{
-      {"qtype", ns.qtype.getName()},
+      {"qtype", ns.qtype.toString()},
       {"qname", ns.qname.toString()},
       {"qclass", QClass::IN.getCode()},
       {"content", ns.content},
@@ -686,7 +686,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const
   Json::array json_rrset;
   for (const auto& rr : rrset) {
     json_rrset.push_back(Json::object{
-      {"qtype", rr.qtype.getName()},
+      {"qtype", rr.qtype.toString()},
       {"qname", rr.qname.toString()},
       {"qclass", QClass::IN.getCode()},
       {"content", rr.content},
@@ -696,7 +696,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const
 
   Json query = Json::object{
     {"method", "replaceRRSet"},
-    {"parameters", Json::object{{"domain_id", static_cast<double>(domain_id)}, {"qname", qname.toString()}, {"qtype", qtype.getName()}, {"trxid", static_cast<double>(d_trxid)}, {"rrset", json_rrset}}}};
+    {"parameters", Json::object{{"domain_id", static_cast<double>(domain_id)}, {"qname", qname.toString()}, {"qtype", qtype.toString()}, {"trxid", static_cast<double>(d_trxid)}, {"rrset", json_rrset}}}};
 
   Json answer;
   if (this->send(query) == false || this->recv(answer) == false)
@@ -710,7 +710,7 @@ bool RemoteBackend::feedRecord(const DNSResourceRecord& rr, const DNSName& order
   Json query = Json::object{
     {"method", "feedRecord"},
     {"parameters", Json::object{
-                     {"rr", Json::object{{"qtype", rr.qtype.getName()}, {"qname", rr.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", rr.content}, {"ttl", static_cast<int>(rr.ttl)}, {"auth", rr.auth}, {"ordername", (ordername.empty() ? Json() : ordername.toString())}}},
+                     {"rr", Json::object{{"qtype", rr.qtype.toString()}, {"qname", rr.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", rr.content}, {"ttl", static_cast<int>(rr.ttl)}, {"auth", rr.auth}, {"ordername", (ordername.empty() ? Json() : ordername.toString())}}},
                      {"trxid", static_cast<double>(d_trxid)},
                    }}};
 
index 4853d8b523916e9ffc541bc3807df76e4eacfbaf..96b076cf7e86bb2415ae13d9af246326644573d4 100644 (file)
@@ -210,7 +210,7 @@ void TinyDNSBackend::lookup(const QType& qtype, const DNSName& qdomain, int zone
 
   string key = simpleCompress(queryDomain);
 
-  DLOG(g_log << Logger::Debug << backendname << "[lookup] query for qtype [" << qtype.getName() << "] qdomain [" << qdomain << "]" << endl);
+  DLOG(g_log << Logger::Debug << backendname << "[lookup] query for qtype [" << qtype.toString() << "] qdomain [" << qdomain << "]" << endl);
   DLOG(g_log << Logger::Debug << "[lookup] key [" << makeHexDump(key) << "]" << endl);
 
   d_isWildcardQuery = false;
@@ -332,7 +332,7 @@ bool TinyDNSBackend::get(DNSResourceRecord& rr)
         DLOG(cerr << "CONTENT: " << rr.content << endl);
       }
       catch (...) {
-        g_log << Logger::Error << backendname << "Failed to parse record content for " << rr.qname << " with type " << rr.qtype.getName();
+        g_log << Logger::Error << backendname << "Failed to parse record content for " << rr.qname << " with type " << rr.qtype.toString();
         if (d_ignorebogus) {
           g_log << ". Ignoring!" << endl;
           continue;
@@ -342,7 +342,7 @@ bool TinyDNSBackend::get(DNSResourceRecord& rr)
           throw;
         }
       }
-      //      DLOG(g_log<<Logger::Debug<<backendname<<"Returning ["<<rr.content<<"] for ["<<rr.qname<<"] of RecordType ["<<rr.qtype.getName()<<"]"<<endl;);
+      //      DLOG(g_log<<Logger::Debug<<backendname<<"Returning ["<<rr.content<<"] for ["<<rr.qname<<"] of RecordType ["<<rr.qtype.toString()<<"]"<<endl;);
       return true;
     }
   } // end of while
index 5f55bd48a69af6b1824ede9261adcceb73a299b0..d3ca5bbdbbb0b637665c1928d8d6742f65c606d7 100644 (file)
@@ -510,12 +510,12 @@ bool GSQLBackend::updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName
           bind("auth", auth)->
           bind("domain_id", domain_id)->
           bind("qname", qname)->
-          bind("qtype", QType(qtype).getName())->
+          bind("qtype", QType(qtype).toString())->
           execute()->
           reset();
       }
       catch(SSqlException &e) {
-        throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).getName() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
+        throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
       }
     }
   } else {
@@ -541,12 +541,12 @@ bool GSQLBackend::updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName
           bind("auth", auth)->
           bind("domain_id", domain_id)->
           bind("qname", qname)->
-          bind("qtype", QType(qtype).getName())->
+          bind("qtype", QType(qtype).toString())->
           execute()->
           reset();
       }
       catch(SSqlException &e) {
-        throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).getName() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
+        throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
       }
     }
   }
@@ -1111,13 +1111,13 @@ void GSQLBackend::lookup(const QType &qtype,const DNSName &qname, int domain_id,
         d_query_name = "basic-query";
         d_query_stmt = &d_NoIdQuery_stmt;
         (*d_query_stmt)->
-          bind("qtype", qtype.getName())->
+          bind("qtype", qtype.toString())->
           bind("qname", qname);
       } else {
         d_query_name = "id-query";
         d_query_stmt = &d_IdQuery_stmt;
         (*d_query_stmt)->
-          bind("qtype", qtype.getName())->
+          bind("qtype", qtype.toString())->
           bind("qname", qname)->
           bind("domain_id", domain_id);
       }
@@ -1141,7 +1141,7 @@ void GSQLBackend::lookup(const QType &qtype,const DNSName &qname, int domain_id,
       execute();
   }
   catch(SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to lookup '" + qname.toLogString() + "|" + qtype.getName() + "':"+e.txtReason());
+    throw PDNSException("GSQLBackend unable to lookup '" + qname.toLogString() + "|" + qtype.toString() + "':"+e.txtReason());
   }
 
   d_list=false;
@@ -1199,7 +1199,7 @@ bool GSQLBackend::listSubZone(const DNSName &zone, int domain_id) {
 
 bool GSQLBackend::get(DNSResourceRecord &r)
 {
-  // g_log << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
+  // g_log << "GSQLBackend get() was called for "<<qtype.toString() << " record: ";
   SSqlStatement::row_t row;
 
 skiprow:
@@ -1471,7 +1471,7 @@ bool GSQLBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q
       d_DeleteRRSetQuery_stmt->
         bind("domain_id", domain_id)->
         bind("qname", qname)->
-        bind("qtype", qt.getName())->
+        bind("qtype", qt.toString())->
         execute()->
         reset();
     } else {
@@ -1483,7 +1483,7 @@ bool GSQLBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q
     }
   }
   catch (SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to delete RRSet " + qname.toLogString() + "|" + qt.getName() + ": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to delete RRSet " + qname.toLogString() + "|" + qt.toString() + ": "+e.txtReason());
   }
 
   if (rrset.empty()) {
@@ -1493,12 +1493,12 @@ bool GSQLBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q
       d_DeleteCommentRRsetQuery_stmt->
         bind("domain_id", domain_id)->
         bind("qname", qname)->
-        bind("qtype", qt.getName())->
+        bind("qtype", qt.toString())->
         execute()->
         reset();
     }
     catch (SSqlException &e) {
-      throw PDNSException("GSQLBackend unable to delete comment for RRSet " + qname.toLogString() + "|" + qt.getName() + ": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to delete comment for RRSet " + qname.toLogString() + "|" + qt.toString() + ": "+e.txtReason());
     }
   }
   for(const auto& rr: rrset) {
@@ -1528,7 +1528,7 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordernam
       bind("content",content)->
       bind("ttl",r.ttl)->
       bind("priority",prio)->
-      bind("qtype",r.qtype.getName())->
+      bind("qtype",r.qtype.toString())->
       bind("domain_id",r.domain_id)->
       bind("disabled",r.disabled)->
       bind("qname",r.qname);
@@ -1548,7 +1548,7 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordernam
       reset();
   }
   catch (SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to feed record " + r.qname.toLogString() + "|" + r.qtype.getName() + ": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to feed record " + r.qname.toLogString() + "|" + r.qtype.toString() + ": "+e.txtReason());
   }
   return true; // XXX FIXME this API should not return 'true' I think -ahu 
 }
@@ -1715,7 +1715,7 @@ void GSQLBackend::feedComment(const Comment& comment)
     d_InsertCommentQuery_stmt->
       bind("domain_id",comment.domain_id)->
       bind("qname",comment.qname)->
-      bind("qtype",comment.qtype.getName())->
+      bind("qtype",comment.qtype.toString())->
       bind("modified_at",comment.modified_at)->
       bind("account",comment.account)->
       bind("content",comment.content)->
@@ -1723,7 +1723,7 @@ void GSQLBackend::feedComment(const Comment& comment)
       reset();
   }
   catch (SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to feed comment for RRSet '" + comment.qname.toLogString() + "|" + comment.qtype.getName() + "': "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to feed comment for RRSet '" + comment.qname.toLogString() + "|" + comment.qtype.toString() + "': "+e.txtReason());
   }
 }
 
@@ -1739,12 +1739,12 @@ bool GSQLBackend::replaceComments(const uint32_t domain_id, const DNSName& qname
     d_DeleteCommentRRsetQuery_stmt->
       bind("domain_id",domain_id)->
       bind("qname", qname)->
-      bind("qtype",qt.getName())->
+      bind("qtype",qt.toString())->
       execute()->
       reset();
   }
   catch (SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to delete comment for RRSet '" + qname.toLogString() + "|" + qt.getName() + "': "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to delete comment for RRSet '" + qname.toLogString() + "|" + qt.toString() + "': "+e.txtReason());
   }
 
   for(const auto& comment: comments) {
index 60c81cad963c7e684bfe3ba9b99622f15888b9bc..5c978564ef7d9c51634b8e72c35d3419e51b3ea9 100644 (file)
@@ -470,7 +470,7 @@ try
         remote = question.getRemote().toString() + "<-" + question.getRealRemote().toString();
       else
         remote = question.getRemote().toString();
-      g_log << Logger::Notice<<"Remote "<< remote <<" wants '" << question.qdomain<<"|"<<question.qtype.getName() << 
+      g_log << Logger::Notice<<"Remote "<< remote <<" wants '" << question.qdomain<<"|"<<question.qtype.toString() << 
         "', do = " <<question.d_dnssecOk <<", bufsize = "<< question.getMaxReplyLen();
       if(question.d_ednsRawPacketSizeLimit > 0 && question.getMaxReplyLen() != (unsigned int)question.d_ednsRawPacketSizeLimit)
         g_log<<" ("<<question.d_ednsRawPacketSizeLimit<<")";
index c1356a887498b929e42e2d97d7569907eb4de6cb..afe679ea5e539383e7a60c6ed7dd0df96ec402b1 100644 (file)
@@ -488,7 +488,7 @@ uint64_t DNSDistPacketCache::dump(int fd)
           rcode = dh.rcode;
         }
 
-        fprintf(fp.get(), "%s %" PRId64 " %s ; rcode %" PRIu8 ", key %" PRIu32 ", length %" PRIu16 ", tcp %d, added %" PRId64 "\n", value.qname.toString().c_str(), static_cast<int64_t>(value.validity - now), QType(value.qtype).getName().c_str(), rcode, entry.first, value.len, value.tcp, static_cast<int64_t>(value.added));
+        fprintf(fp.get(), "%s %" PRId64 " %s ; rcode %" PRIu8 ", key %" PRIu32 ", length %" PRIu16 ", tcp %d, added %" PRId64 "\n", value.qname.toString().c_str(), static_cast<int64_t>(value.validity - now), QType(value.qtype).toString().c_str(), rcode, entry.first, value.len, value.tcp, static_cast<int64_t>(value.added));
       }
       catch(...) {
         fprintf(fp.get(), "; error printing '%s'\n", value.qname.empty() ? "EMPTY" : value.qname.toString().c_str());
index 80a0dca6034a9899faa391feb34c0802e4a46f28..e3c1a6247a64e4687c00492f3adc51657404410b 100644 (file)
@@ -312,7 +312,7 @@ public:
     }
     result << "QType rules: " << std::endl;
     for (const auto& rule : d_qtypeRules) {
-      result << "- " << QType(rule.first).getName() << ": " << rule.second.toString() << std::endl;
+      result << "- " << QType(rule.first).toString() << ": " << rule.second.toString() << std::endl;
     }
     result << "Excluded Subnets: " << d_excludedSubnets.toString() << std::endl;
     result << "Excluded Domains: " << d_excludedDomains.toString() << std::endl;
index 707afe83e369f8145da517d19541454333166444..c4f6250a7c45226012f0c5139ee48d9713e3c555 100644 (file)
@@ -754,10 +754,10 @@ public:
     if (!d_fp) {
       if (!d_verboseOnly || g_verbose) {
         if (d_includeTimestamp) {
-          infolog("[%u.%u] Packet from %s for %s %s with id %d", static_cast<unsigned long long>(dq->queryTime->tv_sec), static_cast<unsigned long>(dq->queryTime->tv_nsec), dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).getName(), dq->getHeader()->id);
+          infolog("[%u.%u] Packet from %s for %s %s with id %d", static_cast<unsigned long long>(dq->queryTime->tv_sec), static_cast<unsigned long>(dq->queryTime->tv_nsec), dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).toString(), dq->getHeader()->id);
         }
         else {
-          infolog("Packet from %s for %s %s with id %d", dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).getName(), dq->getHeader()->id);
+          infolog("Packet from %s for %s %s with id %d", dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).toString(), dq->getHeader()->id);
         }
       }
     }
@@ -785,10 +785,10 @@ public:
       }
       else {
         if (d_includeTimestamp) {
-          fprintf(d_fp.get(), "[%llu.%lu] Packet from %s for %s %s with id %d\n", static_cast<unsigned long long>(dq->queryTime->tv_sec), static_cast<unsigned long>(dq->queryTime->tv_nsec), dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).getName().c_str(), dq->getHeader()->id);
+          fprintf(d_fp.get(), "[%llu.%lu] Packet from %s for %s %s with id %d\n", static_cast<unsigned long long>(dq->queryTime->tv_sec), static_cast<unsigned long>(dq->queryTime->tv_nsec), dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).toString().c_str(), dq->getHeader()->id);
         }
         else {
-          fprintf(d_fp.get(), "Packet from %s for %s %s with id %d\n", dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).getName().c_str(), dq->getHeader()->id);
+          fprintf(d_fp.get(), "Packet from %s for %s %s with id %d\n", dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).toString().c_str(), dq->getHeader()->id);
         }
       }
     }
@@ -844,19 +844,19 @@ public:
     if (!d_fp) {
       if (!d_verboseOnly || g_verbose) {
         if (d_includeTimestamp) {
-          infolog("[%u.%u] Answer to %s for %s %s (%s) with id %d", static_cast<unsigned long long>(dr->queryTime->tv_sec), static_cast<unsigned long>(dr->queryTime->tv_nsec), dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).getName(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id);
+          infolog("[%u.%u] Answer to %s for %s %s (%s) with id %d", static_cast<unsigned long long>(dr->queryTime->tv_sec), static_cast<unsigned long>(dr->queryTime->tv_nsec), dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).toString(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id);
         }
         else {
-          infolog("Answer to %s for %s %s (%s) with id %d", dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).getName(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id);
+          infolog("Answer to %s for %s %s (%s) with id %d", dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).toString(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id);
         }
       }
     }
     else {
       if (d_includeTimestamp) {
-        fprintf(d_fp.get(), "[%llu.%lu] Answer to %s for %s %s (%s) with id %d\n", static_cast<unsigned long long>(dr->queryTime->tv_sec), static_cast<unsigned long>(dr->queryTime->tv_nsec), dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).getName().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id);
+        fprintf(d_fp.get(), "[%llu.%lu] Answer to %s for %s %s (%s) with id %d\n", static_cast<unsigned long long>(dr->queryTime->tv_sec), static_cast<unsigned long>(dr->queryTime->tv_nsec), dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).toString().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id);
       }
       else {
-        fprintf(d_fp.get(), "Answer to %s for %s %s (%s) with id %d\n", dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).getName().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id);
+        fprintf(d_fp.get(), "Answer to %s for %s %s (%s) with id %d\n", dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).toString().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id);
       }
     }
     return Action::None;
index f23430d643069ef443dccc85f7786b7a97622c15..163df71d0442da3ac2fa8202d209e68dade89044 100644 (file)
@@ -476,7 +476,7 @@ void setupLuaInspection(LuaContext& luaCtx)
             if (c.dh.opcode != 0) {
               extra = " (" + Opcode::to_s(c.dh.opcode) + ")";
             }
-            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % "" % htons(c.dh.id) % c.name.toString() % qt.getName()  % "" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % ("Question" + extra)).str() )) ;
+            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % "" % htons(c.dh.id) % c.name.toString() % qt.toString()  % "" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % ("Question" + extra)).str() )) ;
 
             if(limit && *limit==++num)
               break;
@@ -514,10 +514,10 @@ void setupLuaInspection(LuaContext& luaCtx)
           }
 
           if (c.usec != std::numeric_limits<decltype(c.usec)>::max()) {
-            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString()  % qt.getName()  % (c.usec/1000.0) % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str()  )) ;
+            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString()  % qt.toString()  % (c.usec/1000.0) % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str()  )) ;
           }
           else {
-            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString()  % qt.getName()  % "T.O" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str()  )) ;
+            out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString()  % qt.toString()  % "T.O" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str()  )) ;
           }
 
           if (limit && *limit == ++num) {
index 32af86fcc9df96ba8ead2d8b00cda336e0d38c98..aa27cb2a51d130febcc2f0fb3b84bd448a4116d9 100644 (file)
@@ -761,7 +761,7 @@ static void handleQuery(std::shared_ptr<IncomingTCPConnectionState>& state, cons
   }
 
   ++state->d_currentQueriesCount;
-  vinfolog("Got query for %s|%s from %s (%s, %d bytes), relayed to %s", query.d_idstate.qname.toLogString(), QType(query.d_idstate.qtype).getName(), state->d_proxiedRemote.toStringWithPort(), (state->d_ci.cs->tlsFrontend ? "DoT" : "TCP"), query.d_buffer.size(), ds->getName());
+  vinfolog("Got query for %s|%s from %s (%s, %d bytes), relayed to %s", query.d_idstate.qname.toLogString(), QType(query.d_idstate.qtype).toString(), state->d_proxiedRemote.toStringWithPort(), (state->d_ci.cs->tlsFrontend ? "DoT" : "TCP"), query.d_buffer.size(), ds->getName());
   downstreamConnection->queueQuery(std::move(query), downstreamConnection);
 }
 
index f474c79c91e52ac449b40c4d06c11e47ba59ccc8..0b4c5b316b559fe182a62718e6e7ff6bb8cf686c 100644 (file)
@@ -1248,7 +1248,7 @@ ProcessQueryResult processQuery(DNSQuestion& dq, ClientState& cs, LocalHolders&
     if (!selectedBackend) {
       ++g_stats.noPolicy;
 
-      vinfolog("%s query for %s|%s from %s, no policy applied", g_servFailOnNoPolicy ? "ServFailed" : "Dropped", dq.qname->toLogString(), QType(dq.qtype).getName(), dq.remote->toStringWithPort());
+      vinfolog("%s query for %s|%s from %s, no policy applied", g_servFailOnNoPolicy ? "ServFailed" : "Dropped", dq.qname->toLogString(), QType(dq.qtype).toString(), dq.remote->toStringWithPort());
       if (g_servFailOnNoPolicy) {
         dq.getHeader()->rcode = RCode::ServFail;
         dq.getHeader()->qr = true;
@@ -1419,7 +1419,7 @@ static void processUDPQuery(ClientState& cs, LocalHolders& holders, const struct
       ++g_stats.downstreamSendErrors;
     }
 
-    vinfolog("Got query for %s|%s from %s, relayed to %s", ids->qname.toLogString(), QType(ids->qtype).getName(), proxiedRemote.toStringWithPort(), ss->getName());
+    vinfolog("Got query for %s|%s from %s, relayed to %s", ids->qname.toLogString(), QType(ids->qtype).toString(), proxiedRemote.toStringWithPort(), ss->getName());
   }
   catch(const std::exception& e){
     vinfolog("Got an error in UDP question thread while parsing a query from %s, id %d: %s", proxiedRemote.toStringWithPort(), queryId, e.what());
@@ -1736,7 +1736,7 @@ static void healthChecksThread()
           ++g_stats.downstreamTimeouts; // this is an 'actively' discovered timeout
           vinfolog("Had a downstream timeout from %s (%s) for query for %s|%s from %s",
                    dss->remote.toStringWithPort(), dss->getName(),
-                   ids.qname.toLogString(), QType(ids.qtype).getName(), ids.origRemote.toStringWithPort());
+                   ids.qname.toLogString(), QType(ids.qtype).toString(), ids.origRemote.toStringWithPort());
 
           struct timespec ts;
           gettime(&ts);
index 395a500a1d0e10fac0a114c8650a5f39f4e97de6..ac013d2c02d3c916fe8857bd0fd218ac8fad40b9 100644 (file)
@@ -136,7 +136,7 @@ static bool handleResponse(std::shared_ptr<HealthCheckData>& data)
 
     if (receivedName != data->d_checkName || receivedType != data->d_checkType || receivedClass != data->d_checkClass) {
       if (g_verboseHealthChecks) {
-        infolog("Backend %s responded to health check with an invalid qname (%s vs %s), qtype (%s vs %s) or qclass (%d vs %d)", ds->getNameWithAddr(), receivedName.toLogString(), data->d_checkName.toLogString(), QType(receivedType).getName(), QType(data->d_checkType).getName(), receivedClass, data->d_checkClass);
+        infolog("Backend %s responded to health check with an invalid qname (%s vs %s), qtype (%s vs %s) or qclass (%d vs %d)", ds->getNameWithAddr(), receivedName.toLogString(), data->d_checkName.toLogString(), QType(receivedType).toString(), QType(data->d_checkType).toString(), receivedClass, data->d_checkClass);
       }
       return false;
     }
index a9f690ca9ff5bba9e2e7ee98fe6a194a520478ad..e19d363e126eb3d0221f20dae614b2f60a66763e 100644 (file)
@@ -635,7 +635,7 @@ public:
   string toString() const override
   {
     QType qt(d_qtype);
-    return "qtype=="+qt.getName();
+    return "qtype=="+qt.toString();
   }
 private:
   uint16_t d_qtype;
@@ -828,7 +828,7 @@ public:
       section = "AR";
       break;
     }
-    return std::to_string(d_minCount) + " <= " + QType(d_type).getName() + " records in " + section + " <= "+ std::to_string(d_maxCount);
+    return std::to_string(d_minCount) + " <= " + QType(d_type).toString() + " records in " + section + " <= "+ std::to_string(d_maxCount);
   }
 private:
   uint16_t d_type;
index 5742aba4a473b4962d1f359c5544d20e8d73d587..79e3f69f494f68899a318e51bc8c906a83b2c5d7 100644 (file)
@@ -170,7 +170,7 @@ static std::string getSecPollStatus(const std::string& queriedName, int timeout=
 
     if (receivedName != sentName || receivedType != QType::TXT || receivedClass != QClass::IN) {
       if (g_verbose) {
-        warnlog("Invalid answer, either the qname (%s / %s), qtype (%s / %s) or qclass (%s / %s) does not match, received from the secpoll stub resolver %s", receivedName, sentName, QType(receivedType).getName(), QType(QType::TXT).getName(), QClass(receivedClass).toString(), QClass::IN.toString(), dest.toString());
+        warnlog("Invalid answer, either the qname (%s / %s), qtype (%s / %s) or qclass (%s / %s) does not match, received from the secpoll stub resolver %s", receivedName, sentName, QType(receivedType).toString(), QType(QType::TXT).toString(), QClass(receivedClass).toString(), QClass::IN.toString(), dest.toString());
       }
       continue;
     }
index 08bf9376fad0469de62071633ee5567bbbe42f70..7dcefdd21dea3425a053027ef4d94584e1d2477f 100644 (file)
@@ -587,7 +587,7 @@ static int processDOHQuery(DOHUnit* du)
       throw;
     }
 
-    vinfolog("Got query for %s|%s from %s (https), relayed to %s", ids->qname.toString(), QType(ids->qtype).getName(), remote.toStringWithPort(), ss->getName());
+    vinfolog("Got query for %s|%s from %s (https), relayed to %s", ids->qname.toString(), QType(ids->qtype).toString(), remote.toStringWithPort(), ss->getName());
   }
   catch(const std::exception& e) {
     vinfolog("Got an error in DOH question thread while parsing a query from %s, id %d: %s", remote.toStringWithPort(), queryId, e.what());
index 7348010ab9f860f9039b5543d29631700a239832..77265999d1016f2427e188869df22d9f8d9aad33 100644 (file)
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
 
         const ComboAddress requestor = pr.getSource();
 
-        fp << qname << " " << QType(qtype).getName() << " " << requestor.toString() << endl;
+        fp << qname << " " << QType(qtype).toString() << " " << requestor.toString() << endl;
       }
     }
     catch (const std::exception& e) {
index 4487cce5b385dcdbdc0e35c812cb312741d20f9d..be12827a7ec784ce2081aaae45bc73bdad4bab8f 100644 (file)
@@ -270,7 +270,7 @@ void DNSProxy::mainloop()
           }
           i->second.complete->setRcode(mdp.d_header.rcode);
         } else {
-          g_log<<Logger::Error<<"Error resolving for "<<i->second.aname<<" ALIAS "<<i->second.qname<<" over UDP, "<<QType(i->second.qtype).getName()<<"-record query returned "<<RCode::to_s(mdp.d_header.rcode)<<", returning SERVFAIL"<<endl;
+          g_log<<Logger::Error<<"Error resolving for "<<i->second.aname<<" ALIAS "<<i->second.qname<<" over UDP, "<<QType(i->second.qtype).toString()<<"-record query returned "<<RCode::to_s(mdp.d_header.rcode)<<", returning SERVFAIL"<<endl;
           i->second.complete->clearRecords();
           i->second.complete->setRcode(RCode::ServFail);
         }
index b5f66d8f6a60e0ff768469f158d393f070ae8e84..3521721ed25f07b0d23b52158103c6f868615f72 100644 (file)
@@ -681,7 +681,7 @@ void DNSFilterEngine::Zone::dumpNamedPolicy(FILE* fp, const DNSName& name, const
 {
   auto records = pol.getRecords(name);
   for (const auto& dr : records) {
-    fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).getName().c_str(), dr.d_content->getZoneRepresentation().c_str());
+    fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).toString().c_str(), dr.d_content->getZoneRepresentation().c_str());
   }
 }
 
@@ -737,7 +737,7 @@ void DNSFilterEngine::Zone::dumpAddrPolicy(FILE* fp, const Netmask& nm, const DN
 
   auto records = pol.getRecords(full);
   for (const auto& dr : records) {
-    fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).getName().c_str(), dr.d_content->getZoneRepresentation().c_str());
+    fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).toString().c_str(), dr.d_content->getZoneRepresentation().c_str());
   }
 }
 
index 7b47f1affd7922d41c49be414eb46fda2b770833..9b1b4b33d34dec48a6cdcf7de5a4b51bfa4f2fd0 100644 (file)
@@ -212,7 +212,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
       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).getName()+")");
+          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()+")");
         }
 
         auto sr = getRR<SOARecordContent>(r.first);
@@ -245,7 +245,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
         if(r.first.d_type == QType::OPT)
           continue;
 
-        throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).getName()+") 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.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());
       }
 
       r.first.d_name.makeUsRelative(zone);
index bb48caad71aed3395d314f4d002bba3247c8baae..6774ed362492993042986785713bafe9c885897e 100644 (file)
@@ -469,14 +469,14 @@ static void updateThread(const string& workdir, const uint16_t& keep, const uint
 static bool checkQuery(const MOADNSParser& mdp, const ComboAddress& saddr, const bool udp = true, const string& logPrefix="") {
   vector<string> info_msg;
 
-  g_log<<Logger::Debug<<logPrefix<<"Had "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).getName()<<" query from "<<saddr.toStringWithPort()<<endl;
+  g_log<<Logger::Debug<<logPrefix<<"Had "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).toString()<<" query from "<<saddr.toStringWithPort()<<endl;
 
   if (udp && mdp.d_qtype != QType::SOA && mdp.d_qtype != QType::IXFR) {
-    info_msg.push_back("QType is unsupported (" + QType(mdp.d_qtype).getName() + " is not in {SOA,IXFR})");
+    info_msg.push_back("QType is unsupported (" + QType(mdp.d_qtype).toString() + " is not in {SOA,IXFR})");
   }
 
   if (!udp && mdp.d_qtype != QType::SOA && mdp.d_qtype != QType::IXFR && mdp.d_qtype != QType::AXFR) {
-    info_msg.push_back("QType is unsupported (" + QType(mdp.d_qtype).getName() + " is not in {SOA,IXFR,AXFR})");
+    info_msg.push_back("QType is unsupported (" + QType(mdp.d_qtype).toString() + " is not in {SOA,IXFR,AXFR})");
   }
 
   {
@@ -492,7 +492,7 @@ static bool checkQuery(const MOADNSParser& mdp, const ComboAddress& saddr, const
   }
 
   if (!info_msg.empty()) {
-    g_log<<Logger::Warning<<logPrefix<<"Refusing "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).getName()<<" query from "<<saddr.toStringWithPort();
+    g_log<<Logger::Warning<<logPrefix<<"Refusing "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).toString()<<" query from "<<saddr.toStringWithPort();
     g_log<<Logger::Warning<<": ";
     bool first = true;
     for (const auto& s : info_msg) {
@@ -814,7 +814,7 @@ static void handleUDPRequest(int fd, boost::any&) {
 
   if(sendto(fd, &packet[0], packet.size(), 0, (struct sockaddr*) &saddr, fromlen) < 0) {
     auto savedErrno = errno;
-    g_log<<Logger::Warning<<"Could not send reply for "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).getName()<<" to "<<saddr.toStringWithPort()<<": "<<strerror(savedErrno)<<endl;
+    g_log<<Logger::Warning<<"Could not send reply for "<<mdp.d_qname<<"|"<<QType(mdp.d_qtype).toString()<<" to "<<saddr.toStringWithPort()<<": "<<strerror(savedErrno)<<endl;
   }
   return;
 }
index f20e4b05129a5108d0f9a7e8c9fe0e0d10fd1850..2045d9e1b5dfb5f62406987d80e018ac4c170a34 100644 (file)
@@ -71,7 +71,7 @@ void AuthLua4::postPrepareContext() {
   d_lw->registerMember<DNSPacket, DNSName>("qdomainzone", [](const DNSPacket &p) -> DNSName { return p.qdomainzone; }, [](DNSPacket &p, const DNSName& name) { p.qdomainzone = name; });
 
   d_lw->registerMember<DNSPacket, std::string>("d_peer_principal", [](const DNSPacket &p) -> std::string { return p.d_peer_principal; }, [](DNSPacket &p, const std::string &princ) { p.d_peer_principal = princ; });
-  d_lw->registerMember<DNSPacket, const std::string>("qtype", [](const DNSPacket &p) ->  const std::string { return p.qtype.getName(); }, [](DNSPacket &p, const std::string &type) { p.qtype = type; });
+  d_lw->registerMember<DNSPacket, const std::string>("qtype", [](const DNSPacket &p) ->  const std::string { return p.qtype.toString(); }, [](DNSPacket &p, const std::string &type) { p.qtype = type; });
 /* End of DNSPacket */
 
 
index c67e6d8a102c647707f28fba27f54a4e09a71a48..ba48fc617aeb8ca48e3f62f607b38bf84300e909 100644 (file)
@@ -151,9 +151,9 @@ void BaseLua4::prepareContext() {
   // QType
   d_lw->writeFunction("newQType", [](const string& s) { QType q; q = s; return q; });
   d_lw->registerFunction("getCode", &QType::getCode);
-  d_lw->registerFunction("getName", &QType::getName);
+  d_lw->registerFunction("getName", &QType::toString);
   d_lw->registerEqFunction<bool(QType::*)(const QType&)>([](const QType& a, const QType& b){ return a == b;}); // operator overloading confuses LuaContext
-  d_lw->registerToStringFunction(&QType::getName);
+  d_lw->registerToStringFunction(&QType::toString);
 
   // Netmask
   d_lw->writeFunction("newNetmask", [](const string& s) { return Netmask(s); });
index 31d4647ac286148229d39d65d16d57b2f8d6a733..c93f9ba7a863dba391313bfa6671d3415fdae11b 100644 (file)
@@ -1000,7 +1000,7 @@ std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, cons
         ret.push_back(DNSRecordContent::mastermake(qtype, QClass::IN, content_it ));
     }
   } catch(std::exception &e) {
-    g_log << Logger::Info << "Lua record ("<<query<<"|"<<QType(qtype).getName()<<") reported: " << e.what();
+    g_log << Logger::Info << "Lua record ("<<query<<"|"<<QType(qtype).toString()<<") reported: " << e.what();
     try {
       std::rethrow_if_nested(e);
       g_log<<endl;
index 3f03eb3ff54e42b89c9048fcd5afb9212f911efa..c52341bce41ee8318cd912d5874d39426e5614b6 100644 (file)
@@ -229,7 +229,7 @@ void UDPNameserver::send(DNSPacket& p)
   }
   DLOG(g_log<<Logger::Notice<<"Sending a packet to "<< p.getRemote() <<" ("<< buffer.length()<<" octets)"<<endl);
   if(buffer.length() > p.getMaxReplyLen()) {
-    g_log<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p.getMaxReplyLen()<<". Question was for "<<p.qdomain<<"|"<<p.qtype.getName()<<endl;
+    g_log<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p.getMaxReplyLen()<<". Question was for "<<p.qdomain<<"|"<<p.qtype.toString()<<endl;
   }
   if(sendmsg(p.getSocket(), &msgh, 0) < 0)
     g_log<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p.getSocket()<<", dest="<<p.d_remote.toStringWithPort()<<"): "<<stringerror()<<endl;
index 925536f61f592aec12696b53e840af9ce117c60f..58325b6ef1c3214ef68c5f5427650151a4435332 100644 (file)
@@ -477,7 +477,7 @@ DNSName PacketHandler::doAdditionalServiceProcessing(const DNSName &firstTarget,
         default:
           while (B.get(rr)) ;              // don't leave DB handle in bad state
 
-          throw PDNSException("Unknown type (" + QType(qtype).getName() + ") for additional service processing");
+          throw PDNSException("Unknown type (" + QType(qtype).toString() + ") for additional service processing");
       }
     }
     ctr--;
@@ -1335,7 +1335,7 @@ std::unique_ptr<DNSPacket> PacketHandler::doQuestion(DNSPacket& p)
       return r; 
     }
 
-    // g_log<<Logger::Warning<<"Query for '"<<p.qdomain<<"' "<<p.qtype.getName()<<" from "<<p.getRemote()<< " (tcp="<<p.d_tcp<<")"<<endl;
+    // g_log<<Logger::Warning<<"Query for '"<<p.qdomain<<"' "<<p.qtype.toString()<<" from "<<p.getRemote()<< " (tcp="<<p.d_tcp<<")"<<endl;
     
     if(p.qtype.getCode()==QType::IXFR) {
       r->setRcode(RCode::Refused);
@@ -1503,7 +1503,7 @@ std::unique_ptr<DNSPacket> PacketHandler::doQuestion(DNSPacket& p)
       if (rr.dr.d_type == QType::RRSIG) // RRSIGS are added later any way.
         continue; // TODO: this actually means addRRSig should check if the RRSig is already there
 
-      // cerr<<"Auth: "<<rr.auth<<", "<<(rr.dr.d_type == p.qtype)<<", "<<rr.dr.d_type.getName()<<endl;
+      // cerr<<"Auth: "<<rr.auth<<", "<<(rr.dr.d_type == p.qtype)<<", "<<rr.dr.d_type.toString()<<endl;
       if((p.qtype.getCode() == QType::ANY || rr.dr.d_type == p.qtype.getCode()) && rr.auth) 
         weDone=true;
       // the line below fakes 'unauth NS' for delegations for non-DNSSEC backends.
@@ -1688,7 +1688,7 @@ std::unique_ptr<DNSPacket> PacketHandler::doQuestion(DNSPacket& p)
     throw; // we WANT to die at this point
   }
   catch(const std::exception &e) {
-    g_log<<Logger::Error<<"Exception building answer packet for "<<p.qdomain<<"/"<<p.qtype.getName()<<" ("<<e.what()<<") sending out servfail"<<endl;
+    g_log<<Logger::Error<<"Exception building answer packet for "<<p.qdomain<<"/"<<p.qtype.toString()<<" ("<<e.what()<<") sending out servfail"<<endl;
     r=p.replyPacket(); // generate an empty reply packet
     r->setRcode(RCode::ServFail);
     S.inc("servfail-packets");
index 72588567aca192ab90999c247147b006bf188454..a59b4948962cb04fd4028b55dee2973cccedc86b 100644 (file)
@@ -1083,7 +1083,7 @@ static PolicyResult handlePolicyHit(const DNSFilterEngine::Policy& appliedPolicy
   }
 
   if (sr.doLog() &&  appliedPolicy.d_type != DNSFilterEngine::PolicyType::None) {
-    g_log << Logger::Warning << dc->d_mdp.d_qname << "|" << QType(dc->d_mdp.d_qtype).getName() << appliedPolicy.getLogString() << endl;
+    g_log << Logger::Warning << dc->d_mdp.d_qname << "|" << QType(dc->d_mdp.d_qtype).toString() << appliedPolicy.getLogString() << endl;
   }
 
   if (appliedPolicy.d_zoneData && appliedPolicy.d_zoneData->d_extendedErrorCode) {
@@ -1350,7 +1350,7 @@ static bool udrCheckUniqueDNSRecord(const DNSName& dname, uint16_t qtype, const
     if (t_udrDBp && t_udrDBp->isUniqueResponse(ss.str())) {
       if (g_udrLog) {  
         // This should also probably log to a dedicated file. 
-        g_log<<Logger::Notice<<"Unique response observed: qname="<<dname<<" qtype="<<QType(qtype).getName()<< " rrtype=" << QType(record.d_type).getName() << " rrname=" << record.d_name << " rrcontent=" << record.d_content->getZoneRepresentation() << endl;
+        g_log<<Logger::Notice<<"Unique response observed: qname="<<dname<<" qtype="<<QType(qtype).toString()<< " rrtype=" << QType(record.d_type).toString() << " rrname=" << record.d_name << " rrcontent=" << record.d_content->getZoneRepresentation() << endl;
       }
       ret = true;
     }
@@ -1878,7 +1878,7 @@ static void startDoResolve(void *p)
 
           if(state == vState::Secure) {
             if(sr.doLog()) {
-              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<x_marker<<" for "<<dc->getRemote()<<" validates correctly"<<endl;
+              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<x_marker<<" for "<<dc->getRemote()<<" validates correctly"<<endl;
             }
 
             // Is the query source interested in the value of the ad-bit?
@@ -1887,7 +1887,7 @@ static void startDoResolve(void *p)
           }
           else if(state == vState::Insecure) {
             if(sr.doLog()) {
-              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<x_marker<<" for "<<dc->getRemote()<<" validates as Insecure"<<endl;
+              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<x_marker<<" for "<<dc->getRemote()<<" validates as Insecure"<<endl;
             }
 
             pw.getHeader()->ad=0;
@@ -1898,27 +1898,27 @@ static void startDoResolve(void *p)
             if(t_bogusqueryring)
               t_bogusqueryring->push_back(make_pair(dc->d_mdp.d_qname, dc->d_mdp.d_qtype));
             if(g_dnssecLogBogus || sr.doLog() || g_dnssecmode == DNSSECMode::ValidateForLog) {
-               g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<x_marker<<" for "<<dc->getRemote()<<" validates as "<<vStateToString(state)<<endl;
+               g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<x_marker<<" for "<<dc->getRemote()<<" validates as "<<vStateToString(state)<<endl;
             }
 
             // Does the query or validation mode sending out a SERVFAIL on validation errors?
             if(!pw.getHeader()->cd && (g_dnssecmode == DNSSECMode::ValidateAll || dc->d_mdp.d_header.ad || DNSSECOK)) {
               if(sr.doLog()) {
-                g_log<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<<endl;
+                g_log<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<" because recursor or query demands it for Bogus results"<<endl;
               }
 
               pw.getHeader()->rcode=RCode::ServFail;
               goto sendit;
             } else {
               if(sr.doLog()) {
-                g_log<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<x_marker<<" Bogus validation since neither config nor query demands this"<<endl;
+                g_log<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<x_marker<<" Bogus validation since neither config nor query demands this"<<endl;
               }
             }
           }
         }
         catch(const ImmediateServFailException &e) {
           if(g_logCommonErrors)
-            g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<"' because: "<<e.reason<<endl;
+            g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).toString()<<"' because: "<<e.reason<<endl;
           pw.getHeader()->rcode=RCode::ServFail;
           goto sendit;
         }
index bc99b51fedc133583ec954c3f020de71a3ef7d3d..9ce08dcbd09889809d42194657dbf02dedc01252 100644 (file)
@@ -363,7 +363,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
       stringtok(parts, rr.content);
 
       if(parts.size() < 7) {
-        cout<<"[Warning] SOA autocomplete is deprecated, missing field(s) in SOA content: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"'"<<endl;
+        cout<<"[Warning] SOA autocomplete is deprecated, missing field(s) in SOA content: "<<rr.qname<<" IN " <<rr.qtype.toString()<< " '" << rr.content<<"'"<<endl;
       }
 
       ostringstream o;
@@ -387,28 +387,28 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
             tmp = drc->getZoneRepresentation(false);
           }
           if(!pdns_iequals(tmp, rr.content)) {
-            cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
+            cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.toString()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
             numwarnings++;
           }
         }
       } else {
         struct in6_addr tmpbuf;
         if (inet_pton(AF_INET6, rr.content.c_str(), &tmpbuf) != 1 || rr.content.find('.') != string::npos) {
-          cout<<"[Warning] Following record is not a valid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"'"<<endl;
+          cout<<"[Warning] Following record is not a valid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.toString()<< " '" << rr.content<<"'"<<endl;
           numwarnings++;
         }
       }
     }
     catch(std::exception& e)
     {
-      cout<<"[Error] Following record had a problem: \""<<rr.qname<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"\""<<endl;
+      cout<<"[Error] Following record had a problem: \""<<rr.qname<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<"\""<<endl;
       cout<<"[Error] Error was: "<<e.what()<<endl;
       numerrors++;
       continue;
     }
 
     if(!rr.qname.isPartOf(zone)) {
-      cout<<"[Error] Record '"<<rr.qname<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"' in zone '"<<zone<<"' is out-of-zone."<<endl;
+      cout<<"[Error] Record '"<<rr.qname<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<"' in zone '"<<zone<<"' is out-of-zone."<<endl;
       numerrors++;
       continue;
     }
@@ -418,7 +418,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
       // I, too, like to live dangerously
       auto svcbrc = std::dynamic_pointer_cast<SVCBBaseRecordContent>(drc);
       if (svcbrc->getPriority() == 0 && svcbrc->hasParams()) {
-        cout<<"[Warning] Aliasform "<<rr.qtype.getName()<<" record "<<rr.qname<<" has service parameters."<<endl;
+        cout<<"[Warning] Aliasform "<<rr.qtype.toString()<<" record "<<rr.qname<<" has service parameters."<<endl;
         numwarnings++;
       }
 
@@ -430,14 +430,14 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
            *  also be specified in order for the RR to be "self-consistent
            *  (Section 2.4.3).
            */
-          cout<<"[Warning] "<<rr.qname<<"|"<<rr.qtype.getName()<<" is not self-consistent: 'no-default-alpn' parameter without 'alpn' parameter"<<endl;
+          cout<<"[Warning] "<<rr.qname<<"|"<<rr.qtype.toString()<<" is not self-consistent: 'no-default-alpn' parameter without 'alpn' parameter"<<endl;
           numwarnings++;
         }
         if (svcbrc->hasParam(SvcParam::mandatory)) {
           auto keys = svcbrc->getParam(SvcParam::mandatory).getMandatory();
           for (auto const &k: keys) {
             if (!svcbrc->hasParam(k)) {
-              cout<<"[Warning] "<<rr.qname<<"|"<<rr.qtype.getName()<<" is not self-consistent: 'mandatory' parameter lists '"+ SvcParam::keyToString(k) +"', but that parameter does not exist"<<endl;
+              cout<<"[Warning] "<<rr.qname<<"|"<<rr.qtype.toString()<<" is not self-consistent: 'mandatory' parameter lists '"+ SvcParam::keyToString(k) +"', but that parameter does not exist"<<endl;
               numwarnings++;
             }
           }
@@ -471,33 +471,33 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     }
 
     content.str("");
-    content<<rr.qname<<" "<<rr.qtype.getName()<<" "<<rr.content;
+    content<<rr.qname<<" "<<rr.qtype.toString()<<" "<<rr.content;
     string contentstr = content.str();
     if (rr.qtype.getCode() != QType::TXT) {
       contentstr=toLower(contentstr);
     }
     if (recordcontents.count(contentstr)) {
-      cout<<"[Error] Duplicate record found in rrset: '"<<rr.qname<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"'"<<endl;
+      cout<<"[Error] Duplicate record found in rrset: '"<<rr.qname<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<"'"<<endl;
       numerrors++;
       continue;
     } else
       recordcontents.insert(contentstr);
 
     content.str("");
-    content<<rr.qname<<" "<<rr.qtype.getName();
+    content<<rr.qname<<" "<<rr.qtype.toString();
     if (rr.qtype.getCode() == QType::RRSIG) {
       RRSIGRecordContent rrc(rr.content);
       content<<" ("<<DNSRecordContent::NumberToType(rrc.d_type)<<")";
     }
     ret = ttl.insert(pair<string, unsigned int>(toLower(content.str()), rr.ttl));
     if (ret.second == false && ret.first->second != rr.ttl) {
-      cout<<"[Error] TTL mismatch in rrset: '"<<rr.qname<<" IN " <<rr.qtype.getName()<<" "<<rr.content<<"' ("<<ret.first->second<<" != "<<rr.ttl<<")"<<endl;
+      cout<<"[Error] TTL mismatch in rrset: '"<<rr.qname<<" IN " <<rr.qtype.toString()<<" "<<rr.content<<"' ("<<ret.first->second<<" != "<<rr.ttl<<")"<<endl;
       numerrors++;
       continue;
     }
 
     if (isSecure && isOptOut && (rr.qname.countLabels() && rr.qname.getRawLabels()[0] == "*")) {
-      cout<<"[Warning] wildcard record '"<<rr.qname<<" IN " <<rr.qtype.getName()<<" "<<rr.content<<"' is insecure"<<endl;
+      cout<<"[Warning] wildcard record '"<<rr.qname<<" IN " <<rr.qtype.toString()<<" "<<rr.content<<"' is insecure"<<endl;
       cout<<"[Info] Wildcard records in opt-out zones are insecure. Disable the opt-out flag for this zone to avoid this warning. Command: pdnsutil set-nsec3 "<<zone<<endl;
       numwarnings++;
     }
@@ -513,11 +513,11 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     } else {
       // non-apex checks
       if (rr.qtype.getCode() == QType::SOA) {
-        cout<<"[Error] SOA record not at apex '"<<rr.qname<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"' in zone '"<<zone<<"'"<<endl;
+        cout<<"[Error] SOA record not at apex '"<<rr.qname<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<"' in zone '"<<zone<<"'"<<endl;
         numerrors++;
         continue;
       } else if (rr.qtype.getCode() == QType::DNSKEY) {
-        cout<<"[Warning] DNSKEY record not at apex '"<<rr.qname<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"' in zone '"<<zone<<"', should not be here."<<endl;
+        cout<<"[Warning] DNSKEY record not at apex '"<<rr.qname<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<"' in zone '"<<zone<<"', should not be here."<<endl;
         numwarnings++;
       } else if (rr.qtype.getCode() == QType::NS) {
         if (DNSName(rr.content).isPartOf(rr.qname)) {
@@ -535,13 +535,13 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     }
 
     if((rr.qtype.getCode() == QType::A || rr.qtype.getCode() == QType::AAAA) && !rr.qname.isWildcard() && !rr.qname.isHostname())
-      cout<<"[Info] "<<rr.qname.toString()<<" record for '"<<rr.qtype.getName()<<"' is not a valid hostname."<<endl;
+      cout<<"[Info] "<<rr.qname.toString()<<" record for '"<<rr.qtype.toString()<<"' is not a valid hostname."<<endl;
 
     // Check if the DNSNames that should be hostnames, are hostnames
     try {
       checkHostnameCorrectness(rr);
     } catch (const std::exception& e) {
-      cout << "[Warning] " << rr.qtype.getName() << " record in zone '" << zone << ": " << e.what() << endl;
+      cout << "[Warning] " << rr.qtype.toString() << " record in zone '" << zone << ": " << e.what() << endl;
       numwarnings++;
     }
 
@@ -729,7 +729,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
         // occluded by a DNAME, or
         // occluded by a delegation, and is not glue or ENTs leading towards that glue
         if( qname.second == QType::DNAME || ( rr.qtype != QType::ENT && rr.qtype.getCode() != QType::A && rr.qtype.getCode() != QType::AAAA ) ) {
-          cout << "[Warning] '" << rr.qname << "|" << rr.qtype.getName() << "' in zone '" << zone << "' is occluded by a ";
+          cout << "[Warning] '" << rr.qname << "|" << rr.qtype.toString() << "' in zone '" << zone << "' is occluded by a ";
           if( qname.second == QType::NS ) {
             cout << "delegation";
           } else {
@@ -760,7 +760,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
         break;
     }
     if (target.isPartOf(zone) && cnames.count(target) != 0) {
-      cout<<"[Warning] '" << rr.qname << "|" << rr.qtype.getName() << " has a target (" << target << ") that is a CNAME." << endl;
+      cout<<"[Warning] '" << rr.qname << "|" << rr.qtype.toString() << " has a target (" << target << ") that is a CNAME." << endl;
       numwarnings++;
     }
   }
@@ -796,7 +796,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
       numwarnings++;
     }
     if( ! ok && ! suppliedrecords ) {
-      cout << "[Error] Following record is auth=" << rr.auth << ", run pdnsutil rectify-zone?: " << rr.qname << " IN " << rr.qtype.getName() << " " << rr.content << endl;
+      cout << "[Error] Following record is auth=" << rr.auth << ", run pdnsutil rectify-zone?: " << rr.qname << " IN " << rr.qtype.toString() << " " << rr.content << endl;
       numerrors++;
     }
   }
@@ -1054,7 +1054,7 @@ static int listZone(const DNSName &zone) {
       if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME) && !rr.content.empty() && rr.content[rr.content.size()-1] != '.')
        rr.content.append(1, '.');
 
-      cout<<rr.qname<<"\t"<<rr.ttl<<"\tIN\t"<<rr.qtype.getName()<<"\t"<<rr.content<<"\n";
+      cout<<rr.qname<<"\t"<<rr.ttl<<"\tIN\t"<<rr.qtype.toString()<<"\t"<<rr.content<<"\n";
     }
   }
   cout.flush();
@@ -1370,11 +1370,11 @@ static int loadZone(const DNSName& zone, const string& fname) {
       DNSRecordContent::mastermake(rr.qtype, QClass::IN, rr.content);
     }
     catch (const PDNSException &pe) {
-      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.getName()<<": "<<pe.reason<<endl;
+      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.toString()<<": "<<pe.reason<<endl;
       return EXIT_FAILURE;
     }
     catch (const std::exception &e) {
-      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.getName()<<": "<<e.what()<<endl;
+      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.toString()<<": "<<e.what()<<endl;
       return EXIT_FAILURE;
     }
     db->feedRecord(rr, DNSName());
@@ -1537,7 +1537,7 @@ static int addOrReplaceRecord(bool addOrReplace, const vector<string>& cmds) {
   }
 
   if(!addOrReplace) {
-    cout<<"Current records for "<<rr.qname<<" IN "<<rr.qtype.getName()<<" will be replaced"<<endl;
+    cout<<"Current records for "<<rr.qname<<" IN "<<rr.qtype.toString()<<" will be replaced"<<endl;
   }
   for(auto i = contentStart ; i < cmds.size() ; ++i) {
     rr.content = DNSRecordContent::mastermake(rr.qtype.getCode(), QClass::IN, cmds[i])->getZoneRepresentation(true);
@@ -1554,7 +1554,7 @@ static int addOrReplaceRecord(bool addOrReplace, const vector<string>& cmds) {
   di.backend->lookup(rr.qtype, name, di.id);
   cout<<"New rrset:"<<endl;
   while(di.backend->get(rr)) {
-    cout<<rr.qname.toString()<<" "<<rr.ttl<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<endl;
+    cout<<rr.qname.toString()<<" "<<rr.ttl<<" IN "<<rr.qtype.toString()<<" "<<rr.content<<endl;
   }
   di.backend->commitTransaction();
   return EXIT_SUCCESS;
index e4b1f5ca9ac428848830ca3106b688171977716d..b3d7d14087343300136cb4e2bb1117fcd9f00adb 100644 (file)
@@ -126,7 +126,7 @@ bool QType::isMetadataType() const
   return false;
 }
 
-const string QType::getName() const
+const string QType::toString() const
 {
   const auto& name = numbers.find(code);
   if (name != numbers.cend()) {
index ae9c682e5ff45f2f544da59bb8d89df799bb1286..d76ccfcbe378513888a27096bd63b4dd97344aa8 100644 (file)
@@ -31,7 +31,7 @@
    t="CNAME";
    cout<<t.getCode()<<endl; // prints '5'
    t=6;
-   cout<<t.getName()<<endl; // prints 'SOA'
+   cout<<t.toString()<<endl; // prints 'SOA'
 \endcode
 
 */
@@ -47,7 +47,7 @@ public:
     return code;
   }
 
-  const string getName() const;
+  const string toString() const;
   uint16_t getCode() const
   {
     return code;
index a27635b29299ccd80661466d9aa8cb677a28a67c..bf28093e99ed061eed58754ea5ab3a22153471eb 100644 (file)
@@ -522,7 +522,7 @@ bool AggressiveNSECCache::getNSEC3Denial(time_t now, std::shared_ptr<AggressiveN
     }
 
     if (!isTypeDenied(nsec3, type)) {
-      LOG(" but the requested type (" << type.getName() << ") does exist" << endl);
+      LOG(" but the requested type (" << type.toString() << ") does exist" << endl);
       return false;
     }
 
@@ -620,7 +620,7 @@ bool AggressiveNSECCache::getNSEC3Denial(time_t now, std::shared_ptr<AggressiveN
     }
 
     if (!isTypeDenied(nsec3, type)) {
-      LOG(" but the requested type (" << type.getName() << ") does exist" << endl);
+      LOG(" but the requested type (" << type.toString() << ") does exist" << endl);
       return synthesizeFromNSEC3Wildcard(now, name, type, ret, res, doDNSSEC, nextCloserEntry, wildcard);
     }
 
index c1030a6af66edb25b38e6e9b7dd2c3dc1b2dcfbf..53dcb6f76abbd3a4fe390512f341d54d92b23581 100644 (file)
@@ -250,7 +250,7 @@ size_t NegCache::dumpToFile(FILE* fp, const struct timeval& now) const
     for (const NegCacheEntry& ne : sidx) {
       ret++;
       int64_t ttl = ne.d_ttd - now.tv_sec;
-      fprintf(fp, "%s %" PRId64 " IN %s VIA %s ; (%s)\n", ne.d_name.toString().c_str(), ttl, ne.d_qtype.getName().c_str(), ne.d_auth.toString().c_str(), vStateToString(ne.d_validationState).c_str());
+      fprintf(fp, "%s %" PRId64 " IN %s VIA %s ; (%s)\n", ne.d_name.toString().c_str(), ttl, ne.d_qtype.toString().c_str(), ne.d_auth.toString().c_str(), vStateToString(ne.d_validationState).c_str());
       for (const auto& rec : ne.authoritySOA.records) {
         fprintf(fp, "%s %" PRId64 " IN %s %s ; (%s)\n", rec.d_name.toString().c_str(), ttl, DNSRecordContent::NumberToType(rec.d_type).c_str(), rec.d_content->getZoneRepresentation().c_str(), vStateToString(ne.d_validationState).c_str());
       }
index 847ed88b37274c2e0066ed598eb1df1266c8954d..ad0eba7632fd9f73b321ff93ddf8392b6af335f0 100644 (file)
@@ -68,7 +68,7 @@ bool TaskQueue::runOnce(bool logErrors)
     vector<DNSRecord> ret;
     sr.setRefreshAlmostExpired(task.d_refreshMode);
     try {
-      g_log << Logger::Debug << "TaskQueue: resolving " << task.d_qname.toString() << '|' << QType(task.d_qtype).getName() << endl;
+      g_log << Logger::Debug << "TaskQueue: resolving " << task.d_qname.toString() << '|' << QType(task.d_qtype).toString() << endl;
       sr.beginResolve(task.d_qname, QType(task.d_qtype), QClass::IN, ret);
     }
     catch (const std::exception& e) {
@@ -93,7 +93,7 @@ bool TaskQueue::runOnce(bool logErrors)
   }
   else {
     // Deadline passed
-    g_log << Logger::Debug << "TaskQueue: deadline for " << task.d_qname.toString() << '|' << QType(task.d_qtype).getName() << " passed" << endl;
+    g_log << Logger::Debug << "TaskQueue: deadline for " << task.d_qname.toString() << '|' << QType(task.d_qtype).toString() << " passed" << endl;
     d_expired++;
   }
   return true;
index 7cffa8128702a7fbb40d2c61557fe4ebe5ef48e5..666083da756db079797e7ba65904085ff59734f3 100644 (file)
@@ -21,7 +21,7 @@ static recordsAndSignatures genRecsAndSigs(const DNSName& name, const uint16_t q
 
   if (sigs) {
     rec.d_type = QType::RRSIG;
-    rec.d_content = std::make_shared<RRSIGRecordContent>(QType(qtype).getName() + " 5 3 600 2037010100000000 2037010100000000 24567 dummy data");
+    rec.d_content = std::make_shared<RRSIGRecordContent>(QType(qtype).toString() + " 5 3 600 2037010100000000 2037010100000000 24567 dummy data");
     ret.signatures.push_back(rec);
   }
 
@@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(test_get_entry)
 
   BOOST_CHECK(ret);
   BOOST_CHECK_EQUAL(ne.d_name, qname);
-  BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName());
+  BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString());
   BOOST_CHECK_EQUAL(ne.d_auth, auth);
 }
 
@@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(test_get_entry2038)
 
   BOOST_CHECK(ret);
   BOOST_CHECK_EQUAL(ne.d_name, qname);
-  BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName());
+  BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString());
   BOOST_CHECK_EQUAL(ne.d_auth, auth);
 }
 
@@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(test_get_NODATA_entry)
 
   BOOST_CHECK(ret);
   BOOST_CHECK_EQUAL(ne.d_name, qname);
-  BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(1).getName());
+  BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(1).toString());
   BOOST_CHECK_EQUAL(ne.d_auth, auth);
 
   NegCache::NegCacheEntry ne2;
@@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(test_getRootNXTrust_entry)
 
   BOOST_CHECK(ret);
   BOOST_CHECK_EQUAL(ne.d_name, qname);
-  BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName());
+  BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString());
   BOOST_CHECK_EQUAL(ne.d_auth, auth);
 }
 
index 9e6f51376d8686ecac947dfc33a5125db8bdfe5d..53457477bc6b2a5102139555d8f1fa651882a367 100644 (file)
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(test_cache_auth)
   int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret);
   BOOST_CHECK_EQUAL(res, RCode::NoError);
   BOOST_REQUIRE_EQUAL(ret.size(), 1U);
-  BOOST_REQUIRE_EQUAL(QType(ret.at(0).d_type).getName(), QType(QType::A).getName());
+  BOOST_REQUIRE_EQUAL(QType(ret.at(0).d_type).toString(), QType(QType::A).toString());
   BOOST_CHECK_EQUAL(getRR<ARecordContent>(ret.at(0))->getCA().toString(), ComboAddress("192.0.2.2").toString());
 
   /* check that we correctly cached only the answer entry, not the additional one */
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_cache_auth)
   vector<DNSRecord> cached;
   BOOST_REQUIRE_GT(g_recCache->get(now, target, QType(QType::A), true, &cached, who), 0);
   BOOST_REQUIRE_EQUAL(cached.size(), 1U);
-  BOOST_REQUIRE_EQUAL(QType(cached.at(0).d_type).getName(), QType(QType::A).getName());
+  BOOST_REQUIRE_EQUAL(QType(cached.at(0).d_type).toString(), QType(QType::A).toString());
   BOOST_CHECK_EQUAL(getRR<ARecordContent>(cached.at(0))->getCA().toString(), ComboAddress("192.0.2.2").toString());
 }
 
@@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(test_special_types)
   size_t queriesCount = 0;
 
   sr->setAsyncCallback([&queriesCount](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional<Netmask>& srcmask, boost::optional<const ResolveContext&> context, LWResult* res, bool* chained) {
-    cerr << "asyncresolve called to ask " << ip.toStringWithPort() << " about " << domain.toString() << " / " << QType(type).getName() << " over " << (doTCP ? "TCP" : "UDP") << " (rd: " << sendRDQuery << ", EDNS0 level: " << EDNS0Level << ")" << endl;
+    cerr << "asyncresolve called to ask " << ip.toStringWithPort() << " about " << domain.toString() << " / " << QType(type).toString() << " over " << (doTCP ? "TCP" : "UDP") << " (rd: " << sendRDQuery << ", EDNS0 level: " << EDNS0Level << ")" << endl;
     queriesCount++;
     return LWResult::Result::Timeout;
   });
index caae18954f69f6586f6a00567ad1e3818f22ab12..a5430c85157e0ab90edec1cc7dcfa8e52a852ef9 100644 (file)
@@ -407,10 +407,10 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
             dr.d_place = DNSResourceRecord::ANSWER;
           }
           catch (std::exception& e) {
-            throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.getName() + " in zone '" + headers.first + "' from file '" + headers.second + "': " + e.what());
+            throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.toString() + " in zone '" + headers.first + "' from file '" + headers.second + "': " + e.what());
           }
           catch (...) {
-            throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.getName() + " in zone '" + headers.first + "' from file '" + headers.second + "'");
+            throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.toString() + " in zone '" + headers.first + "' from file '" + headers.second + "'");
           }
 
           ad.d_records.insert(dr);
index 1f569c4d1885479fa16b6dbabd031a0a9db55c6f..5cde2e88f344809f0be7f26be5f36dabeab4dfdc 100644 (file)
@@ -354,7 +354,7 @@ void Resolver::getSoaSerial(const ComboAddress& ipport, const DNSName &domain, u
     throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced no answers");
 
   if(res[0].qtype.getCode() != QType::SOA) 
-    throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced a "+res[0].qtype.getName()+" record");
+    throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced a "+res[0].qtype.toString()+" record");
 
   vector<string>parts;
   stringtok(parts, res[0].content);
index 12f007655f15a9255185bdad497d717809f8c041..0890693a28ca146f71af07b87400bc8d50491fb6 100644 (file)
@@ -95,17 +95,17 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   QType rrType = QType(rr->d_type);
 
   if (rrType == QType::NSEC || rrType == QType::NSEC3) {
-    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<". These are generated records, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.toString()<<". These are generated records, ignoring!"<<endl;
     return 0;
   }
 
   if (!isPresigned && ((!::arg().mustDo("direct-dnskey") && rrType == QType::DNSKEY) || rrType == QType::RRSIG)) {
-    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<" in non-presigned zone, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.toString()<<" in non-presigned zone, ignoring!"<<endl;
     return 0;
   }
 
   if ((rrType == QType::NSEC3PARAM || rrType == QType::DNSKEY) && rr->d_name != di->zone) {
-    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<", "<<rrType.getName()<<" must be at zone apex, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.toString()<<", "<<rrType.toString()<<" must be at zone apex, ignoring!"<<endl;
     return 0;
   }
 
@@ -117,7 +117,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
 
 
   if (rr->d_class == QClass::IN) { // 3.4.2.2 QClass::IN means insert or update
-    DLOG(g_log<<msgPrefix<<"Add/Update record (QClass == IN) "<<rr->d_name<<"|"<<rrType.getName()<<endl);
+    DLOG(g_log<<msgPrefix<<"Add/Update record (QClass == IN) "<<rr->d_name<<"|"<<rrType.toString()<<endl);
 
     if (rrType == QType::NSEC3PARAM) {
       g_log<<Logger::Notice<<msgPrefix<<"Adding/updating NSEC3PARAM for zone, resetting ordernames."<<endl;
@@ -156,7 +156,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
           di->backend->replaceRRSet(di->id, oldRec->qname, oldRec->qtype, rrset);
           *updatedSerial = true;
           changedRecords++;
-          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
         } else {
           g_log<<Logger::Notice<<msgPrefix<<"Provided serial ("<<sdUpdate.serial<<") is older than the current serial ("<<sdOld.serial<<"), ignoring SOA update."<<endl;
         }
@@ -173,10 +173,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
         if (changedCNames > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
           changedRecords += changedCNames;
         } else {
-          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but no changes made."<<endl;
         }
 
       // In any other case, we must check if the TYPE and RDATA match to provide an update (which effectively means a update of TTL)
@@ -204,10 +204,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
         if (updateTTL > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
           changedRecords += updateTTL;
         } else {
-          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but no changes made."<<endl;
         }
       }
 
@@ -244,7 +244,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
 
     // If we haven't found a record that matches, we must add it.
     if (! foundRecord) {
-      g_log<<Logger::Notice<<msgPrefix<<"Adding record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Adding record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
       delnonterm.insert(rr->d_name); // always remove any ENT's in the place where we're going to add a record.
       auto newRec = DNSResourceRecord::fromWire(*rr);
       newRec.domain_id = di->id;
@@ -359,7 +359,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   // Delete records - section 3.4.2.3 and 3.4.2.4 with the exception of the 'always leave 1 NS rule' as that's handled by
   // the code that calls this performUpdate().
   if ((rr->d_class == QClass::ANY || rr->d_class == QClass::NONE) && rrType != QType::SOA) { // never delete a SOA.
-    DLOG(g_log<<msgPrefix<<"Deleting records: "<<rr->d_name<<"; QClass:"<<rr->d_class<<"; rrType: "<<rrType.getName()<<endl);
+    DLOG(g_log<<msgPrefix<<"Deleting records: "<<rr->d_name<<"; QClass:"<<rr->d_class<<"; rrType: "<<rrType.toString()<<endl);
 
     if (rrType == QType::NSEC3PARAM) {
       g_log<<Logger::Notice<<msgPrefix<<"Deleting NSEC3PARAM from zone, resetting ordernames."<<endl;
@@ -405,7 +405,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   
     if (recordsToDelete.size()) {
       di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-      g_log<<Logger::Notice<<msgPrefix<<"Deleting record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Deleting record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
       changedRecords += recordsToDelete.size();
 
 
@@ -494,7 +494,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
       }
     } else { // if (recordsToDelete.size())
-      g_log<<Logger::Notice<<msgPrefix<<"Deletion for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but not found."<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Deletion for record "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but not found."<<endl;
     }
   } // (End of delete block d_class == ANY || d_class == NONE
   
@@ -868,10 +868,10 @@ int PacketHandler::processUpdate(DNSPacket& p) {
         /* see if it's permitted by policy */
         if (this->d_update_policy_lua != nullptr) {
           if (this->d_update_policy_lua->updatePolicy(rr->d_name, QType(rr->d_type), di.zone, p) == false) {
-            g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Not permitted by policy"<<endl;
+            g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).toString() << ": Not permitted by policy"<<endl;
             continue;
           } else {
-            g_log<<Logger::Debug<<msgPrefix<<"Accepting update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Permitted by policy"<<endl;
+            g_log<<Logger::Debug<<msgPrefix<<"Accepting update for " << rr->d_name << "/" << QType(rr->d_type).toString() << ": Permitted by policy"<<endl;
           }
         }
 
@@ -896,7 +896,7 @@ int PacketHandler::processUpdate(DNSPacket& p) {
           // leave database handle in a consistent state
           while (di.backend->get(rec))
             ;
-          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Data other than CNAME exists for the same name"<<endl;
+          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).toString() << ": Data other than CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;
         }
@@ -911,7 +911,7 @@ int PacketHandler::processUpdate(DNSPacket& p) {
           // leave database handle in a consistent state
           while (di.backend->get(rec))
             ;
-          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": CNAME exists for the same name"<<endl;
+          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).toString() << ": CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;
         }
index 619c7e66605be7fe1db0a964523fd158c2aec145..29c309892e6c545d25cf0df9cc45c11e9639637c 100644 (file)
@@ -270,7 +270,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
         continue;
 
       if(!rec.qname.isPartOf(domain)) {
-        g_log<<Logger::Warning<<logPrefix<<"primary tried to sneak in out-of-zone data '"<<rec.qname<<"'|"<<rec.qtype.getName()<<", ignoring"<<endl;
+        g_log<<Logger::Warning<<logPrefix<<"primary tried to sneak in out-of-zone data '"<<rec.qname<<"'|"<<rec.qtype.toString()<<", ignoring"<<endl;
         continue;
       }
 
@@ -281,7 +281,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
 
       for(auto& rr :  out) {
         if(!rr.qname.isPartOf(domain)) {
-          g_log<<Logger::Error<<logPrefix<<"axfrfilter() filter tried to sneak in out-of-zone data '"<<rr.qname<<"'|"<<rr.qtype.getName()<<", ignoring"<<endl;
+          g_log<<Logger::Error<<logPrefix<<"axfrfilter() filter tried to sneak in out-of-zone data '"<<rr.qname<<"'|"<<rr.qtype.toString()<<", ignoring"<<endl;
           continue;
         }
         if(!processRecordForZS(domain, firstNSEC3, rr, zs))
index 4350250eb22d32eb41d4e58431fb294561811ff1..28f46dfefc6e464507fa6dba5959c73e95e4a32a 100644 (file)
@@ -304,7 +304,7 @@ vector<pair<string, unsigned int> > StatBag::getRing(const string &name)
   } else if(d_dnsnameqtyperings.count(name)) {
     auto raw = d_dnsnameqtyperings[name].get();
     for (auto const &e : raw) {
-      ret.push_back(make_pair(std::get<0>(e.first).toLogString() + "/" + std::get<1>(e.first).getName(), e.second));
+      ret.push_back(make_pair(std::get<0>(e.first).toLogString() + "/" + std::get<1>(e.first).toString(), e.second));
     }
   }
   return ret;
index 3951be74b3cbac287b9b4605b7caf0668d73df17..4b3a47ab7ad844d2903952235812ecabed732312 100644 (file)
@@ -126,7 +126,7 @@ int stubDoResolve(const DNSName& qname, uint16_t qtype, vector<DNSZoneRecord>& r
   pw.getHeader()->id=dns_random_uint16();
   pw.getHeader()->rd=1;
 
-  string queryNameType = qname.toString() + "|" + QType(qtype).getName();
+  string queryNameType = qname.toString() + "|" + QType(qtype).toString();
   string msg ="Doing stub resolving for '" + queryNameType + "', using resolvers: ";
   for (const auto& server : s_resolversForStub) {
     msg += server.toString() + ", ";
index 50586d8603c09f85d6e546d53789d27ffcbffd05..359ef78e840856c7eaf06731dffacd9c88ba21d5 100644 (file)
@@ -699,7 +699,7 @@ int SyncRes::doResolve(const DNSName &qname, const QType qtype, vector<DNSRecord
   // moves to three labels per iteration after three iterations.
 
   DNSName child;
-  prefix.append(string("QM ") + qname.toString() + "|" + qtype.getName());
+  prefix.append(string("QM ") + qname.toString() + "|" + qtype.toString());
 
   QLOG("doResolve");
 
@@ -844,7 +844,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp
     prefix.append(depth, ' ');
   }
 
-  LOG(prefix<<qname<<": Wants "<< (d_doDNSSEC ? "" : "NO ") << "DNSSEC processing, "<<(d_requireAuthData ? "" : "NO ")<<"auth data in query for "<<qtype.getName()<<endl);
+  LOG(prefix<<qname<<": Wants "<< (d_doDNSSEC ? "" : "NO ") << "DNSSEC processing, "<<(d_requireAuthData ? "" : "NO ")<<"auth data in query for "<<qtype.toString()<<endl);
 
   if (s_maxdepth && depth > s_maxdepth) {
     string msg = "More than " + std::to_string(s_maxdepth) + " (max-recursion-depth) levels of recursion needed while resolving " + qname.toLogString();
@@ -857,7 +857,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp
   if(!(d_updatingRootNS && qtype.getCode()==QType::NS && qname.isRoot())) {
     if(d_cacheonly) { // very limited OOB support
       LWResult lwr;
-      LOG(prefix<<qname<<": Recursion not requested for '"<<qname<<"|"<<qtype.getName()<<"', peeking at auth/forward zones"<<endl);
+      LOG(prefix<<qname<<": Recursion not requested for '"<<qname<<"|"<<qtype.toString()<<"', peeking at auth/forward zones"<<endl);
       DNSName authname(qname);
       domainmap_t::const_iterator iter=getBestAuthZone(&authname);
       if(iter != t_sstorage.domainmap->end()) {
@@ -1001,7 +1001,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp
     return 0;
   }
 
-  LOG(prefix<<qname<<": No cache hit for '"<<qname<<"|"<<qtype.getName()<<"', trying to find an appropriate NS record"<<endl);
+  LOG(prefix<<qname<<": No cache hit for '"<<qname<<"|"<<qtype.toString()<<"', trying to find an appropriate NS record"<<endl);
 
   DNSName subdomain(qname);
   if (qtype == QType::DS) subdomain.chopOff();
@@ -1450,7 +1450,7 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType qtype, vector<
   if (qtype == QType::DS && authZone == qname) {
     /* CNAME at APEX of the child zone, we can't use that to prove that
        there is no DS */
-    LOG(prefix<<qname<<": Found a "<<foundQT.getName()<<" cache hit of '"<< qname <<"' from "<<authZone<<", but such a record at the apex of the child zone does not prove that there is no DS in the parent zone"<<endl);
+    LOG(prefix<<qname<<": Found a "<<foundQT.toString()<<" cache hit of '"<< qname <<"' from "<<authZone<<", but such a record at the apex of the child zone does not prove that there is no DS in the parent zone"<<endl);
     return false;
   }
 
@@ -1466,10 +1466,10 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType qtype, vector<
 
         vState recordState = getValidationStatus(foundName, !signatures.empty(), qtype == QType::DS, depth);
         if (recordState == vState::Secure) {
-          LOG(prefix<<qname<<": got vState::Indeterminate state from the "<<foundQT.getName()<<" cache, validating.."<<endl);
+          LOG(prefix<<qname<<": got vState::Indeterminate state from the "<<foundQT.toString()<<" cache, validating.."<<endl);
           state = SyncRes::validateRecordsWithSigs(depth, qname, qtype, foundName, foundQT, cset, signatures);
           if (state != vState::Indeterminate) {
-            LOG(prefix<<qname<<": got vState::Indeterminate state from the "<<foundQT.getName()<<" cache, new validation result is "<<state<<endl);
+            LOG(prefix<<qname<<": got vState::Indeterminate state from the "<<foundQT.toString()<<" cache, new validation result is "<<state<<endl);
             if (vStateIsBogus(state)) {
               capTTL = s_maxbogusttl;
             }
@@ -1478,7 +1478,7 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType qtype, vector<
         }
       }
 
-      LOG(prefix<<qname<<": Found cache "<<foundQT.getName()<<" hit for '"<< foundName << "|"<<foundQT.getName()<<"' to '"<<record.d_content->getZoneRepresentation()<<"', validation state is "<<state<<endl);
+      LOG(prefix<<qname<<": Found cache "<<foundQT.toString()<<" hit for '"<< foundName << "|"<<foundQT.toString()<<"' to '"<<record.d_content->getZoneRepresentation()<<"', validation state is "<<state<<endl);
 
       DNSRecord dr = record;
       dr.d_ttl -= d_now.tv_sec;
@@ -1718,7 +1718,7 @@ bool SyncRes::doCacheCheck(const DNSName &qname, const DNSName& authname, bool w
   DNSName sqname(qname);
   QType sqt(qtype);
   uint32_t sttl=0;
-  //  cout<<"Lookup for '"<<qname<<"|"<<qtype.getName()<<"' -> "<<getLastLabel(qname)<<endl;
+  //  cout<<"Lookup for '"<<qname<<"|"<<qtype.toString()<<"' -> "<<getLastLabel(qname)<<endl;
   vState cachedState;
   NegCache::NegCacheEntry ne;
 
@@ -1742,7 +1742,7 @@ bool SyncRes::doCacheCheck(const DNSName &qname, const DNSName& authname, bool w
       giveNegative = true;
       cachedState = ne.d_validationState;
       if (ne.d_qtype.getCode()) {
-        LOG(prefix<<qname<<": "<<qtype.getName()<<" is negatively cached via '"<<ne.d_auth<<"' for another "<<sttl<<" seconds"<<endl);
+        LOG(prefix<<qname<<": "<<qtype.toString()<<" is negatively cached via '"<<ne.d_auth<<"' for another "<<sttl<<" seconds"<<endl);
         res = RCode::NoError;
       } else {
         LOG(prefix<<qname<<": Entire name '"<<qname<<"' is negatively cached via '"<<ne.d_auth<<"' for another "<<sttl<<" seconds"<<endl);
@@ -1810,7 +1810,7 @@ bool SyncRes::doCacheCheck(const DNSName &qname, const DNSName& authname, bool w
 
   if(g_recCache->get(d_now.tv_sec, sqname, sqt, !wasForwardRecurse && d_requireAuthData, &cset, d_cacheRemote, d_refresh, d_routingTag, d_doDNSSEC ? &signatures : nullptr, d_doDNSSEC ? &authorityRecs : nullptr, &d_wasVariable, &cachedState, &wasCachedAuth) > 0) {
 
-    LOG(prefix<<sqname<<": Found cache hit for "<<sqt.getName()<<": ");
+    LOG(prefix<<sqname<<": Found cache hit for "<<sqt.toString()<<": ");
 
     if (!wasAuthZone && shouldValidate() && (wasCachedAuth || wasForwardRecurse) && cachedState == vState::Indeterminate && d_requireAuthData) {
 
@@ -2157,7 +2157,7 @@ void SyncRes::handlePolicyHit(const std::string& prefix, const DNSName& qname, c
   }
 
   if (d_appliedPolicy.d_type != DNSFilterEngine::PolicyType::None) {
-    LOG(prefix << qname << "|" << qtype.getName() << d_appliedPolicy.getLogString() << endl);
+    LOG(prefix << qname << "|" << qtype.toString() << d_appliedPolicy.getLogString() << endl);
   }
 
   switch (d_appliedPolicy.d_kind) {
@@ -2338,7 +2338,7 @@ bool SyncRes::throttledOrBlocked(const std::string& prefix, const ComboAddress&
     return true;
   }
   else if(t_sstorage.throttle.shouldThrottle(d_now.tv_sec, boost::make_tuple(remoteIP, qname, qtype.getCode()))) {
-    LOG(prefix<<qname<<": query throttled "<<remoteIP.toString()<<", "<<qname<<"; "<<qtype.getName()<<endl);
+    LOG(prefix<<qname<<": query throttled "<<remoteIP.toString()<<", "<<qname<<"; "<<qtype.toString()<<endl);
     s_throttledqueries++; d_throttledqueries++;
     return true;
   }
@@ -2815,7 +2815,7 @@ vState SyncRes::validateRecordsWithSigs(unsigned int depth, const DNSName& qname
     recordcontents.insert(record.d_content);
   }
 
-  LOG(d_prefix<<"Going to validate "<<recordcontents.size()<< " record contents with "<<signatures.size()<<" sigs and "<<keys.size()<<" keys for "<<name<<"|"<<type.getName()<<endl);
+  LOG(d_prefix<<"Going to validate "<<recordcontents.size()<< " record contents with "<<signatures.size()<<" sigs and "<<keys.size()<<" keys for "<<name<<"|"<<type.toString()<<endl);
   vState state = validateWithKeySet(d_now.tv_sec, name, recordcontents, signatures, keys, false);
   if (state == vState::Secure) {
     LOG(d_prefix<<"Secure!"<<endl);
@@ -3259,7 +3259,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, LWResult& lwr
           recordState = validateDNSKeys(i->first.name, i->second.records, i->second.signatures, depth);
         }
         else {
-          LOG(d_prefix<<"Validating non-additional "<<QType(i->first.type).getName()<<" record for "<<i->first.name<<endl);
+          LOG(d_prefix<<"Validating non-additional "<<QType(i->first.type).toString()<<" record for "<<i->first.name<<endl);
           recordState = validateRecordsWithSigs(depth, qname, qtype, i->first.name, QType(i->first.type), i->second.records, i->second.signatures);
         }
       }
@@ -3644,7 +3644,7 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co
     }
     else if (!done && rec.d_place == DNSResourceRecord::AUTHORITY && rec.d_type == QType::SOA &&
             lwr.d_rcode == RCode::NoError && qname.isPartOf(rec.d_name)) {
-      LOG(prefix<<qname<<": got negative caching indication for '"<< qname<<"|"<<qtype.getName()<<"'"<<endl);
+      LOG(prefix<<qname<<": got negative caching indication for '"<< qname<<"|"<<qtype.toString()<<"'"<<endl);
 
       if (!newtarget.empty()) {
         LOG(prefix<<qname<<": Hang on! Got a redirect to '"<<newtarget<<"' already"<<endl);
@@ -3716,7 +3716,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname,
   }
 
   if(s_maxtotusec && d_totUsec > s_maxtotusec) {
-    throw ImmediateServFailException("Too much time waiting for "+qname.toLogString()+"|"+qtype.getName()+", timeouts: "+std::to_string(d_timeouts) +", throttles: "+std::to_string(d_throttledqueries) + ", queries: "+std::to_string(d_outqueries)+", "+std::to_string(d_totUsec/1000)+"msec");
+    throw ImmediateServFailException("Too much time waiting for "+qname.toLogString()+"|"+qtype.toString()+", timeouts: "+std::to_string(d_timeouts) +", throttles: "+std::to_string(d_throttledqueries) + ", queries: "+std::to_string(d_outqueries)+", "+std::to_string(d_totUsec/1000)+"msec");
   }
 
   if(doTCP) {
@@ -4204,7 +4204,7 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con
         }
 
         for(remoteIP = remoteIPs.cbegin(); remoteIP != remoteIPs.cend(); ++remoteIP) {
-          LOG(prefix<<qname<<": Trying IP "<< remoteIP->toStringWithPort() <<", asking '"<<qname<<"|"<<qtype.getName()<<"'"<<endl);
+          LOG(prefix<<qname<<": Trying IP "<< remoteIP->toStringWithPort() <<", asking '"<<qname<<"|"<<qtype.toString()<<"'"<<endl);
 
           if (throttledOrBlocked(prefix, *remoteIP, qname, qtype, pierceDontQuery)) {
             continue;
index 61dcc2fca45ea70f19d6a609ff15d6d1d4e9871d..4d0188833e0e011bc0e1204a06afe36b5487b51e 100644 (file)
@@ -309,7 +309,7 @@ void TCPNameserver::doConnection(int fd)
           remote_text = packet->getRemote().toString() + "<-" + packet->getRealRemote().toString();
         else
           remote_text = packet->getRemote().toString();
-        g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<<packet->qtype.getName() <<
+        g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<<packet->qtype.toString() <<
         "', do = " <<packet->d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen();
       }
 
@@ -1052,7 +1052,7 @@ int TCPNameserver::doIXFR(std::unique_ptr<DNSPacket>& q, int outsock)
         return 0;
       }
     } else if (rr->d_type != QType::TSIG && rr->d_type != QType::OPT) {
-      g_log<<Logger::Warning<<logPrefix<<"additional records in IXFR query, type: "<<QType(rr->d_type).getName()<<endl;
+      g_log<<Logger::Warning<<logPrefix<<"additional records in IXFR query, type: "<<QType(rr->d_type).toString()<<endl;
       outpacket->setRcode(RCode::FormErr);
       sendPacket(outpacket,outsock);
       return 0;
index 0f7161d0db4e0b5775b1e94e92abca84da862f9b..da3c667c804cfa1ee6f1c043797f3a8fa665cbc4 100644 (file)
@@ -268,12 +268,12 @@ BOOST_AUTO_TEST_CASE(test_record_types) {
    const broken_marker broken = val.get<4>();
 
    if (lq != q.getCode()) n = 0;
-   if (q.getCode() != QType::TSIG && q.getCode() != 65226) BOOST_CHECK_MESSAGE(QType::names.find(q.getName()) != QType::names.end(), "qtype " << q.getName() << " not registered in QType::names");
+   if (q.getCode() != QType::TSIG && q.getCode() != 65226) BOOST_CHECK_MESSAGE(QType::names.find(q.toString()) != QType::names.end(), "qtype " << q.toString() << " not registered in QType::names");
    BOOST_CHECK_MESSAGE(q.getCode() >= lq, "record types should be sorted such that qtype " << q.getCode() << " is before " << lq);
    lq = q.getCode();
    n++;
-   BOOST_TEST_CHECKPOINT("Checking record type " << q.getName() << " test #" << n);
-   BOOST_TEST_MESSAGE("Checking record type " << q.getName() << " test #" << n);
+   BOOST_TEST_CHECKPOINT("Checking record type " << q.toString() << " test #" << n);
+   BOOST_TEST_MESSAGE("Checking record type " << q.toString() << " test #" << n);
    try {
       std::string recData;
       auto rec = DNSRecordContent::mastermake(q.getCode(), 1, inval);
@@ -306,10 +306,10 @@ BOOST_AUTO_TEST_CASE(test_record_types) {
       recData = makeHexDump(recData);
       REC_CHECK_EQUAL(recData, cmpData);
    } catch (std::runtime_error &err) {
-      REC_CHECK_MESSAGE(false, q.getName() << ": " << err.what());
+      REC_CHECK_MESSAGE(false, q.toString() << ": " << err.what());
       continue;
    }
-   REC_FAIL_XSUCCESS(q.getName() << " test #" << n << " has unexpectedly passed")
+   REC_FAIL_XSUCCESS(q.toString() << " test #" << n << " has unexpectedly passed")
  }
 }
 
@@ -365,8 +365,8 @@ BOOST_AUTO_TEST_CASE(test_record_types_bad_values) {
     if (lq != q.getCode()) n = 0;
     lq = q.getCode();
     n++;
-    BOOST_TEST_CHECKPOINT("Checking bad value for record type " << q.getName() << " test #" << n);
-    BOOST_TEST_MESSAGE("Checking bad value for record type " << q.getName() << " test #" << n);
+    BOOST_TEST_CHECKPOINT("Checking bad value for record type " << q.toString() << " test #" << n);
+    BOOST_TEST_MESSAGE("Checking bad value for record type " << q.toString() << " test #" << n);
 
     vector<uint8_t> packet;
     DNSPacketWriter pw(packet, DNSName("unit.test"), q.getCode());
@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(test_record_types_bad_values) {
         },
         std::exception, test_dnsrecords_cc_predicate
       );
-      if (success) REC_FAIL_XSUCCESS(q.getName() << " test #" << n << " has unexpectedly passed"); // a bad record was detected when it was supposed not to be detected
+      if (success) REC_FAIL_XSUCCESS(q.toString() << " test #" << n << " has unexpectedly passed"); // a bad record was detected when it was supposed not to be detected
     } else {
       BOOST_CHECK_EXCEPTION(
         {
index 3921b02fa760232e0a323b5c633792445621a1df..6da2d46ea74777d925b2d4c24754f8fbfee39aa1 100644 (file)
@@ -400,7 +400,7 @@ static void checkRecordExists(const std::vector<DNSZoneRecord>& records, const D
       return;
     }
   }
-  BOOST_CHECK_MESSAGE(false, "Record " + name.toString() + "/" + QType(type).getName() + " - " + std::to_string(zoneId) + " not found");
+  BOOST_CHECK_MESSAGE(false, "Record " + name.toString() + "/" + QType(type).toString() + " - " + std::to_string(zoneId) + " not found");
 }
 
 BOOST_AUTO_TEST_CASE(test_simple) {
index 1075a75323e7cb3ce1811264270150b8b490655e..665710944355d315edf75871e69286bf50e99d3a 100644 (file)
@@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_types) {
     // see if these agree
     BOOST_CHECK_EQUAL(rr.qname.toString(), host);
     BOOST_CHECK_EQUAL(rr.ttl, ttl);
-    BOOST_CHECK_EQUAL(rr.qtype.getName(), type);
+    BOOST_CHECK_EQUAL(rr.qtype.toString(), type);
     if (rr.qtype == QType::SOA)
       continue; // FIXME400 remove trailing dots from data
     if (*(rr.content.rbegin()) != '.' && *(data.rbegin()) == '.') 
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
       BOOST_CHECK_EQUAL(rr.qname.toString(), exp);
       BOOST_CHECK_EQUAL(rr.ttl, 86400U);
       BOOST_CHECK_EQUAL(rr.qclass, 1U);
-      BOOST_CHECK_EQUAL(rr.qtype.getName(), "A");
+      BOOST_CHECK_EQUAL(rr.qtype.toString(), "A");
       BOOST_CHECK_EQUAL(rr.content, "1.2.3.4");
     }
   }
@@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
       BOOST_CHECK_EQUAL(rr.qname.toString(), exp);
       BOOST_CHECK_EQUAL(rr.ttl, 86400U);
       BOOST_CHECK_EQUAL(rr.qclass, 1U);
-      BOOST_CHECK_EQUAL(rr.qtype.getName(), "A");
+      BOOST_CHECK_EQUAL(rr.qtype.toString(), "A");
       BOOST_CHECK_EQUAL(rr.content, "1.2.3.4");
     }
   }
@@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(test_tng_upgrade) {
   DNSResourceRecord rr;
   zp.get(rr);
 
-  BOOST_CHECK_EQUAL(rr.qtype.getName(), QType(QType::A).getName());
+  BOOST_CHECK_EQUAL(rr.qtype.toString(), QType(QType::A).toString());
   BOOST_CHECK_EQUAL(rr.content, std::string("192.0.3.4"));
 }
 
index 901b085d40b39287063f4091b8537dd094dc8d85..8d18956a02ab97d5b52dd3536dfd5629419de41d 100644 (file)
@@ -247,7 +247,7 @@ bool isNSEC3AncestorDelegation(const DNSName& signer, const DNSName& owner, cons
 static bool provesNoDataWildCard(const DNSName& qname, const uint16_t qtype, const DNSName& closestEncloser, const cspmap_t& validrrsets)
 {
   const DNSName wildcard = g_wildcarddnsname + closestEncloser;
-  LOG("Trying to prove that there is no data in wildcard for "<<qname<<"/"<<QType(qtype).getName()<<endl);
+  LOG("Trying to prove that there is no data in wildcard for "<<qname<<"/"<<QType(qtype).toString()<<endl);
   for (const auto& v : validrrsets) {
     LOG("Do have: "<<v.first.first<<"/"<<DNSRecordContent::NumberToType(v.first.second)<<endl);
     if (v.first.second == QType::NSEC) {
@@ -293,7 +293,7 @@ DNSName getClosestEncloserFromNSEC(const DNSName& name, const DNSName& owner, co
 */
 static bool provesNoWildCard(const DNSName& qname, const uint16_t qtype, const DNSName& closestEncloser, const cspmap_t & validrrsets)
 {
-  LOG("Trying to prove that there is no wildcard for "<<qname<<"/"<<QType(qtype).getName()<<endl);
+  LOG("Trying to prove that there is no wildcard for "<<qname<<"/"<<QType(qtype).toString()<<endl);
   const DNSName wildcard = g_wildcarddnsname + closestEncloser;
   for (const auto& v : validrrsets) {
     LOG("Do have: "<<v.first.first<<"/"<<DNSRecordContent::NumberToType(v.first.second)<<endl);
@@ -342,7 +342,7 @@ static bool provesNoWildCard(const DNSName& qname, const uint16_t qtype, const D
 static bool provesNSEC3NoWildCard(const DNSName& closestEncloser, uint16_t const qtype, const cspmap_t& validrrsets, bool* wildcardExists, nsec3HashesCache& cache)
 {
   auto wildcard = g_wildcarddnsname + closestEncloser;
-  LOG("Trying to prove that there is no wildcard for "<<wildcard<<"/"<<QType(qtype).getName()<<endl);
+  LOG("Trying to prove that there is no wildcard for "<<wildcard<<"/"<<QType(qtype).toString()<<endl);
 
   for (const auto& v : validrrsets) {
     LOG("Do have: "<<v.first.first<<"/"<<DNSRecordContent::NumberToType(v.first.second)<<endl);
@@ -429,11 +429,11 @@ dState matchesNSEC(const DNSName& name, uint16_t qtype, const DNSName& nsecOwner
   /* check if the type is denied */
   if (name == owner) {
     if (!isTypeDenied(nsec, QType(qtype))) {
-      LOG("Does _not_ deny existence of type "<<QType(qtype).getName()<<endl);
+      LOG("Does _not_ deny existence of type "<<QType(qtype).toString()<<endl);
       return dState::NODENIAL;
     }
 
-    LOG("Denies existence of type "<<QType(qtype).getName()<<endl);
+    LOG("Denies existence of type "<<QType(qtype).toString()<<endl);
     return dState::NXQTYPE;
   }
 
@@ -455,7 +455,7 @@ dState matchesNSEC(const DNSName& name, uint16_t qtype, const DNSName& nsecOwner
     LOG(name<<" is covered ");
 
     if (nsecProvesENT(name, owner, nsec->d_next)) {
-      LOG("Denies existence of type "<<name<<"/"<<QType(qtype).getName()<<" by proving that "<<name<<" is an ENT"<<endl);
+      LOG("Denies existence of type "<<name<<"/"<<QType(qtype).toString()<<" by proving that "<<name<<" is an ENT"<<endl);
       return dState::NXQTYPE;
     }
 
@@ -524,11 +524,11 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
         /* check if the type is denied */
         if (qname == owner) {
           if (!isTypeDenied(nsec, QType(qtype))) {
-            LOG("Does _not_ deny existence of type "<<QType(qtype).getName()<<endl);
+            LOG("Does _not_ deny existence of type "<<QType(qtype).toString()<<endl);
             return dState::NODENIAL;
           }
 
-          LOG("Denies existence of type "<<QType(qtype).getName()<<endl);
+          LOG("Denies existence of type "<<QType(qtype).toString()<<endl);
 
           /*
            * RFC 4035 Section 2.3:
@@ -583,7 +583,7 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
             if (wantsNoDataProof) {
               /* if the name is an ENT and we received a NODATA answer,
                  we are fine with a NSEC proving that the name does not exist. */
-              LOG("Denies existence of type "<<qname<<"/"<<QType(qtype).getName()<<" by proving that "<<qname<<" is an ENT"<<endl);
+              LOG("Denies existence of type "<<qname<<"/"<<QType(qtype).toString()<<" by proving that "<<qname<<" is an ENT"<<endl);
               return dState::NXQTYPE;
             }
             else {
@@ -617,7 +617,7 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
           return dState::NODENIAL;
         }
 
-        LOG("Did not deny existence of "<<QType(qtype).getName()<<", "<<v.first.first<<"?="<<qname<<", "<<nsec->isSet(qtype)<<", next: "<<nsec->d_next<<endl);
+        LOG("Did not deny existence of "<<QType(qtype).toString()<<", "<<v.first.first<<"?="<<qname<<", "<<nsec->isSet(qtype)<<", next: "<<nsec->d_next<<endl);
       }
     } else if(v.first.second==QType::NSEC3) {
       for (const auto& r : v.second.records) {
@@ -664,11 +664,11 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
           }
 
           if (!isTypeDenied(nsec3, QType(qtype))) {
-            LOG("Does _not_ deny existence of type "<<QType(qtype).getName()<<" for name "<<qname<<" (not opt-out)."<<endl);
+            LOG("Does _not_ deny existence of type "<<QType(qtype).toString()<<" for name "<<qname<<" (not opt-out)."<<endl);
             return dState::NODENIAL;
           }
 
-          LOG("Denies existence of type "<<QType(qtype).getName()<<" for name "<<qname<<" (not opt-out)."<<endl);
+          LOG("Denies existence of type "<<QType(qtype).toString()<<" for name "<<qname<<" (not opt-out)."<<endl);
 
           /*
            * RFC 5155 section 8.9:
@@ -811,7 +811,7 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
 
             LOG("Comparing "<<toBase32Hex(h)<<" against "<<toBase32Hex(beginHash)<<" -> "<<toBase32Hex(nsec3->d_nexthash)<<endl);
             if (isCoveredByNSEC3Hash(h, beginHash, nsec3->d_nexthash)) {
-              LOG("Denies existence of name "<<qname<<"/"<<QType(qtype).getName());
+              LOG("Denies existence of name "<<qname<<"/"<<QType(qtype).toString());
               nextCloserFound = true;
 
               if (nsec3->isOptOut()) {
@@ -837,7 +837,7 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
     /* RFC 7129 section-5.6 */
     if (needWildcardProof && !provesNSEC3NoWildCard(closestEncloser, qtype, validrrsets, &wildcardExists, cache)) {
       if (!isOptOut) {
-        LOG("But the existence of a wildcard is not denied for "<<qname<<"/"<<QType(qtype).getName()<<endl);
+        LOG("But the existence of a wildcard is not denied for "<<qname<<"/"<<QType(qtype).toString()<<endl);
         return dState::NODENIAL;
       }
     }
index 3479f38505283b722731ec15d8f9b21cc03c25ed..e26479b745172b3382eeb289400d5866f5367f10 100644 (file)
@@ -472,7 +472,7 @@ static void fillZone(UeberBackend& B, const DNSName& zonename, HttpResponse* res
       }
 
       rrset["name"] = current_qname.toString();
-      rrset["type"] = current_qtype.getName();
+      rrset["type"] = current_qtype.toString();
       rrset["records"] = rrset_records;
       rrset["comments"] = rrset_comments;
       rrset["ttl"] = (double)ttl;
@@ -512,7 +512,7 @@ boost::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
 
 static void validateGatheredRRType(const DNSResourceRecord& rr) {
   if (rr.qtype.getCode() == QType::OPT || rr.qtype.getCode() == QType::TSIG) {
-    throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": invalid type given");
+    throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.toString()+": invalid type given");
   }
 }
 
@@ -549,7 +549,7 @@ static void gatherRecords(UeberBackend& B, const string& logprefix, const Json&
     }
     catch(std::exception& e)
     {
-      throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.getName()+" '"+content+"': "+e.what());
+      throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.toString()+" '"+content+"': "+e.what());
     }
 
     new_records.push_back(rr);
@@ -1426,13 +1426,13 @@ static void checkNewRecords(vector<DNSResourceRecord>& records) {
     if (previous.qname == rec.qname) {
       if (previous.qtype == rec.qtype) {
         if (onlyOneEntryTypes.count(rec.qtype.getCode()) != 0) {
-          throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName()+" has more than one record");
+          throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString()+" has more than one record");
         }
         if (previous.content == rec.content) {
-          throw ApiException("Duplicate record in RRset " + rec.qname.toString() + " IN " + rec.qtype.getName() + " with content \"" + rec.content + "\"");
+          throw ApiException("Duplicate record in RRset " + rec.qname.toString() + " IN " + rec.qtype.toString() + " with content \"" + rec.content + "\"");
         }
       } else if (exclusiveEntryTypes.count(rec.qtype.getCode()) != 0 || exclusiveEntryTypes.count(previous.qtype.getCode()) != 0) {
-        throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName()+": Conflicts with another RRset");
+        throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString()+": Conflicts with another RRset");
       }
     }
 
@@ -1440,7 +1440,7 @@ static void checkNewRecords(vector<DNSResourceRecord>& records) {
     try {
       checkHostnameCorrectness(rec);
     } catch (const std::exception& e) {
-      throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName() + " " + e.what());
+      throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString() + " " + e.what());
     }
 
     previous = rec;
@@ -1652,7 +1652,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
     for(auto& rr : new_records) {
       rr.qname.makeUsLowerCase();
       if (!rr.qname.isPartOf(zonename) && rr.qname != zonename)
-        throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": Name is out of zone");
+        throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.toString()+": Name is out of zone");
       apiCheckQNameAllowedCharacters(rr.qname.toString());
 
       if (rr.qtype.getCode() == QType::SOA && rr.qname==zonename) {
@@ -1874,7 +1874,7 @@ static void apiServerZoneExport(HttpRequest* req, HttpResponse* resp) {
       rr.qname.toString() << "\t" <<
       rr.ttl << "\t" <<
       "IN" << "\t" <<
-      rr.qtype.getName() << "\t" <<
+      rr.qtype.toString() << "\t" <<
       makeApiRecordContent(rr.qtype, rr.content) <<
       endl;
   }
@@ -1992,7 +1992,7 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) {
 
       if(seen.count({qname, qtype, changetype}))
       {
-        throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.getName()+" with changetype: "+changetype);
+        throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.toString()+" with changetype: "+changetype);
       }
       seen.insert({qname, qtype, changetype});
 
@@ -2005,13 +2005,13 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) {
       else if (changetype == "REPLACE") {
         // we only validate for REPLACE, as DELETE can be used to "fix" out of zone records.
         if (!qname.isPartOf(zonename) && qname != zonename)
-          throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Name is out of zone");
+          throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Name is out of zone");
 
         bool replace_records = rrset["records"].is_array();
         bool replace_comments = rrset["comments"].is_array();
 
         if (!replace_records && !replace_comments) {
-          throw ApiException("No change for RRset " + qname.toString() + " IN " + qtype.getName());
+          throw ApiException("No change for RRset " + qname.toString() + " IN " + qtype.toString());
         }
 
         new_records.clear();
@@ -2064,12 +2064,12 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) {
               while (di.backend->get(rr))
                 ;
 
-              throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Conflicts with pre-existing RRset");
+              throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Conflicts with pre-existing RRset");
             }
           }
 
           if (dname_seen && ns_seen && qname != zonename) {
-            throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Cannot have both NS and DNAME except in zone apex");
+            throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Cannot have both NS and DNAME except in zone apex");
           }
           if (!new_records.empty() && ent_present) {
             QType qt_ent{0};
@@ -2212,7 +2212,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) {
       auto object = Json::object {
         { "object_type", "record" },
         { "name", rr.qname.toString() },
-        { "type", rr.qtype.getName() },
+        { "type", rr.qtype.toString() },
         { "ttl", (double)rr.ttl },
         { "disabled", rr.disabled },
         { "content", makeApiRecordContent(rr.qtype, rr.content) }
@@ -2232,7 +2232,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) {
       auto object = Json::object {
         { "object_type", "comment" },
         { "name", c.qname.toString() },
-        { "type", c.qtype.getName() },
+        { "type", c.qtype.toString() },
         { "content", c.content }
       };
       if ((val = zoneIdZone.find(c.domain_id)) != zoneIdZone.end()) {
index b4aee1c6cd08803b9b0e8adecfe97bee3f797278..9da32bf5d54f9141f713ed0865b691e1225686ed 100644 (file)
@@ -175,7 +175,7 @@ try
             obj["name"] = i->name.toString();
 
             while(zpt.get(rr)) 
-              recs.push_back(emitRecord(i->name.toString(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
+              recs.push_back(emitRecord(i->name.toString(), rr.qname, rr.qtype.toString(), rr.content, rr.ttl));
             obj["records"] = recs;
             Json tmp = obj;
             cout<<tmp.dump();
@@ -211,7 +211,7 @@ try
       obj["name"] = ::arg()["zone-name"];
 
       while(zpt.get(rr)) 
-        records.push_back(emitRecord(::arg()["zone-name"], rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
+        records.push_back(emitRecord(::arg()["zone-name"], rr.qname, rr.qtype.toString(), rr.content, rr.ttl));
       obj["records"] = records;
 
       Json tmp = obj;
index 6e514a5123714a82084ee4cfd3b6d8591b4f8f66..b1f3434da671f2248f8f41cfe5ef76ea7f911a96 100644 (file)
@@ -320,7 +320,7 @@ int main( int argc, char* argv[] )
                                                 zpt.setMaxGenerateSteps(args.asNum("max-generate-steps"));
                                                 DNSResourceRecord rr;
                                                 while(zpt.get(rr)) {
-                                                        callback(g_domainid, rr.qname, rr.qtype.getName(), encode_non_ascii(rr.content), rr.ttl);
+                                                        callback(g_domainid, rr.qname, rr.qtype.toString(), encode_non_ascii(rr.content), rr.ttl);
                                                         if( rr.qtype == QType::SOA )
                                                                 ++g_domainid;
                                                 }
@@ -349,7 +349,7 @@ int main( int argc, char* argv[] )
                         zpt.setMaxGenerateSteps(args.asNum("max-generate-steps"));
                         DNSResourceRecord rr;
                         while(zpt.get(rr)) {
-                                callback(g_domainid, rr.qname, rr.qtype.getName(), encode_non_ascii(rr.content), rr.ttl);
+                                callback(g_domainid, rr.qname, rr.qtype.toString(), encode_non_ascii(rr.content), rr.ttl);
                                 if ( rr.qtype == QType::SOA )
                                         ++g_domainid;
                         }
index 339b7ffecb1ff7d6f85621595a46f695dc464019..505fd1dfd7f518d8c7bd0fc7870dbe6d98008806 100644 (file)
@@ -304,7 +304,7 @@ try
               if(rr.qtype.getCode() == QType::SOA)
                 seenSOA=true;
 
-              emitRecord(domain.name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
+              emitRecord(domain.name, rr.qname, rr.qtype.toString(), rr.content, rr.ttl, comment);
             }
             num_domainsdone++;
           }
@@ -354,7 +354,7 @@ try
           }
         }
 
-        emitRecord(zpt.getZoneName(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
+        emitRecord(zpt.getZoneName(), rr.qname, rr.qtype.toString(), rr.content, rr.ttl, comment);
       }
       num_domainsdone=1;
     }
index c769626997a03d34d0f1c4268b9dbb8eecd3ee73..b7c020fae382b63199ded8a6d6884e7ae9aed557 100644 (file)
@@ -473,7 +473,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
         try {
           recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
         } catch (std::exception &e) {
-          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
+          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.toString() + "': " + e.what());
         }
       }
       rr.content=recparts[0]+" "+recparts[1];
@@ -496,7 +496,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
         try {
           recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
         } catch (std::exception &e) {
-          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
+          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.toString() + "': " + e.what());
         }
       }
       rr.content=recparts[0]+" "+recparts[1]+" "+recparts[2]+" "+recparts[3];
@@ -511,7 +511,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
     try {
       rr.content = toCanonic(d_zonename, rr.content).toStringRootDot();
     } catch (std::exception &e) {
-      throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
+      throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.toString() + "': " + e.what());
     }
     break;
   case QType::AFSDB:
@@ -520,7 +520,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
       try {
         recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
       } catch (std::exception &e) {
-        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
+        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.toString() + "': " + e.what());
       }
     } else {
       throw PDNSException("AFSDB record for "+rr.qname.toLogString()+" invalid");
@@ -542,7 +542,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
         recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
         recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
       } catch (std::exception &e) {
-        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
+        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.toString() + "': " + e.what());
       }
     }
     rr.content.clear();