From ba66f43d966a24ebcc47451bd3a2b0ddda7d0f55 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Mon, 15 Jun 2015 15:26:40 +0300 Subject: [PATCH] Change remotebackend to use DNSName --- modules/remotebackend/remotebackend.cc | 104 ++++++++++++------------- modules/remotebackend/remotebackend.hh | 46 +++++------ 2 files changed, 76 insertions(+), 74 deletions(-) diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index f89ad6b89..daecda4a2 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -160,7 +160,7 @@ int RemoteBackend::build() { * The functions here are just remote json stubs that send and receive the method call * data is mainly left alone, some defaults are assumed. */ -void RemoteBackend::lookup(const QType &qtype, const std::string &qdomain, DNSPacket *pkt_p, int zoneId) { +void RemoteBackend::lookup(const QType &qtype, const DNSName& qdomain, DNSPacket *pkt_p, int zoneId) { rapidjson::Document query; rapidjson::Value parameters; @@ -171,7 +171,7 @@ void RemoteBackend::lookup(const QType &qtype, const std::string &qdomain, DNSPa JSON_ADD_MEMBER(query, "method", "lookup", query.GetAllocator()) parameters.SetObject(); JSON_ADD_MEMBER(parameters, "qtype", qtype.getName().c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(parameters, "qname", qdomain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "qname", qdomain, query.GetAllocator()); string localIP="0.0.0.0"; string remoteIP="0.0.0.0"; @@ -204,7 +204,7 @@ void RemoteBackend::lookup(const QType &qtype, const std::string &qdomain, DNSPa d_index = 0; } -bool RemoteBackend::list(const std::string &target, int domain_id, bool include_disabled) { +bool RemoteBackend::list(const DNSName& target, int domain_id, bool include_disabled) { rapidjson::Document query; rapidjson::Value parameters; @@ -215,7 +215,7 @@ bool RemoteBackend::list(const std::string &target, int domain_id, bool include_ JSON_ADD_MEMBER(query, "method", "list", query.GetAllocator()); query["method"] = "list"; parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "zonename", target.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "zonename", target, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "domain-id", domain_id, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -266,7 +266,7 @@ bool RemoteBackend::get(DNSResourceRecord &rr) { return true; } -bool RemoteBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string& qname, std::string& unhashed, std::string& before, std::string& after) { +bool RemoteBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string& qname, DNSName& unhashed, std::string& before, std::string& after) { rapidjson::Document query,answer; rapidjson::Value parameters; // no point doing dnssec if it's not supported @@ -290,14 +290,14 @@ bool RemoteBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::strin return true; } -bool RemoteBackend::getAllDomainMetadata(const string& name, std::map >& meta) { +bool RemoteBackend::getAllDomainMetadata(const DNSName& name, std::map >& meta) { rapidjson::Document query,answer; rapidjson::Value parameters; query.SetObject(); JSON_ADD_MEMBER(query, "method", "getAllDomainMetadata", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); if (this->send(query) == false) @@ -323,14 +323,14 @@ bool RemoteBackend::getAllDomainMetadata(const string& name, std::map& meta) { +bool RemoteBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) { rapidjson::Document query,answer; rapidjson::Value parameters; query.SetObject(); JSON_ADD_MEMBER(query, "method", "getDomainMetadata", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "kind", kind.c_str(), query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -354,13 +354,13 @@ bool RemoteBackend::getDomainMetadata(const std::string& name, const std::string return true; } -bool RemoteBackend::setDomainMetadata(const string& name, const std::string& kind, const std::vector& meta) { +bool RemoteBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) { rapidjson::Document query,answer; rapidjson::Value parameters,val; query.SetObject(); JSON_ADD_MEMBER(query, "method", "setDomainMetadata", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "kind", kind.c_str(), query.GetAllocator()); val.SetArray(); BOOST_FOREACH(std::string value, meta) { @@ -376,7 +376,7 @@ bool RemoteBackend::setDomainMetadata(const string& name, const std::string& kin } -bool RemoteBackend::getDomainKeys(const std::string& name, unsigned int kind, std::vector& keys) { +bool RemoteBackend::getDomainKeys(const DNSName& name, unsigned int kind, std::vector& keys) { rapidjson::Document query,answer; rapidjson::Value parameters; // no point doing dnssec if it's not supported @@ -385,7 +385,7 @@ bool RemoteBackend::getDomainKeys(const std::string& name, unsigned int kind, st query.SetObject(); JSON_ADD_MEMBER(query, "method", "getDomainKeys", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "kind", kind, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -415,7 +415,7 @@ bool RemoteBackend::getDomainKeys(const std::string& name, unsigned int kind, st return true; } -bool RemoteBackend::removeDomainKey(const string& name, unsigned int id) { +bool RemoteBackend::removeDomainKey(const DNSName& name, unsigned int id) { rapidjson::Document query,answer; rapidjson::Value parameters; // no point doing dnssec if it's not supported @@ -424,7 +424,7 @@ bool RemoteBackend::removeDomainKey(const string& name, unsigned int id) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "removeDomainKey", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "id", id, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -434,7 +434,7 @@ bool RemoteBackend::removeDomainKey(const string& name, unsigned int id) { return true; } -int RemoteBackend::addDomainKey(const string& name, const KeyData& key) { +int RemoteBackend::addDomainKey(const DNSName& name, const KeyData& key) { rapidjson::Document query,answer; rapidjson::Value parameters,jkey; @@ -443,7 +443,7 @@ int RemoteBackend::addDomainKey(const string& name, const KeyData& key) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "addDomainKey", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); jkey.SetObject(); JSON_ADD_MEMBER(jkey, "flags", key.flags, query.GetAllocator()); JSON_ADD_MEMBER(jkey, "active", key.active, query.GetAllocator()); @@ -457,7 +457,7 @@ int RemoteBackend::addDomainKey(const string& name, const KeyData& key) { return getInt(answer["result"]); } -bool RemoteBackend::activateDomainKey(const string& name, unsigned int id) { +bool RemoteBackend::activateDomainKey(const DNSName& name, unsigned int id) { rapidjson::Document query,answer; rapidjson::Value parameters; @@ -467,7 +467,7 @@ bool RemoteBackend::activateDomainKey(const string& name, unsigned int id) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "activateDomainKey", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "id", id, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -477,7 +477,7 @@ bool RemoteBackend::activateDomainKey(const string& name, unsigned int id) { return true; } -bool RemoteBackend::deactivateDomainKey(const string& name, unsigned int id) { +bool RemoteBackend::deactivateDomainKey(const DNSName& name, unsigned int id) { rapidjson::Document query,answer; rapidjson::Value parameters; @@ -487,7 +487,7 @@ bool RemoteBackend::deactivateDomainKey(const string& name, unsigned int id) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "deactivateDomainKey", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "id", id, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -599,7 +599,7 @@ bool RemoteBackend::getTSIGKeys(std::vector& keys) { return true; } -bool RemoteBackend::getDomainInfo(const string &domain, DomainInfo &di) { +bool RemoteBackend::getDomainInfo(const DNSName& domain, DomainInfo &di) { rapidjson::Document query,answer; rapidjson::Value parameters; rapidjson::Value value; @@ -608,7 +608,7 @@ bool RemoteBackend::getDomainInfo(const string &domain, DomainInfo &di) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "getDomainInfo", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", domain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", domain, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); if (this->send(query) == false || this->recv(answer) == false) @@ -663,7 +663,7 @@ void RemoteBackend::setNotified(uint32_t id, uint32_t serial) { } } -bool RemoteBackend::isMaster(const string &name, const string &ip) +bool RemoteBackend::isMaster(const DNSName& name, const string &ip) { rapidjson::Document query,answer; rapidjson::Value parameters; @@ -671,7 +671,7 @@ bool RemoteBackend::isMaster(const string &name, const string &ip) query.SetObject(); JSON_ADD_MEMBER(query, "method", "isMaster", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "name", name.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "ip", ip.c_str(), query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); if (this->send(query) == false || this->recv(answer) == false) @@ -680,7 +680,7 @@ bool RemoteBackend::isMaster(const string &name, const string &ip) return true; } -bool RemoteBackend::superMasterBackend(const string &ip, const string &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **ddb) +bool RemoteBackend::superMasterBackend(const string &ip, const DNSName& domain, const vector&nsset, string* nameserver, string *account, DNSBackend **ddb) { rapidjson::Document query,answer; rapidjson::Value parameters; @@ -690,14 +690,14 @@ bool RemoteBackend::superMasterBackend(const string &ip, const string &domain, c JSON_ADD_MEMBER(query, "method", "superMasterBackend", query.GetAllocator()); parameters.SetObject(); JSON_ADD_MEMBER(parameters, "ip", ip.c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(parameters, "domain", domain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain, query.GetAllocator()); rrset.SetArray(); rrset.Reserve(nsset.size(), query.GetAllocator()); for(rapidjson::SizeType i = 0; i < nsset.size(); i++) { rapidjson::Value rr; rr.SetObject(); JSON_ADD_MEMBER(rr, "qtype", nsset[i].qtype.getName().c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(rr, "qname", nsset[i].qname.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(rr, "qname", nsset[i].qname, query.GetAllocator()); JSON_ADD_MEMBER(rr, "qclass", QClass::IN, query.GetAllocator()); JSON_ADD_MEMBER(rr, "content", nsset[i].content.c_str(), query.GetAllocator()); JSON_ADD_MEMBER(rr, "ttl", nsset[i].ttl, query.GetAllocator()); @@ -714,7 +714,7 @@ bool RemoteBackend::superMasterBackend(const string &ip, const string &domain, c // we are the backend *ddb = this; - + // we allow simple true as well... if (answer["result"].IsObject()) { if (answer["result"].HasMember("account")) @@ -725,14 +725,14 @@ bool RemoteBackend::superMasterBackend(const string &ip, const string &domain, c return true; } -bool RemoteBackend::createSlaveDomain(const string &ip, const string &domain, const string &nameserver, const string &account) { - rapidjson::Document query,answer; +bool RemoteBackend::createSlaveDomain(const string &ip, const DNSName& domain, const string& nameserver, const string &account) { + rapidjson::Document query,answer; rapidjson::Value parameters; query.SetObject(); JSON_ADD_MEMBER(query, "method", "createSlaveDomain", query.GetAllocator()); parameters.SetObject(); JSON_ADD_MEMBER(parameters, "ip", ip.c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(parameters, "domain", domain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain. query.GetAllocator()); JSON_ADD_MEMBER(parameters, "nameserver", nameserver.c_str(), query.GetAllocator()); JSON_ADD_MEMBER(parameters, "account", account.c_str(), query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -742,7 +742,7 @@ bool RemoteBackend::createSlaveDomain(const string &ip, const string &domain, co return true; } -bool RemoteBackend::replaceRRSet(uint32_t domain_id, const string& qname, const QType& qtype, const vector& rrset) { +bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qtype, const vector& rrset) { rapidjson::Document query,answer; rapidjson::Value parameters; rapidjson::Value rj_rrset; @@ -750,7 +750,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const string& qname, const JSON_ADD_MEMBER(query, "method", "replaceRRSet", query.GetAllocator()); parameters.SetObject(); JSON_ADD_MEMBER(parameters, "domain_id", domain_id, query.GetAllocator()); - JSON_ADD_MEMBER(parameters, "qname", qname.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "qname", qname, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "qtype", qtype.getName().c_str(), query.GetAllocator()); JSON_ADD_MEMBER(parameters, "trxid", d_trxid, query.GetAllocator()); @@ -761,7 +761,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const string& qname, const rapidjson::Value rr; rr.SetObject(); JSON_ADD_MEMBER(rr, "qtype", rrset[i].qtype.getName().c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(rr, "qname", rrset[i].qname.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(rr, "qname", rrset[i].qname, query.GetAllocator()); JSON_ADD_MEMBER(rr, "qclass", QClass::IN, query.GetAllocator()); JSON_ADD_MEMBER(rr, "content", rrset[i].content.c_str(), query.GetAllocator()); JSON_ADD_MEMBER(rr, "ttl", rrset[i].ttl, query.GetAllocator()); @@ -785,7 +785,7 @@ bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, string *ordername) { parameters.SetObject(); rj_rr.SetObject(); JSON_ADD_MEMBER(rj_rr, "qtype", rr.qtype.getName().c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(rj_rr, "qname", rr.qname.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(rj_rr, "qname", rr.qname, query.GetAllocator()); JSON_ADD_MEMBER(rj_rr, "qclass", QClass::IN, query.GetAllocator()); JSON_ADD_MEMBER(rj_rr, "content", rr.content.c_str(), query.GetAllocator()); JSON_ADD_MEMBER(rj_rr, "ttl", rr.ttl, query.GetAllocator()); @@ -805,7 +805,7 @@ bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, string *ordername) { return true; // XXX FIXME this API should not return 'true' I think -ahu } -bool RemoteBackend::feedEnts(int domain_id, map& nonterm) { +bool RemoteBackend::feedEnts(int domain_id, map& nonterm) { rapidjson::Document query,answer; rapidjson::Value parameters; rapidjson::Value nts; @@ -815,9 +815,9 @@ bool RemoteBackend::feedEnts(int domain_id, map& nonterm) { JSON_ADD_MEMBER(parameters, "domain_id", domain_id, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "trxid", d_trxid, query.GetAllocator()); nts.SetArray(); - pair t; - BOOST_FOREACH(t, nonterm) { - nts.PushBack(t.first.c_str(), query.GetAllocator()); + for(auto t: nonterm) { + rapidjson::Value value(t.first.toStringNoDot().c_str(), query.GetAllocator()); + nts.PushBack(value, query.GetAllocator()); } parameters.AddMember("nonterm", nts, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -827,7 +827,7 @@ bool RemoteBackend::feedEnts(int domain_id, map& nonterm) { return true; } -bool RemoteBackend::feedEnts3(int domain_id, const string &domain, map &nonterm, unsigned int times, const string &salt, bool narrow) { +bool RemoteBackend::feedEnts3(int domain_id, const DNSName& domain, map& nonterm, unsigned int times, const string &salt, bool narrow) { rapidjson::Document query,answer; rapidjson::Value parameters; rapidjson::Value nts; @@ -835,16 +835,16 @@ bool RemoteBackend::feedEnts3(int domain_id, const string &domain, map t; - BOOST_FOREACH(t, nonterm) { - nts.PushBack(t.first.c_str(), query.GetAllocator()); + for(auto t: nonterm) { + rapidjson::Value value(t.first.toStringNoDot().c_str(), query.GetAllocator()); + nts.PushBack(value, query.GetAllocator()); } parameters.AddMember("nonterm", nts, query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); @@ -854,7 +854,7 @@ bool RemoteBackend::feedEnts3(int domain_id, const string &domain, mapd_trxid = time((time_t*)NULL); @@ -862,7 +862,7 @@ bool RemoteBackend::startTransaction(const string &domain, int domain_id) { query.SetObject(); JSON_ADD_MEMBER(query, "method", "startTransaction", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "domain", domain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "domain_id", domain_id, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "trxid", d_trxid, query.GetAllocator()); @@ -907,7 +907,7 @@ bool RemoteBackend::abortTransaction() { return true; } -bool RemoteBackend::calculateSOASerial(const string& domain, const SOAData& sd, time_t& serial) { +bool RemoteBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial) { rapidjson::Document query,answer; rapidjson::Value parameters; rapidjson::Value soadata; @@ -915,11 +915,11 @@ bool RemoteBackend::calculateSOASerial(const string& domain, const SOAData& sd, query.SetObject(); JSON_ADD_MEMBER(query, "method", "calculateSOASerial", query.GetAllocator()); parameters.SetObject(); - JSON_ADD_MEMBER(parameters, "domain", domain.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain, query.GetAllocator()); soadata.SetObject(); - JSON_ADD_MEMBER(soadata, "qname", sd.qname.c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(soadata, "nameserver", sd.nameserver.c_str(), query.GetAllocator()); - JSON_ADD_MEMBER(soadata, "hostmaster", sd.hostmaster.c_str(), query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(soadata, "qname", sd.qname, query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(soadata, "nameserver", sd.nameserver, query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(soadata, "hostmaster", sd.hostmaster, query.GetAllocator()); JSON_ADD_MEMBER(soadata, "ttl", sd.ttl, query.GetAllocator()); JSON_ADD_MEMBER(soadata, "serial", sd.serial, query.GetAllocator()); JSON_ADD_MEMBER(soadata, "refresh", sd.refresh, query.GetAllocator()); diff --git a/modules/remotebackend/remotebackend.hh b/modules/remotebackend/remotebackend.hh index 76a1d0ec6..6334cd09f 100644 --- a/modules/remotebackend/remotebackend.hh +++ b/modules/remotebackend/remotebackend.hh @@ -16,6 +16,7 @@ #include #include #include "yahttp/yahttp.hpp" +#include #ifdef REMOTEBACKEND_ZEROMQ #include @@ -28,6 +29,7 @@ #endif #define JSON_GET(obj,val,def) (obj.HasMember(val)?obj["" val ""]:def) #define JSON_ADD_MEMBER(obj, name, val, alloc) { rapidjson::Value __xval; __xval = val; obj.AddMember(name, __xval, alloc); } +#define JSON_ADD_MEMBER_DNSNAME(obj, name, val, alloc) { rapidjson::Value __xval(val.toStringNoDot().c_str(), alloc); obj.AddMember(name, __xval, alloc); } class Connector { public: @@ -131,36 +133,36 @@ class RemoteBackend : public DNSBackend RemoteBackend(const std::string &suffix=""); ~RemoteBackend(); - void lookup(const QType &qtype, const std::string &qdomain, DNSPacket *pkt_p=0, int zoneId=-1); + void lookup(const QType &qtype, const DNSName& qdomain, DNSPacket *pkt_p=0, int zoneId=-1); bool get(DNSResourceRecord &rr); - bool list(const std::string &target, int domain_id, bool include_disabled=false); + bool list(const DNSName& target, int domain_id, bool include_disabled=false); - virtual bool getAllDomainMetadata(const string& name, std::map >& meta); - virtual bool getDomainMetadata(const std::string& name, const std::string& kind, std::vector& meta); - virtual bool getDomainKeys(const std::string& name, unsigned int kind, std::vector& keys); + virtual bool getAllDomainMetadata(const DNSName& name, std::map >& meta); + virtual bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); + virtual bool getDomainKeys(const DNSName& name, unsigned int kind, std::vector& keys); virtual bool getTSIGKey(const std::string& name, std::string* algorithm, std::string* content); - virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string& qname, std::string& unhashed, std::string& before, std::string& after); - virtual bool setDomainMetadata(const string& name, const string& kind, const std::vector >& meta); - virtual bool removeDomainKey(const string& name, unsigned int id); - virtual int addDomainKey(const string& name, const KeyData& key); - virtual bool activateDomainKey(const string& name, unsigned int id); - virtual bool deactivateDomainKey(const string& name, unsigned int id); - virtual bool getDomainInfo(const string&, DomainInfo&); + virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const string& qname, DNSName& unhashed, string& before, string& after); + virtual bool setDomainMetadata(const DNSName& name, const string& kind, const std::vector >& meta); + virtual bool removeDomainKey(const DNSName& name, unsigned int id); + virtual int addDomainKey(const DNSName& name, const KeyData& key); + virtual bool activateDomainKey(const DNSName& name, unsigned int id); + virtual bool deactivateDomainKey(const DNSName& name, unsigned int id); + virtual bool getDomainInfo(const DNSName& domain, DomainInfo& di); virtual void setNotified(uint32_t id, uint32_t serial); virtual bool doesDNSSEC(); - virtual bool isMaster(const string &name, const string &ip); - virtual bool superMasterBackend(const string &ip, const string &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **ddb); - virtual bool createSlaveDomain(const string &ip, const string &domain, const string &nameserver, const string &account); - virtual bool replaceRRSet(uint32_t domain_id, const string& qname, const QType& qt, const vector& rrset); + virtual bool isMaster(const DNSName& name, const string &ip); + virtual bool superMasterBackend(const string &ip, const DNSName& domain, const vector&nsset, string *nameserver, string *account, DNSBackend **ddb); + virtual bool createSlaveDomain(const string &ip, const DNSName& domain, const string& nameserver, const string &account); + virtual bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset); virtual bool feedRecord(const DNSResourceRecord &r, string *ordername); - virtual bool feedEnts(int domain_id, map& nonterm); - virtual bool feedEnts3(int domain_id, const string &domain, map &nonterm, unsigned int times, const string &salt, bool narrow); - virtual bool startTransaction(const string &domain, int domain_id); + virtual bool feedEnts(int domain_id, map& nonterm); + virtual bool feedEnts3(int domain_id, const DNSName& domain, map& nonterm, unsigned int times, const string &salt, bool narrow); + virtual bool startTransaction(const DNSName& domain, int domain_id); virtual bool commitTransaction(); virtual bool abortTransaction(); - virtual bool calculateSOASerial(const string& domain, const SOAData& sd, time_t& serial); - virtual bool setTSIGKey(const string& name, const string& algorithm, const string& content); - virtual bool deleteTSIGKey(const string& name); + virtual bool calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial); + virtual bool setTSIGKey(const std::string& name, const string& algorithm, const string& content); + virtual bool deleteTSIGKey(const std::string& name); virtual bool getTSIGKeys(std::vector< struct TSIGKey > &keys); static DNSBackend *maker(); -- 2.40.0