Skip to content

Commit

Permalink
Rename QType.getName() to QType.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
omoerbeek committed May 18, 2021
1 parent 1c6bcc3 commit d5fcd58
Show file tree
Hide file tree
Showing 56 changed files with 243 additions and 243 deletions.
18 changes: 9 additions & 9 deletions modules/bindbackend/bindbackend2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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)))) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand All @@ -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++;
Expand Down
6 changes: 3 additions & 3 deletions modules/ldapbackend/ldapbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}
}
Expand All @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions modules/ldapbackend/native.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -146,15 +146,15 @@ 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;
}

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);
}

Expand Down Expand Up @@ -188,15 +188,15 @@ 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;
}

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);
}

Expand All @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions modules/lmdbbackend/lmdbbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions modules/lua2backend/lua2api2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/pipebackend/pipebackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions modules/remotebackend/remotebackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand All @@ -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)
Expand All @@ -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)},
}}};

Expand Down
6 changes: 3 additions & 3 deletions modules/tinydnsbackend/tinydnsbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
Loading

0 comments on commit d5fcd58

Please sign in to comment.