]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Introduce ZoneName.
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 11 Apr 2025 07:29:05 +0000 (09:29 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 11 Apr 2025 13:29:27 +0000 (15:29 +0200)
This is currently equivalent to DNSName and is intended to be used for,
well, zone names. This will allow specific processing later, and
currently make the areas where such names are used more visible.

This commit is mostly mechanical and introduces type changes in various
API and data fields.

76 files changed:
modules/bindbackend/bindbackend2.cc
modules/bindbackend/bindbackend2.hh
modules/bindbackend/binddnssec.cc
modules/geoipbackend/geoipbackend.cc
modules/geoipbackend/geoipbackend.hh
modules/ldapbackend/ldapbackend.hh
modules/ldapbackend/native.cc
modules/ldapbackend/primary.cc
modules/lmdbbackend/lmdbbackend.cc
modules/lmdbbackend/lmdbbackend.hh
modules/lua2backend/lua2api2.hh
modules/pipebackend/pipebackend.cc
modules/pipebackend/pipebackend.hh
modules/remotebackend/remotebackend.cc
modules/remotebackend/remotebackend.hh
modules/remotebackend/test-remotebackend.cc
modules/tinydnsbackend/tinydnsbackend.cc
modules/tinydnsbackend/tinydnsbackend.hh
pdns/auth-catalogzone.cc
pdns/auth-catalogzone.hh
pdns/auth-primarycommunicator.cc
pdns/auth-secondarycommunicator.cc
pdns/auth-zonecache.cc
pdns/auth-zonecache.hh
pdns/axfr-retriever.cc
pdns/axfr-retriever.hh
pdns/backends/gsql/gsqlbackend.cc
pdns/backends/gsql/gsqlbackend.hh
pdns/bindparser.yy
pdns/bindparserclasses.hh
pdns/communicator.hh
pdns/dbdnsseckeeper.cc
pdns/dnsbackend.cc
pdns/dnsbackend.hh
pdns/dnsname.cc
pdns/dnsname.hh
pdns/dnspacket.hh
pdns/dnsrecords.hh
pdns/dnssecinfra.hh
pdns/dnsseckeeper.hh
pdns/dnssecsigner.cc
pdns/dynhandler.cc
pdns/ixfrdist-stats.hh
pdns/ixfrdist.cc
pdns/ixfrutils.cc
pdns/ixfrutils.hh
pdns/ixplore.cc
pdns/lua-record.cc
pdns/misc.hh
pdns/nsecrecords.cc
pdns/pdnsutil.cc
pdns/rcpgenerator.cc
pdns/rcpgenerator.hh
pdns/serialtweaker.cc
pdns/signingpipe.cc
pdns/signingpipe.hh
pdns/tcpreceiver.cc
pdns/test-auth-zonecache_cc.cc
pdns/test-bindparser_cc.cc
pdns/test-communicator_hh.cc
pdns/test-ueberbackend_cc.cc
pdns/test-zonemd_cc.cc
pdns/test-zoneparser_tng_cc.cc
pdns/tkey.cc
pdns/tsig-tests.cc
pdns/ueberbackend.cc
pdns/ueberbackend.hh
pdns/ws-api.cc
pdns/ws-api.hh
pdns/ws-auth.cc
pdns/zone2json.cc
pdns/zone2ldap.cc
pdns/zone2sql.cc
pdns/zonemd.hh
pdns/zoneparser-tng.cc
pdns/zoneparser-tng.hh

index 3c9b5409d7d61c2bbe824a402244140ff68e3482..7caf87b500b5447bf16a3b50d3b0ec62036dcc80 100644 (file)
@@ -142,7 +142,7 @@ bool Bind2Backend::safeGetBBDomainInfo(int id, BB2DomainInfo* bbd)
   return true;
 }
 
-bool Bind2Backend::safeGetBBDomainInfo(const DNSName& name, BB2DomainInfo* bbd)
+bool Bind2Backend::safeGetBBDomainInfo(const ZoneName& name, BB2DomainInfo* bbd)
 {
   auto state = s_state.read_lock();
   const auto& nameindex = boost::multi_index::get<NameTag>(*state);
@@ -154,7 +154,7 @@ bool Bind2Backend::safeGetBBDomainInfo(const DNSName& name, BB2DomainInfo* bbd)
   return true;
 }
 
-bool Bind2Backend::safeRemoveBBDomainInfo(const DNSName& name)
+bool Bind2Backend::safeRemoveBBDomainInfo(const ZoneName& name)
 {
   auto state = s_state.write_lock();
   using nameindex_t = state_t::index<NameTag>::type;
@@ -202,7 +202,7 @@ void Bind2Backend::setFresh(uint32_t domain_id)
   setLastCheck(domain_id, time(nullptr));
 }
 
-bool Bind2Backend::startTransaction(const DNSName& qname, int id)
+bool Bind2Backend::startTransaction(const ZoneName& qname, int id)
 {
   if (id < 0) {
     d_transaction_tmpname.clear();
@@ -436,7 +436,7 @@ void Bind2Backend::getUnfreshSecondaryInfos(vector<DomainInfo>* unfreshDomains)
   }
 }
 
-bool Bind2Backend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial)
+bool Bind2Backend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial)
 {
   BB2DomainInfo bbd;
   if (!safeGetBBDomainInfo(domain, &bbd))
@@ -464,7 +464,7 @@ bool Bind2Backend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool get
   return true;
 }
 
-void Bind2Backend::alsoNotifies(const DNSName& domain, set<string>* ips)
+void Bind2Backend::alsoNotifies(const ZoneName& domain, set<string>* ips)
 {
   // combine global list with local list
   for (const auto& i : this->alsoNotify) {
@@ -525,7 +525,7 @@ void Bind2Backend::parseZoneFile(BB2DomainInfo* bbd)
 
 /** THIS IS AN INTERNAL FUNCTION! It does moadnsparser prio impedance matching
     Much of the complication is due to the efforts to benefit from std::string reference counting copy on write semantics */
-void Bind2Backend::insertRecord(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, const DNSName& qname, const QType& qtype, const string& content, int ttl, const std::string& hashed, bool* auth)
+void Bind2Backend::insertRecord(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, const DNSName& qname, const QType& qtype, const string& content, int ttl, const std::string& hashed, bool* auth)
 {
   Bind2DNSRecord bdr;
   bdr.qname = qname;
@@ -569,7 +569,7 @@ string Bind2Backend::DLReloadNowHandler(const vector<string>& parts, Utility::pi
 
   for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
     BB2DomainInfo bbd;
-    DNSName zone(*i);
+    ZoneName zone(*i);
     if (safeGetBBDomainInfo(zone, &bbd)) {
       Bind2Backend bb2;
       bb2.queueReloadAndStore(bbd.d_id);
@@ -595,7 +595,7 @@ string Bind2Backend::DLDomStatusHandler(const vector<string>& parts, Utility::pi
   if (parts.size() > 1) {
     for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
       BB2DomainInfo bbd;
-      if (safeGetBBDomainInfo(DNSName(*i), &bbd)) {
+      if (safeGetBBDomainInfo(ZoneName(*i), &bbd)) {
         ret << *i << ": " << (bbd.d_loaded ? "" : "[rejected]") << "\t" << bbd.d_status << "\n";
       }
       else {
@@ -657,7 +657,7 @@ string Bind2Backend::DLDomExtendedStatusHandler(const vector<string>& parts, Uti
   if (parts.size() > 1) {
     for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
       BB2DomainInfo bbd;
-      if (safeGetBBDomainInfo(DNSName(*i), &bbd)) {
+      if (safeGetBBDomainInfo(ZoneName(*i), &bbd)) {
         printDomainExtendedStatus(ret, bbd);
       }
       else {
@@ -695,7 +695,7 @@ string Bind2Backend::DLAddDomainHandler(const vector<string>& parts, Utility::pi
   if (parts.size() < 3)
     return "ERROR: Domain name and zone filename are required";
 
-  DNSName domainname(parts[1]);
+  ZoneName domainname(parts[1]);
   const string& filename = parts[2];
   BB2DomainInfo bbd;
   if (safeGetBBDomainInfo(domainname, &bbd))
@@ -793,7 +793,7 @@ void Bind2Backend::reload()
   }
 }
 
-void Bind2Backend::fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
+void Bind2Backend::fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
 {
   bool skip;
   DNSName shorter;
@@ -831,7 +831,7 @@ void Bind2Backend::fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records,
   }
 }
 
-void Bind2Backend::doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
+void Bind2Backend::doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
 {
   bool auth = false;
   DNSName shorter;
@@ -905,7 +905,8 @@ void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cog
 
     g_log << Logger::Warning << d_logprefix << " Parsing " << domains.size() << " domain(s), will report when done" << endl;
 
-    set<DNSName> oldnames, newnames;
+    set<ZoneName> oldnames;
+    set<ZoneName> newnames;
     {
       auto state = s_state.read_lock();
       for (const BB2DomainInfo& bbd : *state) {
@@ -1019,12 +1020,12 @@ void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cog
         safePutBBDomainInfo(bbd);
       }
     }
-    vector<DNSName> diff;
+    vector<ZoneName> diff;
 
     set_difference(oldnames.begin(), oldnames.end(), newnames.begin(), newnames.end(), back_inserter(diff));
     unsigned int remdomains = diff.size();
 
-    for (const DNSName& name : diff) {
+    for (const ZoneName& name : diff) {
       safeRemoveBBDomainInfo(name);
     }
 
@@ -1155,7 +1156,7 @@ void Bind2Backend::lookup(const QType& qtype, const DNSName& qname, int zoneId,
   static bool mustlog = ::arg().mustDo("query-logging");
 
   bool found = false;
-  DNSName domain;
+  ZoneName domain;
   BB2DomainInfo bbd;
 
   if (mustlog)
@@ -1290,7 +1291,7 @@ bool Bind2Backend::handle::get_normal(DNSResourceRecord& r)
   return true;
 }
 
-bool Bind2Backend::list(const DNSName& /* target */, int id, bool /* include_disabled */)
+bool Bind2Backend::list(const ZoneName& /* target */, int id, bool /* include_disabled */)
 {
   BB2DomainInfo bbd;
 
@@ -1354,7 +1355,7 @@ bool Bind2Backend::autoPrimariesList(std::vector<AutoPrimary>& primaries)
   return true;
 }
 
-bool Bind2Backend::autoPrimaryBackend(const string& ip, const DNSName& /* domain */, const vector<DNSResourceRecord>& /* nsset */, string* /* nameserver */, string* account, DNSBackend** db)
+bool Bind2Backend::autoPrimaryBackend(const string& ip, const ZoneName& /* domain */, const vector<DNSResourceRecord>& /* nsset */, string* /* nameserver */, string* account, DNSBackend** db)
 {
   // Check whether we have a configfile available.
   if (getArg("autoprimary-config").empty())
@@ -1390,7 +1391,7 @@ bool Bind2Backend::autoPrimaryBackend(const string& ip, const DNSName& /* domain
   return true;
 }
 
-BB2DomainInfo Bind2Backend::createDomainEntry(const DNSName& domain, const string& filename)
+BB2DomainInfo Bind2Backend::createDomainEntry(const ZoneName& domain, const string& filename)
 {
   int newid = 1;
   { // Find a free zone id nr.
@@ -1413,7 +1414,7 @@ BB2DomainInfo Bind2Backend::createDomainEntry(const DNSName& domain, const strin
   return bbd;
 }
 
-bool Bind2Backend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& /* nameserver */, const string& account)
+bool Bind2Backend::createSecondaryDomain(const string& ip, const ZoneName& domain, const string& /* nameserver */, const string& account)
 {
   string filename = getArg("autoprimary-destdir") + '/' + domain.toStringNoDot();
 
index 9fee22400488e59ed499f10d8fe94a05dc4f394e..8b0adb2d8cb227929b1ba63f877f0382f31ff3a5 100644 (file)
@@ -147,7 +147,7 @@ public:
     return d_checkinterval;
   }
 
-  DNSName d_name; //!< actual name of the domain
+  ZoneName d_name; //!< actual name of the domain
   DomainInfo::DomainKind d_kind{DomainInfo::Native}; //!< the kind of domain
   string d_filename; //!< full absolute filename of the zone on disk
   string d_status; //!< message describing status of a domain, for human consumption
@@ -184,12 +184,12 @@ public:
   unsigned int getCapabilities() override;
   void getUnfreshSecondaryInfos(vector<DomainInfo>* unfreshDomains) override;
   void getUpdatedPrimaries(vector<DomainInfo>& changedDomains, std::unordered_set<DNSName>& catalogs, CatalogHashMap& catalogHashes) override;
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial = true) override;
   time_t getCtime(const string& fname);
   // DNSSEC
   bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override;
   void lookup(const QType&, const DNSName& qdomain, int zoneId, DNSPacket* p = nullptr) override;
-  bool list(const DNSName& target, int id, bool include_disabled = false) override;
+  bool list(const ZoneName& target, int id, bool include_disabled = false) override;
   bool get(DNSResourceRecord&) override;
   void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled = false) override;
 
@@ -199,24 +199,24 @@ public:
   void setStale(uint32_t domain_id) override;
   void setFresh(uint32_t domain_id) override;
   void setNotified(uint32_t id, uint32_t serial) override;
-  bool startTransaction(const DNSName& qname, int id) override;
+  bool startTransaction(const ZoneName& qname, int id) override;
   bool feedRecord(const DNSResourceRecord& rr, const DNSName& ordername, bool ordernameIsNSEC3 = false) override;
   bool commitTransaction() override;
   bool abortTransaction() override;
-  void alsoNotifies(const DNSName& domain, set<string>* ips) override;
+  void alsoNotifies(const ZoneName& domain, set<string>* ips) override;
   bool searchRecords(const string& pattern, size_t maxResults, vector<DNSResourceRecord>& result) override;
 
   // the DNSSEC related (getDomainMetadata has broader uses too)
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta) override;
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override;
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta) override;
-  bool getDomainKeys(const DNSName& name, std::vector<KeyData>& keys) override;
-  bool removeDomainKey(const DNSName& name, unsigned int id) override;
-  bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
-  bool activateDomainKey(const DNSName& name, unsigned int id) override;
-  bool deactivateDomainKey(const DNSName& name, unsigned int id) override;
-  bool publishDomainKey(const DNSName& name, unsigned int id) override;
-  bool unpublishDomainKey(const DNSName& name, unsigned int id) override;
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override;
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override;
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta) override;
+  bool getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys) override;
+  bool removeDomainKey(const ZoneName& name, unsigned int id) override;
+  bool addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id) override;
+  bool activateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool deactivateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool publishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool unpublishDomainKey(const ZoneName& name, unsigned int id) override;
   bool getTSIGKey(const DNSName& name, DNSName& algorithm, string& content) override;
   bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override;
   bool deleteTSIGKey(const DNSName& name) override;
@@ -225,7 +225,7 @@ public:
 
   typedef multi_index_container<BB2DomainInfo,
                                 indexed_by<ordered_unique<member<BB2DomainInfo, unsigned int, &BB2DomainInfo::d_id>>,
-                                           ordered_unique<tag<NameTag>, member<BB2DomainInfo, DNSName, &BB2DomainInfo::d_name>>>>
+                                           ordered_unique<tag<NameTag>, member<BB2DomainInfo, ZoneName, &BB2DomainInfo::d_name>>>>
     state_t;
   static SharedLockGuarded<state_t> s_state;
 
@@ -234,9 +234,9 @@ public:
 
   // for autoprimary support
   bool autoPrimariesList(std::vector<AutoPrimary>& primaries) override;
-  bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** db) override;
+  bool autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** db) override;
   static std::mutex s_autosecondary_config_lock;
-  bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override;
+  bool createSecondaryDomain(const string& ip, const ZoneName& domain, const string& nameserver, const string& account) override;
 
 private:
   void setupDNSSEC();
@@ -244,12 +244,12 @@ private:
   void freeStatements();
   static bool safeGetBBDomainInfo(int id, BB2DomainInfo* bbd);
   static void safePutBBDomainInfo(const BB2DomainInfo& bbd);
-  static bool safeGetBBDomainInfo(const DNSName& name, BB2DomainInfo* bbd);
-  static bool safeRemoveBBDomainInfo(const DNSName& name);
+  static bool safeGetBBDomainInfo(const ZoneName& name, BB2DomainInfo* bbd);
+  static bool safeRemoveBBDomainInfo(const ZoneName& name);
   shared_ptr<SSQLite3> d_dnssecdb;
-  bool getNSEC3PARAM(const DNSName& name, NSEC3PARAMRecordContent* ns3p);
+  bool getNSEC3PARAM(const ZoneName& name, NSEC3PARAMRecordContent* ns3p);
   void setLastCheck(uint32_t domain_id, time_t lastcheck);
-  bool getNSEC3PARAMuncached(const DNSName& name, NSEC3PARAMRecordContent* ns3p);
+  bool getNSEC3PARAMuncached(const ZoneName& name, NSEC3PARAMRecordContent* ns3p);
   class handle
   {
   public:
@@ -267,7 +267,7 @@ private:
     recordstorage_t::const_iterator d_qname_iter, d_qname_end;
 
     DNSName qname;
-    DNSName domain;
+    ZoneName domain;
 
     int id{-1};
     QType qtype;
@@ -296,7 +296,7 @@ private:
   unique_ptr<SSqlStatement> d_deleteTSIGKeyQuery_stmt;
   unique_ptr<SSqlStatement> d_getTSIGKeysQuery_stmt;
 
-  DNSName d_transaction_qname;
+  ZoneName d_transaction_qname;
   string d_transaction_tmpname;
   string d_logprefix;
   set<string> alsoNotify; //!< this is used to store the also-notify list of interested peers.
@@ -309,18 +309,18 @@ private:
   bool d_hybrid;
   bool d_upgradeContent;
 
-  BB2DomainInfo createDomainEntry(const DNSName& domain, const string& filename); //!< does not insert in s_state
+  BB2DomainInfo createDomainEntry(const ZoneName& domain, const string& filename); //!< does not insert in s_state
 
   void queueReloadAndStore(unsigned int id);
   static bool findBeforeAndAfterUnhashed(std::shared_ptr<const recordstorage_t>& records, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after);
-  static void insertRecord(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, const DNSName& qname, const QType& qtype, const string& content, int ttl, const std::string& hashed = string(), bool* auth = nullptr);
+  static void insertRecord(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, const DNSName& qname, const QType& qtype, const string& content, int ttl, const std::string& hashed = string(), bool* auth = nullptr);
   void reload() override;
   static string DLDomStatusHandler(const vector<string>& parts, Utility::pid_t ppid);
   static string DLDomExtendedStatusHandler(const vector<string>& parts, Utility::pid_t ppid);
   static string DLListRejectsHandler(const vector<string>& parts, Utility::pid_t ppid);
   static string DLReloadNowHandler(const vector<string>& parts, Utility::pid_t ppid);
   static string DLAddDomainHandler(const vector<string>& parts, Utility::pid_t ppid);
-  static void fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr);
-  static void doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records, const DNSName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr);
+  static void fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr);
+  static void doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr);
   void loadConfig(string* status = nullptr);
 };
index 8bd46b5f8be0435780946e15b4c6541ccd124d7c..4e3ce26072be48c159ba3f77a3bd43eb105e9142 100644 (file)
@@ -45,62 +45,62 @@ unsigned int Bind2Backend::getCapabilities()
   return caps;
 }
 
-bool Bind2Backend::getNSEC3PARAM(const DNSName& /* name */, NSEC3PARAMRecordContent* /* ns3p */)
+bool Bind2Backend::getNSEC3PARAM(const ZoneName& /* name */, NSEC3PARAMRecordContent* /* ns3p */)
 {
   return false;
 }
 
-bool Bind2Backend::getNSEC3PARAMuncached(const DNSName& /* name */, NSEC3PARAMRecordContent* /* ns3p */)
+bool Bind2Backend::getNSEC3PARAMuncached(const ZoneName& /* name */, NSEC3PARAMRecordContent* /* ns3p */)
 {
   return false;
 }
 
-bool Bind2Backend::getAllDomainMetadata(const DNSName& /* name */, std::map<std::string, std::vector<std::string>>& /* meta */)
+bool Bind2Backend::getAllDomainMetadata(const ZoneName& /* name */, std::map<std::string, std::vector<std::string>>& /* meta */)
 {
   return false;
 }
 
-bool Bind2Backend::getDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */)
+bool Bind2Backend::getDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */)
 {
   return false;
 }
 
-bool Bind2Backend::setDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */)
+bool Bind2Backend::setDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */)
 {
   return false;
 }
 
-bool Bind2Backend::getDomainKeys(const DNSName& /* name */, std::vector<KeyData>& /* keys */)
+bool Bind2Backend::getDomainKeys(const ZoneName& /* name */, std::vector<KeyData>& /* keys */)
 {
   return false;
 }
 
-bool Bind2Backend::removeDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool Bind2Backend::removeDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool Bind2Backend::addDomainKey(const DNSName& /* name */, const KeyData& /* key */, int64_t& /* id */)
+bool Bind2Backend::addDomainKey(const ZoneName& /* name */, const KeyData& /* key */, int64_t& /* id */)
 {
   return false;
 }
 
-bool Bind2Backend::activateDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool Bind2Backend::activateDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool Bind2Backend::deactivateDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool Bind2Backend::deactivateDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool Bind2Backend::publishDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool Bind2Backend::publishDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool Bind2Backend::unpublishDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool Bind2Backend::unpublishDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
@@ -210,7 +210,7 @@ unsigned int Bind2Backend::getCapabilities()
   return caps;
 }
 
-bool Bind2Backend::getNSEC3PARAM(const DNSName& name, NSEC3PARAMRecordContent* ns3p)
+bool Bind2Backend::getNSEC3PARAM(const ZoneName& name, NSEC3PARAMRecordContent* ns3p)
 {
   BB2DomainInfo bbd;
   if (!safeGetBBDomainInfo(name, &bbd))
@@ -223,7 +223,7 @@ bool Bind2Backend::getNSEC3PARAM(const DNSName& name, NSEC3PARAMRecordContent* n
   return bbd.d_nsec3zone;
 }
 
-bool Bind2Backend::getNSEC3PARAMuncached(const DNSName& name, NSEC3PARAMRecordContent* ns3p)
+bool Bind2Backend::getNSEC3PARAMuncached(const ZoneName& name, NSEC3PARAMRecordContent* ns3p)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -255,7 +255,7 @@ bool Bind2Backend::getNSEC3PARAMuncached(const DNSName& name, NSEC3PARAMRecordCo
   return true;
 }
 
-bool Bind2Backend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
+bool Bind2Backend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -277,7 +277,7 @@ bool Bind2Backend::getAllDomainMetadata(const DNSName& name, std::map<std::strin
   return true;
 }
 
-bool Bind2Backend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
+bool Bind2Backend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -299,7 +299,7 @@ bool Bind2Backend::getDomainMetadata(const DNSName& name, const std::string& kin
   return true;
 }
 
-bool Bind2Backend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
+bool Bind2Backend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -318,7 +318,7 @@ bool Bind2Backend::setDomainMetadata(const DNSName& name, const std::string& kin
   return true;
 }
 
-bool Bind2Backend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
+bool Bind2Backend::getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -346,7 +346,7 @@ bool Bind2Backend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys
   return true;
 }
 
-bool Bind2Backend::removeDomainKey(const DNSName& name, unsigned int id)
+bool Bind2Backend::removeDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -360,7 +360,7 @@ bool Bind2Backend::removeDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool Bind2Backend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id)
+bool Bind2Backend::addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -395,7 +395,7 @@ bool Bind2Backend::addDomainKey(const DNSName& name, const KeyData& key, int64_t
   }
 }
 
-bool Bind2Backend::activateDomainKey(const DNSName& name, unsigned int id)
+bool Bind2Backend::activateDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -409,7 +409,7 @@ bool Bind2Backend::activateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool Bind2Backend::deactivateDomainKey(const DNSName& name, unsigned int id)
+bool Bind2Backend::deactivateDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -423,7 +423,7 @@ bool Bind2Backend::deactivateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool Bind2Backend::publishDomainKey(const DNSName& name, unsigned int id)
+bool Bind2Backend::publishDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
@@ -437,7 +437,7 @@ bool Bind2Backend::publishDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool Bind2Backend::unpublishDomainKey(const DNSName& name, unsigned int id)
+bool Bind2Backend::unpublishDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssecdb || d_hybrid)
     return false;
index f8781e28110f4ae0a53be640e4128be477fc7a57..60e9b2361121caaa36bb236d7813ff112f1d50fd 100644 (file)
@@ -57,7 +57,7 @@ struct GeoIPService
 struct GeoIPDomain
 {
   std::uint32_t id{};
-  DNSName domain;
+  ZoneName domain;
   int ttl{};
   map<DNSName, GeoIPService> services;
   map<DNSName, vector<GeoIPDNSResourceRecord>> records;
@@ -903,7 +903,7 @@ void GeoIPBackend::rediscover(string* /* status */)
   reload();
 }
 
-bool GeoIPBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* getSerial */)
+bool GeoIPBackend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool /* getSerial */)
 {
   ReadLock rl(&s_state_lock);
 
@@ -939,7 +939,7 @@ void GeoIPBackend::getAllDomains(vector<DomainInfo>* domains, bool /* getSerial
   }
 }
 
-bool GeoIPBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
+bool GeoIPBackend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   if (!d_dnssec)
     return false;
@@ -957,7 +957,7 @@ bool GeoIPBackend::getAllDomainMetadata(const DNSName& name, std::map<std::strin
   return false;
 }
 
-bool GeoIPBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
+bool GeoIPBackend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta)
 {
   if (!d_dnssec)
     return false;
@@ -977,7 +977,7 @@ bool GeoIPBackend::getDomainMetadata(const DNSName& name, const std::string& kin
   return false;
 }
 
-bool GeoIPBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys)
+bool GeoIPBackend::getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys)
 {
   if (!d_dnssec)
     return false;
@@ -1021,7 +1021,7 @@ bool GeoIPBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::Ke
   return false;
 }
 
-bool GeoIPBackend::removeDomainKey(const DNSName& name, unsigned int id)
+bool GeoIPBackend::removeDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssec)
     return false;
@@ -1057,7 +1057,7 @@ bool GeoIPBackend::removeDomainKey(const DNSName& name, unsigned int id)
   return false;
 }
 
-bool GeoIPBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id)
+bool GeoIPBackend::addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id)
 {
   if (!d_dnssec)
     return false;
@@ -1095,7 +1095,7 @@ bool GeoIPBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t
   return false;
 }
 
-bool GeoIPBackend::activateDomainKey(const DNSName& name, unsigned int id)
+bool GeoIPBackend::activateDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssec)
     return false;
@@ -1130,7 +1130,7 @@ bool GeoIPBackend::activateDomainKey(const DNSName& name, unsigned int id)
   return false;
 }
 
-bool GeoIPBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
+bool GeoIPBackend::deactivateDomainKey(const ZoneName& name, unsigned int id)
 {
   if (!d_dnssec)
     return false;
@@ -1165,17 +1165,17 @@ bool GeoIPBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
   return false;
 }
 
-bool GeoIPBackend::publishDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool GeoIPBackend::publishDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool GeoIPBackend::unpublishDomainKey(const DNSName& /* name */, unsigned int /* id */)
+bool GeoIPBackend::unpublishDomainKey(const ZoneName& /* name */, unsigned int /* id */)
 {
   return false;
 }
 
-bool GeoIPBackend::hasDNSSECkey(const DNSName& name)
+bool GeoIPBackend::hasDNSSECkey(const ZoneName& name)
 {
   ostringstream pathname;
   pathname << getArg("dnssec-keydir") << "/" << name.toStringNoDot() << "*.key";
index d21aadf2147c67956df2d625eb52919dd5b68611..9275d05f0c6beda6467fce2bc4d53e6ff4d2db67 100644 (file)
@@ -65,23 +65,23 @@ public:
   }
 
   void lookup(const QType& qtype, const DNSName& qdomain, int zoneId, DNSPacket* pkt_p = nullptr) override;
-  bool list(const DNSName& /* target */, int /* domain_id */, bool /* include_disabled */ = false) override { return false; } // not supported
+  bool list(const ZoneName& /* target */, int /* domain_id */, bool /* include_disabled */ = false) override { return false; } // not supported
   bool get(DNSResourceRecord& r) override;
   void reload() override;
   void rediscover(string* status = nullptr) override;
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial = true) override;
   void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled) override;
 
   // dnssec support
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta) override;
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override;
-  bool getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys) override;
-  bool removeDomainKey(const DNSName& name, unsigned int id) override;
-  bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
-  bool activateDomainKey(const DNSName& name, unsigned int id) override;
-  bool deactivateDomainKey(const DNSName& name, unsigned int id) override;
-  bool publishDomainKey(const DNSName& name, unsigned int id) override;
-  bool unpublishDomainKey(const DNSName& name, unsigned int id) override;
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override;
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override;
+  bool getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys) override;
+  bool removeDomainKey(const ZoneName& name, unsigned int id) override;
+  bool addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id) override;
+  bool activateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool deactivateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool publishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool unpublishDomainKey(const ZoneName& name, unsigned int id) override;
 
 private:
   static ReadWriteLock s_state_lock;
@@ -89,7 +89,7 @@ private:
   void initialize();
   string format2str(string format, const Netmask& addr, GeoIPNetmask& gl, const GeoIPDomain& dom);
   bool d_dnssec{};
-  bool hasDNSSECkey(const DNSName& name);
+  bool hasDNSSECkey(const ZoneName& name);
   bool lookup_static(const GeoIPDomain& dom, const DNSName& search, const QType& qtype, const DNSName& qdomain, const Netmask& addr, GeoIPNetmask& gl);
   void setupNetmasks(const YAML::Node& domain, GeoIPDomain& dom);
   bool loadDomain(const YAML::Node& domain, std::uint32_t domainID, GeoIPDomain& dom);
index 77cab28fc299b91ad9b4fa0960ec7a5ceb5906d6..b6209b2496ddc796e6307cb462e2cbea06f29682 100644 (file)
@@ -142,11 +142,11 @@ class LdapBackend : public DNSBackend
   PowerLDAP* d_pldap;
   LdapAuthenticator* d_authenticator;
 
-  bool (LdapBackend::*d_list_fcnt)(const DNSName&, int);
+  bool (LdapBackend::*d_list_fcnt)(const ZoneName&, int);
   void (LdapBackend::*d_lookup_fcnt)(const QType&, const DNSName&, DNSPacket*, int);
 
-  bool list_simple(const DNSName& target, int domain_id);
-  bool list_strict(const DNSName& target, int domain_id);
+  bool list_simple(const ZoneName& target, int domain_id);
+  bool list_strict(const ZoneName& target, int domain_id);
 
   void lookup_simple(const QType& qtype, const DNSName& qdomain, DNSPacket* p, int zoneid);
   void lookup_strict(const QType& qtype, const DNSName& qdomain, DNSPacket* p, int zoneid);
@@ -171,11 +171,11 @@ public:
 
   // Native backend
   unsigned int getCapabilities() override { return CAP_LIST; }
-  bool list(const DNSName& target, int domain_id, bool include_disabled = false) override;
+  bool list(const ZoneName& target, int domain_id, bool include_disabled = false) override;
   void lookup(const QType& qtype, const DNSName& qdomain, int zoneid, DNSPacket* p = nullptr) override;
   bool get(DNSResourceRecord& rr) override;
 
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial = true) override;
 
   // Primary backend
   void getUpdatedPrimaries(vector<DomainInfo>& domains, std::unordered_set<DNSName>& catalogs, CatalogHashMap& catalogHashes) override;
index 48421ea99ce474353d753f31fd19a26d9809e64a..6373b7c64b6d84d8cf8bdc88b4ca68c860c86640 100644 (file)
@@ -24,7 +24,7 @@
 #include "ldapbackend.hh"
 #include <cstdlib>
 
-bool LdapBackend::list(const DNSName& target, int domain_id, bool /* include_disabled */)
+bool LdapBackend::list(const ZoneName& target, int domain_id, bool /* include_disabled */)
 {
   try {
     d_in_list = true;
@@ -57,7 +57,7 @@ bool LdapBackend::list(const DNSName& target, int domain_id, bool /* include_dis
   return false;
 }
 
-bool LdapBackend::list_simple(const DNSName& target, int /* domain_id */)
+bool LdapBackend::list_simple(const ZoneName& target, int /* domain_id */)
 {
   string dn;
   string filter;
@@ -92,7 +92,7 @@ bool LdapBackend::list_simple(const DNSName& target, int /* domain_id */)
   return true;
 }
 
-bool LdapBackend::list_strict(const DNSName& target, int domain_id)
+bool LdapBackend::list_strict(const ZoneName& target, int domain_id)
 {
   if (target.isPartOf(DNSName("in-addr.arpa")) || target.isPartOf(DNSName("ip6.arpa"))) {
     g_log << Logger::Warning << d_myname << " Request for reverse zone AXFR, but this is not supported in strict mode" << endl;
@@ -318,7 +318,7 @@ bool LdapBackend::get(DNSResourceRecord& rr)
   return true;
 }
 
-bool LdapBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* getSerial */)
+bool LdapBackend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool /* getSerial */)
 {
   string filter;
   SOAData sd;
@@ -369,7 +369,7 @@ bool LdapBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* g
       di.id = 0;
 
     di.serial = sd.serial;
-    di.zone = DNSName(domain);
+    di.zone = domain;
 
     if (result.count("PdnsDomainLastCheck") && !result["PdnsDomainLastCheck"].empty())
       pdns::checked_stoi_into(di.last_check, result["PdnsDomainLastCheck"][0]);
index 13c112d14fef73314428b4fbb44c6ca5c7617c02..ddee33b611dd77fdcd113a6deb92e2188d33417b 100644 (file)
@@ -62,7 +62,7 @@ void LdapBackend::getUpdatedPrimaries(vector<DomainInfo>& domains, std::unordere
       continue;
 
     DomainInfo di;
-    if (!getDomainInfo(DNSName(result["associatedDomain"][0]), di))
+    if (!getDomainInfo(ZoneName(result["associatedDomain"][0]), di))
       continue;
 
     if (di.notified_serial < di.serial)
index e67ceceb5fb7dde391ef77a3f2b86d4dc72dbc92..da492110fe0babbf7b8c9afedd202bbf9bbfcf7d 100644 (file)
@@ -1074,7 +1074,7 @@ void LMDBBackend::deleteDomainRecords(RecordsRWTransaction& txn, uint32_t domain
 
 */
 
-bool LMDBBackend::startTransaction(const DNSName& domain, int domain_id)
+bool LMDBBackend::startTransaction(const ZoneName& domain, int domain_id)
 {
   // cout <<"startTransaction("<<domain<<", "<<domain_id<<")"<<endl;
   int real_id = domain_id;
@@ -1371,14 +1371,14 @@ bool LMDBBackend::upgradeToSchemav3()
 }
 #endif
 
-bool LMDBBackend::deleteDomain(const DNSName& domain)
+bool LMDBBackend::deleteDomain(const ZoneName& domain)
 {
   if (!d_rwtxn) {
     throw DBException(std::string(__PRETTY_FUNCTION__) + " called without a transaction");
   }
 
   int transactionDomainId = d_transactiondomainid;
-  DNSName transactionDomain = d_transactiondomain;
+  ZoneName transactionDomain = d_transactiondomain;
 
   abortTransaction();
 
@@ -1444,7 +1444,7 @@ bool LMDBBackend::deleteDomain(const DNSName& domain)
   return true;
 }
 
-bool LMDBBackend::list(const DNSName& target, int /* id */, bool include_disabled)
+bool LMDBBackend::list(const ZoneName& target, int /* id */, bool include_disabled)
 {
   d_includedisabled = include_disabled;
 
@@ -1655,7 +1655,7 @@ bool LMDBBackend::getSerial(DomainInfo& di)
   return false;
 }
 
-bool LMDBBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool getserial)
+bool LMDBBackend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getserial)
 {
   {
     auto txn = d_tdomains->getROTransaction();
@@ -1686,7 +1686,7 @@ bool LMDBBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool gets
   return true;
 }
 
-int LMDBBackend::genChangeDomain(const DNSName& domain, const std::function<void(DomainInfo&)>& func)
+int LMDBBackend::genChangeDomain(const ZoneName& domain, const std::function<void(DomainInfo&)>& func)
 {
   auto txn = d_tdomains->getRWTransaction();
 
@@ -1717,28 +1717,28 @@ int LMDBBackend::genChangeDomain(uint32_t id, const std::function<void(DomainInf
   return true;
 }
 
-bool LMDBBackend::setKind(const DNSName& domain, const DomainInfo::DomainKind kind)
+bool LMDBBackend::setKind(const ZoneName& domain, const DomainInfo::DomainKind kind)
 {
   return genChangeDomain(domain, [kind](DomainInfo& di) {
     di.kind = kind;
   });
 }
 
-bool LMDBBackend::setAccount(const DNSName& domain, const std::string& account)
+bool LMDBBackend::setAccount(const ZoneName& domain, const std::string& account)
 {
   return genChangeDomain(domain, [account](DomainInfo& di) {
     di.account = account;
   });
 }
 
-bool LMDBBackend::setPrimaries(const DNSName& domain, const vector<ComboAddress>& primaries)
+bool LMDBBackend::setPrimaries(const ZoneName& domain, const vector<ComboAddress>& primaries)
 {
   return genChangeDomain(domain, [&primaries](DomainInfo& di) {
     di.primaries = primaries;
   });
 }
 
-bool LMDBBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
+bool LMDBBackend::createDomain(const ZoneName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
 {
   DomainInfo di;
 
@@ -1764,8 +1764,8 @@ void LMDBBackend::getAllDomainsFiltered(vector<DomainInfo>* domains, const std::
 {
   auto txn = d_tdomains->getROTransaction();
   if (d_handle_dups) {
-    map<DNSName, DomainInfo> zonemap;
-    set<DNSName> dups;
+    map<ZoneName, DomainInfo> zonemap;
+    set<ZoneName> dups;
 
     for (auto iter = txn.begin(); iter != txn.end(); ++iter) {
       DomainInfo di = *iter;
@@ -1910,7 +1910,7 @@ public:
     std::runtime_error("getCatalogMembers should return false") {}
 };
 
-bool LMDBBackend::getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type)
+bool LMDBBackend::getCatalogMembers(const ZoneName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type)
 {
   vector<DomainInfo> scratch;
 
@@ -1943,21 +1943,21 @@ bool LMDBBackend::getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>&
   return true;
 }
 
-bool LMDBBackend::setOptions(const DNSName& domain, const std::string& options)
+bool LMDBBackend::setOptions(const ZoneName& domain, const std::string& options)
 {
   return genChangeDomain(domain, [options](DomainInfo& di) {
     di.options = options;
   });
 }
 
-bool LMDBBackend::setCatalog(const DNSName& domain, const DNSName& catalog)
+bool LMDBBackend::setCatalog(const ZoneName& domain, const ZoneName& catalog)
 {
   return genChangeDomain(domain, [catalog](DomainInfo& di) {
     di.catalog = catalog;
   });
 }
 
-bool LMDBBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
+bool LMDBBackend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   meta.clear();
   auto txn = d_tmeta->getROTransaction();
@@ -1974,7 +1974,7 @@ bool LMDBBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string
   return true;
 }
 
-bool LMDBBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
+bool LMDBBackend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta)
 {
   auto txn = d_tmeta->getRWTransaction();
 
@@ -1999,7 +1999,7 @@ bool LMDBBackend::setDomainMetadata(const DNSName& name, const std::string& kind
   return true;
 }
 
-bool LMDBBackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
+bool LMDBBackend::getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys)
 {
   auto txn = d_tkdb->getROTransaction();
   LmdbIdVec ids;
@@ -2017,7 +2017,7 @@ bool LMDBBackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
   return true;
 }
 
-bool LMDBBackend::removeDomainKey(const DNSName& name, unsigned int id)
+bool LMDBBackend::removeDomainKey(const ZoneName& name, unsigned int id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb;
@@ -2032,7 +2032,7 @@ bool LMDBBackend::removeDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool LMDBBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id)
+bool LMDBBackend::addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb{name, key.content, key.flags, key.active, key.published};
@@ -2042,7 +2042,7 @@ bool LMDBBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t&
   return true;
 }
 
-bool LMDBBackend::activateDomainKey(const DNSName& name, unsigned int id)
+bool LMDBBackend::activateDomainKey(const ZoneName& name, unsigned int id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb;
@@ -2060,7 +2060,7 @@ bool LMDBBackend::activateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool LMDBBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
+bool LMDBBackend::deactivateDomainKey(const ZoneName& name, unsigned int id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb;
@@ -2077,7 +2077,7 @@ bool LMDBBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool LMDBBackend::publishDomainKey(const DNSName& name, unsigned int id)
+bool LMDBBackend::publishDomainKey(const ZoneName& name, unsigned int id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb;
@@ -2095,7 +2095,7 @@ bool LMDBBackend::publishDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool LMDBBackend::unpublishDomainKey(const DNSName& name, unsigned int id)
+bool LMDBBackend::unpublishDomainKey(const ZoneName& name, unsigned int id)
 {
   auto txn = d_tkdb->getRWTransaction();
   KeyDataDB kdb;
@@ -2331,9 +2331,9 @@ bool LMDBBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qna
   return true;
 }
 
-bool LMDBBackend::getBeforeAndAfterNames(uint32_t id, const DNSName& zonenameU, const DNSName& qname, DNSName& before, DNSName& after)
+bool LMDBBackend::getBeforeAndAfterNames(uint32_t id, const ZoneName& zonenameU, const DNSName& qname, DNSName& before, DNSName& after)
 {
-  DNSName zonename = zonenameU.makeLowerCase();
+  ZoneName zonename = zonenameU.makeLowerCase();
   //  cout << __PRETTY_FUNCTION__<< ": "<<id <<", "<<zonename << ", '"<<qname<<"'"<<endl;
 
   auto txn = getRecordsROTransaction(id);
index e84d0363b4c607aa9d6f0dc7b6215d66273c8517..eb1ae68ea3a182e44f21af8dc701a97d9e808b33 100644 (file)
@@ -32,7 +32,7 @@ std::string keyConv(const T& t)
      nl -> nl0
   */
   if (t.empty()) {
-    throw std::out_of_range(std::string(__PRETTY_FUNCTION__) + " Attempt to serialize an unset dnsname");
+    throw std::out_of_range(std::string(__PRETTY_FUNCTION__) + " Attempt to serialize an unset DNSName");
   }
 
   if (t.isRoot()) {
@@ -63,12 +63,12 @@ public:
   ~LMDBBackend();
 
   unsigned int getCapabilities() override { return CAP_DNSSEC | CAP_DIRECT | CAP_LIST | CAP_CREATE; }
-  bool list(const DNSName& target, int id, bool include_disabled) override;
+  bool list(const ZoneName& target, int id, bool include_disabled) override;
 
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getserial = true) override;
-  bool createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getserial = true) override;
+  bool createDomain(const ZoneName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account) override;
 
-  bool startTransaction(const DNSName& domain, int domain_id = -1) override;
+  bool startTransaction(const ZoneName& domain, int domain_id = -1) override;
   bool commitTransaction() override;
   bool abortTransaction() override;
   bool feedRecord(const DNSResourceRecord& r, const DNSName& ordername, bool ordernameIsNSEC3 = false) override;
@@ -92,14 +92,14 @@ public:
   void setNotified(uint32_t id, uint32_t serial) override;
 
   // catalog zones
-  bool getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type) override;
-  bool setOptions(const DNSName& domain, const std::string& options) override;
-  bool setCatalog(const DNSName& domain, const DNSName& options) override;
-
-  bool setPrimaries(const DNSName& domain, const vector<ComboAddress>& primaries) override;
-  bool setKind(const DNSName& domain, const DomainInfo::DomainKind kind) override;
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta) override;
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override
+  bool getCatalogMembers(const ZoneName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type) override;
+  bool setOptions(const ZoneName& domain, const std::string& options) override;
+  bool setCatalog(const ZoneName& domain, const ZoneName& options) override;
+
+  bool setPrimaries(const ZoneName& domain, const vector<ComboAddress>& primaries) override;
+  bool setKind(const ZoneName& domain, const DomainInfo::DomainKind kind) override;
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override;
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override
   {
     //    std::cout<<"Request for metadata items for zone "<<name<<", kind "<<kind<<endl;
     meta.clear();
@@ -116,17 +116,17 @@ public:
     return false;
   }
 
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta) override;
-  bool setAccount(const DNSName& domain, const std::string& account) override;
-  bool deleteDomain(const DNSName& domain) override;
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta) override;
+  bool setAccount(const ZoneName& domain, const std::string& account) override;
+  bool deleteDomain(const ZoneName& domain) override;
 
-  bool getDomainKeys(const DNSName& name, std::vector<KeyData>& keys) override;
-  bool removeDomainKey(const DNSName& name, unsigned int id) override;
-  bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
-  bool activateDomainKey(const DNSName& name, unsigned int id) override;
-  bool deactivateDomainKey(const DNSName& name, unsigned int id) override;
-  bool publishDomainKey(const DNSName& name, unsigned int id) override;
-  bool unpublishDomainKey(const DNSName& name, unsigned int id) override;
+  bool getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys) override;
+  bool removeDomainKey(const ZoneName& name, unsigned int id) override;
+  bool addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id) override;
+  bool activateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool deactivateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool publishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool unpublishDomainKey(const ZoneName& name, unsigned int id) override;
 
   // TSIG
   bool getTSIGKey(const DNSName& name, DNSName& algorithm, string& content) override;
@@ -138,7 +138,7 @@ public:
 
   bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override;
 
-  bool getBeforeAndAfterNames(uint32_t id, const DNSName& zonename, const DNSName& qname, DNSName& before, DNSName& after) override;
+  bool getBeforeAndAfterNames(uint32_t id, const ZoneName& zonename, const DNSName& qname, DNSName& before, DNSName& after) override;
 
   bool updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName& qname, const DNSName& ordername, bool auth, const uint16_t qtype = QType::ANY) override;
 
@@ -226,13 +226,13 @@ private:
 public:
   struct DomainMeta
   {
-    DNSName domain;
+    ZoneName domain;
     string key;
     string value;
   };
   struct KeyDataDB
   {
-    DNSName domain;
+    ZoneName domain;
     std::string content;
     unsigned int flags{0};
     bool active{true};
@@ -250,15 +250,15 @@ public:
 
 private:
   typedef TypedDBI<DomainInfo,
-                   index_on<DomainInfo, DNSName, &DomainInfo::zone>>
+                   index_on<DomainInfo, ZoneName, &DomainInfo::zone>>
     tdomains_t;
 
   typedef TypedDBI<DomainMeta,
-                   index_on<DomainMeta, DNSName, &DomainMeta::domain>>
+                   index_on<DomainMeta, ZoneName, &DomainMeta::domain>>
     tmeta_t;
 
   typedef TypedDBI<KeyDataDB,
-                   index_on<KeyDataDB, DNSName, &KeyDataDB::domain>>
+                   index_on<KeyDataDB, ZoneName, &KeyDataDB::domain>>
     tkdb_t;
 
   typedef TypedDBI<TSIGKey,
@@ -305,7 +305,7 @@ private:
   bool d_txnorder{false}; // whether d_rotxn is more recent than d_rwtxn
   std::shared_ptr<RecordsRWTransaction> getRecordsRWTransaction(uint32_t id);
   std::shared_ptr<RecordsROTransaction> getRecordsROTransaction(uint32_t id, const std::shared_ptr<LMDBBackend::RecordsRWTransaction>& rwtxn = nullptr);
-  int genChangeDomain(const DNSName& domain, const std::function<void(DomainInfo&)>& func);
+  int genChangeDomain(const ZoneName& domain, const std::function<void(DomainInfo&)>& func);
   int genChangeDomain(uint32_t id, const std::function<void(DomainInfo&)>& func);
   void deleteDomainRecords(RecordsRWTransaction& txn, uint32_t domain_id, uint16_t qtype = QType::ANY);
 
@@ -318,7 +318,7 @@ private:
   bool get_list(DNSZoneRecord& rr);
   bool get_lookup(DNSZoneRecord& rr);
   std::string d_matchkey;
-  DNSName d_lookupdomain;
+  ZoneName d_lookupdomain;
 
   vector<LMDBResourceRecord> d_currentrrset;
   size_t d_currentrrsetpos;
@@ -326,7 +326,7 @@ private:
   MDBOutVal d_currentVal;
   bool d_includedisabled;
 
-  DNSName d_transactiondomain;
+  ZoneName d_transactiondomain;
   uint32_t d_transactiondomainid;
   bool d_dolog;
   bool d_random_ids;
index acd501fd8881af88d3e3e804399b6590ea5a9e09..25444f21fd5981ba3959d1bf28414dff90f726ba 100644 (file)
@@ -183,7 +183,7 @@ public:
       g_log << Logger::Debug << "[" << getPrefix() << "] Got empty result" << endl;
   }
 
-  bool list(const DNSName& target, int domain_id, bool /* include_disabled */ = false) override
+  bool list(const ZoneName& target, int domain_id, bool /* include_disabled */ = false) override
   {
     if (f_list == nullptr) {
       g_log << Logger::Error << "[" << getPrefix() << "] dns_list missing - cannot do AXFR" << endl;
@@ -279,7 +279,7 @@ public:
     logResult("zone=" << di.zone << ",serial=" << di.serial << ",kind=" << di.getKindString());
   }
 
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* getSerial */ = true) override
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool /* getSerial */ = true) override
   {
     if (f_get_domaininfo == nullptr) {
       // use getAuth instead
@@ -320,7 +320,7 @@ public:
     }
   }
 
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta) override
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override
   {
     if (f_get_all_domain_metadata == nullptr)
       return false;
@@ -340,7 +340,7 @@ public:
     return true;
   }
 
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override
   {
     if (f_get_domain_metadata == nullptr)
       return false;
@@ -358,7 +358,7 @@ public:
     return true;
   }
 
-  bool getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys) override
+  bool getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys) override
   {
     if (f_get_domain_keys == nullptr)
       return false;
index 68173dc3a43e701c47f22b67e02aadf9e96a97fa..5a7b74d2abe0091ce436df5f3c9a7285a1cd726c 100644 (file)
@@ -195,7 +195,7 @@ void PipeBackend::lookup(const QType& qtype, const DNSName& qname, int zoneId, D
   d_qname = qname;
 }
 
-bool PipeBackend::list(const DNSName& target, int inZoneId, bool /* include_disabled */)
+bool PipeBackend::list(const ZoneName& target, int inZoneId, bool /* include_disabled */)
 {
   try {
     launch();
index 64b4b3477e08fe420a12d84c89d056d5f8e0fff5..a2d270bc8eab51e8f53412a3fd121859a08b82c9 100644 (file)
@@ -53,7 +53,7 @@ public:
 
   unsigned int getCapabilities() override { return CAP_DIRECT | CAP_LIST; }
   void lookup(const QType&, const DNSName& qdomain, int zoneId, DNSPacket* p = nullptr) override;
-  bool list(const DNSName& target, int domain_id, bool include_disabled = false) override;
+  bool list(const ZoneName& target, int domain_id, bool include_disabled = false) override;
   bool get(DNSResourceRecord& r) override;
   string directBackendCmd(const string& query) override;
   static DNSBackend* maker();
index b38280ed2d6c0e4cfe67d8e2a4b8413f2ec253bf..b035dccae212e8ba4ae34c313597c8aaed0473c0 100644 (file)
@@ -225,7 +225,7 @@ void RemoteBackend::lookup(const QType& qtype, const DNSName& qdomain, int zoneI
   d_index = 0;
 }
 
-bool RemoteBackend::list(const DNSName& target, int domain_id, bool include_disabled)
+bool RemoteBackend::list(const ZoneName& target, int domain_id, bool include_disabled)
 {
   if (d_index != -1) {
     throw PDNSException("Attempt to lookup while one running");
@@ -304,7 +304,7 @@ bool RemoteBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& q
   return true;
 }
 
-bool RemoteBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
+bool RemoteBackend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   Json query = Json::object{
     {"method", "getAllDomainMetadata"},
@@ -336,7 +336,7 @@ bool RemoteBackend::getAllDomainMetadata(const DNSName& name, std::map<std::stri
   return true;
 }
 
-bool RemoteBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
+bool RemoteBackend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta)
 {
   Json query = Json::object{
     {"method", "getDomainMetadata"},
@@ -366,7 +366,7 @@ bool RemoteBackend::getDomainMetadata(const DNSName& name, const std::string& ki
   return true;
 }
 
-bool RemoteBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
+bool RemoteBackend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta)
 {
   Json query = Json::object{
     {"method", "setDomainMetadata"},
@@ -380,7 +380,7 @@ bool RemoteBackend::setDomainMetadata(const DNSName& name, const std::string& ki
   return boolFromJson(answer, "result", false);
 }
 
-bool RemoteBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys)
+bool RemoteBackend::getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -411,7 +411,7 @@ bool RemoteBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::K
   return true;
 }
 
-bool RemoteBackend::removeDomainKey(const DNSName& name, unsigned int id)
+bool RemoteBackend::removeDomainKey(const ZoneName& name, unsigned int id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -426,7 +426,7 @@ bool RemoteBackend::removeDomainKey(const DNSName& name, unsigned int id)
   return this->send(query) && this->recv(answer);
 }
 
-bool RemoteBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id)
+bool RemoteBackend::addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -446,7 +446,7 @@ bool RemoteBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_
   return id >= 0;
 }
 
-bool RemoteBackend::activateDomainKey(const DNSName& name, unsigned int id)
+bool RemoteBackend::activateDomainKey(const ZoneName& name, unsigned int id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -461,7 +461,7 @@ bool RemoteBackend::activateDomainKey(const DNSName& name, unsigned int id)
   return this->send(query) && this->recv(answer);
 }
 
-bool RemoteBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
+bool RemoteBackend::deactivateDomainKey(const ZoneName& name, unsigned int id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -476,7 +476,7 @@ bool RemoteBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
   return this->send(query) && this->recv(answer);
 }
 
-bool RemoteBackend::publishDomainKey(const DNSName& name, unsigned int id)
+bool RemoteBackend::publishDomainKey(const ZoneName& name, unsigned int id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -491,7 +491,7 @@ bool RemoteBackend::publishDomainKey(const DNSName& name, unsigned int id)
   return this->send(query) && this->recv(answer);
 }
 
-bool RemoteBackend::unpublishDomainKey(const DNSName& name, unsigned int id)
+bool RemoteBackend::unpublishDomainKey(const ZoneName& name, unsigned int id)
 {
   // no point doing dnssec if it's not supported
   if (!d_dnssec) {
@@ -595,7 +595,7 @@ bool RemoteBackend::getTSIGKeys(std::vector<struct TSIGKey>& keys)
 void RemoteBackend::parseDomainInfo(const Json& obj, DomainInfo& di)
 {
   di.id = intFromJson(obj, "id", -1);
-  di.zone = DNSName(stringFromJson(obj, "zone"));
+  di.zone = ZoneName(stringFromJson(obj, "zone"));
   for (const auto& primary : obj["masters"].array_items()) {
     di.primaries.emplace_back(primary.string_value(), 53);
   }
@@ -620,7 +620,7 @@ void RemoteBackend::parseDomainInfo(const Json& obj, DomainInfo& di)
   di.backend = this;
 }
 
-bool RemoteBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* getSerial */)
+bool RemoteBackend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool /* getSerial */)
 {
   if (domain.empty()) {
     return false;
@@ -651,7 +651,7 @@ void RemoteBackend::setNotified(uint32_t id, uint32_t serial)
   }
 }
 
-bool RemoteBackend::autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb)
+bool RemoteBackend::autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb)
 {
   Json::array rrset;
 
@@ -688,7 +688,7 @@ bool RemoteBackend::autoPrimaryBackend(const string& ip, const DNSName& domain,
   return true;
 }
 
-bool RemoteBackend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account)
+bool RemoteBackend::createSecondaryDomain(const string& ip, const ZoneName& domain, const string& nameserver, const string& account)
 {
   Json query = Json::object{
     {"method", "createSlaveDomain"},
@@ -775,7 +775,7 @@ bool RemoteBackend::feedEnts3(int domain_id, const DNSName& domain, map<DNSName,
   return this->send(query) && this->recv(answer);
 }
 
-bool RemoteBackend::startTransaction(const DNSName& domain, int domain_id)
+bool RemoteBackend::startTransaction(const ZoneName& domain, int domain_id)
 {
   this->d_trxid = time((time_t*)nullptr);
 
index 0949150872339f05834a61bf550fb0bbe5c5eb90..5aa7b5b73ab87aa2982b390aff5ba77d34972e5f 100644 (file)
@@ -170,29 +170,29 @@ public:
   unsigned int getCapabilities() override;
   void lookup(const QType& qtype, const DNSName& qdomain, int zoneId = -1, DNSPacket* pkt_p = nullptr) override;
   bool get(DNSResourceRecord& rr) override;
-  bool list(const DNSName& target, int domain_id, bool include_disabled = false) override;
+  bool list(const ZoneName& target, int domain_id, bool include_disabled = false) override;
 
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta) override;
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override;
-  bool getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys) override;
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override;
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override;
+  bool getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys) override;
   bool getTSIGKey(const DNSName& name, DNSName& algorithm, std::string& content) override;
   bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override;
   bool setDomainMetadata(const DNSName& name, const string& kind, const std::vector<std::basic_string<char>>& meta) override;
-  bool removeDomainKey(const DNSName& name, unsigned int id) override;
-  bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
-  bool activateDomainKey(const DNSName& name, unsigned int id) override;
-  bool deactivateDomainKey(const DNSName& name, unsigned int id) override;
-  bool publishDomainKey(const DNSName& name, unsigned int id) override;
-  bool unpublishDomainKey(const DNSName& name, unsigned int id) override;
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  bool removeDomainKey(const ZoneName& name, unsigned int id) override;
+  bool addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id) override;
+  bool activateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool deactivateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool publishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool unpublishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial = true) override;
   void setNotified(uint32_t id, uint32_t serial) override;
-  bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb) override;
-  bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override;
+  bool autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb) override;
+  bool createSecondaryDomain(const string& ip, const ZoneName& domain, const string& nameserver, const string& account) override;
   bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset) override;
   bool feedRecord(const DNSResourceRecord& r, const DNSName& ordername, bool ordernameIsNSEC3 = false) override;
   bool feedEnts(int domain_id, map<DNSName, bool>& nonterm) override;
   bool feedEnts3(int domain_id, const DNSName& domain, map<DNSName, bool>& nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override;
-  bool startTransaction(const DNSName& domain, int domain_id) override;
+  bool startTransaction(const ZoneName& domain, int domain_id) override;
   bool commitTransaction() override;
   bool abortTransaction() override;
   bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override;
index 0aa002df9df80648bf92f3ff866b3faa93017de4..9589c68e5d2cf8bca5b02c9b58074861cbf906f0 100644 (file)
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(test_method_list)
   DNSResourceRecord resourceRecord;
 
   BOOST_TEST_MESSAGE("Testing list method");
-  backendUnderTest->list(DNSName("unit.test."), -1);
+  backendUnderTest->list(ZoneName("unit.test."), -1);
   while (backendUnderTest->get(resourceRecord)) {
     record_count++;
   }
@@ -96,27 +96,27 @@ BOOST_AUTO_TEST_CASE(test_method_setDomainMetadata)
   std::vector<std::string> meta;
   meta.emplace_back("VALUE");
   BOOST_TEST_MESSAGE("Testing setDomainMetadata method");
-  BOOST_CHECK(backendUnderTest->setDomainMetadata(DNSName("unit.test."), "TEST", meta));
+  BOOST_CHECK(backendUnderTest->setDomainMetadata(ZoneName("unit.test."), "TEST", meta));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_alsoNotifies)
 {
-  BOOST_CHECK(backendUnderTest->setDomainMetadata(DNSName("unit.test."), "ALSO-NOTIFY", {"192.0.2.1"}));
+  BOOST_CHECK(backendUnderTest->setDomainMetadata(ZoneName("unit.test."), "ALSO-NOTIFY", {"192.0.2.1"}));
   std::set<std::string> alsoNotifies;
   BOOST_TEST_MESSAGE("Testing alsoNotifies method");
-  backendUnderTest->alsoNotifies(DNSName("unit.test."), &alsoNotifies);
+  backendUnderTest->alsoNotifies(ZoneName("unit.test."), &alsoNotifies);
   BOOST_CHECK_EQUAL(alsoNotifies.size(), 1);
   if (!alsoNotifies.empty()) {
     BOOST_CHECK_EQUAL(alsoNotifies.count("192.0.2.1"), 1);
   }
-  BOOST_CHECK(backendUnderTest->setDomainMetadata(DNSName("unit.test."), "ALSO-NOTIFY", std::vector<std::string>()));
+  BOOST_CHECK(backendUnderTest->setDomainMetadata(ZoneName("unit.test."), "ALSO-NOTIFY", std::vector<std::string>()));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_getDomainMetadata)
 {
   std::vector<std::string> meta;
   BOOST_TEST_MESSAGE("Testing getDomainMetadata method");
-  backendUnderTest->getDomainMetadata(DNSName("unit.test."), "TEST", meta);
+  backendUnderTest->getDomainMetadata(ZoneName("unit.test."), "TEST", meta);
   BOOST_CHECK_EQUAL(meta.size(), 1);
   // in case we got more than one value, which would be unexpected
   // but not fatal
@@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(test_method_getAllDomainMetadata)
 {
   std::map<std::string, std::vector<std::string>> meta;
   BOOST_TEST_MESSAGE("Testing getAllDomainMetadata method");
-  backendUnderTest->getAllDomainMetadata(DNSName("unit.test."), meta);
+  backendUnderTest->getAllDomainMetadata(ZoneName("unit.test."), meta);
   BOOST_CHECK_EQUAL(meta.size(), 1);
   // in case we got more than one value, which would be unexpected
   // but not fatal
@@ -142,9 +142,9 @@ BOOST_AUTO_TEST_CASE(test_method_addDomainKey)
 {
   BOOST_TEST_MESSAGE("Testing addDomainKey method");
   int64_t keyID = 0;
-  backendUnderTest->addDomainKey(DNSName("unit.test."), k1, keyID);
+  backendUnderTest->addDomainKey(ZoneName("unit.test."), k1, keyID);
   BOOST_CHECK_EQUAL(keyID, 1);
-  backendUnderTest->addDomainKey(DNSName("unit.test."), k2, keyID);
+  backendUnderTest->addDomainKey(ZoneName("unit.test."), k2, keyID);
   BOOST_CHECK_EQUAL(keyID, 2);
 }
 
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(test_method_getDomainKeys)
   std::vector<DNSBackend::KeyData> keys;
   BOOST_TEST_MESSAGE("Testing getDomainKeys method");
   // we expect to get two keys
-  backendUnderTest->getDomainKeys(DNSName("unit.test."), keys);
+  backendUnderTest->getDomainKeys(ZoneName("unit.test."), keys);
   BOOST_CHECK_EQUAL(keys.size(), 2);
   // in case we got more than 2 keys, which would be unexpected
   // but not fatal
@@ -172,19 +172,19 @@ BOOST_AUTO_TEST_CASE(test_method_getDomainKeys)
 BOOST_AUTO_TEST_CASE(test_method_deactivateDomainKey)
 {
   BOOST_TEST_MESSAGE("Testing deactivateDomainKey method");
-  BOOST_CHECK(backendUnderTest->deactivateDomainKey(DNSName("unit.test."), 1));
+  BOOST_CHECK(backendUnderTest->deactivateDomainKey(ZoneName("unit.test."), 1));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_activateDomainKey)
 {
   BOOST_TEST_MESSAGE("Testing activateDomainKey method");
-  BOOST_CHECK(backendUnderTest->activateDomainKey(DNSName("unit.test."), 1));
+  BOOST_CHECK(backendUnderTest->activateDomainKey(ZoneName("unit.test."), 1));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_removeDomainKey)
 {
-  BOOST_CHECK(backendUnderTest->removeDomainKey(DNSName("unit.test."), 2));
-  BOOST_CHECK(backendUnderTest->removeDomainKey(DNSName("unit.test."), 1));
+  BOOST_CHECK(backendUnderTest->removeDomainKey(ZoneName("unit.test."), 2));
+  BOOST_CHECK(backendUnderTest->removeDomainKey(ZoneName("unit.test."), 1));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_getBeforeAndAfterNamesAbsolute)
@@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(test_method_getDomainInfo)
 {
   DomainInfo domainInfo;
   BOOST_TEST_MESSAGE("Testing getDomainInfo method");
-  backendUnderTest->getDomainInfo(DNSName("unit.test."), domainInfo);
+  backendUnderTest->getDomainInfo(ZoneName("unit.test."), domainInfo);
   BOOST_CHECK_EQUAL(domainInfo.zone.toString(), "unit.test.");
   BOOST_CHECK_EQUAL(domainInfo.serial, 2);
   BOOST_CHECK_EQUAL(domainInfo.notified_serial, 2);
@@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(test_method_autoPrimaryBackend)
   resourceRecord.content = "ns2.example.com.";
   nsset.push_back(resourceRecord);
 
-  BOOST_CHECK(backendUnderTest->autoPrimaryBackend("10.0.0.1", DNSName("example.com."), nsset, nullptr, nullptr, &dbd));
+  BOOST_CHECK(backendUnderTest->autoPrimaryBackend("10.0.0.1", ZoneName("example.com."), nsset, nullptr, nullptr, &dbd));
 
   // let's see what we got
   BOOST_CHECK_EQUAL(dbd, backendUnderTest.get());
@@ -304,14 +304,14 @@ BOOST_AUTO_TEST_CASE(test_method_autoPrimaryBackend)
 BOOST_AUTO_TEST_CASE(test_method_createSecondaryDomain)
 {
   BOOST_TEST_MESSAGE("Testing createSecondaryDomain method");
-  BOOST_CHECK(backendUnderTest->createSecondaryDomain("10.0.0.1", DNSName("pirate.unit.test."), "", ""));
+  BOOST_CHECK(backendUnderTest->createSecondaryDomain("10.0.0.1", ZoneName("pirate.unit.test."), "", ""));
 }
 
 BOOST_AUTO_TEST_CASE(test_method_feedRecord)
 {
   DNSResourceRecord resourceRecord;
   BOOST_TEST_MESSAGE("Testing feedRecord method");
-  backendUnderTest->startTransaction(DNSName("example.com."), 3);
+  backendUnderTest->startTransaction(ZoneName("example.com."), 3);
   resourceRecord.qname = DNSName("example.com.");
   resourceRecord.qtype = QType::SOA;
   resourceRecord.qclass = QClass::IN;
@@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(test_method_feedRecord)
 
 BOOST_AUTO_TEST_CASE(test_method_replaceRRSet)
 {
-  backendUnderTest->startTransaction(DNSName("example.com."), 3);
+  backendUnderTest->startTransaction(ZoneName("example.com."), 3);
   DNSResourceRecord resourceRecord;
   std::vector<DNSResourceRecord> rrset;
   BOOST_TEST_MESSAGE("Testing replaceRRSet method");
@@ -346,7 +346,7 @@ BOOST_AUTO_TEST_CASE(test_method_replaceRRSet)
 BOOST_AUTO_TEST_CASE(test_method_feedEnts)
 {
   BOOST_TEST_MESSAGE("Testing feedEnts method");
-  backendUnderTest->startTransaction(DNSName("example.com."), 3);
+  backendUnderTest->startTransaction(ZoneName("example.com."), 3);
   map<DNSName, bool> nonterm = boost::assign::map_list_of(DNSName("_udp"), true)(DNSName("_sip._udp"), true);
   BOOST_CHECK(backendUnderTest->feedEnts(2, nonterm));
   backendUnderTest->commitTransaction();
@@ -355,7 +355,7 @@ BOOST_AUTO_TEST_CASE(test_method_feedEnts)
 BOOST_AUTO_TEST_CASE(test_method_feedEnts3)
 {
   BOOST_TEST_MESSAGE("Testing feedEnts3 method");
-  backendUnderTest->startTransaction(DNSName("example.com"), 3);
+  backendUnderTest->startTransaction(ZoneName("example.com"), 3);
   NSEC3PARAMRecordContent ns3prc;
   ns3prc.d_iterations = 1;
   ns3prc.d_salt = "\u00aa\u00bb\u00cc\u00dd";
@@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE(test_method_feedEnts3)
 BOOST_AUTO_TEST_CASE(test_method_abortTransaction)
 {
   BOOST_TEST_MESSAGE("Testing abortTransaction method");
-  backendUnderTest->startTransaction(DNSName("example.com."), 3);
+  backendUnderTest->startTransaction(ZoneName("example.com."), 3);
   BOOST_CHECK(backendUnderTest->abortTransaction());
 }
 
index 009f48c41d33443097237d3ebd6afb484ced1891..0f5b714da3e035ea632bfe4a3207dbe3584924eb 100644 (file)
@@ -173,7 +173,7 @@ void TinyDNSBackend::getAllDomains_locked(vector<DomainInfo>* domains, bool getS
       DomainInfo di;
       di.id = -1; // Will be overridden by caller
       di.backend = this;
-      di.zone = rr.qname;
+      di.zone = ZoneName(rr.qname);
       di.kind = DomainInfo::Primary;
       di.last_check = time(0);
 
@@ -214,7 +214,7 @@ void TinyDNSBackend::getAllDomains(vector<DomainInfo>* domains, bool getSerial,
 }
 
 //NOLINTNEXTLINE(readability-identifier-length)
-bool TinyDNSBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial)
+bool TinyDNSBackend::getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial)
 {
   auto domainInfo = s_domainInfo.lock(); //TODO: We could actually lock less if we do it per suffix.
   if (domainInfo->count(d_suffix) == 0) {
@@ -240,7 +240,7 @@ bool TinyDNSBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool g
   return found;
 }
 
-bool TinyDNSBackend::list(const DNSName& target, int /* domain_id */, bool /* include_disabled */)
+bool TinyDNSBackend::list(const ZoneName& target, int /* domain_id */, bool /* include_disabled */)
 {
   d_isAxfr = true;
   d_isGetDomains = false;
index d227f51bd52eb438b15f6c52925d9ebe69089e16..b7477c7ebb7c2db3f3f8cf6b86a5cf60be920795 100644 (file)
@@ -40,7 +40,7 @@ struct TinyDomainInfo
 {
   uint32_t id;
   uint32_t notified_serial;
-  DNSName zone;
+  ZoneName zone;
 
   bool operator<(const TinyDomainInfo& tdi) const
   {
@@ -70,9 +70,9 @@ public:
 
   unsigned int getCapabilities() override { return CAP_LIST; }
   void lookup(const QType& qtype, const DNSName& qdomain, int zoneId, DNSPacket* pkt_p = nullptr) override;
-  bool list(const DNSName& target, int domain_id, bool include_disabled = false) override;
+  bool list(const ZoneName& target, int domain_id, bool include_disabled = false) override;
   bool get(DNSResourceRecord& rr) override;
-  bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool getSerial = true) override;
   void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled) override;
 
   // Primary mode operation
@@ -90,7 +90,7 @@ private:
   typedef multi_index_container<
     TinyDomainInfo,
     indexed_by<
-      hashed_unique<tag<tag_zone>, member<TinyDomainInfo, DNSName, &TinyDomainInfo::zone>>,
+      hashed_unique<tag<tag_zone>, member<TinyDomainInfo, ZoneName, &TinyDomainInfo::zone>>,
       hashed_unique<tag<tag_domainid>, member<TinyDomainInfo, uint32_t, &TinyDomainInfo::id>>>>
     TDI_t;
   typedef map<string, TDI_t> TDI_suffix_t;
index bcff734f082deb553a576d6fd3273390779fb547..f07e39360f76b05323fb0b2c1c2b92c4ce2cfd8a 100644 (file)
@@ -113,7 +113,7 @@ void CatalogInfo::updateHash(CatalogHashMap& hashes, const DomainInfo& di) const
   }
 }
 
-DNSZoneRecord CatalogInfo::getCatalogVersionRecord(const DNSName& zone)
+DNSZoneRecord CatalogInfo::getCatalogVersionRecord(const ZoneName& zone)
 {
   DNSZoneRecord dzr;
   dzr.dr.d_name = DNSName("version") + zone;
@@ -123,7 +123,7 @@ DNSZoneRecord CatalogInfo::getCatalogVersionRecord(const DNSName& zone)
   return dzr;
 }
 
-void CatalogInfo::toDNSZoneRecords(const DNSName& zone, vector<DNSZoneRecord>& dzrs) const
+void CatalogInfo::toDNSZoneRecords(const ZoneName& zone, vector<DNSZoneRecord>& dzrs) const
 {
   DNSName prefix;
   if (d_unique.empty()) {
index d8a4fe907cbfdad5b71682f2829433058193b951..fc040c6bd28a84f78098341487aff5ad47d4e116 100644 (file)
@@ -28,7 +28,7 @@
 
 struct DomainInfo;
 
-typedef map<DNSName, pdns::SHADigest> CatalogHashMap;
+typedef map<ZoneName, pdns::SHADigest> CatalogHashMap;
 
 class CatalogInfo
 {
@@ -48,7 +48,7 @@ public:
 
   CatalogInfo() :
     d_id(0), d_type(CatalogType::None) {}
-  CatalogInfo(uint32_t id, const DNSName& zone, const std::string& options, CatalogType type)
+  CatalogInfo(uint32_t id, const ZoneName& zone, const std::string& options, CatalogType type)
   {
     d_id = id;
     d_zone = zone;
@@ -61,8 +61,8 @@ public:
 
   void updateHash(CatalogHashMap& hashes, const DomainInfo& di) const;
   DNSName getUnique() const { return DNSName(toBase32Hex(hashQNameWithSalt(std::to_string(d_id), 0, d_zone))); } // salt with domain id to detect recreated zones
-  static DNSZoneRecord getCatalogVersionRecord(const DNSName& zone);
-  void toDNSZoneRecords(const DNSName& zone, vector<DNSZoneRecord>& dzrs) const;
+  static DNSZoneRecord getCatalogVersionRecord(const ZoneName& zone);
+  void toDNSZoneRecords(const ZoneName& zone, vector<DNSZoneRecord>& dzrs) const;
 
   bool operator<(const CatalogInfo& rhs) const
   {
@@ -70,7 +70,8 @@ public:
   }
 
   uint32_t d_id;
-  DNSName d_zone, d_coo, d_unique;
+  ZoneName d_zone;
+  DNSName d_coo, d_unique;
   std::set<std::string> d_group;
   vector<ComboAddress> d_primaries;
 
index 82314c3cd8869abd2fb70ec2a5fea8a7ba74ffcf..a52ea897714165d6d42640e2dd63d45ab760b887 100644 (file)
@@ -111,7 +111,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
     g_log << Logger::Warning << "Request to queue notification for domain '" << di.zone << "' was processed, but no valid nameservers or ALSO-NOTIFYs found. Not notifying!" << endl;
 }
 
-bool CommunicatorClass::notifyDomain(const DNSName& domain, UeberBackend* B)
+bool CommunicatorClass::notifyDomain(const ZoneName& domain, UeberBackend* B)
 {
   DomainInfo di;
   if (!B->getDomainInfo(domain, di)) {
@@ -247,7 +247,7 @@ time_t CommunicatorClass::doNotifications(PacketHandler* P)
   }
 
   // send out possible new notifications
-  DNSName domain;
+  ZoneName domain;
   string ip;
   uint16_t id = 0;
 
@@ -280,7 +280,7 @@ time_t CommunicatorClass::doNotifications(PacketHandler* P)
   return d_nq.earliest();
 }
 
-void CommunicatorClass::sendNotification(int sock, const DNSName& domain, const ComboAddress& remote, uint16_t id, UeberBackend* B)
+void CommunicatorClass::sendNotification(int sock, const ZoneName& domain, const ComboAddress& remote, uint16_t id, UeberBackend* B)
 {
   vector<string> meta;
   DNSName tsigkeyname;
@@ -323,12 +323,12 @@ void CommunicatorClass::sendNotification(int sock, const DNSName& domain, const
   }
 }
 
-void CommunicatorClass::drillHole(const DNSName& domain, const string& ip)
+void CommunicatorClass::drillHole(const ZoneName& domain, const string& ip)
 {
   (*d_holes.lock())[pair(domain, ip)] = time(nullptr);
 }
 
-bool CommunicatorClass::justNotified(const DNSName& domain, const string& ip)
+bool CommunicatorClass::justNotified(const ZoneName& domain, const string& ip)
 {
   auto holes = d_holes.lock();
   auto it = holes->find(pair(domain, ip));
@@ -362,7 +362,7 @@ void CommunicatorClass::makeNotifySockets()
   }
 }
 
-void CommunicatorClass::notify(const DNSName& domain, const string& ip)
+void CommunicatorClass::notify(const ZoneName& domain, const string& ip)
 {
   d_nq.add(domain, ip);
 }
index 739838afe9762cce2d95f6842b8357f5a2e9a857..f05347dcfbe1fff56ef3f5432fbe4af75c35cdd9 100644 (file)
@@ -48,7 +48,7 @@
 
 #include "ixfr.hh"
 
-void CommunicatorClass::addSuckRequest(const DNSName& domain, const ComboAddress& primary, SuckRequest::RequestPriority priority, bool force)
+void CommunicatorClass::addSuckRequest(const ZoneName& domain, const ComboAddress& primary, SuckRequest::RequestPriority priority, bool force)
 {
   auto data = d_data.lock();
   SuckRequest sr;
@@ -94,7 +94,7 @@ static bool catalogDiff(const DomainInfo& di, vector<CatalogInfo>& fromXFR, vect
   bool doTransaction{true};
   bool inTransaction{false};
   CatalogInfo ciCreate, ciRemove;
-  std::unordered_map<DNSName, bool> clearCache;
+  std::unordered_map<ZoneName, bool> clearCache;
   vector<CatalogInfo> retrieve;
 
   try {
@@ -309,7 +309,7 @@ static bool catalogProcess(const DomainInfo& di, vector<DNSResourceRecord>& rrs,
   logPrefix += "Catalog-Zone ";
 
   vector<CatalogInfo> fromXFR, fromDB;
-  std::unordered_set<DNSName> dupcheck;
+  std::unordered_set<ZoneName> dupcheck;
 
   // From XFR
   bool hasSOA{false};
@@ -425,7 +425,7 @@ static bool catalogProcess(const DomainInfo& di, vector<DNSResourceRecord>& rrs,
   return catalogDiff(di, fromXFR, fromDB, logPrefix);
 }
 
-void CommunicatorClass::ixfrSuck(const DNSName& domain, const TSIGTriplet& tt, const ComboAddress& laddr, const ComboAddress& remote, ZoneStatus& zs, vector<DNSRecord>* axfr)
+void CommunicatorClass::ixfrSuck(const ZoneName& domain, const TSIGTriplet& tt, const ComboAddress& laddr, const ComboAddress& remote, ZoneStatus& zs, vector<DNSRecord>* axfr)
 {
   string logPrefix = "IXFR-in zone '" + domain.toLogString() + "', primary '" + remote.toString() + "', ";
 
@@ -471,7 +471,7 @@ void CommunicatorClass::ixfrSuck(const DNSName& domain, const TSIGTriplet& tt, c
       // this means that we must group updates by {qname,qtype}, retrieve the RRSET, apply
       // the add/remove updates, and replaceRRSet the whole thing.
 
-      map<pair<DNSName, uint16_t>, pair<vector<DNSRecord>, vector<DNSRecord>>> grouped;
+      map<pair<ZoneName, uint16_t>, pair<vector<DNSRecord>, vector<DNSRecord>>> grouped;
 
       for (const auto& x : remove)
         grouped[{x.d_name, x.d_type}].first.push_back(x);
@@ -636,7 +636,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
   return rrs;
 }
 
-void CommunicatorClass::suck(const DNSName& domain, const ComboAddress& remote, bool force) // NOLINT(readability-function-cognitive-complexity)
+void CommunicatorClass::suck(const ZoneName& domain, const ComboAddress& remote, bool force) // NOLINT(readability-function-cognitive-complexity)
 {
   {
     auto data = d_data.lock();
@@ -1391,9 +1391,9 @@ void CommunicatorClass::secondaryRefresh(PacketHandler* P)
   }
 }
 
-vector<pair<DNSName, ComboAddress>> CommunicatorClass::getSuckRequests()
+vector<pair<ZoneName, ComboAddress>> CommunicatorClass::getSuckRequests()
 {
-  vector<pair<DNSName, ComboAddress>> ret;
+  vector<pair<ZoneName, ComboAddress>> ret;
   auto data = d_data.lock();
   ret.reserve(data->d_suckdomains.size());
   for (auto const& d : data->d_suckdomains) {
index 09a460eaa499a1f9af5796d1b9e69bf596eafd50..f1c26f0a9cae3324fc221e9c837f47bc9b599c5a 100644 (file)
@@ -42,7 +42,7 @@ AuthZoneCache::AuthZoneCache(size_t mapsCount) :
   d_statnumentries = S.getPointer("zone-cache-size");
 }
 
-bool AuthZoneCache::getEntry(const DNSName& zone, int& zoneId)
+bool AuthZoneCache::getEntry(const ZoneName& zone, int& zoneId)
 {
   auto& mc = getMap(zone);
   bool found = false;
@@ -74,7 +74,7 @@ void AuthZoneCache::clear()
   purgeLockedCollectionsVector(d_maps);
 }
 
-void AuthZoneCache::replace(const vector<std::tuple<DNSName, int>>& zone_indices)
+void AuthZoneCache::replace(const vector<std::tuple<ZoneName, int>>& zone_indices)
 {
   if (!d_refreshinterval)
     return;
@@ -133,7 +133,7 @@ void AuthZoneCache::replace(const vector<std::tuple<DNSName, int>>& zone_indices
   }
 }
 
-void AuthZoneCache::add(const DNSName& zone, const int zoneId)
+void AuthZoneCache::add(const ZoneName& zone, const int zoneId)
 {
   if (!d_refreshinterval)
     return;
@@ -163,7 +163,7 @@ void AuthZoneCache::add(const DNSName& zone, const int zoneId)
   }
 }
 
-void AuthZoneCache::remove(const DNSName& zone)
+void AuthZoneCache::remove(const ZoneName& zone)
 {
   if (!d_refreshinterval)
     return;
index 2a25cc4c8e25b779598ac1e93202c50b0040ced0..02db80f9c5205f309ae971231e1479a238474490 100644 (file)
@@ -32,12 +32,12 @@ class AuthZoneCache : public boost::noncopyable
 public:
   AuthZoneCache(size_t mapsCount = 1024);
 
-  void replace(const vector<std::tuple<DNSName, int>>& zone);
-  void add(const DNSName& zone, const int zoneId);
-  void remove(const DNSName& zone);
+  void replace(const vector<std::tuple<ZoneName, int>>& zone);
+  void add(const ZoneName& zone, const int zoneId);
+  void remove(const ZoneName& zone);
   void setReplacePending(); //!< call this when data collection for the subsequent replace() call starts.
 
-  bool getEntry(const DNSName& zone, int& zoneId);
+  bool getEntry(const ZoneName& zone, int& zoneId);
 
   size_t size() { return *d_statnumentries; } //!< number of entries in the cache
 
@@ -62,7 +62,7 @@ private:
     int zoneId{-1};
   };
 
-  typedef std::unordered_map<DNSName, CacheValue, std::hash<DNSName>> cmap_t;
+  typedef std::unordered_map<ZoneName, CacheValue, std::hash<ZoneName>> cmap_t;
 
   struct MapCombo
   {
@@ -75,11 +75,11 @@ private:
   };
 
   vector<MapCombo> d_maps;
-  size_t getMapIndex(const DNSName& zone)
+  size_t getMapIndex(const ZoneName& zone)
   {
     return zone.hash() % d_maps.size();
   }
-  MapCombo& getMap(const DNSName& qname)
+  MapCombo& getMap(const ZoneName& qname)
   {
     return d_maps[getMapIndex(qname)];
   }
@@ -92,7 +92,7 @@ private:
 
   struct PendingData
   {
-    std::vector<std::tuple<DNSName, int, bool>> d_pendingUpdates;
+    std::vector<std::tuple<ZoneName, int, bool>> d_pendingUpdates;
     bool d_replacePending{false};
   };
   LockGuarded<PendingData> d_pending;
index 4e93d3af2a191b2fa202154410c967331abfd59d..216f80f9fb3cd8cbf632ffdee8ac702b8e54ce55 100644 (file)
@@ -30,7 +30,7 @@
 using pdns::resolver::parseResult;
 
 AXFRRetriever::AXFRRetriever(const ComboAddress& remote,
-                             const DNSName& domain,
+                             const ZoneName& domain,
                              const TSIGTriplet& tsigConf,
                              const ComboAddress* laddr,
                              size_t maxReceivedBytes,
index 18e37f6c5da4cf4ff6ff2c88fbb51c8d9eb285a8..a2542a0301b0406c0a92c6f0374f75dc06e3b7c0 100644 (file)
@@ -30,7 +30,7 @@ class AXFRRetriever : public boost::noncopyable
 {
   public:
     AXFRRetriever(const ComboAddress& remote,
-                  const DNSName& zone,
+                  const ZoneName& zone,
                   const TSIGTriplet& tt = TSIGTriplet(),
                   const ComboAddress* laddr = NULL,
                   size_t maxReceivedBytes=0,
index 7cc98514690499169c4bb0541fbe9e868ca14857..1dafd5bbdc04980192a38355d21915436b3bccae 100644 (file)
@@ -248,7 +248,7 @@ void GSQLBackend::setFresh(uint32_t domain_id)
   setLastCheck(domain_id, time(nullptr));
 }
 
-bool GSQLBackend::setPrimaries(const DNSName& domain, const vector<ComboAddress>& primaries)
+bool GSQLBackend::setPrimaries(const ZoneName& domain, const vector<ComboAddress>& primaries)
 {
   vector<string> primaries_s;
   primaries_s.reserve(primaries.size());
@@ -275,7 +275,7 @@ bool GSQLBackend::setPrimaries(const DNSName& domain, const vector<ComboAddress>
   return true;
 }
 
-bool GSQLBackend::setKind(const DNSName &domain, const DomainInfo::DomainKind kind)
+bool GSQLBackend::setKind(const ZoneName &domain, const DomainInfo::DomainKind kind)
 {
   try {
     reconnectIfNeeded();
@@ -294,7 +294,7 @@ bool GSQLBackend::setKind(const DNSName &domain, const DomainInfo::DomainKind ki
   return true;
 }
 
-bool GSQLBackend::setOptions(const DNSName& domain, const string& options)
+bool GSQLBackend::setOptions(const ZoneName& domain, const string& options)
 {
   try {
     reconnectIfNeeded();
@@ -313,7 +313,7 @@ bool GSQLBackend::setOptions(const DNSName& domain, const string& options)
   return true;
 }
 
-bool GSQLBackend::setCatalog(const DNSName& domain, const DNSName& catalog)
+bool GSQLBackend::setCatalog(const ZoneName& domain, const ZoneName& catalog)
 {
   try {
     reconnectIfNeeded();
@@ -332,7 +332,7 @@ bool GSQLBackend::setCatalog(const DNSName& domain, const DNSName& catalog)
   return true;
 }
 
-bool GSQLBackend::setAccount(const DNSName &domain, const string &account)
+bool GSQLBackend::setAccount(const ZoneName &domain, const string &account)
 {
   try {
     reconnectIfNeeded();
@@ -351,7 +351,7 @@ bool GSQLBackend::setAccount(const DNSName &domain, const string &account)
   return true;
 }
 
-bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial)
+bool GSQLBackend::getDomainInfo(const ZoneName &domain, DomainInfo &di, bool getSerial)
 {
   /* fill DomainInfo from database info:
      id,name,master IP(s),last_check,notified_serial,type,account */
@@ -378,8 +378,8 @@ bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getS
 
   pdns::checked_stoi_into(di.id, d_result[0][0]);
   try {
-    di.zone=DNSName(d_result[0][1]);
-    di.catalog = (!d_result[0][7].empty() ? DNSName(d_result[0][7]) : DNSName());
+    di.zone=ZoneName(d_result[0][1]);
+    di.catalog = (!d_result[0][7].empty() ? ZoneName(d_result[0][7]) : ZoneName());
   } catch (...) {
     return false;
   }
@@ -443,7 +443,7 @@ void GSQLBackend::getUnfreshSecondaryInfos(vector<DomainInfo>* unfreshDomains)
     ASSERT_ROW_COLUMNS("info-all-secondaries-query", row, 6);
 
     try {
-      di.zone = DNSName(row[1]);
+      di.zone = ZoneName(row[1]);
     }
     catch (const std::runtime_error& e) {
       g_log << Logger::Warning << __PRETTY_FUNCTION__ << " zone name '" << row[1] << "' is not a valid DNS name: " << e.what() << endl;
@@ -559,7 +559,7 @@ void GSQLBackend::getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::u
     }
 
     try {
-      di.zone = DNSName(row[1]);
+      di.zone = ZoneName(row[1]);
     }
     catch (const std::runtime_error& e) {
       g_log << Logger::Warning << __PRETTY_FUNCTION__ << " zone name '" << row[1] << "' is not a valid DNS name: " << e.what() << endl;
@@ -571,7 +571,7 @@ void GSQLBackend::getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::u
     }
 
     try {
-      di.catalog = DNSName(row[5]);
+      di.catalog = ZoneName(row[5]);
     }
     catch (const std::runtime_error& e) {
       g_log << Logger::Warning << __PRETTY_FUNCTION__ << " zone name '" << row[5] << "' is not a valid DNS name: " << e.what() << endl;
@@ -632,7 +632,7 @@ void GSQLBackend::getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::u
   }
 }
 
-bool GSQLBackend::getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type)
+bool GSQLBackend::getCatalogMembers(const ZoneName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type)
 {
   try {
     reconnectIfNeeded();
@@ -675,7 +675,7 @@ bool GSQLBackend::getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>&
     CatalogInfo ci;
 
     try {
-      ci.d_zone = DNSName(row[1]);
+      ci.d_zone = ZoneName(row[1]);
     }
     catch (const std::runtime_error& e) {
       g_log << Logger::Warning << __PRETTY_FUNCTION__ << " zone name '" << row[1] << "' is not a valid DNS name: " << e.what() << endl;
@@ -989,7 +989,7 @@ bool GSQLBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qna
   return true;
 }
 
-bool GSQLBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id)
+bool GSQLBackend::addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1046,7 +1046,7 @@ bool GSQLBackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t&
   }
 }
 
-bool GSQLBackend::activateDomainKey(const DNSName& name, unsigned int id)
+bool GSQLBackend::activateDomainKey(const ZoneName& name, unsigned int id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1068,7 +1068,7 @@ bool GSQLBackend::activateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool GSQLBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
+bool GSQLBackend::deactivateDomainKey(const ZoneName& name, unsigned int id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1090,7 +1090,7 @@ bool GSQLBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool GSQLBackend::publishDomainKey(const DNSName& name, unsigned int id)
+bool GSQLBackend::publishDomainKey(const ZoneName& name, unsigned int id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1112,7 +1112,7 @@ bool GSQLBackend::publishDomainKey(const DNSName& name, unsigned int id)
   return true;
 }
 
-bool GSQLBackend::unpublishDomainKey(const DNSName& name, unsigned int id)
+bool GSQLBackend::unpublishDomainKey(const ZoneName& name, unsigned int id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1136,7 +1136,7 @@ bool GSQLBackend::unpublishDomainKey(const DNSName& name, unsigned int id)
 
 
 
-bool GSQLBackend::removeDomainKey(const DNSName& name, unsigned int id)
+bool GSQLBackend::removeDomainKey(const ZoneName& name, unsigned int id)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1264,7 +1264,7 @@ bool GSQLBackend::getTSIGKeys(std::vector< struct TSIGKey > &keys)
   return true;
 }
 
-bool GSQLBackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
+bool GSQLBackend::getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys)
 {
   if(!d_dnssecQueries)
     return false;
@@ -1303,7 +1303,7 @@ bool GSQLBackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
   return true;
 }
 
-bool GSQLBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string> >& meta)
+bool GSQLBackend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string> >& meta)
 {
   try {
     reconnectIfNeeded();
@@ -1334,7 +1334,7 @@ bool GSQLBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string
 }
 
 
-bool GSQLBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
+bool GSQLBackend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta)
 {
   if(!d_dnssecQueries && isDnssecDomainMetadata(kind))
     return false;
@@ -1366,7 +1366,7 @@ bool GSQLBackend::getDomainMetadata(const DNSName& name, const std::string& kind
   return true;
 }
 
-bool GSQLBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
+bool GSQLBackend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta)
 {
   if(!d_dnssecQueries && isDnssecDomainMetadata(kind))
     return false;
@@ -1456,7 +1456,7 @@ void GSQLBackend::lookup(const QType& qtype, const DNSName& qname, int domain_id
   d_qname=qname;
 }
 
-bool GSQLBackend::list(const DNSName &target, int domain_id, bool include_disabled)
+bool GSQLBackend::list(const ZoneName &target, int domain_id, bool include_disabled)
 {
   DLOG(g_log<<"GSQLBackend constructing handle for list of domain id '"<<domain_id<<"'"<<endl);
 
@@ -1482,7 +1482,7 @@ bool GSQLBackend::list(const DNSName &target, int domain_id, bool include_disabl
   return true;
 }
 
-bool GSQLBackend::listSubZone(const DNSName &zone, int domain_id) {
+bool GSQLBackend::listSubZone(const ZoneName &zone, int domain_id) {
 
   string wildzone = "%." + zone.makeLowerCase().toStringNoDot();
 
@@ -1609,7 +1609,7 @@ bool GSQLBackend::autoPrimariesList(std::vector<AutoPrimary>& primaries)
   return true;
 }
 
-bool GSQLBackend::autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb)
+bool GSQLBackend::autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** ddb)
 {
   // check if we know the ip/ns couple in the database
   for(const auto & i : nsset) {
@@ -1639,7 +1639,7 @@ bool GSQLBackend::autoPrimaryBackend(const string& ip, const DNSName& domain, co
   return false;
 }
 
-bool GSQLBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
+bool GSQLBackend::createDomain(const ZoneName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
 {
   vector<string> primaries_s;
   primaries_s.reserve(primaries.size());
@@ -1666,7 +1666,7 @@ bool GSQLBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKi
   return true;
 }
 
-bool GSQLBackend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account)
+bool GSQLBackend::createSecondaryDomain(const string& ip, const ZoneName& domain, const string& nameserver, const string& account)
 {
   string name;
   vector<ComboAddress> primaries({ComboAddress(ip, 53)});
@@ -1703,7 +1703,7 @@ bool GSQLBackend::createSecondaryDomain(const string& ip, const DNSName& domain,
   return true;
 }
 
-bool GSQLBackend::deleteDomain(const DNSName &domain)
+bool GSQLBackend::deleteDomain(const ZoneName &domain)
 {
   if (!d_inTransaction) {
     throw PDNSException("deleteDomain called outside of transaction");
@@ -1766,9 +1766,9 @@ void GSQLBackend::getAllDomains(vector<DomainInfo>* domains, bool getSerial, boo
       DomainInfo di;
       pdns::checked_stoi_into(di.id, row[0]);
       try {
-        di.zone = DNSName(row[1]);
+        di.zone = ZoneName(row[1]);
         if (!row[8].empty()) {
-          di.catalog = DNSName(row[8]);
+          di.catalog = ZoneName(row[8]);
         }
       } catch (...) {
         continue;
@@ -2013,7 +2013,7 @@ bool GSQLBackend::feedEnts3(int domain_id, const DNSName& /* domain */, map<DNSN
   return true;
 }
 
-bool GSQLBackend::startTransaction(const DNSName &domain, int domain_id)
+bool GSQLBackend::startTransaction(const ZoneName &domain, int domain_id)
 {
   try {
     reconnectIfNeeded();
index f0633d4da012b8eb3eac0c9f81670cfc40457408..3ee05ca7c438930ea66973b18da80cfd2cb7a311 100644 (file)
@@ -196,34 +196,34 @@ protected:
 public:
   unsigned int getCapabilities() override;
   void lookup(const QType &, const DNSName &qdomain, int zoneId, DNSPacket *p=nullptr) override;
-  bool list(const DNSName &target, int domain_id, bool include_disabled=false) override;
+  bool list(const ZoneName &target, int domain_id, bool include_disabled=false) override;
   bool get(DNSResourceRecord &r) override;
   void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled) override;
-  bool startTransaction(const DNSName &domain, int domain_id=-1) override;
+  bool startTransaction(const ZoneName &domain, int domain_id=-1) override;
   bool commitTransaction() override;
   bool abortTransaction() override;
   bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
   bool feedEnts(int domain_id, map<DNSName,bool>& nonterm) override;
   bool feedEnts3(int domain_id, const DNSName &domain, map<DNSName,bool> &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override;
-  bool createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account) override;
-  bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override;
-  bool deleteDomain(const DNSName &domain) override;
+  bool createDomain(const ZoneName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account) override;
+  bool createSecondaryDomain(const string& ip, const ZoneName& domain, const string& nameserver, const string& account) override;
+  bool deleteDomain(const ZoneName &domain) override;
   bool autoPrimaryAdd(const AutoPrimary& primary) override;
   bool autoPrimaryRemove(const AutoPrimary& primary) override;
   bool autoPrimariesList(std::vector<AutoPrimary>& primaries) override;
-  bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** db) override;
+  bool autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** db) override;
   void setStale(uint32_t domain_id) override;
   void setFresh(uint32_t domain_id) override;
   void getUnfreshSecondaryInfos(vector<DomainInfo>* domains) override;
   void getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::unordered_set<DNSName>& catalogs, CatalogHashMap& catalogHashes) override;
-  bool getCatalogMembers(const DNSName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type) override;
-  bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true) override;
+  bool getCatalogMembers(const ZoneName& catalog, vector<CatalogInfo>& members, CatalogInfo::CatalogType type) override;
+  bool getDomainInfo(const ZoneName &domain, DomainInfo &di, bool getSerial=true) override;
   void setNotified(uint32_t domain_id, uint32_t serial) override;
-  bool setPrimaries(const DNSName& domain, const vector<ComboAddress>& primaries) override;
-  bool setKind(const DNSName &domain, const DomainInfo::DomainKind kind) override;
-  bool setOptions(const DNSName& domain, const string& options) override;
-  bool setCatalog(const DNSName& domain, const DNSName& catalog) override;
-  bool setAccount(const DNSName &domain, const string &account) override;
+  bool setPrimaries(const ZoneName& domain, const vector<ComboAddress>& primaries) override;
+  bool setKind(const ZoneName &domain, const DomainInfo::DomainKind kind) override;
+  bool setOptions(const ZoneName& domain, const string& options) override;
+  bool setCatalog(const ZoneName& domain, const ZoneName& catalog) override;
+  bool setAccount(const ZoneName &domain, const string &account) override;
 
   bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override;
   bool updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName& qname, const DNSName& ordername, bool auth, const uint16_t=QType::ANY) override;
@@ -231,18 +231,18 @@ public:
   bool updateEmptyNonTerminals(uint32_t domain_id, set<DNSName>& insert ,set<DNSName>& erase, bool remove) override;
 
   bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset) override;
-  bool listSubZone(const DNSName &zone, int domain_id) override;
-  bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override;
-  bool getDomainKeys(const DNSName& name, std::vector<KeyData>& keys) override;
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string> >& meta) override;
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override;
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta) override;
-
-  bool removeDomainKey(const DNSName& name, unsigned int id) override;
-  bool activateDomainKey(const DNSName& name, unsigned int id) override;
-  bool deactivateDomainKey(const DNSName& name, unsigned int id) override;
-  bool publishDomainKey(const DNSName& name, unsigned int id) override;
-  bool unpublishDomainKey(const DNSName& name, unsigned int id) override;
+  bool listSubZone(const ZoneName &zone, int domain_id) override;
+  bool addDomainKey(const ZoneName& name, const KeyData& key, int64_t& id) override;
+  bool getDomainKeys(const ZoneName& name, std::vector<KeyData>& keys) override;
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string> >& meta) override;
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override;
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta) override;
+
+  bool removeDomainKey(const ZoneName& name, unsigned int id) override;
+  bool activateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool deactivateDomainKey(const ZoneName& name, unsigned int id) override;
+  bool publishDomainKey(const ZoneName& name, unsigned int id) override;
+  bool unpublishDomainKey(const ZoneName& name, unsigned int id) override;
 
   bool getTSIGKey(const DNSName& name, DNSName& algorithm, string& content) override;
   bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override;
index 7b9e49eda93447b2df5b5670604691fc9b1354a1..aaf96155e4fbf5fbf6b3f31d9487970946395c78 100644 (file)
@@ -132,7 +132,7 @@ command:
 global_zone_command:
        ZONETOK quotedname zone_block
        {
-               s_di.name=DNSName($2);
+               s_di.name=ZoneName($2);
                free($2);
                parent->commit(s_di);
                s_di.clear();
@@ -140,7 +140,7 @@ global_zone_command:
        |
        ZONETOK quotedname AWORD zone_block
        {
-               s_di.name=DNSName($2);
+               s_di.name=ZoneName($2);
                free($2);
                parent->commit(s_di);
                s_di.clear();
index 655367abdfefbfbd5b8518ac3e6d8f64d5fd9f5b..a6c63d97eeeaac258efbc20639da66bc5cedb1c6 100644 (file)
@@ -34,14 +34,14 @@ class BindDomainInfo
 public:
   void clear() 
   {
-    name=DNSName();
+    name=ZoneName();
     filename=type="";
     primaries.clear();
     alsoNotify.clear();
     d_dev=0;
     d_ino=0;
   }
-  DNSName name;
+  ZoneName name;
   string viewName;
   string filename;
   vector<ComboAddress> primaries;
@@ -88,7 +88,6 @@ class BindParser
   set<string> & getAlsoNotify() { return this->alsoNotify; } 
 private:
   string d_dir{"."};
-  typedef map<DNSName,string> zonedomain_t;
   set<string> alsoNotify;
   vector<BindDomainInfo> d_zonedomains;
   bool d_verbose{false};
index 4fba795a508467967a99dec2b40986528e23682b..7af12f9811918e471401b7ba527cd8d967b48d7d 100644 (file)
@@ -44,7 +44,7 @@ using namespace boost::multi_index;
 
 struct SuckRequest
 {
-  DNSName domain;
+  ZoneName domain;
   ComboAddress primary;
   bool force;
   enum RequestPriority : uint8_t
@@ -76,13 +76,13 @@ using domains_by_name_t = UniQueue::index<IDTag>::type;
 class NotificationQueue
 {
 public:
-  void add(const DNSName& domain, const string& ipstring, time_t delay = 0)
+  void add(const ZoneName& domain, const string& ipstring, time_t delay = 0)
   {
     const ComboAddress ipaddress(ipstring);
     add(domain, ipaddress, delay);
   }
 
-  void add(const DNSName& domain, const ComboAddress& ipaddress, time_t delay = 0)
+  void add(const ZoneName& domain, const ComboAddress& ipaddress, time_t delay = 0)
   {
     NotificationRequest nr;
     nr.domain = domain;
@@ -94,7 +94,7 @@ public:
     d_nqueue.push_back(nr);
   }
 
-  bool removeIf(const ComboAddress& remote, uint16_t id, const DNSName& domain)
+  bool removeIf(const ComboAddress& remote, uint16_t id, const ZoneName& domain)
   {
     for (auto i = d_nqueue.begin(); i != d_nqueue.end(); ++i) {
       ComboAddress stQueued{i->ip};
@@ -106,7 +106,7 @@ public:
     return false;
   }
 
-  bool getOne(DNSName& domain, string& ip, uint16_t* id, bool& purged)
+  bool getOne(ZoneName& domain, string& ip, uint16_t* id, bool& purged)
   {
     for (d_nqueue_t::iterator i = d_nqueue.begin(); i != d_nqueue.end(); ++i)
       if (i->next <= time(nullptr)) {
@@ -139,7 +139,7 @@ public:
 private:
   struct NotificationRequest
   {
-    DNSName domain;
+    ZoneName domain;
     string ip;
     time_t next;
     int attempts;
@@ -169,17 +169,17 @@ public:
   time_t doNotifications(PacketHandler* P);
   void go();
 
-  void drillHole(const DNSName& domain, const string& ip);
-  bool justNotified(const DNSName& domain, const string& ip);
-  void addSuckRequest(const DNSName& domain, const ComboAddress& primary, SuckRequest::RequestPriority, bool force = false);
+  void drillHole(const ZoneName& domain, const string& ip);
+  bool justNotified(const ZoneName& domain, const string& ip);
+  void addSuckRequest(const ZoneName& domain, const ComboAddress& primary, SuckRequest::RequestPriority, bool force = false);
   void addSecondaryCheckRequest(const DomainInfo& di, const ComboAddress& remote);
   void addTryAutoPrimaryRequest(const DNSPacket& p);
-  void notify(const DNSName& domain, const string& ip);
+  void notify(const ZoneName& domain, const string& ip);
   void mainloop();
   void retrievalLoopThread();
-  void sendNotification(int sock, const DNSName& domain, const ComboAddress& remote, uint16_t id, UeberBackend* B);
-  bool notifyDomain(const DNSName& domain, UeberBackend* B);
-  vector<pair<DNSName, ComboAddress>> getSuckRequests();
+  void sendNotification(int sock, const ZoneName& domain, const ComboAddress& remote, uint16_t id, UeberBackend* B);
+  bool notifyDomain(const ZoneName& domain, UeberBackend* B);
+  vector<pair<ZoneName, ComboAddress>> getSuckRequests();
   size_t getSuckRequestsWaiting();
 
 private:
@@ -187,10 +187,10 @@ private:
   void makeNotifySockets();
   void queueNotifyDomain(const DomainInfo& di, UeberBackend* B);
   int d_nsock4, d_nsock6;
-  LockGuarded<map<pair<DNSName, string>, time_t>> d_holes;
+  LockGuarded<map<pair<ZoneName, string>, time_t>> d_holes;
 
-  void suck(const DNSName& domain, const ComboAddress& remote, bool force = false);
-  void ixfrSuck(const DNSName& domain, const TSIGTriplet& tt, const ComboAddress& laddr, const ComboAddress& remote, ZoneStatus& zs, vector<DNSRecord>* axfr);
+  void suck(const ZoneName& domain, const ComboAddress& remote, bool force = false);
+  void ixfrSuck(const ZoneName& domain, const TSIGTriplet& tt, const ComboAddress& laddr, const ComboAddress& remote, ZoneStatus& zs, vector<DNSRecord>* axfr);
 
   void secondaryRefresh(PacketHandler* P);
   void primaryUpdateCheck(PacketHandler* P);
@@ -212,7 +212,7 @@ private:
   {
     uint64_t d_sorthelper{0};
     UniQueue d_suckdomains;
-    set<DNSName> d_inprogress;
+    set<ZoneName> d_inprogress;
 
     set<DomainInfo> d_tocheck;
     struct cmp
@@ -228,14 +228,14 @@ private:
     // Used to keep some state on domains that failed their freshness checks.
     // uint64_t == counter of the number of failures (increased by 1 every consecutive slave-cycle-interval that the domain fails)
     // time_t == wait at least until this time before attempting a new check
-    map<DNSName, pair<uint64_t, time_t>> d_failedSecondaryRefresh;
+    map<ZoneName, pair<uint64_t, time_t>> d_failedSecondaryRefresh;
   };
 
   LockGuarded<Data> d_data;
 
   struct RemoveSentinel
   {
-    explicit RemoveSentinel(DNSName dn, CommunicatorClass* cc) :
+    explicit RemoveSentinel(ZoneName dn, CommunicatorClass* cc) :
       d_dn(std::move(dn)), d_cc(cc)
     {}
 
@@ -247,7 +247,7 @@ private:
       catch (...) {
       }
     }
-    DNSName d_dn;
+    ZoneName d_dn;
     CommunicatorClass* d_cc;
   };
 };
index 8685920dc7a2151294ff5da850c20293b5c44ac5..d3ce6015f835f952e3ff1121f5a50a456fdb80da 100644 (file)
@@ -58,7 +58,7 @@ bool DNSSECKeeper::doesDNSSEC()
   return d_keymetadb->doesDNSSEC();
 }
 
-bool DNSSECKeeper::isSecuredZone(const DNSName& zone, bool useCache)
+bool DNSSECKeeper::isSecuredZone(const ZoneName& zone, bool useCache)
 {
   if(isPresigned(zone, useCache))
     return true;
@@ -73,7 +73,7 @@ bool DNSSECKeeper::isSecuredZone(const DNSName& zone, bool useCache)
   return false;
 }
 
-bool DNSSECKeeper::isPresigned(const DNSName& name, bool useCache)
+bool DNSSECKeeper::isPresigned(const ZoneName& name, bool useCache)
 {
   string meta;
   if (useCache) {
@@ -86,7 +86,7 @@ bool DNSSECKeeper::isPresigned(const DNSName& name, bool useCache)
 }
 
 
-bool DNSSECKeeper::addKey(const DNSName& name, bool setSEPBit, int algorithm, int64_t& id, int bits, bool active, bool published)
+bool DNSSECKeeper::addKey(const ZoneName& name, bool setSEPBit, int algorithm, int64_t& id, int bits, bool active, bool published)
 {
   if(!bits) {
     if(algorithm <= 10)
@@ -121,26 +121,26 @@ void DNSSECKeeper::clearAllCaches() {
 
 /* This function never fails, the return value is to simplify call chains
    elsewhere so we can do mutate<cache> && clear<cache> */
-bool DNSSECKeeper::clearKeyCache(const DNSName& name)
+bool DNSSECKeeper::clearKeyCache(const ZoneName& name)
 {
   s_keycache.write_lock()->erase(name);
   return true;
 }
 
-bool DNSSECKeeper::clearMetaCache(const DNSName& name)
+bool DNSSECKeeper::clearMetaCache(const ZoneName& name)
 {
   s_metacache.write_lock()->erase(name);
   ++s_metaCacheCleanActions;
   return true;
 }
 
-void DNSSECKeeper::clearCaches(const DNSName& name)
+void DNSSECKeeper::clearCaches(const ZoneName& name)
 {
   (void)clearKeyCache(name);
   (void)clearMetaCache(name);
 }
 
-bool DNSSECKeeper::addKey(const DNSName& name, const DNSSECPrivateKey& dpk, int64_t& id, bool active, bool published)
+bool DNSSECKeeper::addKey(const ZoneName& name, const DNSSECPrivateKey& dpk, int64_t& id, bool active, bool published)
 {
   DNSBackend::KeyData kd;
   kd.flags = dpk.getFlags(); // the dpk doesn't get stored, only they key part
@@ -158,7 +158,7 @@ static bool keyCompareByKindAndID(const DNSSECKeeper::keyset_t::value_type& a, c
          pair(!b.second.keyType, b.second.id);
 }
 
-DNSSECPrivateKey DNSSECKeeper::getKeyById(const DNSName& zname, unsigned int id)
+DNSSECPrivateKey DNSSECKeeper::getKeyById(const ZoneName& zname, unsigned int id)
 {
   vector<DNSBackend::KeyData> keys;
   d_keymetadb->getDomainKeys(zname, keys);
@@ -177,32 +177,32 @@ DNSSECPrivateKey DNSSECKeeper::getKeyById(const DNSName& zname, unsigned int id)
 }
 
 
-bool DNSSECKeeper::removeKey(const DNSName& zname, unsigned int id)
+bool DNSSECKeeper::removeKey(const ZoneName& zname, unsigned int id)
 {
   return d_keymetadb->removeDomainKey(zname, id) && clearKeyCache(zname);
 }
 
-bool DNSSECKeeper::deactivateKey(const DNSName& zname, unsigned int id)
+bool DNSSECKeeper::deactivateKey(const ZoneName& zname, unsigned int id)
 {
   return d_keymetadb->deactivateDomainKey(zname, id) && clearKeyCache(zname);
 }
 
-bool DNSSECKeeper::activateKey(const DNSName& zname, unsigned int id)
+bool DNSSECKeeper::activateKey(const ZoneName& zname, unsigned int id)
 {
   return d_keymetadb->activateDomainKey(zname, id) && clearKeyCache(zname);
 }
 
-bool DNSSECKeeper::unpublishKey(const DNSName& zname, unsigned int id)
+bool DNSSECKeeper::unpublishKey(const ZoneName& zname, unsigned int id)
 {
   return d_keymetadb->unpublishDomainKey(zname, id) && clearKeyCache(zname);
 }
 
-bool DNSSECKeeper::publishKey(const DNSName& zname, unsigned int id)
+bool DNSSECKeeper::publishKey(const ZoneName& zname, unsigned int id)
 {
   return d_keymetadb->publishDomainKey(zname, id) && clearKeyCache(zname);
 }
 
-void DNSSECKeeper::getFromMetaOrDefault(const DNSName& zname, const std::string& key, std::string& value, const std::string& defaultvalue)
+void DNSSECKeeper::getFromMetaOrDefault(const ZoneName& zname, const std::string& key, std::string& value, const std::string& defaultvalue)
 {
   if (getFromMeta(zname, key, value))
     return;
@@ -210,7 +210,7 @@ void DNSSECKeeper::getFromMetaOrDefault(const DNSName& zname, const std::string&
     value = defaultvalue;
 }
 
-bool DNSSECKeeper::getFromMeta(const DNSName& zname, const std::string& key, std::string& value)
+bool DNSSECKeeper::getFromMeta(const ZoneName& zname, const std::string& key, std::string& value)
 {
   if (d_metaUpdate) {
     if (d_keymetadb->inTransaction()) {
@@ -273,7 +273,7 @@ bool DNSSECKeeper::getFromMeta(const DNSName& zname, const std::string& key, std
   return ret;
 }
 
-bool DNSSECKeeper::getFromMetaNoCache(const DNSName& name, const std::string& kind, std::string& value)
+bool DNSSECKeeper::getFromMetaNoCache(const ZoneName& name, const std::string& kind, std::string& value)
 {
   std::vector<std::string> meta;
   if (d_keymetadb->getDomainMetadata(name, kind, meta)) {
@@ -285,7 +285,7 @@ bool DNSSECKeeper::getFromMetaNoCache(const DNSName& name, const std::string& ki
   return false;
 }
 
-void DNSSECKeeper::getSoaEdit(const DNSName& zname, std::string& value, bool useCache)
+void DNSSECKeeper::getSoaEdit(const ZoneName& zname, std::string& value, bool useCache)
 {
   static const string soaEdit(::arg()["default-soa-edit"]);
   static const string soaEditSigned(::arg()["default-soa-edit-signed"]);
@@ -318,7 +318,7 @@ uint64_t DNSSECKeeper::dbdnssecCacheSizes(const std::string& str)
   return (uint64_t)-1;
 }
 
-bool DNSSECKeeper::getNSEC3PARAM(const DNSName& zname, NSEC3PARAMRecordContent* ns3p, bool* narrow, bool useCache)
+bool DNSSECKeeper::getNSEC3PARAM(const ZoneName& zname, NSEC3PARAMRecordContent* ns3p, bool* narrow, bool useCache)
 {
   string value;
   if(useCache) {
@@ -381,7 +381,7 @@ bool DNSSECKeeper::checkNSEC3PARAM(const NSEC3PARAMRecordContent& ns3p, string&
   return ret;
 }
 
-bool DNSSECKeeper::setNSEC3PARAM(const DNSName& zname, const NSEC3PARAMRecordContent& ns3p, const bool& narrow)
+bool DNSSECKeeper::setNSEC3PARAM(const ZoneName& zname, const NSEC3PARAMRecordContent& ns3p, const bool& narrow)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -405,7 +405,7 @@ bool DNSSECKeeper::setNSEC3PARAM(const DNSName& zname, const NSEC3PARAMRecordCon
   return false;
 }
 
-bool DNSSECKeeper::unsetNSEC3PARAM(const DNSName& zname)
+bool DNSSECKeeper::unsetNSEC3PARAM(const ZoneName& zname)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -415,7 +415,7 @@ bool DNSSECKeeper::unsetNSEC3PARAM(const DNSName& zname)
 }
 
 
-bool DNSSECKeeper::setPresigned(const DNSName& zname)
+bool DNSSECKeeper::setPresigned(const ZoneName& zname)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -426,7 +426,7 @@ bool DNSSECKeeper::setPresigned(const DNSName& zname)
   return d_keymetadb->setDomainMetadata(zname, "PRESIGNED", meta) && clearMetaCache(zname);
 }
 
-bool DNSSECKeeper::unsetPresigned(const DNSName& zname)
+bool DNSSECKeeper::unsetPresigned(const ZoneName& zname)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -438,13 +438,13 @@ bool DNSSECKeeper::unsetPresigned(const DNSName& zname)
 /**
  * Add domainmetadata to allow publishing CDS records for zone zname
  *
- * @param zname        DNSName of the zone
+ * @param zname        ZoneName of the zone
  * @param digestAlgos  string with comma-separated numbers that describe the
  *                     used digest algorithms. This is copied to the database
  *                     verbatim
  * @return             true if the data was inserted, false otherwise
  */
-bool DNSSECKeeper::setPublishCDS(const DNSName& zname, const string& digestAlgos)
+bool DNSSECKeeper::setPublishCDS(const ZoneName& zname, const string& digestAlgos)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -455,7 +455,7 @@ bool DNSSECKeeper::setPublishCDS(const DNSName& zname, const string& digestAlgos
   return d_keymetadb->setDomainMetadata(zname, "PUBLISH-CDS", meta) && clearMetaCache(zname);
 }
 
-void DNSSECKeeper::getPublishCDS(const DNSName& zname, std::string& value)
+void DNSSECKeeper::getPublishCDS(const ZoneName& zname, std::string& value)
 {
   getFromMetaOrDefault(zname, "PUBLISH-CDS", value, ::arg()["default-publish-cds"]);
 }
@@ -463,10 +463,10 @@ void DNSSECKeeper::getPublishCDS(const DNSName& zname, std::string& value)
 /**
  * Remove domainmetadata to stop publishing CDS records for zone zname
  *
- * @param zname        DNSName of the zone
+ * @param zname        ZoneName of the zone
  * @return             true if the operation was successful, false otherwise
  */
-bool DNSSECKeeper::unsetPublishCDS(const DNSName& zname)
+bool DNSSECKeeper::unsetPublishCDS(const ZoneName& zname)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -478,10 +478,10 @@ bool DNSSECKeeper::unsetPublishCDS(const DNSName& zname)
 /**
  * Add domainmetadata to allow publishing CDNSKEY records.for zone zname
  *
- * @param zname        DNSName of the zone
+ * @param zname        ZoneName of the zone
  * @return             true if the data was inserted, false otherwise
  */
-bool DNSSECKeeper::setPublishCDNSKEY(const DNSName& zname, bool deleteAlg)
+bool DNSSECKeeper::setPublishCDNSKEY(const ZoneName& zname, bool deleteAlg)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -492,7 +492,7 @@ bool DNSSECKeeper::setPublishCDNSKEY(const DNSName& zname, bool deleteAlg)
   return d_keymetadb->setDomainMetadata(zname, "PUBLISH-CDNSKEY", meta) && clearMetaCache(zname);
 }
 
-void DNSSECKeeper::getPublishCDNSKEY(const DNSName& zname, std::string& value)
+void DNSSECKeeper::getPublishCDNSKEY(const ZoneName& zname, std::string& value)
 {
   getFromMetaOrDefault(zname, "PUBLISH-CDNSKEY", value, ::arg()["default-publish-cdnskey"]);
 }
@@ -500,10 +500,10 @@ void DNSSECKeeper::getPublishCDNSKEY(const DNSName& zname, std::string& value)
 /**
  * Remove domainmetadata to stop publishing CDNSKEY records for zone zname
  *
- * @param zname        DNSName of the zone
+ * @param zname        ZoneName of the zone
  * @return             true if the operation was successful, false otherwise
  */
-bool DNSSECKeeper::unsetPublishCDNSKEY(const DNSName& zname)
+bool DNSSECKeeper::unsetPublishCDNSKEY(const ZoneName& zname)
 {
   if (d_keymetadb->inTransaction()) {
     d_metaUpdate = true;
@@ -515,11 +515,11 @@ bool DNSSECKeeper::unsetPublishCDNSKEY(const DNSName& zname)
 /**
  * Returns all keys that are used to sign the DNSKEY RRSet in a zone
  *
- * @param zname        DNSName of the zone
+ * @param zname        ZoneName of the zone
  * @return             a keyset_t with all keys that are used to sign the DNSKEY
  *                     RRSet (these are the entrypoint(s) to the zone)
  */
-DNSSECKeeper::keyset_t DNSSECKeeper::getEntryPoints(const DNSName& zname)
+DNSSECKeeper::keyset_t DNSSECKeeper::getEntryPoints(const ZoneName& zname)
 {
   DNSSECKeeper::keyset_t ret;
   DNSSECKeeper::keyset_t keys = getKeys(zname);
@@ -530,7 +530,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getEntryPoints(const DNSName& zname)
   return ret;
 }
 
-DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const DNSName& zone, bool useCache)
+DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const ZoneName& zone, bool useCache)
 {
   static int ttl = ::arg().asNum("dnssec-key-cache-ttl");
   // coverity[store_truncates_time_t]
@@ -615,7 +615,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const DNSName& zone, bool useCache)
   return retkeyset;
 }
 
-bool DNSSECKeeper::checkKeys(const DNSName& zone, std::optional<std::reference_wrapper<std::vector<std::string>>> errorMessages)
+bool DNSSECKeeper::checkKeys(const ZoneName& zone, std::optional<std::reference_wrapper<std::vector<std::string>>> errorMessages)
 {
   vector<DNSBackend::KeyData> dbkeyset;
   d_keymetadb->getDomainKeys(zone, dbkeyset);
@@ -655,7 +655,7 @@ void DNSSECKeeper::getPreRRSIGs(UeberBackend& db, vector<DNSZoneRecord>& rrs, ui
   }
 }
 
-bool DNSSECKeeper::TSIGGrantsAccess(const DNSName& zone, const DNSName& keyname)
+bool DNSSECKeeper::TSIGGrantsAccess(const ZoneName& zone, const DNSName& keyname)
 {
   vector<string> allowed;
 
@@ -668,7 +668,7 @@ bool DNSSECKeeper::TSIGGrantsAccess(const DNSName& zone, const DNSName& keyname)
   return false;
 }
 
-bool DNSSECKeeper::getTSIGForAccess(const DNSName& zone, const ComboAddress& /* primary */, DNSName* keyname)
+bool DNSSECKeeper::getTSIGForAccess(const ZoneName& zone, const ComboAddress& /* primary */, DNSName* keyname)
 {
   vector<string> keynames;
   d_keymetadb->getDomainMetadata(zone, "AXFR-MASTER-TSIG", keynames);
@@ -682,7 +682,7 @@ bool DNSSECKeeper::getTSIGForAccess(const DNSName& zone, const ComboAddress& /*
   return false;
 }
 
-bool DNSSECKeeper::unSecureZone(const DNSName& zone, string& error) {
+bool DNSSECKeeper::unSecureZone(const ZoneName& zone, string& error) {
   // Not calling isSecuredZone(), as it will return false for zones with zero
   // active keys.
   DNSSECKeeper::keyset_t keyset=getKeys(zone);
@@ -718,7 +718,8 @@ struct RecordStatus
  * \param info& A string where informational messages are added
  * \param doTransaction Whether or not to wrap the rectify in a transaction
  */
-bool DNSSECKeeper::rectifyZone(const DNSName& zone, string& error, string& info, bool doTransaction) {
+// NOLINTNEXTLINE(readability-function-cognitive-complexity)
+bool DNSSECKeeper::rectifyZone(const ZoneName& zone, string& error, string& info, bool doTransaction) {
   if (isPresigned(zone, doTransaction)) {
     error =  "Rectify presigned zone '"+zone.toLogString()+"' is not allowed/necessary.";
     return false;
index 289cee88b6d73cf5a953a9b31901fbf5e9ab0fb6..db5fc19af744ef4e93a5f9243ef3cd0ab513bd3e 100644 (file)
@@ -42,7 +42,7 @@ extern StatBag S;
 // this is so the geoipbackend can set this pointer if loaded for lua-record.cc
 std::function<std::string(const std::string&, int)> g_getGeo;
 
-bool DNSBackend::getAuth(const DNSName& target, SOAData* soaData)
+bool DNSBackend::getAuth(const ZoneName& target, SOAData* soaData)
 {
   return this->getSOA(target, *soaData);
 }
@@ -242,7 +242,7 @@ vector<std::unique_ptr<DNSBackend>> BackendMakerClass::all(bool metadataOnly)
     \param sd SOAData which is filled with the SOA details
     \param unmodifiedSerial bool if set, serial will be returned as stored in the backend (maybe 0)
 */
-bool DNSBackend::getSOA(const DNSName& domain, SOAData& soaData)
+bool DNSBackend::getSOA(const ZoneName& domain, SOAData& soaData)
 {
   this->lookup(QType(QType::SOA), domain, -1);
   S.inc("backend-queries");
@@ -300,7 +300,7 @@ bool DNSBackend::get(DNSZoneRecord& zoneRecord)
   return true;
 }
 
-bool DNSBackend::getBeforeAndAfterNames(uint32_t id, const DNSName& zonename, const DNSName& qname, DNSName& before, DNSName& after)
+bool DNSBackend::getBeforeAndAfterNames(uint32_t id, const ZoneName& zonename, const DNSName& qname, DNSName& before, DNSName& after)
 {
   DNSName unhashed;
   bool ret = this->getBeforeAndAfterNamesAbsolute(id, qname.makeRelative(zonename).makeLowerCase(), unhashed, before, after);
index 51b04194e21ea98c3111162e037fe0c4e0d76415..5b670f439a61905d8f92e1abb83b4e86fe9dd136 100644 (file)
@@ -54,8 +54,8 @@ struct DomainInfo
 {
   DomainInfo() = default;
 
-  DNSName zone;
-  DNSName catalog;
+  ZoneName zone;
+  ZoneName catalog;
   time_t last_check{};
   string options;
   string account;
@@ -177,19 +177,19 @@ public:
       if the backend does not consider itself responsible for the id passed.
       \param domain_id ID of which a list is requested
   */
-  virtual bool list(const DNSName& target, int domain_id, bool include_disabled = false) = 0;
+  virtual bool list(const ZoneName& target, int domain_id, bool include_disabled = false) = 0;
 
   virtual ~DNSBackend() = default;
 
   //! fills the soadata struct with the SOA details. Returns false if there is no SOA.
-  virtual bool getSOA(const DNSName& domain, SOAData& soaData);
+  virtual bool getSOA(const ZoneName& domain, SOAData& soaData);
 
   virtual bool replaceRRSet(uint32_t /* domain_id */, const DNSName& /* qname */, const QType& /* qt */, const vector<DNSResourceRecord>& /* rrset */)
   {
     return false;
   }
 
-  virtual bool listSubZone(const DNSName& /* zone */, int /* domain_id */)
+  virtual bool listSubZone(const ZoneName& /* zone */, int /* domain_id */)
   {
     return false;
   }
@@ -199,9 +199,9 @@ public:
   {
     return (name == "PRESIGNED" || name == "NSEC3PARAM" || name == "NSEC3NARROW");
   }
-  virtual bool getAllDomainMetadata(const DNSName& /* name */, std::map<std::string, std::vector<std::string>>& /* meta */) { return false; };
-  virtual bool getDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */) { return false; }
-  virtual bool getDomainMetadataOne(const DNSName& name, const std::string& kind, std::string& value)
+  virtual bool getAllDomainMetadata(const ZoneName& /* name */, std::map<std::string, std::vector<std::string>>& /* meta */) { return false; };
+  virtual bool getDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */) { return false; }
+  virtual bool getDomainMetadataOne(const ZoneName& name, const std::string& kind, std::string& value)
   {
     std::vector<std::string> meta;
     if (getDomainMetadata(name, kind, meta)) {
@@ -213,8 +213,8 @@ public:
     return false;
   }
 
-  virtual bool setDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */) { return false; }
-  virtual bool setDomainMetadataOne(const DNSName& name, const std::string& kind, const std::string& value)
+  virtual bool setDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */) { return false; }
+  virtual bool setDomainMetadataOne(const ZoneName& name, const std::string& kind, const std::string& value)
   {
     const std::vector<std::string> meta(1, value);
     return setDomainMetadata(name, kind, meta);
@@ -223,7 +223,7 @@ public:
   virtual void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled);
 
   /** Determines if we are authoritative for a zone, and at what level */
-  virtual bool getAuth(const DNSName& target, SOAData* /* sd */);
+  virtual bool getAuth(const ZoneName& target, SOAData* /* sd */);
 
   struct KeyData
   {
@@ -234,13 +234,13 @@ public:
     bool published{false};
   };
 
-  virtual bool getDomainKeys(const DNSName& /* name */, std::vector<KeyData>& /* keys */) { return false; }
-  virtual bool removeDomainKey(const DNSName& /* name */, unsigned int /* id */) { return false; }
-  virtual bool addDomainKey(const DNSName& /* name */, const KeyData& /* key */, int64_t& /* id */) { return false; }
-  virtual bool activateDomainKey(const DNSName& /* name */, unsigned int /* id */) { return false; }
-  virtual bool deactivateDomainKey(const DNSName& /* name */, unsigned int /* id */) { return false; }
-  virtual bool publishDomainKey(const DNSName& /* name */, unsigned int /* id */) { return false; }
-  virtual bool unpublishDomainKey(const DNSName& /* name */, unsigned int /* id */) { return false; }
+  virtual bool getDomainKeys(const ZoneName& /* name */, std::vector<KeyData>& /* keys */) { return false; }
+  virtual bool removeDomainKey(const ZoneName& /* name */, unsigned int /* id */) { return false; }
+  virtual bool addDomainKey(const ZoneName& /* name */, const KeyData& /* key */, int64_t& /* id */) { return false; }
+  virtual bool activateDomainKey(const ZoneName& /* name */, unsigned int /* id */) { return false; }
+  virtual bool deactivateDomainKey(const ZoneName& /* name */, unsigned int /* id */) { return false; }
+  virtual bool publishDomainKey(const ZoneName& /* name */, unsigned int /* id */) { return false; }
+  virtual bool unpublishDomainKey(const ZoneName& /* name */, unsigned int /* id */) { return false; }
 
   virtual bool setTSIGKey(const DNSName& /* name */, const DNSName& /* algorithm */, const string& /* content */) { return false; }
   virtual bool getTSIGKey(const DNSName& /* name */, DNSName& /* algorithm */, string& /* content */) { return false; }
@@ -254,7 +254,7 @@ public:
     return false;
   }
 
-  virtual bool getBeforeAndAfterNames(uint32_t /* id */, const DNSName& zonename, const DNSName& qname, DNSName& before, DNSName& after);
+  virtual bool getBeforeAndAfterNames(uint32_t /* id */, const ZoneName& zonename, const DNSName& qname, DNSName& before, DNSName& after);
 
   virtual bool updateDNSSECOrderNameAndAuth(uint32_t /* domain_id */, const DNSName& /* qname */, const DNSName& /* ordername */, bool /* auth */, const uint16_t /* qtype */ = QType::ANY)
   {
@@ -295,8 +295,12 @@ public:
   }
 
   //! returns true if primary ip is primary for domain name.
-  //! starts the transaction for updating domain qname (FIXME: what is id?)
-  virtual bool startTransaction(const DNSName& /* qname */, int /* id */ = -1)
+  //! starts the transaction for updating domain qname, destroying all
+  //! existing data for that domain if id is >= 0. In this case, the id MUST
+  //! match the DomainInfo information for qname, or very bad things will
+  //! happen.
+  //! FIXME: replace this with a bool to make this a less error-prone interface.
+  virtual bool startTransaction(const ZoneName& /* qname */, int /* id */ = -1)
   {
     return false;
   }
@@ -341,7 +345,7 @@ public:
   }
 
   //! if this returns true, DomainInfo di contains information about the domain
-  virtual bool getDomainInfo(const DNSName& /* domain */, DomainInfo& /* di */, bool /* getSerial */ = true)
+  virtual bool getDomainInfo(const ZoneName& /* domain */, DomainInfo& /* di */, bool /* getSerial */ = true)
   {
     return false;
   }
@@ -351,7 +355,7 @@ public:
   }
 
   //! get a list of IP addresses that should also be notified for a domain
-  virtual void alsoNotifies(const DNSName& domain, set<string>* ips)
+  virtual void alsoNotifies(const ZoneName& domain, set<string>* ips)
   {
     std::vector<std::string> meta;
     getDomainMetadata(domain, "ALSO-NOTIFY", meta);
@@ -364,7 +368,7 @@ public:
   }
 
   //! get list of all members in a catalog
-  [[nodiscard]] virtual bool getCatalogMembers(const DNSName& /* catalog */, vector<CatalogInfo>& /* members */, CatalogInfo::CatalogType /* type */)
+  [[nodiscard]] virtual bool getCatalogMembers(const ZoneName& /* catalog */, vector<CatalogInfo>& /* members */, CatalogInfo::CatalogType /* type */)
   {
     return false;
   }
@@ -385,31 +389,31 @@ public:
   }
 
   //! Called when the Primary list of a domain should be changed
-  virtual bool setPrimaries(const DNSName& /* domain */, const vector<ComboAddress>& /* primaries */)
+  virtual bool setPrimaries(const ZoneName& /* domain */, const vector<ComboAddress>& /* primaries */)
   {
     return false;
   }
 
   //! Called when the Kind of a domain should be changed (primary -> native and similar)
-  virtual bool setKind(const DNSName& /* domain */, const DomainInfo::DomainKind /* kind */)
+  virtual bool setKind(const ZoneName& /* domain */, const DomainInfo::DomainKind /* kind */)
   {
     return false;
   }
 
   //! Called when the options of a domain should be changed
-  virtual bool setOptions(const DNSName& /* domain */, const string& /* options */)
+  virtual bool setOptions(const ZoneName& /* domain */, const string& /* options */)
   {
     return false;
   }
 
   //! Called when the catalog of a domain should be changed
-  virtual bool setCatalog(const DNSName& /* domain */, const DNSName& /* catalog */)
+  virtual bool setCatalog(const ZoneName& /* domain */, const ZoneName& /* catalog */)
   {
     return false;
   }
 
   //! Called when the Account of a domain should be changed
-  virtual bool setAccount(const DNSName& /* domain */, const string& /* account */)
+  virtual bool setAccount(const ZoneName& /* domain */, const string& /* account */)
   {
     return false;
   }
@@ -436,25 +440,25 @@ public:
   }
 
   //! determine if ip is a autoprimary or a domain
-  virtual bool autoPrimaryBackend(const string& /* ip */, const DNSName& /* domain */, const vector<DNSResourceRecord>& /* nsset */, string* /* nameserver */, string* /* account */, DNSBackend** /* db */)
+  virtual bool autoPrimaryBackend(const string& /* ip */, const ZoneName& /* domain */, const vector<DNSResourceRecord>& /* nsset */, string* /* nameserver */, string* /* account */, DNSBackend** /* db */)
   {
     return false;
   }
 
   //! called by PowerDNS to create a new domain
-  virtual bool createDomain(const DNSName& /* domain */, const DomainInfo::DomainKind /* kind */, const vector<ComboAddress>& /* primaries */, const string& /* account */)
+  virtual bool createDomain(const ZoneName& /* domain */, const DomainInfo::DomainKind /* kind */, const vector<ComboAddress>& /* primaries */, const string& /* account */)
   {
     return false;
   }
 
   //! called by PowerDNS to create a secondary record for a autoPrimary
-  virtual bool createSecondaryDomain(const string& /* ip */, const DNSName& /* domain */, const string& /* nameserver */, const string& /* account */)
+  virtual bool createSecondaryDomain(const string& /* ip */, const ZoneName& /* domain */, const string& /* nameserver */, const string& /* account */)
   {
     return false;
   }
 
   //! called to delete a domain, incl. all metadata, zone contents, etc.
-  virtual bool deleteDomain(const DNSName& /* domain */)
+  virtual bool deleteDomain(const ZoneName& /* domain */)
   {
     return false;
   }
index bbac4ffcb6a4a46fcbaa7c72d024abc7b12b2f29..1af07d4dc577415b9605c2ed36d79ba1b76af49a 100644 (file)
@@ -257,7 +257,7 @@ std::string DNSName::toString(const std::string& separator, const bool trailing)
 void DNSName::toString(std::string& output, const std::string& separator, const bool trailing) const
 {
   if (empty()) {
-    throw std::out_of_range("Attempt to print an unset dnsname");
+    throw std::out_of_range("Attempt to print an unset DNSName");
   }
 
   if (isRoot()) {
@@ -298,7 +298,7 @@ std::string DNSName::toLogString() const
 std::string DNSName::toDNSString() const
 {
   if (empty()) {
-    throw std::out_of_range("Attempt to DNSString an unset dnsname");
+    throw std::out_of_range("Attempt to DNSString an unset DNSName");
   }
 
   return std::string(d_storage.c_str(), d_storage.length());
@@ -324,7 +324,7 @@ size_t DNSName::wirelength() const {
 bool DNSName::isPartOf(const DNSName& parent) const
 {
   if(parent.empty() || empty()) {
-    throw std::out_of_range("empty dnsnames aren't part of anything");
+    throw std::out_of_range("empty DNSNames aren't part of anything");
   }
 
   if(parent.d_storage.size() > d_storage.size()) {
@@ -346,7 +346,7 @@ bool DNSName::isPartOf(const DNSName& parent) const
       return true;
     }
     if (static_cast<uint8_t>(*us) > 63) {
-      throw std::out_of_range("illegal label length in dnsname");
+      throw std::out_of_range("illegal label length in DNSName");
     }
   }
   return false;
index 86079bae32188a2e8198a1c99f52c0927e76309b..ed3e73f027ab801fea1cf22a7daa23ec1ceb945c 100644 (file)
@@ -57,11 +57,6 @@ inline unsigned char dns_tolower(unsigned char c)
 #include "burtle.hh"
 #include "views.hh"
 
-// #include "dns.hh"
-// #include "logger.hh"
-
-//#include <ext/vstring.h>
-
 /* Quest in life:
      accept escaped ascii presentations of DNS names and store them "natively"
      accept a DNS packet with an offset, and extract a DNS name from it
@@ -74,6 +69,14 @@ inline unsigned char dns_tolower(unsigned char c)
    NOTE: For now, everything MUST be . terminated, otherwise it is an error
 */
 
+// DNSName: represents a case-insensitive string, allowing for non-printable
+// characters. It is used for all kinds of name (of hosts, domains, keys,
+// algorithm...) overall the PowerDNS codebase.
+//
+// The following type traits are provided:
+// - EqualityComparable
+// - LessThanComparable
+// - Hash
 class DNSName
 {
 public:
@@ -304,6 +307,11 @@ inline DNSName operator+(const DNSName& lhs, const DNSName& rhs)
 
 extern const DNSName g_rootdnsname, g_wildcarddnsname;
 
+// ZoneName: this is equivalent to DNSName, but intended to only store zone
+// names. For the time being, they are strictly identical.
+using ZoneName = DNSName;
+using CanonZoneNameCompare = CanonDNSNameCompare;
+
 template<typename T>
 struct SuffixMatchTree
 {
index 67b84c651a237ff772e786d03c60f39ce641ee08..8a6500133fb1841de8246f6b4d88eb50d6be53a2 100644 (file)
@@ -139,7 +139,7 @@ public:
 
   DNSName qdomain;  //!< qname of the question 4 - unsure how this is used
   DNSName qdomainwild;  //!< wildcard matched by qname, used by LuaPolicyEngine
-  DNSName qdomainzone;  //!< zone name for the answer (as reflected in SOA for negative responses), used by LuaPolicyEngine
+  ZoneName qdomainzone;  //!< zone name for the answer (as reflected in SOA for negative responses), used by LuaPolicyEngine
   string d_peer_principal;
   const DNSName& getTSIGKeyname() const;
 
index 7bddcc2b6d6fd79e563f6c8431ebbb890cc338a8..a79bd2fbb42076f5a92691c8e60973d9510d8184 100644 (file)
@@ -885,7 +885,7 @@ class NSECRecordContent : public DNSRecordContent
 public:
   static void report(const ReportIsOnlyCallableByReportAllTypes& guard);
   NSECRecordContent() = default;
-  NSECRecordContent(const string& content, const DNSName& zone=DNSName());
+  NSECRecordContent(const string& content, const ZoneName& zone=ZoneName());
 
   static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
   static std::shared_ptr<DNSRecordContent> make(const string& content);
@@ -926,7 +926,7 @@ class NSEC3RecordContent : public DNSRecordContent
 public:
   static void report(const ReportIsOnlyCallableByReportAllTypes& guard);
   NSEC3RecordContent() = default;
-  NSEC3RecordContent(const string& content, const DNSName& zone=DNSName());
+  NSEC3RecordContent(const string& content, const ZoneName& zone=ZoneName());
 
   static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
   static std::shared_ptr<DNSRecordContent> make(const string& content);
@@ -976,7 +976,7 @@ class CSYNCRecordContent : public DNSRecordContent
 public:
   static void report(const ReportIsOnlyCallableByReportAllTypes& guard);
   CSYNCRecordContent() = default;
-  CSYNCRecordContent(const string& content, const DNSName& zone=DNSName());
+  CSYNCRecordContent(const string& content, const ZoneName& zone=ZoneName());
 
   static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
   static std::shared_ptr<DNSRecordContent> make(const string& content);
@@ -1009,7 +1009,7 @@ class NSEC3PARAMRecordContent : public DNSRecordContent
 public:
   static void report(const ReportIsOnlyCallableByReportAllTypes& guard);
   NSEC3PARAMRecordContent() = default;
-  NSEC3PARAMRecordContent(const string& content, const DNSName& zone=DNSName());
+  NSEC3PARAMRecordContent(const string& content, const ZoneName& zone=ZoneName());
 
   static std::shared_ptr<DNSRecordContent> make(const DNSRecord &dr, PacketReader& pr);
   static std::shared_ptr<DNSRecordContent> make(const string& content);
index 32b565d75668fccb3a56b6c7e9759ee75e1e0d24..3a9b8c8b0115030df8832b47518f0f0fbaea553c 100644 (file)
@@ -292,7 +292,7 @@ string hashQNameWithSalt(const std::string& salt, unsigned int iterations, const
 void incrementHash(std::string& raw);
 void decrementHash(std::string& raw);
 
-void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const std::set<DNSName>& authSet, vector<DNSZoneRecord>& rrs, DNSPacket* packet=nullptr);
+void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const std::set<ZoneName>& authSet, vector<DNSZoneRecord>& rrs, DNSPacket* packet=nullptr);
 
 void addTSIG(DNSPacketWriter& pw, TSIGRecordContent& trc, const DNSName& tsigkeyname, const string& tsigsecret, const string& tsigprevious, bool timersonly);
 bool validateTSIG(const std::string& packet, size_t sigPos, const TSIGTriplet& tt, const TSIGRecordContent& trc, const std::string& previousMAC, const std::string& theirMAC, bool timersOnly, unsigned int dnsHeaderOffset=0);
index 04727305ee74043556e07915db32640683fb629b..5af42115d118820766b8beedf89e4e1f67b00218 100644 (file)
@@ -187,43 +187,43 @@ public:
 
   static uint64_t dbdnssecCacheSizes(const std::string& str);
   static void clearAllCaches();
-  static bool clearKeyCache(const DNSName& name);
-  static bool clearMetaCache(const DNSName& name);
-  static void clearCaches(const DNSName& name);
+  static bool clearKeyCache(const ZoneName& name);
+  static bool clearMetaCache(const ZoneName& name);
+  static void clearCaches(const ZoneName& name);
 
   bool doesDNSSEC();
-  bool isSecuredZone(const DNSName& zone, bool useCache=true);
-  keyset_t getEntryPoints(const DNSName& zname);
-  keyset_t getKeys(const DNSName& zone, bool useCache = true);
-  DNSSECPrivateKey getKeyById(const DNSName& zone, unsigned int id);
-  bool addKey(const DNSName& zname, bool setSEPBit, int algorithm, int64_t& id, int bits=0, bool active=true, bool published=true);
-  bool addKey(const DNSName& zname, const DNSSECPrivateKey& dpk, int64_t& id, bool active=true, bool published=true);
-  bool removeKey(const DNSName& zname, unsigned int id);
-  bool activateKey(const DNSName& zname, unsigned int id);
-  bool deactivateKey(const DNSName& zname, unsigned int id);
-  bool publishKey(const DNSName& zname, unsigned int id);
-  bool unpublishKey(const DNSName& zname, unsigned int id);
-  bool checkKeys(const DNSName& zname, std::optional<std::reference_wrapper<std::vector<std::string>>> errorMessages);
-
-  bool getNSEC3PARAM(const DNSName& zname, NSEC3PARAMRecordContent* n3p=nullptr, bool* narrow=nullptr, bool useCache=true);
+  bool isSecuredZone(const ZoneName& zone, bool useCache=true);
+  keyset_t getEntryPoints(const ZoneName& zname);
+  keyset_t getKeys(const ZoneName& zone, bool useCache = true);
+  DNSSECPrivateKey getKeyById(const ZoneName& zone, unsigned int id);
+  bool addKey(const ZoneName& zname, bool setSEPBit, int algorithm, int64_t& id, int bits=0, bool active=true, bool published=true);
+  bool addKey(const ZoneName& zname, const DNSSECPrivateKey& dpk, int64_t& id, bool active=true, bool published=true);
+  bool removeKey(const ZoneName& zname, unsigned int id);
+  bool activateKey(const ZoneName& zname, unsigned int id);
+  bool deactivateKey(const ZoneName& zname, unsigned int id);
+  bool publishKey(const ZoneName& zname, unsigned int id);
+  bool unpublishKey(const ZoneName& zname, unsigned int id);
+  bool checkKeys(const ZoneName& zname, std::optional<std::reference_wrapper<std::vector<std::string>>> errorMessages);
+
+  bool getNSEC3PARAM(const ZoneName& zname, NSEC3PARAMRecordContent* n3p=nullptr, bool* narrow=nullptr, bool useCache=true);
   bool checkNSEC3PARAM(const NSEC3PARAMRecordContent& ns3p, string& msg);
-  bool setNSEC3PARAM(const DNSName& zname, const NSEC3PARAMRecordContent& n3p, const bool& narrow=false);
-  bool unsetNSEC3PARAM(const DNSName& zname);
+  bool setNSEC3PARAM(const ZoneName& zname, const NSEC3PARAMRecordContent& n3p, const bool& narrow=false);
+  bool unsetNSEC3PARAM(const ZoneName& zname);
   void getPreRRSIGs(UeberBackend& db, vector<DNSZoneRecord>& rrs, uint32_t signTTL, DNSPacket* p=nullptr);
-  bool isPresigned(const DNSName& zname, bool useCache=true);
-  bool setPresigned(const DNSName& zname);
-  bool unsetPresigned(const DNSName& zname);
-  bool setPublishCDNSKEY(const DNSName& zname, bool deleteAlg);
-  void getPublishCDNSKEY(const DNSName& zname, std::string& value);
-  bool unsetPublishCDNSKEY(const DNSName& zname);
-  bool setPublishCDS(const DNSName& zname, const string& digestAlgos);
-  void getPublishCDS(const DNSName& zname, std::string& value);
-  bool unsetPublishCDS(const DNSName& zname);
-
-  bool TSIGGrantsAccess(const DNSName& zone, const DNSName& keyname);
-  bool getTSIGForAccess(const DNSName& zone, const ComboAddress& primary, DNSName* keyname);
-
-  void startTransaction(const DNSName& zone, int zone_id)
+  bool isPresigned(const ZoneName& zname, bool useCache=true);
+  bool setPresigned(const ZoneName& zname);
+  bool unsetPresigned(const ZoneName& zname);
+  bool setPublishCDNSKEY(const ZoneName& zname, bool deleteAlg);
+  void getPublishCDNSKEY(const ZoneName& zname, std::string& value);
+  bool unsetPublishCDNSKEY(const ZoneName& zname);
+  bool setPublishCDS(const ZoneName& zname, const string& digestAlgos);
+  void getPublishCDS(const ZoneName& zname, std::string& value);
+  bool unsetPublishCDS(const ZoneName& zname);
+
+  bool TSIGGrantsAccess(const ZoneName& zone, const DNSName& keyname);
+  bool getTSIGForAccess(const ZoneName& zone, const ComboAddress& primary, DNSName* keyname);
+
+  void startTransaction(const ZoneName& zone, int zone_id)
   {
     (*d_keymetadb->backends.begin())->startTransaction(zone, zone_id);
   }
@@ -233,17 +233,17 @@ public:
     (*d_keymetadb->backends.begin())->commitTransaction();
   }
 
-  void getFromMetaOrDefault(const DNSName& zname, const std::string& key, std::string& value, const std::string& defaultvalue);
-  bool getFromMeta(const DNSName& zname, const std::string& key, std::string& value);
-  void getSoaEdit(const DNSName& zname, std::string& value, bool useCache=true);
-  bool unSecureZone(const DNSName& zone, std::string& error);
-  bool rectifyZone(const DNSName& zone, std::string& error, std::string& info, bool doTransaction);
+  void getFromMetaOrDefault(const ZoneName& zname, const std::string& key, std::string& value, const std::string& defaultvalue);
+  bool getFromMeta(const ZoneName& zname, const std::string& key, std::string& value);
+  void getSoaEdit(const ZoneName& zname, std::string& value, bool useCache=true);
+  bool unSecureZone(const ZoneName& zone, std::string& error);
+  bool rectifyZone(const ZoneName& zone, std::string& error, std::string& info, bool doTransaction);
 
   static void setMaxEntries(size_t maxEntries);
 
   typedef std::map<std::string, std::vector<std::string> > METAValues;
 private:
-  bool getFromMetaNoCache(const DNSName& name, const std::string& kind, std::string& value);
+  bool getFromMetaNoCache(const ZoneName& name, const std::string& kind, std::string& value);
 
   int64_t d_metaCacheCleanAction{0};
   bool d_metaUpdate{false};
@@ -257,7 +257,7 @@ private:
       return d_ttd < now;
     }
 
-    DNSName d_domain;
+    ZoneName d_domain;
     mutable keys_t d_keys;
     unsigned int d_ttd;
   };
@@ -269,7 +269,7 @@ private:
       return d_ttd < now;
     }
 
-    DNSName d_domain;
+    ZoneName d_domain;
     mutable METAValues d_value;
     time_t d_ttd;
   };
@@ -281,7 +281,7 @@ private:
   typedef multi_index_container<
     KeyCacheEntry,
     indexed_by<
-      hashed_unique<tag<KeyCacheTag>,member<KeyCacheEntry, DNSName, &KeyCacheEntry::d_domain> >,
+      hashed_unique<tag<KeyCacheTag>,member<KeyCacheEntry, ZoneName, &KeyCacheEntry::d_domain> >,
       sequenced<tag<SequencedTag>>
     >
   > keycache_t;
@@ -289,7 +289,7 @@ private:
   typedef multi_index_container<
     METACacheEntry,
     indexed_by<
-      ordered_unique<member<METACacheEntry, DNSName, &METACacheEntry::d_domain> >,
+      ordered_unique<member<METACacheEntry, ZoneName, &METACacheEntry::d_domain> >,
       sequenced<tag<SequencedTag>>
     >
   > metacache_t;
@@ -306,8 +306,8 @@ private:
 
 uint32_t localtime_format_YYYYMMDDSS(time_t t, uint32_t seq);
 // for SOA-EDIT
-uint32_t calculateEditSOA(uint32_t old_serial, DNSSECKeeper& dk, const DNSName& zonename);
-uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName& zonename);
+uint32_t calculateEditSOA(uint32_t old_serial, DNSSECKeeper& dk, const ZoneName& zonename);
+uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const ZoneName& zonename);
 // for SOA-EDIT-DNSUPDATE/API
 bool increaseSOARecord(DNSResourceRecord& dr, const string& increaseKind, const string& editKind);
 bool makeIncreasedSOARecord(SOAData& sd, const string& increaseKind, const string& editKind, DNSResourceRecord& rrout);
index 4a9ab1e7dadf036af2e28a993e765b63fa9ab541..50fe1a3b6482763318cb2c526241f0cbf9de491b 100644 (file)
@@ -106,7 +106,7 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR
 
 /* this is where the RRSIGs begin, keys are retrieved,
    but the actual signing happens in fillOutRRSIG */
-static int getRRSIGsForRRSET(DNSSECKeeper& dk, const DNSName& signer, const DNSName& signQName, uint16_t signQType, uint32_t signTTL,
+static int getRRSIGsForRRSET(DNSSECKeeper& dk, const ZoneName& signer, const DNSName& signQName, uint16_t signQType, uint32_t signTTL,
                              const sortedRecords_t& toSign, vector<RRSIGRecordContent>& rrcs)
 {
   if(toSign.empty())
@@ -143,7 +143,7 @@ static int getRRSIGsForRRSET(DNSSECKeeper& dk, const DNSName& signer, const DNSN
 }
 
 // this is the entrypoint from DNSPacket
-static void addSignature(DNSSECKeeper& dk, UeberBackend& db, const DNSName& signer, const DNSName& signQName, const DNSName& wildcardname, uint16_t signQType,
+static void addSignature(DNSSECKeeper& dk, UeberBackend& db, const ZoneName& signer, const DNSName& signQName, const DNSName& wildcardname, uint16_t signQType,
                          uint32_t signTTL, DNSResourceRecord::Place signPlace,
                          sortedRecords_t& toSign, vector<DNSZoneRecord>& outsigned, uint32_t origTTL, DNSPacket* packet)
 {
@@ -190,10 +190,10 @@ static bool rrsigncomp(const DNSZoneRecord& a, const DNSZoneRecord& b)
   return std::tie(a.dr.d_place, a.dr.d_type) < std::tie(b.dr.d_place, b.dr.d_type);
 }
 
-static bool getBestAuthFromSet(const set<DNSName>& authSet, const DNSName& name, DNSName& auth)
+static bool getBestAuthFromSet(const set<ZoneName>& authSet, const DNSName& name, ZoneName& auth)
 {
   auth.trimToLabels(0);
-  DNSName sname(name);
+  ZoneName sname(name);
   do {
     if(authSet.find(sname) != authSet.end()) {
       auth = sname;
@@ -205,7 +205,7 @@ static bool getBestAuthFromSet(const set<DNSName>& authSet, const DNSName& name,
   return false;
 }
 
-void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set<DNSName>& authSet, vector<DNSZoneRecord>& rrs, DNSPacket* packet)
+void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set<ZoneName>& authSet, vector<DNSZoneRecord>& rrs, DNSPacket* packet)
 {
   stable_sort(rrs.begin(), rrs.end(), rrsigncomp);
 
@@ -220,7 +220,7 @@ void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set<DNSName>& authSet,
   vector<DNSZoneRecord> signedRecords;
   signedRecords.reserve(rrs.size()*1.5);
   //  cout<<rrs.size()<<", "<<sizeof(DNSZoneRecord)<<endl;
-  DNSName signer;
+  ZoneName signer;
   for(auto pos = rrs.cbegin(); pos != rrs.cend(); ++pos) {
     if(pos != rrs.cbegin() && (signQType != pos->dr.d_type  || signQName != pos->dr.d_name)) {
       if (getBestAuthFromSet(authSet, authQName, signer))
index 4add3bfbdfaa93e975928fe383429f1051bf8411..2fef06ac1f6f40280767d7c7e696ba17946eb41c 100644 (file)
@@ -139,7 +139,7 @@ string DLPurgeHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
       g_log<<Logger::Warning<<"Cache clear request for '"<<*i<<"' received from operator"<<endl;
       ret+=purgeAuthCaches(*i);
       if(!boost::ends_with(*i, "$"))
-        DNSSECKeeper::clearCaches(DNSName(*i));
+        DNSSECKeeper::clearCaches(ZoneName(*i));
       else
         DNSSECKeeper::clearAllCaches(); // at least we do what we promise.. and a bit more!
     }
@@ -247,9 +247,9 @@ string DLNotifyRetrieveHandler(const vector<string>& parts, Utility::pid_t /* pp
   if(parts.size()!=2 && parts.size()!=3)
     return "syntax: retrieve zone [ip]";
 
-  DNSName domain;
+  ZoneName domain;
   try {
-    domain = DNSName(parts[1]);
+    domain = ZoneName(parts[1]);
   } catch (...) {
     return "Failed to parse zone as valid DNS name";
   }
@@ -295,9 +295,9 @@ string DLNotifyHostHandler(const vector<string>& parts, Utility::pid_t /* ppid *
   if(!::arg().mustDo("primary") && !(::arg().mustDo("secondary") && ::arg().mustDo("secondary-do-renotify")))
     return "PowerDNS not configured as primary, or secondary with re-notifications";
 
-  DNSName domain;
+  ZoneName domain;
   try {
-    domain = DNSName(parts[1]);
+    domain = ZoneName(parts[1]);
   } catch (...) {
     return "Failed to parse zone as valid DNS name";
   }
@@ -342,13 +342,13 @@ string DLNotifyHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
       return std::to_string(notified)+" out of "+std::to_string(total)+" zones added to queue - see log";
     return "Added " + std::to_string(total) + " MASTER/SLAVE/PRODUCER/CONSUMER zones to queue";
   } else {
-    DNSName domain;
+    ZoneName domain;
     try {
-      domain = DNSName(parts[1]);
+      domain = ZoneName(parts[1]);
     } catch (...) {
       return "Failed to parse zone as valid DNS name";
     }
-    if(!Communicator.notifyDomain(DNSName(parts[1]), &B))
+    if(!Communicator.notifyDomain(domain, &B))
       return "Failed to add to the queue - see log";
     return "Added to queue";
   }
index 69f48f9458d88e1f846641ae54b06259939a82e1..c6cb0f564f5d20cedcef3b6cd2361760666d1838 100644 (file)
@@ -36,37 +36,37 @@ class ixfrdistStats {
 
     std::string getStats();
 
-    void setSOASerial(const DNSName& d, const uint32_t serial) {
+    void setSOASerial(const ZoneName& d, const uint32_t serial) {
       auto stat = getRegisteredDomain(d);
       stat->second.currentSOA = serial;
       stat->second.haveZone = true;
     }
-    void incrementSOAChecks(const DNSName& d, const uint64_t amount = 1) {
+    void incrementSOAChecks(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numSOAChecks += amount;
     }
-    void incrementSOAChecksFailed(const DNSName& d, const uint64_t amount = 1) {
+    void incrementSOAChecksFailed(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numSOAChecksFailed += amount;
     }
-    void incrementSOAinQueries(const DNSName& d, const uint64_t amount = 1) {
+    void incrementSOAinQueries(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numSOAinQueries += amount;
     }
-    void incrementAXFRinQueries(const DNSName& d, const uint64_t amount = 1) {
+    void incrementAXFRinQueries(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numAXFRinQueries += amount;
     }
-    void incrementIXFRinQueries(const DNSName& d, const uint64_t amount = 1) {
+    void incrementIXFRinQueries(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numIXFRinQueries += amount;
     }
-    void incrementAXFRFailures(const DNSName& d, const uint64_t amount = 1) {
+    void incrementAXFRFailures(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numAXFRFailures += amount;
     }
-    void incrementIXFRFailures(const DNSName& d, const uint64_t amount = 1) {
+    void incrementIXFRFailures(const ZoneName& d, const uint64_t amount = 1) {
       getRegisteredDomain(d)->second.numIXFRFailures += amount;
     }
-    void registerDomain(const DNSName& d) {
+    void registerDomain(const ZoneName& d) {
       domainStats[d].haveZone = false;
     }
 
-    void incrementUnknownDomainInQueries(const DNSName& /* d */)
+    void incrementUnknownDomainInQueries(const ZoneName& /* d */)
     { // the name is ignored. It would be great to report it, but we don't want to blow up Prometheus
       progStats.unknownDomainInQueries += 1;
     }
@@ -98,11 +98,11 @@ class ixfrdistStats {
         std::atomic<uint32_t> unknownDomainInQueries{0};
     };
 
-    std::map<DNSName, perDomainStat> domainStats;
+    std::map<ZoneName, perDomainStat> domainStats;
     std::array<std::atomic<uint64_t>, 16> notimpStats{};
     programStats progStats;
 
-    std::map<DNSName, perDomainStat>::iterator getRegisteredDomain(const DNSName& d) {
+    std::map<ZoneName, perDomainStat>::iterator getRegisteredDomain(const DNSName& d) {
       auto ret = domainStats.find(d);
       if (ret == domainStats.end()) {
         throw PDNSException("Domain '" + d.toLogString() + "' not defined in the statistics map");
index 61eb200ef10a9e7c686f13ab6beb8bbe27f343fc..ac755d5b2290fe8d4d7a78e7144743f67bd9cda4 100644 (file)
@@ -78,7 +78,7 @@ ArgvMap &arg()
 }
 /* END Needed because of deeper dependencies */
 
-// Allows reading/writing ComboAddresses and DNSNames in YAML-cpp
+// Allows reading/writing ComboAddresses and ZoneNames in YAML-cpp
 namespace YAML {
 template<>
 struct convert<ComboAddress> {
@@ -101,16 +101,16 @@ struct convert<ComboAddress> {
 };
 
 template<>
-struct convert<DNSName> {
-  static Node encode(const DNSName& rhs) {
+struct convert<ZoneName> {
+  static Node encode(const ZoneName& rhs) {
     return Node(rhs.toStringRootDot());
   }
-  static bool decode(const Node& node, DNSName& rhs) {
+  static bool decode(const Node& node, ZoneName& rhs) {
     if (!node.IsScalar()) {
       return false;
     }
     try {
-      rhs = DNSName(node.as<string>());
+      rhs = ZoneName(node.as<string>());
       return true;
     } catch(const runtime_error &e) {
       return false;
@@ -165,14 +165,14 @@ struct ixfrdistdomain_t {
 };
 
 // This contains the configuration for each domain
-static map<DNSName, ixfrdistdomain_t> g_domainConfigs;
+static map<ZoneName, ixfrdistdomain_t> g_domainConfigs;
 
 // Map domains and their data
-static LockGuarded<std::map<DNSName, std::shared_ptr<ixfrinfo_t>>> g_soas;
+static LockGuarded<std::map<ZoneName, std::shared_ptr<ixfrinfo_t>>> g_soas;
 
 // Queue of received NOTIFYs, already verified against their primary IPs
 // Lazily implemented as a set
-static LockGuarded<std::set<DNSName>> g_notifiesReceived;
+static LockGuarded<std::set<ZoneName>> g_notifiesReceived;
 
 // Queue of outgoing NOTIFY
 static LockGuarded<NotificationQueue> g_notificationQueue;
@@ -217,7 +217,7 @@ static bool sortSOA(uint32_t i, uint32_t j) {
   return rfc1982LessThan(i, j);
 }
 
-static void cleanUpDomain(const DNSName& domain, const uint16_t& keep, const string& workdir) {
+static void cleanUpDomain(const ZoneName& domain, const uint16_t& keep, const string& workdir) {
   string dir = workdir + "/" + domain.toString();
   vector<uint32_t> zoneVersions;
   auto directoryError = pdns::visit_directory(dir, [&zoneVersions]([[maybe_unused]] ino_t inodeNumber, const std::string_view& name) {
@@ -288,12 +288,12 @@ static void makeIXFRDiff(const records_t& from, const records_t& to, std::shared
 }
 
 /* you can _never_ alter the content of the resulting shared pointer */
-static std::shared_ptr<ixfrinfo_t> getCurrentZoneInfo(const DNSName& domain)
+static std::shared_ptr<ixfrinfo_t> getCurrentZoneInfo(const ZoneName& domain)
 {
   return (*g_soas.lock())[domain];
 }
 
-static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr<ixfrinfo_t>& newInfo)
+static void updateCurrentZoneInfo(const ZoneName& domain, std::shared_ptr<ixfrinfo_t>& newInfo)
 {
   auto soas = g_soas.lock();
   (*soas)[domain] = newInfo;
@@ -301,7 +301,7 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr<ixfrinf
   // FIXME: also report zone size?
 }
 
-static void sendNotification(int sock, const DNSName& domain, const ComboAddress& remote, uint16_t notificationId)
+static void sendNotification(int sock, const ZoneName& domain, const ComboAddress& remote, uint16_t notificationId)
 {
   std::vector<std::string> meta;
   std::vector<uint8_t> packet;
@@ -356,7 +356,7 @@ static void communicatorReceiveNotificationAnswers(const int sock4, const int so
 
 static void communicatorSendNotifications(const int sock4, const int sock6)
 {
-  DNSName domain;
+  ZoneName domain;
   string destinationIp;
   uint16_t notificationId = 0;
   bool purged{false};
@@ -407,11 +407,11 @@ static void communicatorThread()
 
 static void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry, const uint32_t axfrMaxRecords) { // NOLINT(readability-function-cognitive-complexity) 13400 https://github.com/PowerDNS/pdns/issues/13400 Habbie:  ixfrdist: reduce complexity
   setThreadName("ixfrdist/update");
-  std::map<DNSName, time_t> lastCheck;
+  std::map<ZoneName, time_t> lastCheck;
 
   // Initialize the serials we have
   for (const auto &domainConfig : g_domainConfigs) {
-    DNSName domain = domainConfig.first;
+    ZoneName domain = domainConfig.first;
     lastCheck[domain] = 0;
     string dir = workdir + "/" + domain.toString();
     try {
@@ -464,7 +464,7 @@ static void updateThread(const string& workdir, const uint16_t& keep, const uint
         break;
       }
 
-      DNSName domain = domainConfig.first;
+      ZoneName domain = domainConfig.first;
       shared_ptr<const SOARecordContent> current_soa;
       const auto& zoneInfo = getCurrentZoneInfo(domain);
       if (zoneInfo != nullptr) {
@@ -1391,7 +1391,7 @@ static bool parseAndCheckConfig(const string& configpath, YAML::Node& config) {
           retval = false;
           continue;
         }
-        domain["domain"].as<DNSName>();
+        domain["domain"].as<ZoneName>();
       } catch (const runtime_error &e) {
         g_log<<Logger::Error<<"Unable to read domain '"<<domain["domain"].as<string>()<<"': "<<e.what()<<endl;
       }
@@ -1556,12 +1556,12 @@ static std::optional<IXFRDistConfiguration> parseConfiguration(int argc, char**
     for (auto const &domain : config["domains"]) {
       set<ComboAddress> s;
       s.insert(domain["master"].as<ComboAddress>());
-      g_domainConfigs[domain["domain"].as<DNSName>()].primaries = s;
+      g_domainConfigs[domain["domain"].as<ZoneName>()].primaries = s;
       if (domain["max-soa-refresh"].IsDefined()) {
-        g_domainConfigs[domain["domain"].as<DNSName>()].maxSOARefresh = domain["max-soa-refresh"].as<uint32_t>();
+        g_domainConfigs[domain["domain"].as<ZoneName>()].maxSOARefresh = domain["max-soa-refresh"].as<uint32_t>();
       }
       if (domain["notify"].IsDefined()) {
-        auto& listset = g_domainConfigs[domain["domain"].as<DNSName>()].notify;
+        auto& listset = g_domainConfigs[domain["domain"].as<ZoneName>()].notify;
         if (domain["notify"].IsScalar()) {
           auto remote = domain["notify"].as<std::string>();
           try {
@@ -1582,7 +1582,7 @@ static std::optional<IXFRDistConfiguration> parseConfiguration(int argc, char**
           }
         }
       }
-      g_stats.registerDomain(domain["domain"].as<DNSName>());
+      g_stats.registerDomain(domain["domain"].as<ZoneName>());
     }
 
     for (const auto &addr : config["acl"].as<vector<string>>()) {
index 53e18313531d4e04c3986988cd5337b257e7f58d..5babad55f467eb6ac25399cd9b9b93d967840989 100644 (file)
@@ -31,7 +31,7 @@
 #include "zoneparser-tng.hh"
 #include "dnsparser.hh"
 
-uint32_t getSerialFromPrimary(const ComboAddress& primary, const DNSName& zone, shared_ptr<const SOARecordContent>& sr, const TSIGTriplet& tt, const uint16_t timeout)
+uint32_t getSerialFromPrimary(const ComboAddress& primary, const ZoneName& zone, shared_ptr<const SOARecordContent>& sr, const TSIGTriplet& tt, const uint16_t timeout)
 {
   vector<uint8_t> packet;
   DNSPacketWriter pw(packet, zone, QType::SOA);
@@ -126,7 +126,7 @@ static void writeRecords(FILE* fp, const records_t& records)
   }
 }
 
-void writeZoneToDisk(const records_t& records, const DNSName& zone, const std::string& directory)
+void writeZoneToDisk(const records_t& records, const ZoneName& zone, const std::string& directory)
 {
   DNSRecord soa;
   auto serial = getSerialFromRecords(records, soa);
@@ -169,7 +169,7 @@ void writeZoneToDisk(const records_t& records, const DNSName& zone, const std::s
   }
 }
 
-void loadZoneFromDisk(records_t& records, const string& fname, const DNSName& zone)
+void loadZoneFromDisk(records_t& records, const string& fname, const ZoneName& zone)
 {
   ZoneParserTNG zpt(fname, zone);
 
@@ -197,7 +197,7 @@ void loadZoneFromDisk(records_t& records, const string& fname, const DNSName& zo
  * Load the zone `zone` from `fname` and put the first found SOA into `soa`
  * Does NOT check for nullptr
  */
-void loadSOAFromDisk(const DNSName& zone, const string& fname, shared_ptr<const SOARecordContent>& soa, uint32_t& soaTTL)
+void loadSOAFromDisk(const ZoneName& zone, const string& fname, shared_ptr<const SOARecordContent>& soa, uint32_t& soaTTL)
 {
   ZoneParserTNG zpt(fname, zone);
   zpt.disableGenerate();
index 10285029c0d3383a0dd1726625cc1c01bd5d58c3..92579181b27b1413e5b082678d0753a4565a291c 100644 (file)
@@ -56,9 +56,9 @@ typedef multi_index_container <
     > /* indexed_by */
 > /* multi_index_container */ records_t;
 
-uint32_t getSerialFromPrimary(const ComboAddress& primary, const DNSName& zone, shared_ptr<const SOARecordContent>& sr, const TSIGTriplet& tt = TSIGTriplet(), const uint16_t timeout = 2);
+uint32_t getSerialFromPrimary(const ComboAddress& primary, const ZoneName& zone, shared_ptr<const SOARecordContent>& sr, const TSIGTriplet& tt = TSIGTriplet(), const uint16_t timeout = 2);
 uint32_t getSerialFromDir(const std::string& dir);
 uint32_t getSerialFromRecords(const records_t& records, DNSRecord& soaret);
-void writeZoneToDisk(const records_t& records, const DNSName& zone, const std::string& directory);
-void loadZoneFromDisk(records_t& records, const string& fname, const DNSName& zone);
-void loadSOAFromDisk(const DNSName& zone, const string& fname, shared_ptr<const SOARecordContent>& soa, uint32_t& soaTTL);
+void writeZoneToDisk(const records_t& records, const ZoneName& zone, const std::string& directory);
+void loadZoneFromDisk(records_t& records, const string& fname, const ZoneName& zone);
+void loadSOAFromDisk(const ZoneName& zone, const string& fname, shared_ptr<const SOARecordContent>& soa, uint32_t& soaTTL);
index a8e0c3cba1b321eddbd933de840128c6178711ec..bf8bd064afde8106c2a60bc15f985ea2fc0020ee 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char** argv) {
     }
     if(command=="diff") {
       records_t before, after;
-      DNSName zone(argv[2]);
+      ZoneName zone(argv[2]);
       cout<<"Loading before from "<<argv[3]<<endl;
       loadZoneFromDisk(before, argv[3], zone);
       cout<<"Parsed "<<before.size()<<" records"<<endl;
@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
 
        Next up, loop this every REFRESH seconds */
 
-    DNSName zone(argv[4]);
+    ZoneName zone(argv[4]);
     ComboAddress primary(argv[2], atoi(argv[3]));
     string directory(argv[5]);
     records_t records;
index 3b349804bf0f5cfa906f58173a4fc7ed34aeab02..959c1cf4c2f7c7a4186dbd4b606be4668c470171 100644 (file)
@@ -629,7 +629,7 @@ static std::vector<DNSZoneRecord> lookup(const DNSName& name, uint16_t qtype, in
   return ret;
 }
 
-static bool getAuth(const DNSName& name, uint16_t qtype, SOAData* soaData)
+static bool getAuth(const ZoneName& name, uint16_t qtype, SOAData* soaData)
 {
   static LockGuarded<UeberBackend> s_ub;
 
@@ -1567,10 +1567,10 @@ static vector<string> lua_all(const vector< pair<int,string> >& ips)
 
 static vector<string> lua_dblookup(const string& record, uint16_t qtype)
 {
-  DNSName rec;
+  ZoneName rec;
   vector<string> ret;
   try {
-    rec = DNSName(record);
+    rec = ZoneName(record);
   }
   catch (const std::exception& e) {
     g_log << Logger::Error << "DB lookup cannot be performed, the name (" << record << ") is malformed: " << e.what() << endl;
index efc5e8bf208968038551c9e3352718e3669703b9..6129d37664daa44a75a582e0ff3c7d24195f8c88 100644 (file)
@@ -45,6 +45,7 @@
 #include "namespaces.hh"
 
 class DNSName;
+using ZoneName = DNSName;
 
 // Do not change to "using TSIGHashEnum ..." until you know CodeQL does not choke on it
 typedef enum
@@ -476,7 +477,7 @@ inline bool isCanonical(const string& qname)
   return qname[qname.size()-1]=='.';
 }
 
-inline DNSName toCanonic(const DNSName& zone, const string& qname)
+inline DNSName toCanonic(const ZoneName& zone, const string& qname)
 {
   if(qname.size()==1 && qname[0]=='@')
     return zone;
index eadeebb696b28b90c8c4c140414024c3b3059e11..4161587dfd9f5e361218e0fcb67938e3824a63fb 100644 (file)
@@ -174,7 +174,7 @@ std::shared_ptr<DNSRecordContent> NSECRecordContent::make(const string& content)
   return std::make_shared<NSECRecordContent>(content);
 }
 
-NSECRecordContent::NSECRecordContent(const string& content, const DNSName& zone)
+NSECRecordContent::NSECRecordContent(const string& content, const ZoneName& zone)
 {
   RecordTextReader rtr(content, zone);
   rtr.xfrName(d_next);
@@ -223,7 +223,7 @@ std::shared_ptr<DNSRecordContent> NSEC3RecordContent::make(const string& content
   return std::make_shared<NSEC3RecordContent>(content);
 }
 
-NSEC3RecordContent::NSEC3RecordContent(const string& content, const DNSName& zone)
+NSEC3RecordContent::NSEC3RecordContent(const string& content, const ZoneName& zone)
 {
   RecordTextReader rtr(content, zone);
   rtr.xfr8BitInt(d_algorithm);
@@ -297,7 +297,7 @@ std::shared_ptr<DNSRecordContent> NSEC3PARAMRecordContent::make(const string& co
   return std::make_shared<NSEC3PARAMRecordContent>(content);
 }
 
-NSEC3PARAMRecordContent::NSEC3PARAMRecordContent(const string& content, const DNSName& zone)
+NSEC3PARAMRecordContent::NSEC3PARAMRecordContent(const string& content, const ZoneName& zone)
 {
   RecordTextReader rtr(content, zone);
   rtr.xfr8BitInt(d_algorithm);
@@ -353,7 +353,7 @@ std::shared_ptr<DNSRecordContent> CSYNCRecordContent::make(const string& content
   return std::make_shared<CSYNCRecordContent>(content);
 }
 
-CSYNCRecordContent::CSYNCRecordContent(const string& content, const DNSName& zone)
+CSYNCRecordContent::CSYNCRecordContent(const string& content, const ZoneName& zone)
 {
   RecordTextReader rtr(content, zone);
   rtr.xfr32BitInt(d_serial);
index ae2c0bcb15849310cf8c068efb598b1770fafa79..c144571792a984ede70cf4dc063f0787e6962c18 100644 (file)
@@ -205,7 +205,7 @@ static int usage(const std::string_view synopsis)
   return EXIT_FAILURE;
 }
 
-static bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true)
+static bool rectifyZone(DNSSECKeeper& dk, const ZoneName& zone, bool quiet = false, bool rectifyTransaction = true)
 {
   string output;
   string error;
@@ -286,7 +286,7 @@ static bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false)
   return result;
 }
 
-static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector<DNSResourceRecord>* suppliedrecords=nullptr) // NOLINT(readability-function-cognitive-complexity,readability-identifier-length)
+static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const ZoneName& zone, const vector<DNSResourceRecord>* suppliedrecords=nullptr) // NOLINT(readability-function-cognitive-complexity,readability-identifier-length)
 {
   int numerrors=0;
   int numwarnings=0;
@@ -372,7 +372,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
   }
 
   // Check for delegation in parent zone
-  DNSName parent(zone);
+  ZoneName parent(zone);
   while(parent.chopOff()) {
     SOAData sd_p;
     if(B.getSOAUncached(parent, sd_p)) {
@@ -905,7 +905,7 @@ static int checkAllZones(DNSSECKeeper &dk, bool exitOnError)
   multi_index_container<
     DomainInfo,
     indexed_by<
-      ordered_non_unique< member<DomainInfo,DNSName,&DomainInfo::zone>, CanonDNSNameCompare >,
+      ordered_non_unique< member<DomainInfo,ZoneName,&DomainInfo::zone>, CanonZoneNameCompare >,
       ordered_non_unique< member<DomainInfo,uint32_t,&DomainInfo::id> >
     >
   > seenInfos;
@@ -944,7 +944,7 @@ static int checkAllZones(DNSSECKeeper &dk, bool exitOnError)
   return EXIT_FAILURE;
 }
 
-static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
+static int increaseSerial(const ZoneName& zone, DNSSECKeeper &dk)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   SOAData sd;
@@ -1008,7 +1008,7 @@ static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
   return 0;
 }
 
-static int deleteZone(const DNSName &zone) {
+static int deleteZone(const ZoneName &zone) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
   if (! B.getDomainInfo(zone, di)) {
@@ -1113,7 +1113,7 @@ static int listKeys(const string &zname, DNSSECKeeper& dk){
 
   if (!zname.empty()) {
     DomainInfo di;
-    if(!B.getDomainInfo(DNSName(zname), di)) {
+    if(!B.getDomainInfo(ZoneName(zname), di)) {
       cerr << "Zone "<<zname<<" not found."<<endl;
       return EXIT_FAILURE;
     }
@@ -1130,7 +1130,7 @@ static int listKeys(const string &zname, DNSSECKeeper& dk){
   return EXIT_SUCCESS;
 }
 
-static int listZone(const DNSName &zone) {
+static int listZone(const ZoneName &zone) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
 
@@ -1197,7 +1197,7 @@ static int read1char(){
     return c;
 }
 
-static int clearZone(const DNSName &zone) {
+static int clearZone(const ZoneName &zone) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
 
@@ -1240,7 +1240,7 @@ private:
   bool d_colors;
 };
 
-static int editZone(const DNSName &zone, const PDNSColors& col) {
+static int editZone(const ZoneName &zone, const PDNSColors& col) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
   DNSSECKeeper dk(&B);
@@ -1506,7 +1506,7 @@ static int xcryptIP(const std::string& cmd, const std::string& ip, const std::st
 }
 #endif /* HAVE_IPCIPHER */
 
-static int zonemdVerifyFile(const DNSName& zone, const string& fname) {
+static int zonemdVerifyFile(const ZoneName& zone, const string& fname) {
   ZoneParserTNG zpt(fname, zone, "", true);
   zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
 
@@ -1539,7 +1539,7 @@ static int zonemdVerifyFile(const DNSName& zone, const string& fname) {
   return EXIT_FAILURE;
 }
 
-static int loadZone(const DNSName& zone, const string& fname) {
+static int loadZone(const ZoneName& zone, const string& fname) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
 
@@ -1598,7 +1598,7 @@ static int loadZone(const DNSName& zone, const string& fname) {
   return EXIT_SUCCESS;
 }
 
-static int createZone(const DNSName &zone, const DNSName& nsname) {
+static int createZone(const ZoneName &zone, const DNSName& nsname) {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
   if (B.getDomainInfo(zone, di)) {
@@ -1671,7 +1671,7 @@ static int createZone(const DNSName &zone, const DNSName& nsname) {
 static int addOrReplaceRecord(bool isAdd, const vector<string>& cmds) {
   DNSResourceRecord rr;
   vector<DNSResourceRecord> newrrs;
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   DNSName name;
   if (cmds.at(2) == "@")
     name=zone;
@@ -1838,7 +1838,7 @@ static int deleteRRSet(const std::string& zone_, const std::string& name_, const
 {
   UtilBackend B; //NOLINT(readability-identifier-length)
   DomainInfo di;
-  DNSName zone(zone_);
+  ZoneName zone(zone_);
   if(!B.getDomainInfo(zone, di)) {
     cerr << "Zone '" << zone << "' does not exist" << endl;
     return EXIT_FAILURE;
@@ -1907,7 +1907,7 @@ static int listMemberZones(const string& catalog)
 
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
 
-  DNSName catz(catalog);
+  ZoneName catz(catalog);
   DomainInfo di;
   if (!B.getDomainInfo(catz, di)) {
     cerr << "Zone '" << catz << "' not found" << endl;
@@ -1953,7 +1953,7 @@ static bool testAlgorithms()
   return DNSCryptoKeyEngine::testAll();
 }
 
-static void testSpeed(const DNSName& zone, int cores)
+static void testSpeed(const ZoneName& zone, int cores)
 {
   DNSResourceRecord rr;
   rr.qname=DNSName("blah")+zone;
@@ -1969,7 +1969,7 @@ static void testSpeed(const DNSName& zone, int cores)
     throw runtime_error("No backends available for DNSSEC key storage");
   }
 
-  ChunkedSigningPipe csp(DNSName(zone), true, cores, 100);
+  ChunkedSigningPipe csp(zone, true, cores, 100);
 
   vector<DNSZoneRecord> signatures;
   uint32_t rnd;
@@ -2038,7 +2038,7 @@ static void verifyCrypto(const string& zone)
   }
 }
 
-static bool disableDNSSECOnZone(DNSSECKeeper& dk, const DNSName& zone)
+static bool disableDNSSECOnZone(DNSSECKeeper& dk, const ZoneName& zone)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2056,7 +2056,7 @@ static bool disableDNSSECOnZone(DNSSECKeeper& dk, const DNSName& zone)
   return ret;
 }
 
-static int setZoneOptionsJson(const DNSName& zone, const string& options)
+static int setZoneOptionsJson(const ZoneName& zone, const string& options)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2072,7 +2072,7 @@ static int setZoneOptionsJson(const DNSName& zone, const string& options)
   return EXIT_SUCCESS;
 }
 
-static int setZoneOption(const DNSName& zone, const string& type, const string& option, const set<string>& values)
+static int setZoneOption(const ZoneName& zone, const string& type, const string& option, const set<string>& values)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2111,7 +2111,7 @@ static int setZoneOption(const DNSName& zone, const string& type, const string&
   return EXIT_SUCCESS;
 }
 
-static int setZoneCatalog(const DNSName& zone, const DNSName& catalog)
+static int setZoneCatalog(const ZoneName& zone, const ZoneName& catalog)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2127,7 +2127,7 @@ static int setZoneCatalog(const DNSName& zone, const DNSName& catalog)
   return EXIT_SUCCESS;
 }
 
-static int setZoneAccount(const DNSName& zone, const string &account)
+static int setZoneAccount(const ZoneName& zone, const string &account)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2143,7 +2143,7 @@ static int setZoneAccount(const DNSName& zone, const string &account)
   return EXIT_SUCCESS;
 }
 
-static int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind)
+static int setZoneKind(const ZoneName& zone, const DomainInfo::DomainKind kind)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2159,7 +2159,7 @@ static int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind)
   return EXIT_SUCCESS;
 }
 
-static bool showZone(DNSSECKeeper& dnsseckeeper, const DNSName& zone, bool exportDS = false) // NOLINT(readability-function-cognitive-complexity)
+static bool showZone(DNSSECKeeper& dnsseckeeper, const ZoneName& zone, bool exportDS = false) // NOLINT(readability-function-cognitive-complexity)
 {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
@@ -2387,7 +2387,7 @@ static bool showZone(DNSSECKeeper& dnsseckeeper, const DNSName& zone, bool expor
   return true;
 }
 
-static bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
+static bool secureZone(DNSSECKeeper& dk, const ZoneName& zone)
 {
   // temp var for addKey
   int64_t id{-1};
@@ -2476,7 +2476,7 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
   return true;
 }
 
-static int testSchema(DNSSECKeeper& dk, const DNSName& zone)
+static int testSchema(DNSSECKeeper& dk, const ZoneName& zone)
 {
   cout<<"Note: test-schema will try to create the zone, but it will not remove it."<<endl;
   cout<<"Please clean up after this."<<endl;
@@ -2602,7 +2602,7 @@ static int testSchema(DNSSECKeeper& dk, const DNSName& zone)
   return EXIT_SUCCESS;
 }
 
-static int addOrSetMeta(const DNSName& zone, const string& kind, const vector<string>& values, bool clobber) {
+static int addOrSetMeta(const ZoneName& zone, const string& kind, const vector<string>& values, bool clobber) {
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di;
 
@@ -2773,7 +2773,7 @@ static int zonemdVerifyFile(vector<string>& cmds, const std::string_view synopsi
     cmds[1].clear();
   }
 
-  return zonemdVerifyFile(DNSName(cmds[1]), cmds[2]);
+  return zonemdVerifyFile(ZoneName(cmds[1]), cmds[2]);
 }
 
 
@@ -2784,7 +2784,7 @@ static int testSchema(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  return testSchema(dk, DNSName(cmds.at(1)));
+  return testSchema(dk, ZoneName(cmds.at(1)));
 }
 
 static int rectifyZone(vector<string>& cmds, const std::string_view synopsis)
@@ -2795,7 +2795,7 @@ static int rectifyZone(vector<string>& cmds, const std::string_view synopsis)
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
   int exitCode = 0;
   for(unsigned int n = 1; n < cmds.size(); ++n) { // NOLINT(readability-identifier-length)
-    if (!rectifyZone(dk, DNSName(cmds.at(n)))) {
+    if (!rectifyZone(dk, ZoneName(cmds.at(n)))) {
       exitCode = 1;
     }
   }
@@ -2819,7 +2819,7 @@ static int checkZone(vector<string>& cmds, const std::string_view synopsis)
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
   UtilBackend B("default"); // NOLINT(readability-identifier-length)
-  return checkZone(dk, B, DNSName(cmds.at(1)));
+  return checkZone(dk, B, ZoneName(cmds.at(1)));
 }
 
 static int benchDb(vector<string>& cmds, [[maybe_unused]] const std::string_view synopsis)
@@ -2859,7 +2859,7 @@ static int testSpeed(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() < 3) {
     return usage(synopsis);
   }
-  testSpeed(DNSName(cmds.at(1)), pdns::checked_stoi<int>(cmds.at(2)));
+  testSpeed(ZoneName(cmds.at(1)), pdns::checked_stoi<int>(cmds.at(2)));
   return 0;
 }
 
@@ -2878,7 +2878,7 @@ static int showZone(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!showZone(dk, DNSName(cmds.at(1)))) {
+  if (!showZone(dk, ZoneName(cmds.at(1)))) {
     return 1;
   }
   return 0;
@@ -2890,7 +2890,7 @@ static int exportZoneDS(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!showZone(dk, DNSName(cmds.at(1)), true)) {
+  if (!showZone(dk, ZoneName(cmds.at(1)), true)) {
     return 1;
   }
   return 0;
@@ -2902,7 +2902,7 @@ static int disableDNSSEC(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   if(!disableDNSSECOnZone(dk, zone)) {
     cerr << "Cannot disable DNSSEC on " << zone << endl;
     return 1;
@@ -2915,7 +2915,7 @@ static int activateZoneKey(vector<string>& cmds, const std::string_view synopsis
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   // NOLINTNEXTLINE(readability-identifier-length)
   unsigned int id = atoi(cmds.at(2).c_str()); // if you make this pdns::checked_stoi, the error gets worse
   if(id == 0)
@@ -2942,7 +2942,7 @@ static int deactivateZoneKey(vector<string>& cmds, const std::string_view synops
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   auto id = pdns::checked_stoi<unsigned int>(cmds.at(2)); // NOLINT(readability-identifier-length)
   if(id == 0)
   {
@@ -2968,7 +2968,7 @@ static int publishZoneKey(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   // NOLINTNEXTLINE(readability-identifier-length)
   unsigned int id = atoi(cmds.at(2).c_str()); // if you make this pdns::checked_stoi, the error gets worse
   if(id == 0)
@@ -2995,7 +2995,7 @@ static int unpublishZoneKey(vector<string>& cmds, const std::string_view synopsi
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   // NOLINTNEXTLINE(readability-identifier-length)
   unsigned int id = atoi(cmds.at(2).c_str()); // if you make this pdns::checked_stoi, the error gets worse
   if(id == 0)
@@ -3017,7 +3017,7 @@ static int unpublishZoneKey(vector<string>& cmds, const std::string_view synopsi
   return 0;
 }
 
-static int checkZoneKey(DNSSECKeeper &dsk, DNSName &zone, int64_t keyId)
+static int checkZoneKey(DNSSECKeeper &dsk, ZoneName &zone, int64_t keyId)
 {
   if (keyId == -1) {
     cerr<<std::to_string(keyId)<<": Key was added, but backend does not support returning of key id"<<endl;
@@ -3043,7 +3043,7 @@ static int addZoneKey(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
 
   UtilBackend B("default"); //NOLINT(readability-identifier-length)
   DomainInfo di; //NOLINT(readability-identifier-length)
@@ -3148,7 +3148,7 @@ static int removeZoneKey(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   auto id = pdns::checked_stoi<unsigned int>(cmds.at(2)); // NOLINT(readability-identifier-length)
   if (!dk.removeKey(zone, id)) {
      cerr<<"Cannot remove key " << id << " from " << zone <<endl;
@@ -3162,7 +3162,7 @@ static int deleteZone(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() != 2) {
     return usage(synopsis);
   }
-  return deleteZone(DNSName(cmds.at(1)));
+  return deleteZone(ZoneName(cmds.at(1)));
 }
 
 static int createZone(vector<string>& cmds, const std::string_view synopsis)
@@ -3170,7 +3170,7 @@ static int createZone(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() != 2 && cmds.size()!=3 ) {
     return usage(synopsis);
   }
-  return createZone(DNSName(cmds.at(1)), cmds.size() > 2 ? DNSName(cmds.at(2)) : DNSName());
+  return createZone(ZoneName(cmds.at(1)), cmds.size() > 2 ? DNSName(cmds.at(2)) : DNSName());
 }
 
 static int createSecondaryZone(vector<string>& cmds, const std::string_view synopsis)
@@ -3180,7 +3180,7 @@ static int createSecondaryZone(vector<string>& cmds, const std::string_view syno
   }
   UtilBackend B; // NOLINT(readability-identifier-length)
   DomainInfo di; // NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   if (B.getDomainInfo(zone, di)) {
     cerr << "Zone '" << zone << "' exists already" << endl;
     return EXIT_FAILURE;
@@ -3210,7 +3210,7 @@ static int changeSecondaryZonePrimary(vector<string>& cmds, const std::string_vi
   }
   UtilBackend B; // NOLINT(readability-identifier-length)
   DomainInfo di; // NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   if (!B.getDomainInfo(zone, di)) {
     cerr << "Zone '" << zone << "' doesn't exist" << endl;
     return EXIT_FAILURE;
@@ -3284,7 +3284,7 @@ static int listZone(vector<string>& cmds, const std::string_view synopsis)
     cmds.at(1).clear();
   }
 
-  return listZone(DNSName(cmds.at(1)));
+  return listZone(ZoneName(cmds.at(1)));
 }
 
 static int editZone(vector<string>& cmds, const std::string_view synopsis)
@@ -3297,7 +3297,7 @@ static int editZone(vector<string>& cmds, const std::string_view synopsis)
   }
 
   PDNSColors col(g_vm.count("no-colors") != 0);
-  return editZone(DNSName(cmds.at(1)), col);
+  return editZone(ZoneName(cmds.at(1)), col);
 }
 
 static int clearZone(vector<string>& cmds, const std::string_view synopsis)
@@ -3309,7 +3309,7 @@ static int clearZone(vector<string>& cmds, const std::string_view synopsis)
     cmds.at(1).clear();
   }
 
-  return clearZone(DNSName(cmds.at(1)));
+  return clearZone(ZoneName(cmds.at(1)));
 }
 
 static int listKeys(vector<string>& cmds, const std::string_view synopsis)
@@ -3335,7 +3335,7 @@ static int loadZone(vector<string>& cmds, const std::string_view synopsis)
   }
 
   for(size_t n=1; n + 2 <= cmds.size(); n+=2) { // NOLINT(readability-identifier-length)
-    int ret = loadZone(DNSName(cmds.at(n)), cmds.at(n + 1));
+    int ret = loadZone(ZoneName(cmds.at(n)), cmds.at(n + 1));
     if (ret != 0) {
       return ret;
     }
@@ -3349,10 +3349,10 @@ static int secureZone(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  vector<DNSName> mustRectify;
+  vector<ZoneName> mustRectify;
   unsigned int zoneErrors=0;
   for(unsigned int n = 1; n < cmds.size(); ++n) { // NOLINT(readability-identifier-length)
-    DNSName zone(cmds.at(n));
+    ZoneName zone(cmds.at(n));
     dk.startTransaction(zone, -1);
     if(secureZone(dk, zone)) {
       mustRectify.push_back(std::move(zone));
@@ -3416,7 +3416,7 @@ static int setKind(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   auto kind = DomainInfo::stringToKind(cmds.at(2));
   return setZoneKind(zone, kind);
 }
@@ -3437,7 +3437,7 @@ static int setOptionsJson(vector<string>& cmds, const std::string_view synopsis)
     }
   }
 
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
 
   return setZoneOptionsJson(zone, cmds.at(2));
 }
@@ -3451,7 +3451,7 @@ static int setOption(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
 
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   set<string> values;
   for (unsigned int n = 4; n < cmds.size(); ++n) { // NOLINT(readability-identifier-length)
     if (!cmds.at(n).empty()) {
@@ -3467,10 +3467,10 @@ static int setCatalog(vector<string>& cmds, const std::string_view synopsis)
   if (cmds.size() < 2) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
-  DNSName catalog; // Create an empty DNSName()
+  ZoneName zone(cmds.at(1));
+  ZoneName catalog; // Create an empty ZoneName()
   if (cmds.size() > 2 && !cmds.at(2).empty()) {
-    catalog = DNSName(cmds.at(2));
+    catalog = ZoneName(cmds.at(2));
   }
   return setZoneCatalog(zone, catalog);
 }
@@ -3480,7 +3480,7 @@ static int setAccount(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() != 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   return setZoneAccount(zone, cmds.at(2));
 }
 
@@ -3494,7 +3494,7 @@ static int setNsec3(vector<string>& cmds, const std::string_view synopsis)
   NSEC3PARAMRecordContent ns3pr(nsec3params);
 
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   if (zone.wirelength() > 222) {
     cerr<<"Cannot enable NSEC3 for " << zone << " as it is too long (" << zone.wirelength() << " bytes, maximum is 222 bytes)"<<endl;
     return 1;
@@ -3531,7 +3531,7 @@ static int setPresigned(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.setPresigned(DNSName(cmds.at(1)))) {
+  if (!dk.setPresigned(ZoneName(cmds.at(1)))) {
     cerr << "Could not set presigned for " << cmds.at(1) << " (is DNSSEC enabled in your backend?)" << endl;
     return 1;
   }
@@ -3544,7 +3544,7 @@ static int setPublishCDNSKey(vector<string>& cmds, const std::string_view synops
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.setPublishCDNSKEY(DNSName(cmds.at(1)), (cmds.size() == 3 && cmds.at(2) == "delete"))) {
+  if (!dk.setPublishCDNSKEY(ZoneName(cmds.at(1)), (cmds.size() == 3 && cmds.at(2) == "delete"))) {
     cerr << "Could not set publishing for CDNSKEY records for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3563,7 +3563,7 @@ static int setPublishCDs(vector<string>& cmds, const std::string_view synopsis)
   }
 
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.setPublishCDS(DNSName(cmds.at(1)), cmds.at(2))) {
+  if (!dk.setPublishCDS(ZoneName(cmds.at(1)), cmds.at(2))) {
     cerr << "Could not set publishing for CDS records for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3576,7 +3576,7 @@ static int unsetPresigned(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.unsetPresigned(DNSName(cmds.at(1)))) {
+  if (!dk.unsetPresigned(ZoneName(cmds.at(1)))) {
     cerr << "Could not unset presigned on for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3589,7 +3589,7 @@ static int unsetPublishCDNSKey(vector<string>& cmds, const std::string_view syno
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.unsetPublishCDNSKEY(DNSName(cmds.at(1)))) {
+  if (!dk.unsetPublishCDNSKEY(ZoneName(cmds.at(1)))) {
     cerr << "Could not unset publishing for CDNSKEY records for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3602,7 +3602,7 @@ static int unsetPublishCDs(vector<string>& cmds, const std::string_view synopsis
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.unsetPublishCDS(DNSName(cmds.at(1)))) {
+  if (!dk.unsetPublishCDS(ZoneName(cmds.at(1)))) {
     cerr << "Could not unset publishing for CDS records for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3615,7 +3615,7 @@ static int hashZoneRecord(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   DNSName record(cmds.at(2));
   NSEC3PARAMRecordContent ns3pr;
   bool narrow = false;
@@ -3637,7 +3637,7 @@ static int unsetNSec3(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  if (!dk.unsetNSEC3PARAM(DNSName(cmds.at(1)))) {
+  if (!dk.unsetNSEC3PARAM(ZoneName(cmds.at(1)))) {
     cerr << "Cannot unset NSEC3 param for " << cmds.at(1) << endl;
     return 1;
   }
@@ -3655,7 +3655,7 @@ static int exportZoneKey(vector<string>& cmds, const std::string_view synopsis)
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
   string zone = cmds.at(1);
   auto id = pdns::checked_stoi<unsigned int>(cmds.at(2)); // NOLINT(readability-identifier-length)
-  DNSSECPrivateKey dpk = dk.getKeyById(DNSName(zone), id);
+  DNSSECPrivateKey dpk = dk.getKeyById(ZoneName(zone), id);
   cout << dpk.getKey()->convertToISC() << endl;
   return 0;
 }
@@ -3669,7 +3669,7 @@ static int exportZoneKeyPEM(vector<string>& cmds, const std::string_view synopsi
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
   string zone = cmds.at(1);
   auto id = pdns::checked_stoi<unsigned int>(cmds.at(2)); // NOLINT(readability-identifier-length)
-  DNSSECPrivateKey dpk = dk.getKeyById(DNSName(zone), id);
+  DNSSECPrivateKey dpk = dk.getKeyById(ZoneName(zone), id);
   dpk.getKey()->convertToPEMFile(*stdout);
   return 0;
 }
@@ -3680,7 +3680,7 @@ static int increaseSerial(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  return increaseSerial(DNSName(cmds.at(1)), dk);
+  return increaseSerial(ZoneName(cmds.at(1)), dk);
 }
 
 static int importZoneKeyPEM(vector<string>& cmds, const std::string_view synopsis)
@@ -3689,7 +3689,7 @@ static int importZoneKeyPEM(vector<string>& cmds, const std::string_view synopsi
     return usage(synopsis);
   }
 
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   const string filename = cmds.at(2);
   const auto algorithm = pdns::checked_stoi<unsigned int>(cmds.at(3));
 
@@ -3749,7 +3749,7 @@ static int importZoneKey(vector<string>& cmds, const std::string_view synopsis)
   if(cmds.size() < 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   string fname = cmds.at(2);
   DNSKEYRecordContent drc;
   shared_ptr<DNSCryptoKeyEngine> key(DNSCryptoKeyEngine::makeFromISCFile(drc, fname.c_str()));
@@ -3806,7 +3806,7 @@ static int exportZoneDNSKey(vector<string>& cmds, const std::string_view synopsi
   }
 
   DNSSECKeeper dk; //NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   auto id = pdns::checked_stoi<unsigned int>(cmds.at(2)); // NOLINT(readability-identifier-length)
   DNSSECPrivateKey dpk=dk.getKeyById(zone, id);
   cout << zone<<" IN DNSKEY "<<dpk.getDNSKEY().getZoneRepresentation() <<endl;
@@ -3957,7 +3957,7 @@ static int activateTSIGKey(vector<string>& cmds, const std::string_view synopsis
   if (cmds.size() < 4) {
     return usage(synopsis);
   }
-  DNSName zname(cmds.at(1));
+  ZoneName zname(cmds.at(1));
   string name = cmds.at(2);
   if (cmds.at(3) == "primary" || cmds.at(3) == "producer") {
     metaKey = "TSIG-ALLOW-AXFR";
@@ -4005,7 +4005,7 @@ static int deactivateTSIGKey(vector<string>& cmds, const std::string_view synops
   if (cmds.size() < 4) {
     return usage(synopsis);
   }
-  DNSName zname(cmds.at(1));
+  ZoneName zname(cmds.at(1));
   string name = cmds.at(2);
   if (cmds.at(3) == "primary" || cmds.at(3) == "producer") {
     metaKey = "TSIG-ALLOW-AXFR";
@@ -4053,7 +4053,7 @@ static int getMeta(vector<string>& cmds, const std::string_view synopsis)
     return usage(synopsis);
   }
   UtilBackend B("default"); // NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   vector<string> keys;
 
   DomainInfo di; // NOLINT(readability-identifier-length)
@@ -4088,7 +4088,7 @@ static int setMeta(vector<string>& cmds, const std::string_view synopsis)
   if (cmds.size() < 3) {
     return usage(synopsis);
   }
-  DNSName zone(cmds.at(1));
+  ZoneName zone(cmds.at(1));
   string kind = cmds.at(2);
   const static std::array<string, 7> multiMetaWhitelist = {"ALLOW-AXFR-FROM", "ALLOW-DNSUPDATE-FROM",
     "ALSO-NOTIFY", "TSIG-ALLOW-AXFR", "TSIG-ALLOW-DNSUPDATE", "GSS-ALLOW-AXFR-PRINCIPAL",
@@ -4118,7 +4118,7 @@ static int HSMAssign(vector<string>& cmds, const std::string_view synopsis)
   }
 
   UtilBackend B("default"); // NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(2));
+  ZoneName zone(cmds.at(2));
 
   // verify zone
   if (!B.getDomainInfo(zone, di)) {
@@ -4199,7 +4199,7 @@ static int HSMCreateKey(vector<string>& cmds, const std::string_view synopsis)
   }
   UtilBackend B("default"); // NOLINT(readability-identifier-length)
   DomainInfo di; // NOLINT(readability-identifier-length)
-  DNSName zone(cmds.at(2));
+  ZoneName zone(cmds.at(2));
   unsigned int id{0}; // NOLINT(readability-identifier-length)
   int bits = 2048;
   // verify zone
index db5e48933c312321bfc934b721cba36b0facbd16..9a4c2400002b0e557c3449ba22864958c45b3674 100644 (file)
@@ -36,7 +36,7 @@
 #include "base64.hh"
 #include "namespaces.hh"
 
-RecordTextReader::RecordTextReader(string str, DNSName zone) :
+RecordTextReader::RecordTextReader(string str, ZoneName zone) :
   d_string(std::move(str)), d_zone(std::move(zone))
 {
    /* remove whitespace */
index 914a353aa884bb7de35cd633926ce2b04550bb00..87880008c43dca64a5b5896118007ee8a612bfb8 100644 (file)
@@ -40,7 +40,7 @@ public:
 class RecordTextReader
 {
 public:
-  RecordTextReader(string  str, DNSName  zone=DNSName(""));
+  RecordTextReader(string  str, ZoneName  zone=ZoneName(""));
   void xfrNodeOrLocatorID(NodeOrLocatorID& val);
   void xfr64BitInt(uint64_t& val);
   void xfr48BitInt(uint64_t& val);
@@ -76,7 +76,7 @@ public:
   bool eof();
 private:
   string d_string;
-  DNSName d_zone;
+  ZoneName d_zone;
   string::size_type d_pos{0};
   string::size_type d_end;
   void skipSpaces();
index 771c3088951e7427c8be85213d301ae28978eaf1..4bba4ea5d3a47b86ea22ec3c3bdbe1ff0a881cf0 100644 (file)
@@ -38,7 +38,7 @@ uint32_t localtime_format_YYYYMMDDSS(time_t t, uint32_t seq)
     + seq;
 }
 
-uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName& zonename)
+uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const ZoneName& zonename)
 {
   if(pdns_iequals(kind,"INCEPTION-INCREMENT")) {
     time_t inception = getStartOfWeek();
@@ -79,14 +79,14 @@ uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName
   return old_serial;
 }
 
-uint32_t calculateEditSOA(uint32_t old_serial, DNSSECKeeper& dk, const DNSName& zonename) {
+uint32_t calculateEditSOA(uint32_t old_serial, DNSSECKeeper& dk, const ZoneName& zonename) {
   string kind;
   dk.getSoaEdit(zonename, kind);
   return calculateEditSOA(old_serial, kind, zonename);
 }
 
 /** Used for SOA-EDIT-DNSUPDATE and SOA-EDIT-API. */
-static uint32_t calculateIncreaseSOA(uint32_t old_serial, const string& increaseKind, const string& editKind, const DNSName& zonename) {
+static uint32_t calculateIncreaseSOA(uint32_t old_serial, const string& increaseKind, const string& editKind, const ZoneName& zonename) {
   if (pdns_iequals(increaseKind, "SOA-EDIT-INCREASE")) {
     uint32_t new_serial = old_serial;
     if (!editKind.empty()) {
index f2464c11b079318afa3d7356049b4b6aae567460..5d081532d9caf96a018f0b10567187b58253c364 100644 (file)
@@ -59,7 +59,7 @@ catch(...) {
   return nullptr;
 }
 
-ChunkedSigningPipe::ChunkedSigningPipe(DNSName signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords) :
+ChunkedSigningPipe::ChunkedSigningPipe(ZoneName signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords) :
   d_signed(0), d_numworkers(workers), d_signer(std::move(signerName)), d_maxchunkrecords(maxChunkRecords), d_threads(d_numworkers), d_mustSign(mustSign)
 {
   d_rrsetToSign = make_unique<rrset_t>();
@@ -287,7 +287,7 @@ try
     if(res < 0)
       unixDie("reading object pointer to sign from pdns");
     try {
-      set<DNSName> authSet;
+      set<ZoneName> authSet;
       authSet.insert(d_signer);
       addRRSigs(dk, db, authSet, *chunk);
       ++d_signed;
index d76ebda730c3aa29619879b21b019f38da3e986d..47403be98af5686eeef447e1e801b9a71464f34a 100644 (file)
@@ -42,7 +42,7 @@ public:
   
   ChunkedSigningPipe(const ChunkedSigningPipe&) = delete;
   void operator=(const ChunkedSigningPipe&) = delete;
-  ChunkedSigningPipe(DNSName  signerName, bool mustSign, unsigned int numWorkers, unsigned int maxChunkRecords);
+  ChunkedSigningPipe(ZoneName  signerName, bool mustSign, unsigned int numWorkers, unsigned int maxChunkRecords);
   ~ChunkedSigningPipe();
   bool submit(const DNSZoneRecord& rr);
   chunk_t getChunk(bool final=false);
@@ -67,7 +67,7 @@ private:
 
   std::unique_ptr<rrset_t> d_rrsetToSign;
   std::deque< std::vector<DNSZoneRecord> > d_chunks;
-  DNSName d_signer;
+  ZoneName d_signer;
   
   chunk_t::size_type d_maxchunkrecords;
   
index d8cb2cad9702de204376db45e3cbf178e145f167..f507f7c3373f80365b418fc5404ad24486eddae1 100644 (file)
@@ -688,7 +688,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr<DNSPacket>& q,
   DNSZoneRecord soa = makeEditedDNSZRFromSOAData(dk, sd);
   outpacket->addRecord(DNSZoneRecord(soa));
   if(securedZone && !presignedZone) {
-    set<DNSName> authSet;
+    set<ZoneName> authSet;
     authSet.insert(target);
     addRRSigs(dk, db, authSet, outpacket->getRRS());
   }
@@ -1261,7 +1261,7 @@ int TCPNameserver::doIXFR(std::unique_ptr<DNSPacket>& q, int outsock)
   }
 
   if (serialPermitsIXFR) {
-    DNSName target = q->qdomain;
+    ZoneName target = q->qdomain;
     TSIGRecordContent trc;
     DNSName tsigkeyname;
     string tsigsecret;
@@ -1291,7 +1291,7 @@ int TCPNameserver::doIXFR(std::unique_ptr<DNSPacket>& q, int outsock)
     DNSZoneRecord soa = makeEditedDNSZRFromSOAData(dk, sd);
     outpacket->addRecord(std::move(soa));
     if(securedZone && outpacket->d_dnssecOk) {
-      set<DNSName> authSet;
+      set<ZoneName> authSet;
       authSet.insert(target);
       addRRSigs(dk, db, authSet, outpacket->getRRS());
     }
index 692a4917501675778f126dd41635627377d87035..8466892c7cf09ce45150256084e29a7ce3009771 100644 (file)
@@ -42,14 +42,14 @@ BOOST_AUTO_TEST_CASE(test_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<std::tuple<DNSName, int>> zone_indices{
-    {DNSName("example.org."), 1},
+  vector<std::tuple<ZoneName, int>> zone_indices{
+    {ZoneName("example.org."), 1},
   };
   cache.setReplacePending();
   cache.replace(zone_indices);
 
   int zoneId = 0;
-  bool found = cache.getEntry(DNSName("example.org."), zoneId);
+  bool found = cache.getEntry(ZoneName("example.org."), zoneId);
   if (!found || zoneId != 1) {
     BOOST_FAIL("zone added in replace() not found");
   }
@@ -60,14 +60,14 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<std::tuple<DNSName, int>> zone_indices{
-    {DNSName("powerdns.org."), 1}};
+  vector<std::tuple<ZoneName, int>> zone_indices{
+    {ZoneName("powerdns.org."), 1}};
   cache.setReplacePending();
-  cache.add(DNSName("example.org."), 2);
+  cache.add(ZoneName("example.org."), 2);
   cache.replace(zone_indices);
 
   int zoneId = 0;
-  bool found = cache.getEntry(DNSName("example.org."), zoneId);
+  bool found = cache.getEntry(ZoneName("example.org."), zoneId);
   if (!found || zoneId != 2) {
     BOOST_FAIL("zone added while replace was pending not found");
   }
@@ -78,14 +78,14 @@ BOOST_AUTO_TEST_CASE(test_remove_while_pending_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<std::tuple<DNSName, int>> zone_indices{
-    {DNSName("powerdns.org."), 1}};
+  vector<std::tuple<ZoneName, int>> zone_indices{
+    {ZoneName("powerdns.org."), 1}};
   cache.setReplacePending();
-  cache.remove(DNSName("powerdns.org."));
+  cache.remove(ZoneName("powerdns.org."));
   cache.replace(zone_indices);
 
   int zoneId = 0;
-  bool found = cache.getEntry(DNSName("example.org."), zoneId);
+  bool found = cache.getEntry(ZoneName("example.org."), zoneId);
   if (found) {
     BOOST_FAIL("zone removed while replace was pending is found");
   }
@@ -97,16 +97,16 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace_duplicate)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<std::tuple<DNSName, int>> zone_indices{
-    {DNSName("powerdns.org."), 1},
-    {DNSName("example.org."), 2},
+  vector<std::tuple<ZoneName, int>> zone_indices{
+    {ZoneName("powerdns.org."), 1},
+    {ZoneName("example.org."), 2},
   };
   cache.setReplacePending();
-  cache.add(DNSName("example.org."), 3);
+  cache.add(ZoneName("example.org."), 3);
   cache.replace(zone_indices);
 
   int zoneId = 0;
-  bool found = cache.getEntry(DNSName("example.org."), zoneId);
+  bool found = cache.getEntry(ZoneName("example.org."), zoneId);
   if (!found || zoneId == 0) {
     BOOST_FAIL("zone added while replace was pending not found");
   }
index ff37fcf117df7ec241e2a958e319bcc62fb31e39..e7d98330ee36ffe85b8a650bb4f6760b595007ac 100644 (file)
@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(test_parser)
 
 #define checkzone(i, dname, fname, ztype, nprimaries)           \
   {                                                             \
-    BOOST_CHECK(domains[i].name == DNSName(dname));             \
+    BOOST_CHECK(domains[i].name == ZoneName(dname));            \
     BOOST_CHECK_EQUAL(domains[i].filename, fname);              \
     BOOST_CHECK_EQUAL(domains[i].type, #ztype);                 \
     BOOST_CHECK_EQUAL(domains[i].primaries.size(), nprimaries); \
index 9d389bcf3b432967189dc3b28b915a8d4e69aee4..aca5a47d5c1f1cfb2fd7fbe2293dc954b7bc71aa 100644 (file)
@@ -16,11 +16,11 @@ BOOST_AUTO_TEST_SUITE(test_communicator_hh)
 BOOST_AUTO_TEST_CASE(test_axfr_queue_priority_order)
 {
   SuckRequest sr[5] = {
-    {DNSName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::SignaturesRefresh, 0}},
-    {DNSName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::SerialRefresh, 1}},
-    {DNSName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Notify, 2}},
-    {DNSName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 3}},
-    {DNSName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
+    {ZoneName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::SignaturesRefresh, 0}},
+    {ZoneName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::SerialRefresh, 1}},
+    {ZoneName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Notify, 2}},
+    {ZoneName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 3}},
+    {ZoneName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
   };
 
   UniQueue suckDomains;
@@ -42,11 +42,11 @@ BOOST_AUTO_TEST_CASE(test_axfr_queue_priority_order)
 BOOST_AUTO_TEST_CASE(test_axfr_queue_insert_and_priority_order)
 {
   SuckRequest sr[5] = {
-    {DNSName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 2}},
-    {DNSName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 1}},
-    {DNSName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 0}},
-    {DNSName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
-    {DNSName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 3}},
+    {ZoneName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 2}},
+    {ZoneName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 1}},
+    {ZoneName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 0}},
+    {ZoneName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
+    {ZoneName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 3}},
   };
 
   UniQueue suckDomains;
@@ -68,14 +68,14 @@ BOOST_AUTO_TEST_CASE(test_axfr_queue_insert_and_priority_order)
 BOOST_AUTO_TEST_CASE(test_axfr_queue_insert_and_priority_order_after_modify)
 {
   SuckRequest sr[5] = {
-    {DNSName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 1}},
-    {DNSName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 0}},
-    {DNSName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 2}},
-    {DNSName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
-    {DNSName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 3}},
+    {ZoneName("test1.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 1}},
+    {ZoneName("test2.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 0}},
+    {ZoneName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 2}},
+    {ZoneName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 4}},
+    {ZoneName("test5.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 3}},
   };
-  SuckRequest rr = {DNSName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 5}};
-  SuckRequest rr2 = {DNSName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 6}};
+  SuckRequest rr = {ZoneName("test3.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::PdnsControl, 5}};
+  SuckRequest rr2 = {ZoneName("test4.com"), ComboAddress("0.0.0.0"), false, {SuckRequest::Api, 6}};
 
   UniQueue suckDomains;
 
index 2627e58f3066f89f233afd54189d274b202378d3..ae94432f98e3c7783ec116c261517203a55a1baf 100644 (file)
@@ -55,11 +55,11 @@ public:
 
   struct SimpleDNSZone
   {
-    SimpleDNSZone(const DNSName& name, uint64_t id): d_records(std::make_shared<RecordStorage>()), d_name(name), d_id(id)
+    SimpleDNSZone(const ZoneName& name, uint64_t id): d_records(std::make_shared<RecordStorage>()), d_name(name), d_id(id)
     {
     }
     std::shared_ptr<RecordStorage> d_records;
-    DNSName d_name;
+    ZoneName d_name;
     uint64_t d_id;
   };
 
@@ -70,17 +70,17 @@ public:
     SimpleDNSZone,
     indexed_by <
       ordered_unique<tag<IDTag>, member<SimpleDNSZone, uint64_t, &SimpleDNSZone::d_id> >,
-      hashed_unique<tag<HashedNameTag>, member<SimpleDNSZone, DNSName, &SimpleDNSZone::d_name> >
+      hashed_unique<tag<HashedNameTag>, member<SimpleDNSZone, ZoneName, &SimpleDNSZone::d_name> >
       >
     > ZoneStorage;
 
   struct SimpleMetaData
   {
-    SimpleMetaData(const DNSName& name, const std::string& kind, const std::vector<std::string>& values): d_name(name), d_kind(kind), d_values(values)
+    SimpleMetaData(const ZoneName& name, const std::string& kind, const std::vector<std::string>& values): d_name(name), d_kind(kind), d_values(values)
     {
     }
 
-    DNSName d_name;
+    ZoneName d_name;
     std::string d_kind;
     std::vector<std::string> d_values;
   };
@@ -93,10 +93,10 @@ public:
       ordered_unique<tag<OrderedNameKindTag>,
                      composite_key<
                        SimpleMetaData,
-                       member<SimpleMetaData, DNSName, &SimpleMetaData::d_name>,
+                       member<SimpleMetaData, ZoneName, &SimpleMetaData::d_name>,
                        member<SimpleMetaData, std::string, &SimpleMetaData::d_kind>
                        >,
-                     composite_key_compare<CanonDNSNameCompare, std::less<std::string> >
+                     composite_key_compare<CanonZoneNameCompare, std::less<std::string> >
                      >
       >
     > MetaDataStorage;
@@ -109,7 +109,7 @@ public:
 
   unsigned int getCapabilities() override { return CAP_LIST; }
 
-  bool findZone(const DNSName& qdomain, int zoneId, std::shared_ptr<RecordStorage>& records, uint64_t& currentZoneId) const
+  bool findZone(const ZoneName& qdomain, int zoneId, std::shared_ptr<RecordStorage>& records, uint64_t& currentZoneId) const
   {
     currentZoneId = -1;
     records.reset();
@@ -189,7 +189,7 @@ public:
     return true;
   }
 
-  bool list(const DNSName& target, int zoneId, bool /* include_disabled */ = false) override
+  bool list(const ZoneName& target, int zoneId, bool /* include_disabled */ = false) override
   {
     findZone(target, zoneId, d_records, d_currentZone);
 
@@ -202,7 +202,7 @@ public:
     return false;
   }
 
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta) override
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override
   {
     const auto& idx = boost::multi_index::get<OrderedNameKindTag>(s_metadata.at(d_backendId));
     auto it = idx.find(std::tuple(name, kind));
@@ -215,7 +215,7 @@ public:
     return true;
   }
 
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta) override
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta) override
   {
     auto& idx = boost::multi_index::get<OrderedNameKindTag>(s_metadata.at(d_backendId));
     auto it = idx.find(std::tuple(name, kind));
@@ -248,9 +248,9 @@ public:
   {
   }
 
-  bool getAuth(const DNSName& target, SOAData* sd) override
+  bool getAuth(const ZoneName& target, SOAData* sd) override
   {
-    static const DNSName best("d.0.1.0.0.2.ip6.arpa.");
+    static const ZoneName best("d.0.1.0.0.2.ip6.arpa.");
 
     ++d_authLookupCount;
 
@@ -288,12 +288,12 @@ public:
   {
   }
 
-  bool getDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */) override
+  bool getDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, std::vector<std::string>& /* meta */) override
   {
     return false;
   }
 
-  bool setDomainMetadata(const DNSName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */) override
+  bool setDomainMetadata(const ZoneName& /* name */, const std::string& /* kind */, const std::vector<std::string>& /* meta */) override
   {
     return false;
   }
@@ -462,7 +462,7 @@ static void checkRecordExists(const std::vector<DNSZoneRecord>& records, const D
 BOOST_AUTO_TEST_CASE(test_simple) {
 
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("powerdns.com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::1", 60));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::A, "192.168.0.1", 60));
@@ -568,14 +568,14 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_separate_zones) {
   // no overlap
 
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("powerdns.com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::1", 60));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::A, "192.168.0.1", 60));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("geo.powerdns.com."), QType::A, "192.168.0.42", 60));
     SimpleBackend::s_zones[1].insert(zoneA);
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("powerdns.org."), 2);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("powerdns.org."), 2);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.org."), QType::SOA, "ns1.powerdns.org. powerdns.org. 3 600 600 3600000 604800", 3600));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.org."), QType::AAAA, "2001:db8::2", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.org."), QType::AAAA, "2001:db8::2", 60));
@@ -714,13 +714,13 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_overlay) {
   // one backend holds the SOA, NS and one A
   // a second backend holds another A and AAAA
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("powerdns.com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::NS, "ns1.powerdns.com.", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::A, "192.168.0.1", 60));
     SimpleBackend::s_zones[1].insert(zoneA);
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("powerdns.com."), 1);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::A, "192.168.0.2", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::1", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::A, "192.168.0.1", 60));
@@ -840,7 +840,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_overlay_name) {
   // one backend holds the apex with SOA, NS and one A
   // a second backend holds others names
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("powerdns.com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::NS, "ns1.powerdns.com.", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::A, "192.168.0.1", 60));
@@ -848,7 +848,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_overlay_name) {
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::1", 60));
     SimpleBackend::s_zones[1].insert(zoneA);
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("powerdns.com."), 1);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::A, "192.168.0.1", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::AAAA, "192.168.0.1", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("geo.powerdns.com."), QType::A, "192.168.0.42", 60));
@@ -964,14 +964,14 @@ BOOST_AUTO_TEST_CASE(test_child_zone) {
   // Check that DS queries are correctly handled
 
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("com."), QType::SOA, "a.gtld-servers.net. nstld.verisign-grs.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::NS, "ns1.powerdns.com.", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::DS, "44030 8 3 7DD75AE1565051F9563CF8DF976AC99CDCA51E3463019C81BD2BB083 82F3854E", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("ns1.powerdns.com."), QType::A, "192.0.2.1", 3600));
     SimpleBackend::s_zones[1].insert(zoneA);
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("powerdns.com."), 2);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("powerdns.com."), 2);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::2", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::NS, "ns1.powerdns.com.", 3600));
@@ -1006,7 +1006,7 @@ BOOST_AUTO_TEST_CASE(test_child_zone) {
     {
       // test getAuth() for DS
       SOAData sd;
-      BOOST_REQUIRE(ub.getAuth(DNSName("powerdns.com."), QType::DS, &sd));
+      BOOST_REQUIRE(ub.getAuth(ZoneName("powerdns.com."), QType::DS, &sd));
       BOOST_CHECK_EQUAL(sd.qname.toString(), "com.");
       BOOST_CHECK_EQUAL(sd.domain_id, 1);
     }
@@ -1014,7 +1014,7 @@ BOOST_AUTO_TEST_CASE(test_child_zone) {
     {
       // test getAuth() for A
       SOAData sd;
-      BOOST_REQUIRE(ub.getAuth(DNSName("powerdns.com."), QType::A, &sd));
+      BOOST_REQUIRE(ub.getAuth(ZoneName("powerdns.com."), QType::A, &sd));
       BOOST_CHECK_EQUAL(sd.qname.toString(), "powerdns.com.");
       BOOST_CHECK_EQUAL(sd.domain_id, 2);
     }
@@ -1042,12 +1042,12 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_best_soa) {
   // while the others do simple lookups
 
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("d.0.1.0.0.2.ip6.arpa."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("d.0.1.0.0.2.ip6.arpa."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("d.0.1.0.0.2.ip6.arpa."), QType::SOA, "ns.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3005126844 7200 1800 604800 3600", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa."), QType::PTR, "a.reverse.", 3600));
     SimpleBackend::s_zones[1].insert(zoneA);
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("0.1.0.0.2.ip6.arpa."), 2);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("0.1.0.0.2.ip6.arpa."), 2);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("0.1.0.0.2.ip6.arpa."), QType::SOA, "ns.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3005126844 7200 1800 604800 3600", 3600));
     SimpleBackend::s_zones[2].insert(zoneB);
 
@@ -1066,7 +1066,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_best_soa) {
 
       // test getAuth()
       SOAData sd;
-      BOOST_REQUIRE(ub.getAuth(DNSName("2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa."), QType::PTR, &sd));
+      BOOST_REQUIRE(ub.getAuth(ZoneName("2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa."), QType::PTR, &sd));
       BOOST_CHECK_EQUAL(sd.qname.toString(), "d.0.1.0.0.2.ip6.arpa.");
       BOOST_CHECK_EQUAL(sd.domain_id, 1);
 
@@ -1098,21 +1098,21 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_metadata) {
   // Updating will insert into the first backend, leaving the first one untouched
 
   try {
-    SimpleBackend::SimpleDNSZone zoneA(DNSName("powerdns.com."), 1);
+    SimpleBackend::SimpleDNSZone zoneA(ZoneName("powerdns.com."), 1);
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::SOA, "ns1.powerdns.com. powerdns.com. 3 600 600 3600000 604800", 3600));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.com."), QType::AAAA, "2001:db8::1", 60));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.com."), QType::A, "192.168.0.1", 60));
     zoneA.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("geo.powerdns.com."), QType::A, "192.168.0.42", 60));
     SimpleBackend::s_zones[1].insert(zoneA);
-    SimpleBackend::s_metadata[1].insert(SimpleBackend::SimpleMetaData(DNSName("powerdns.com."), "test-data-a", { "value1", "value2"}));
+    SimpleBackend::s_metadata[1].insert(SimpleBackend::SimpleMetaData(ZoneName("powerdns.com."), "test-data-a", { "value1", "value2"}));
 
-    SimpleBackend::SimpleDNSZone zoneB(DNSName("powerdns.org."), 2);
+    SimpleBackend::SimpleDNSZone zoneB(ZoneName("powerdns.org."), 2);
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.org."), QType::SOA, "ns1.powerdns.org. powerdns.org. 3 600 600 3600000 604800", 3600));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("powerdns.org."), QType::AAAA, "2001:db8::2", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("www.powerdns.org."), QType::AAAA, "2001:db8::2", 60));
     zoneB.d_records->insert(SimpleBackend::SimpleDNSRecord(DNSName("geo.powerdns.org."), QType::AAAA, "2001:db8::42", 60));
     SimpleBackend::s_zones[2].insert(zoneB);
-    SimpleBackend::s_metadata[2].insert(SimpleBackend::SimpleMetaData(DNSName("powerdns.org."), "test-data-b", { "value1", "value2"}));
+    SimpleBackend::s_metadata[2].insert(SimpleBackend::SimpleMetaData(ZoneName("powerdns.org."), "test-data-b", { "value1", "value2"}));
 
     BackendMakers().report(std::make_unique<SimpleBackendFactory>());
     BackendMakers().launch("SimpleBackend:1, SimpleBackend:2");
@@ -1122,47 +1122,47 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_metadata) {
     {
       // check the initial values
       std::vector<std::string> values;
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-a", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.com."), "test-data-a", values));
       BOOST_REQUIRE_EQUAL(values.size(), 2U);
       BOOST_CHECK_EQUAL(values.at(0), "value1");
       BOOST_CHECK_EQUAL(values.at(1), "value2");
       values.clear();
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-b", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.com."), "test-data-b", values));
       BOOST_CHECK_EQUAL(values.size(), 0U);
       values.clear();
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-a", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.org."), "test-data-a", values));
       BOOST_CHECK_EQUAL(values.size(), 0U);
       values.clear();
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-b", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.org."), "test-data-b", values));
       BOOST_CHECK_EQUAL(values.size(), 0U);
     }
 
     {
       // update the values
-      BOOST_CHECK(ub.setDomainMetadata(DNSName("powerdns.com."), "test-data-a", std::vector<std::string>({"value3"})));
-      BOOST_CHECK(ub.setDomainMetadata(DNSName("powerdns.org."), "test-data-a", std::vector<std::string>({"value4"})));
-      BOOST_CHECK(ub.setDomainMetadata(DNSName("powerdns.org."), "test-data-b", std::vector<std::string>({"value5"})));
+      BOOST_CHECK(ub.setDomainMetadata(ZoneName("powerdns.com."), "test-data-a", std::vector<std::string>({"value3"})));
+      BOOST_CHECK(ub.setDomainMetadata(ZoneName("powerdns.org."), "test-data-a", std::vector<std::string>({"value4"})));
+      BOOST_CHECK(ub.setDomainMetadata(ZoneName("powerdns.org."), "test-data-b", std::vector<std::string>({"value5"})));
     }
 
     // check the updated values
     {
       std::vector<std::string> values;
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-a", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.com."), "test-data-a", values));
       BOOST_REQUIRE_EQUAL(values.size(), 1U);
       BOOST_CHECK_EQUAL(values.at(0), "value3");
       values.clear();
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-a", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.org."), "test-data-a", values));
       BOOST_REQUIRE_EQUAL(values.size(), 1U);
       BOOST_CHECK_EQUAL(values.at(0), "value4");
       values.clear();
-      BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-b", values));
+      BOOST_CHECK(ub.getDomainMetadata(ZoneName("powerdns.org."), "test-data-b", values));
       BOOST_REQUIRE_EQUAL(values.size(), 1U);
       BOOST_CHECK_EQUAL(values.at(0), "value5");
     }
 
     {
       // check that it has not been updated in the second backend
-      const auto& it = SimpleBackend::s_metadata[2].find(std::tuple(DNSName("powerdns.org."), "test-data-b"));
+      const auto& it = SimpleBackend::s_metadata[2].find(std::tuple(ZoneName("powerdns.org."), "test-data-b"));
       BOOST_REQUIRE(it != SimpleBackend::s_metadata[2].end());
       BOOST_REQUIRE_EQUAL(it->d_values.size(), 2U);
       BOOST_CHECK_EQUAL(it->d_values.at(0), "value1");
index 3743dd17e7300497f87b2e62035dd0a9461cdc22..0e1a6eff9b087611a32f2d61d3c6c6a413b76918 100644 (file)
@@ -17,7 +17,7 @@ static void testZoneMD(const std::string& zone, const std::string& file, bool ex
   if (!p) {
     p = ".";
   }
-  DNSName z(zone);
+  ZoneName z(zone);
   std::ostringstream pathbuf;
   pathbuf << p << "/../regression-tests/zones/" + file;
   ZoneParserTNG zpt(pathbuf.str(), z);
index 8551ec27d26838f2c00bdd842280bc520ae23b33..6f9db38686b2f1ee8f350f3d11687999cd9f0667 100644 (file)
@@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_types) {
   if(!p)
     p = ".";
   pathbuf << p << "/../regression-tests/zones/unit.test";
-  ZoneParserTNG zp(pathbuf.str(), DNSName("unit.test"));
+  ZoneParserTNG zp(pathbuf.str(), ZoneName("unit.test"));
   DNSResourceRecord rr;
 
   ifstream ifs(pathbuf.str());
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
 
   {
     /* simple case */
-    ZoneParserTNG zp(pathbuf.str(), DNSName("unit2.test"));
+    ZoneParserTNG zp(pathbuf.str(), ZoneName("unit2.test"));
 
     const vector<string> expected = {
       "0.01.0003.000005.00000007.unit2.test.",
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
 
   {
     /* GENERATE with a step of 2, and the template radix defaulting to 'd' */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/2 $.${1,2,o}.${3,4}.${5,6,X}.${7,8,x}    86400   IN      A 1.2.3.4"}), DNSName("unit2.test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/2 $.${1,2,o}.${3,4}.${5,6,X}.${7,8,x}    86400   IN      A 1.2.3.4"}), ZoneName("unit2.test"));
 
     const vector<string> expected = {
       "0.01.0003.000005.00000007.unit2.test.",
@@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
 
   {
     /* GENERATE with a larger initial counter and a large stop */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 4294967294-4294967295/2 $    86400   IN      A 1.2.3.4"}), DNSName("unit2.test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 4294967294-4294967295/2 $    86400   IN      A 1.2.3.4"}), ZoneName("unit2.test"));
 
     const vector<string> expected = {
       "4294967294.unit2.test.",
@@ -146,76 +146,76 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
 
   {
     /* test invalid generate parameters: stop greater than start */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 5-4 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}    86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 5-4 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}    86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: no stop */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 5 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}      86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 5 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}      86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: invalid step */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/0 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}  86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/0 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x}  86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: negative counter */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE -1-4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE -1-4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
   {
     /* test invalid generate parameters: counter out of bounds */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 4294967296-4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 4294967296-4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: negative stop */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0--4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0--4/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: stop out of bounds */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4294967296/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4294967296/1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: negative step */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/-1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/-1 $.${1,2,o}.${3,4,d}.${5,6,X}.${7,8,x} 86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), std::exception);
   }
 
   {
     /* test invalid generate parameters: no offset */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/1 $.${}.${3,4,d}.${5,6,X}.${7,8,x}       86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/1 $.${}.${3,4,d}.${5,6,X}.${7,8,x}       86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), PDNSException);
   }
 
   {
     /* test invalid generate parameters: invalid offset */
-    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/1 $.${a,2,o}.${3,4,d}.${5,6,X}.${7,8,x}  86400   IN      A 1.2.3.4"}), DNSName("test"));
+    ZoneParserTNG zp(std::vector<std::string>({"$GENERATE 0-4/1 $.${a,2,o}.${3,4,d}.${5,6,X}.${7,8,x}  86400   IN      A 1.2.3.4"}), ZoneName("test"));
     DNSResourceRecord rr;
     BOOST_CHECK_THROW(zp.get(rr), PDNSException);
   }
 }
 
 BOOST_AUTO_TEST_CASE(test_tng_upgrade) {
-  ZoneParserTNG zp(std::vector<std::string>({"foo.test. 86400 IN TYPE1 \\# 4 c0000304"}), DNSName("test"), true);
+  ZoneParserTNG zp(std::vector<std::string>({"foo.test. 86400 IN TYPE1 \\# 4 c0000304"}), ZoneName("test"), true);
   DNSResourceRecord rr;
   zp.get(rr);
 
index 2132f207562f70b90af137bd9f6e9ca554258eed..13a0436f2283d7bf487e234cb5f673fe14910553 100644 (file)
@@ -40,7 +40,7 @@ void PacketHandler::tkeyHandler(const DNSPacket& p, std::unique_ptr<DNSPacket>&
     if (g_doGssTSIG) {
       if (tkey_in.d_algo == DNSName("gss-tsig.")) {
         std::vector<std::string> meta;
-        DNSName tmpName(name);
+        ZoneName tmpName(name);
         do {
           if (B.getDomainMetadata(tmpName, "GSS-ACCEPTOR-PRINCIPAL", meta) && meta.size()>0) {
             break;
index e63e29ebc5ecebbf617d1ce73f8f01acba19e58f..5b1c86965c192c2b8f89317021e97b4a5bfc12cc 100644 (file)
@@ -64,7 +64,7 @@ try
   tt.name=keyname;
   tt.algo=DNSName("hmac-md5");
   tt.secret=key;
-  AXFRRetriever axfr(dest, DNSName("b.aa"), tt);
+  AXFRRetriever axfr(dest, ZoneName("b.aa"), tt);
   vector<DNSResourceRecord> res;
   while(axfr.getChunk(res)) {
   }
index dbeb04ee9cea8d9a919b4b2ee5b6fce1f699ebf4..c0f957a53d8d1e9d4d1d62a55c3192648a21b3df 100644 (file)
@@ -119,7 +119,7 @@ void UeberBackend::go()
   d_cond.notify_all();
 }
 
-bool UeberBackend::getDomainInfo(const DNSName& domain, DomainInfo& domainInfo, bool getSerial)
+bool UeberBackend::getDomainInfo(const ZoneName& domain, DomainInfo& domainInfo, bool getSerial)
 {
   for (auto& backend : backends) {
     if (backend->getDomainInfo(domain, domainInfo, getSerial)) {
@@ -129,7 +129,7 @@ bool UeberBackend::getDomainInfo(const DNSName& domain, DomainInfo& domainInfo,
   return false;
 }
 
-bool UeberBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
+bool UeberBackend::createDomain(const ZoneName& domain, const DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account)
 {
   for (auto& backend : backends) {
     if (backend->createDomain(domain, kind, primaries, account)) {
@@ -149,7 +149,7 @@ bool UeberBackend::doesDNSSEC()
   return false;
 }
 
-bool UeberBackend::addDomainKey(const DNSName& name, const DNSBackend::KeyData& key, int64_t& keyID)
+bool UeberBackend::addDomainKey(const ZoneName& name, const DNSBackend::KeyData& key, int64_t& keyID)
 {
   keyID = -1;
   for (auto& backend : backends) {
@@ -159,7 +159,7 @@ bool UeberBackend::addDomainKey(const DNSName& name, const DNSBackend::KeyData&
   }
   return false;
 }
-bool UeberBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys)
+bool UeberBackend::getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys)
 {
   for (auto& backend : backends) {
     if (backend->getDomainKeys(name, keys)) {
@@ -169,7 +169,7 @@ bool UeberBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::Ke
   return false;
 }
 
-bool UeberBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
+bool UeberBackend::getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   for (auto& backend : backends) {
     if (backend->getAllDomainMetadata(name, meta)) {
@@ -179,7 +179,7 @@ bool UeberBackend::getAllDomainMetadata(const DNSName& name, std::map<std::strin
   return false;
 }
 
-bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
+bool UeberBackend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta)
 {
   for (auto& backend : backends) {
     if (backend->getDomainMetadata(name, kind, meta)) {
@@ -189,7 +189,7 @@ bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kin
   return false;
 }
 
-bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::string& meta)
+bool UeberBackend::getDomainMetadata(const ZoneName& name, const std::string& kind, std::string& meta)
 {
   meta.clear();
   std::vector<string> tmp;
@@ -200,7 +200,7 @@ bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kin
   return ret;
 }
 
-bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
+bool UeberBackend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta)
 {
   for (auto& backend : backends) {
     if (backend->setDomainMetadata(name, kind, meta)) {
@@ -210,7 +210,7 @@ bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kin
   return false;
 }
 
-bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::string& meta)
+bool UeberBackend::setDomainMetadata(const ZoneName& name, const std::string& kind, const std::string& meta)
 {
   std::vector<string> tmp;
   if (!meta.empty()) {
@@ -219,7 +219,7 @@ bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kin
   return setDomainMetadata(name, kind, tmp);
 }
 
-bool UeberBackend::activateDomainKey(const DNSName& name, unsigned int keyID)
+bool UeberBackend::activateDomainKey(const ZoneName& name, unsigned int keyID)
 {
   for (auto& backend : backends) {
     if (backend->activateDomainKey(name, keyID)) {
@@ -229,7 +229,7 @@ bool UeberBackend::activateDomainKey(const DNSName& name, unsigned int keyID)
   return false;
 }
 
-bool UeberBackend::deactivateDomainKey(const DNSName& name, unsigned int keyID)
+bool UeberBackend::deactivateDomainKey(const ZoneName& name, unsigned int keyID)
 {
   for (auto& backend : backends) {
     if (backend->deactivateDomainKey(name, keyID)) {
@@ -239,7 +239,7 @@ bool UeberBackend::deactivateDomainKey(const DNSName& name, unsigned int keyID)
   return false;
 }
 
-bool UeberBackend::publishDomainKey(const DNSName& name, unsigned int keyID)
+bool UeberBackend::publishDomainKey(const ZoneName& name, unsigned int keyID)
 {
   for (auto& backend : backends) {
     if (backend->publishDomainKey(name, keyID)) {
@@ -249,7 +249,7 @@ bool UeberBackend::publishDomainKey(const DNSName& name, unsigned int keyID)
   return false;
 }
 
-bool UeberBackend::unpublishDomainKey(const DNSName& name, unsigned int keyID)
+bool UeberBackend::unpublishDomainKey(const ZoneName& name, unsigned int keyID)
 {
   for (auto& backend : backends) {
     if (backend->unpublishDomainKey(name, keyID)) {
@@ -259,7 +259,7 @@ bool UeberBackend::unpublishDomainKey(const DNSName& name, unsigned int keyID)
   return false;
 }
 
-bool UeberBackend::removeDomainKey(const DNSName& name, unsigned int keyID)
+bool UeberBackend::removeDomainKey(const ZoneName& name, unsigned int keyID)
 {
   for (auto& backend : backends) {
     if (backend->removeDomainKey(name, keyID)) {
@@ -282,7 +282,7 @@ void UeberBackend::updateZoneCache()
     return;
   }
 
-  vector<std::tuple<DNSName, int>> zone_indices;
+  vector<std::tuple<ZoneName, int>> zone_indices;
   g_zoneCache.setReplacePending();
 
   for (auto& backend : backends) {
@@ -332,7 +332,7 @@ bool UeberBackend::inTransaction()
   return false;
 }
 
-bool UeberBackend::fillSOAFromZoneRecord(DNSName& shorter, const int zoneId, SOAData* const soaData)
+bool UeberBackend::fillSOAFromZoneRecord(ZoneName& shorter, const int zoneId, SOAData* const soaData)
 {
   // Zone exists in zone cache, directly look up SOA.
   lookup(QType(QType::SOA), shorter, zoneId, nullptr);
@@ -373,7 +373,7 @@ bool UeberBackend::fillSOAFromZoneRecord(DNSName& shorter, const int zoneId, SOA
   return true;
 }
 
-UeberBackend::CacheResult UeberBackend::fillSOAFromCache(SOAData* soaData, DNSName& shorter)
+UeberBackend::CacheResult UeberBackend::fillSOAFromCache(SOAData* soaData, ZoneName& shorter)
 {
   auto cacheResult = cacheHas(d_question, d_answers);
 
@@ -391,7 +391,7 @@ UeberBackend::CacheResult UeberBackend::fillSOAFromCache(SOAData* soaData, DNSNa
   return cacheResult;
 }
 
-static std::vector<std::unique_ptr<DNSBackend>>::iterator findBestMatchingBackend(std::vector<std::unique_ptr<DNSBackend>>& backends, std::vector<std::pair<std::size_t, SOAData>>& bestMatches, const DNSName& shorter, SOAData* soaData)
+static std::vector<std::unique_ptr<DNSBackend>>::iterator findBestMatchingBackend(std::vector<std::unique_ptr<DNSBackend>>& backends, std::vector<std::pair<std::size_t, SOAData>>& bestMatches, const ZoneName& shorter, SOAData* soaData)
 {
   auto backend = backends.begin();
   for (auto bestMatch = bestMatches.begin(); backend != backends.end() && bestMatch != bestMatches.end(); ++backend, ++bestMatch) {
@@ -444,7 +444,7 @@ static bool foundTarget(const DNSName& target, const DNSName& shorter, const QTy
   return false;
 }
 
-bool UeberBackend::getAuth(const DNSName& target, const QType& qtype, SOAData* soaData, bool cachedOk)
+bool UeberBackend::getAuth(const ZoneName& target, const QType& qtype, SOAData* soaData, bool cachedOk)
 {
   // A backend can respond to our authority request with the 'best' match it
   // has. For example, when asked for a.b.c.example.com. it might respond with
@@ -454,7 +454,7 @@ bool UeberBackend::getAuth(const DNSName& target, const QType& qtype, SOAData* s
   // If a backend has no match it may respond with an empty qname.
 
   bool found = false;
-  DNSName shorter(target);
+  ZoneName shorter(target);
   vector<pair<size_t, SOAData>> bestMatches(backends.size(), pair(target.wirelength() + 1, SOAData()));
 
   bool first = true;
@@ -544,7 +544,7 @@ bool UeberBackend::getAuth(const DNSName& target, const QType& qtype, SOAData* s
   return found;
 }
 
-bool UeberBackend::getSOAUncached(const DNSName& domain, SOAData& soaData)
+bool UeberBackend::getSOAUncached(const ZoneName& domain, SOAData& soaData)
 {
   d_question.qtype = QType::SOA;
   d_question.qname = domain;
@@ -605,7 +605,7 @@ bool UeberBackend::autoPrimariesList(std::vector<AutoPrimary>& primaries)
   return false;
 }
 
-bool UeberBackend::autoPrimaryBackend(const string& ipAddr, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend)
+bool UeberBackend::autoPrimaryBackend(const string& ipAddr, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend)
 {
   for (auto& backend : backends) {
     if (backend->autoPrimaryBackend(ipAddr, domain, nsset, nameserver, account, dnsBackend)) {
@@ -678,7 +678,7 @@ void UeberBackend::addCache(const Question& question, vector<DNSZoneRecord>&& rr
   QC.insert(question.qname, question.qtype, std::move(rrs), d_cache_ttl, question.zoneId);
 }
 
-void UeberBackend::alsoNotifies(const DNSName& domain, set<string>* ips)
+void UeberBackend::alsoNotifies(const ZoneName& domain, set<string>* ips)
 {
   for (auto& backend : backends) {
     backend->alsoNotifies(domain, ips);
index 2e403c90036d8bd9f284d127d6bc2c0b9681a078..df21e07169ed1164d7f717c5bbf08b4118b9e2ed 100644 (file)
@@ -47,7 +47,7 @@ public:
   UeberBackend(const string& pname = "default");
   ~UeberBackend();
 
-  bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend);
+  bool autoPrimaryBackend(const string& ip, const ZoneName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend);
 
   bool autoPrimaryAdd(const AutoPrimary& primary);
   bool autoPrimaryRemove(const struct AutoPrimary& primary);
@@ -100,32 +100,32 @@ public:
   void lookupEnd();
 
   /** Determines if we are authoritative for a zone, and at what level */
-  bool getAuth(const DNSName& target, const QType& qtype, SOAData* soaData, bool cachedOk = true);
+  bool getAuth(const ZoneName& target, const QType& qtype, SOAData* soaData, bool cachedOk = true);
   /** Load SOA info from backends, ignoring the cache.*/
-  bool getSOAUncached(const DNSName& domain, SOAData& soaData);
+  bool getSOAUncached(const ZoneName& domain, SOAData& soaData);
   void getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool include_disabled);
 
   void getUnfreshSecondaryInfos(vector<DomainInfo>* domains);
   void getUpdatedPrimaries(vector<DomainInfo>& domains, std::unordered_set<DNSName>& catalogs, CatalogHashMap& catalogHashes);
-  bool getDomainInfo(const DNSName& domain, DomainInfo& domainInfo, bool getSerial = true);
-  bool createDomain(const DNSName& domain, DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account);
+  bool getDomainInfo(const ZoneName& domain, DomainInfo& domainInfo, bool getSerial = true);
+  bool createDomain(const ZoneName& domain, DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries, const string& account);
 
   bool doesDNSSEC();
-  bool addDomainKey(const DNSName& name, const DNSBackend::KeyData& key, int64_t& keyID);
-  bool getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys);
-  bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta);
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta);
-  bool getDomainMetadata(const DNSName& name, const std::string& kind, std::string& meta);
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta);
-  bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::string& meta);
-
-  bool removeDomainKey(const DNSName& name, unsigned int keyID);
-  bool activateDomainKey(const DNSName& name, unsigned int keyID);
-  bool deactivateDomainKey(const DNSName& name, unsigned int keyID);
-  bool publishDomainKey(const DNSName& name, unsigned int keyID);
-  bool unpublishDomainKey(const DNSName& name, unsigned int keyID);
-
-  void alsoNotifies(const DNSName& domain, set<string>* ips);
+  bool addDomainKey(const ZoneName& name, const DNSBackend::KeyData& key, int64_t& keyID);
+  bool getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys);
+  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta);
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta);
+  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::string& meta);
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::vector<std::string>& meta);
+  bool setDomainMetadata(const ZoneName& name, const std::string& kind, const std::string& meta);
+
+  bool removeDomainKey(const ZoneName& name, unsigned int keyID);
+  bool activateDomainKey(const ZoneName& name, unsigned int keyID);
+  bool deactivateDomainKey(const ZoneName& name, unsigned int keyID);
+  bool publishDomainKey(const ZoneName& name, unsigned int keyID);
+  bool unpublishDomainKey(const ZoneName& name, unsigned int keyID);
+
+  void alsoNotifies(const ZoneName& domain, set<string>* ips);
   void rediscover(string* status = nullptr);
   void reload();
 
@@ -181,6 +181,6 @@ private:
   void addNegCache(const Question& question) const;
   void addCache(const Question& question, vector<DNSZoneRecord>&& rrs) const;
 
-  bool fillSOAFromZoneRecord(DNSName& shorter, int zoneId, SOAData* soaData);
-  CacheResult fillSOAFromCache(SOAData* soaData, DNSName& shorter);
+  bool fillSOAFromZoneRecord(ZoneName& shorter, int zoneId, SOAData* soaData);
+  CacheResult fillSOAFromCache(SOAData* soaData, ZoneName& shorter);
 };
index 3c204ae31eeb20f01e8fa69978a011eda7987d12..b3549fc1645754f39dc8d725a328c93c7161a60f 100644 (file)
@@ -266,7 +266,7 @@ DNSName apiNameToDNSName(const string& name)
   }
 }
 
-DNSName apiZoneIdToName(const string& identifier)
+ZoneName apiZoneIdToName(const string& identifier)
 {
   string zonename;
   ostringstream outputStringStream;
@@ -314,14 +314,14 @@ DNSName apiZoneIdToName(const string& identifier)
   zonename = outputStringStream.str();
 
   try {
-    return DNSName(zonename);
+    return ZoneName(zonename);
   }
   catch (...) {
     throw ApiException("Unable to parse DNS Name '" + zonename + "'");
   }
 }
 
-string apiZoneNameToId(const DNSName& dname)
+string apiZoneNameToId(const ZoneName& dname)
 {
   string name = dname.toString();
   ostringstream outputStringStream;
index 7c3059382c021d1ea4a6f3375f3075d8b3a59acd..4f97e302f16e1a4088c7c0f049921a1d4dce5aeb 100644 (file)
@@ -32,8 +32,8 @@ void apiServerConfig(HttpRequest* req, HttpResponse* resp);
 void apiServerStatistics(HttpRequest* req, HttpResponse* resp);
 
 // helpers
-DNSName apiZoneIdToName(const string& identifier);
-string apiZoneNameToId(const DNSName& name);
+ZoneName apiZoneIdToName(const string& identifier);
+string apiZoneNameToId(const ZoneName& name);
 void apiCheckNameAllowedCharacters(const string& name);
 void apiCheckQNameAllowedCharacters(const string& name);
 DNSName apiNameToDNSName(const string& name);
index 3d7037dfc3564437b428a049ffcedc951626c1a6..8e4e0850573ba40cfb9247d904618863bc3f6ba5 100644 (file)
@@ -90,7 +90,7 @@ double Ewma::getMax() const
   return d_max;
 }
 
-static void patchZone(UeberBackend& backend, const DNSName& zonename, DomainInfo& domainInfo, HttpRequest* req, HttpResponse* resp);
+static void patchZone(UeberBackend& backend, const ZoneName& zonename, DomainInfo& domainInfo, HttpRequest* req, HttpResponse* resp);
 
 // QTypes that MUST NOT have multiple records of the same type in a given RRset.
 static const std::set<uint16_t> onlyOneEntryTypes = {QType::CNAME, QType::DNAME, QType::SOA};
@@ -385,7 +385,7 @@ static bool shouldDoRRSets(HttpRequest* req)
   throw ApiException("'rrsets' request parameter value '" + req->getvars["rrsets"] + "' is not supported");
 }
 
-static void fillZone(UeberBackend& backend, const DNSName& zonename, HttpResponse* resp, HttpRequest* req)
+static void fillZone(UeberBackend& backend, const ZoneName& zonename, HttpResponse* resp, HttpRequest* req)
 {
   DomainInfo domainInfo;
 
@@ -668,7 +668,7 @@ static void checkDefaultDNSSECAlgos()
   }
 }
 
-static void throwUnableToSecure(const DNSName& zonename)
+static void throwUnableToSecure(const ZoneName& zonename)
 {
   throw ApiException("No backend was able to secure '" + zonename.toString() + "', most likely because no DNSSEC"
                      + "capable backends are loaded, or because the backends have DNSSEC disabled. Check your configuration.");
@@ -677,7 +677,7 @@ static void throwUnableToSecure(const DNSName& zonename)
 /*
  * Add KSK and ZSK to an existing zone. Algorithms and sizes will be chosen per configuration.
  */
-static void addDefaultDNSSECKeys(DNSSECKeeper& dnssecKeeper, const DNSName& zonename)
+static void addDefaultDNSSECKeys(DNSSECKeeper& dnssecKeeper, const ZoneName& zonename)
 {
   checkDefaultDNSSECAlgos();
   int k_algo = DNSSECKeeper::shorthand2algorithm(::arg()["default-ksk-algorithm"]);
@@ -710,7 +710,7 @@ static bool isZoneApiRectifyEnabled(const DomainInfo& domainInfo)
   return api_rectify == "1";
 }
 
-static void extractDomainInfoFromDocument(const Json& document, std::optional<DomainInfo::DomainKind>& kind, std::optional<vector<ComboAddress>>& primaries, std::optional<DNSName>& catalog, std::optional<string>& account)
+static void extractDomainInfoFromDocument(const Json& document, std::optional<DomainInfo::DomainKind>& kind, std::optional<vector<ComboAddress>>& primaries, std::optional<ZoneName>& catalog, std::optional<string>& account)
 {
   if (document["kind"].is_string()) {
     kind = DomainInfo::stringToKind(stringFromJson(document, "kind"));
@@ -740,7 +740,7 @@ static void extractDomainInfoFromDocument(const Json& document, std::optional<Do
 
   if (document["catalog"].is_string()) {
     string catstring = document["catalog"].string_value();
-    catalog = (!catstring.empty() ? DNSName(catstring) : DNSName());
+    catalog = (!catstring.empty() ? ZoneName(catstring) : ZoneName());
   }
   else {
     catalog = std::nullopt;
@@ -773,11 +773,11 @@ static void extractJsonTSIGKeyIds(UeberBackend& backend, const Json& jsonArray,
 }
 
 // Must be called within backend transaction.
-static void updateDomainSettingsFromDocument(UeberBackend& backend, DomainInfo& domainInfo, const DNSName& zonename, const Json& document, bool zoneWasModified)
+static void updateDomainSettingsFromDocument(UeberBackend& backend, DomainInfo& domainInfo, const ZoneName& zonename, const Json& document, bool zoneWasModified)
 {
   std::optional<DomainInfo::DomainKind> kind;
   std::optional<vector<ComboAddress>> primaries;
-  std::optional<DNSName> catalog;
+  std::optional<ZoneName> catalog;
   std::optional<string> account;
 
   extractDomainInfoFromDocument(document, kind, primaries, catalog, account);
@@ -1013,7 +1013,7 @@ public:
     }
   }
 
-  DNSName zoneName;
+  ZoneName zoneName;
   UeberBackend backend{};
   DNSSECKeeper dnssecKeeper;
   DomainInfo domainInfo{};
@@ -1192,7 +1192,7 @@ static void apiZoneMetadataKindDELETE(HttpRequest* req, HttpResponse* resp)
 }
 
 // Throws 404 if the key with inquireKeyId does not exist
-static void apiZoneCryptoKeysCheckKeyExists(const DNSName& zonename, int inquireKeyId, DNSSECKeeper* dnssecKeeper)
+static void apiZoneCryptoKeysCheckKeyExists(const ZoneName& zonename, int inquireKeyId, DNSSECKeeper* dnssecKeeper)
 {
   DNSSECKeeper::keyset_t keyset = dnssecKeeper->getKeys(zonename, false);
   bool found = false;
@@ -1207,7 +1207,7 @@ static void apiZoneCryptoKeysCheckKeyExists(const DNSName& zonename, int inquire
   }
 }
 
-static inline int getInquireKeyId(HttpRequest* req, const DNSName& zonename, DNSSECKeeper* dnsseckeeper)
+static inline int getInquireKeyId(HttpRequest* req, const ZoneName& zonename, DNSSECKeeper* dnsseckeeper)
 {
   int inquireKeyId = -1;
   if (req->parameters.count("key_id") == 1) {
@@ -1217,7 +1217,7 @@ static inline int getInquireKeyId(HttpRequest* req, const DNSName& zonename, DNS
   return inquireKeyId;
 }
 
-static void apiZoneCryptokeysExport(const DNSName& zonename, int64_t inquireKeyId, HttpResponse* resp, DNSSECKeeper* dnssec_dk)
+static void apiZoneCryptokeysExport(const ZoneName& zonename, int64_t inquireKeyId, HttpResponse* resp, DNSSECKeeper* dnssec_dk)
 {
   DNSSECKeeper::keyset_t keyset = dnssec_dk->getKeys(zonename, false);
 
@@ -1538,7 +1538,7 @@ static void apiZoneCryptokeysPUT(HttpRequest* req, HttpResponse* resp)
   resp->status = 204;
 }
 
-static void gatherRecordsFromZone(const std::string& zonestring, vector<DNSResourceRecord>& new_records, const DNSName& zonename)
+static void gatherRecordsFromZone(const std::string& zonestring, vector<DNSResourceRecord>& new_records, const ZoneName& zonename)
 {
   DNSResourceRecord resourceRecord;
   vector<string> zonedata;
@@ -1578,7 +1578,7 @@ static void gatherRecordsFromZone(const std::string& zonestring, vector<DNSResou
  *   *) no duplicates for QTypes that can only be present once per RRset
  *   *) hostnames are hostnames
  */
-static void checkNewRecords(vector<DNSResourceRecord>& records, const DNSName& zone)
+static void checkNewRecords(vector<DNSResourceRecord>& records, const ZoneName& zone)
 {
   sort(records.begin(), records.end(),
        [](const DNSResourceRecord& rec_a, const DNSResourceRecord& rec_b) -> bool {
@@ -1843,7 +1843,7 @@ static void apiServerZonesPOST(HttpRequest* req, HttpResponse* resp)
   DNSSECKeeper dnssecKeeper(&backend);
   DomainInfo domainInfo;
   const auto& document = req->json();
-  DNSName zonename = apiNameToDNSName(stringFromJson(document, "name"));
+  ZoneName zonename = apiNameToDNSName(stringFromJson(document, "name"));
   apiCheckNameAllowedCharacters(zonename.toString());
   zonename.makeUsLowerCase();
 
@@ -1854,7 +1854,7 @@ static void apiServerZonesPOST(HttpRequest* req, HttpResponse* resp)
 
   std::optional<DomainInfo::DomainKind> kind;
   std::optional<vector<ComboAddress>> primaries;
-  std::optional<DNSName> catalog;
+  std::optional<ZoneName> catalog;
   std::optional<string> account;
   extractDomainInfoFromDocument(document, kind, primaries, catalog, account);
 
@@ -2039,7 +2039,7 @@ static void apiServerZonesGET(HttpRequest* req, HttpResponse* resp)
   if (req->getvars.count("zone") != 0) {
     string zone = req->getvars["zone"];
     apiCheckNameAllowedCharacters(zone);
-    DNSName zonename = apiNameToDNSName(zone);
+    ZoneName zonename = apiNameToDNSName(zone);
     zonename.makeUsLowerCase();
     DomainInfo domainInfo;
     if (backend.getDomainInfo(zonename, domainInfo)) {
@@ -2284,7 +2284,7 @@ static void apiServerZoneRectify(HttpRequest* req, HttpResponse* resp)
 }
 
 // NOLINTNEXTLINE(readability-function-cognitive-complexity): TODO Refactor this function.
-static void patchZone(UeberBackend& backend, const DNSName& zonename, DomainInfo& domainInfo, HttpRequest* req, HttpResponse* resp)
+static void patchZone(UeberBackend& backend, const ZoneName& zonename, DomainInfo& domainInfo, HttpRequest* req, HttpResponse* resp)
 {
   bool zone_disabled = false;
   SOAData soaData;
@@ -2309,11 +2309,11 @@ static void patchZone(UeberBackend& backend, const DNSName& zonename, DomainInfo
     domainInfo.backend->getDomainMetadataOne(zonename, "SOA-EDIT", soa_edit_kind);
     bool soa_edit_done = false;
 
-    set<std::tuple<DNSName, QType, string>> seen;
+    set<std::tuple<ZoneName, QType, string>> seen;
 
     for (const auto& rrset : rrsets.array_items()) {
       string changetype = toUpper(stringFromJson(rrset, "changetype"));
-      DNSName qname = apiNameToDNSName(stringFromJson(rrset, "name"));
+      ZoneName qname = apiNameToDNSName(stringFromJson(rrset, "name"));
       apiCheckQNameAllowedCharacters(qname.toString());
       QType qtype;
       qtype = stringFromJson(rrset, "type");
@@ -2587,7 +2587,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp)
 
 static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp)
 {
-  DNSName canon = apiNameToDNSName(req->getvars["domain"]);
+  ZoneName canon = apiNameToDNSName(req->getvars["domain"]);
 
   if (g_zoneCache.isEnabled()) {
     DomainInfo domainInfo;
index 51e76fa03b429a2223f5f1ee7e09c0ea08f30202..669645aa01187708108078a7ca3175fac68acc50 100644 (file)
@@ -203,7 +203,7 @@ try
       cerr<<"\r100% done\033\133\113"<<endl;
     }
     else {
-      ZoneParserTNG zpt(zonefile, DNSName(::arg()["zone-name"]));
+      ZoneParserTNG zpt(zonefile, ZoneName(::arg()["zone-name"]));
       zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
       DNSResourceRecord rr;
       string zname;
index 5752350e0df455ec483b726cc62b705f7340d6cc..661658650bde01ade3857476bea5a401f7985ff6 100644 (file)
@@ -49,7 +49,7 @@ bool g_pdnsinfo;
 unsigned int g_domainid;
 string g_basedn;
 string g_metadatadn;
-DNSName g_zonename;
+ZoneName g_zonename;
 map<DNSName,bool> g_objects;
 map<string, bool> g_entries;
 map<DNSName,bool> g_recorddata;
@@ -345,7 +345,7 @@ int main( int argc, char* argv[] )
                                         return 1;
                         }
 
-                        g_zonename = DNSName(args["zone-name"]);
+                        g_zonename = ZoneName(args["zone-name"]);
                         ZoneParserTNG zpt(args["zone-file"], g_zonename);
                         zpt.setMaxGenerateSteps(args.asNum("max-generate-steps"));
                         DNSResourceRecord rr;
index 4dfa32ed8464e29e6450d7863db9d48e30dd6021..aff21524e129dc52d4186b4c79b36bf92cda1c19 100644 (file)
@@ -111,7 +111,7 @@ static void startNewTransaction()
     cout<<"BEGIN TRANSACTION;"<<endl;
 }
 
-static void emitDomain(const DNSName& domain, const vector<ComboAddress>* primaries = nullptr)
+static void emitDomain(const ZoneName& domain, const vector<ComboAddress>* primaries = nullptr)
 {
   string iDomain = domain.toStringRootDot();
   if (!::arg().mustDo("secondary")) {
@@ -134,7 +134,7 @@ static void emitDomain(const DNSName& domain, const vector<ComboAddress>* primar
 }
 
 bool g_doJSONComments;
-static void emitRecord(const DNSName& zoneName, const DNSName &DNSqname, const string &qtype, const string &ocontent, int ttl, const string& comment="")
+static void emitRecord(const ZoneName& zoneName, const DNSName &DNSqname, const string &qtype, const string &ocontent, int ttl, const string& comment="")
 {
   string qname = DNSqname.toStringRootDot();
   string zname = zoneName.toStringRootDot();
@@ -331,9 +331,9 @@ try
       cerr<<"\r100% done\033\133\113"<<endl;
     }
     else {
-      DNSName zonename;
+      ZoneName zonename;
       if(!::arg()["zone-name"].empty())
-        zonename = DNSName(::arg()["zone-name"]);
+        zonename = ZoneName(::arg()["zone-name"]);
 
       ZoneParserTNG zpt(zonefile, zonename);
       zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
index bb5a75f1582dcac2e98f31d8cc6572841f7b6155..10dc2b600906f35fae86cd08f1c69aa07ef8c95e 100644 (file)
@@ -50,7 +50,7 @@ public:
     ValidationFailure
   };
 
-  ZoneMD(DNSName zone) :
+  ZoneMD(ZoneName zone) :
     d_zone(std::move(zone))
   {}
   void readRecords(ZoneParserTNG& zpt);
@@ -148,7 +148,7 @@ private:
   ContentSigPair d_nsecs;
   map<DNSName, ContentSigPair> d_nsec3s;
   DNSName d_nsec3label;
-  const DNSName d_zone;
+  const ZoneName d_zone;
   const ContentSigPair empty;
 };
 
index 41bd5e5683c816a830e330c00d660efad72a49a4..93587d902059448780cd0dabf292c3bc8275b6bd 100644 (file)
@@ -38,7 +38,7 @@
 
 const static string g_INstr("IN");
 
-ZoneParserTNG::ZoneParserTNG(const string& fname, DNSName  zname, string  reldir, bool upgradeContent):
+ZoneParserTNG::ZoneParserTNG(const string& fname, ZoneName zname, string reldir, bool upgradeContent):
   d_reldir(std::move(reldir)), d_zonename(std::move(zname)), d_defaultttl(3600),
   d_templatecounter(0), d_templatestop(0), d_templatestep(0),
   d_havedollarttl(false), d_fromfile(true), d_upgradeContent(upgradeContent)
@@ -46,7 +46,7 @@ ZoneParserTNG::ZoneParserTNG(const string& fname, DNSName  zname, string  reldir
   stackFile(fname);
 }
 
-ZoneParserTNG::ZoneParserTNG(const vector<string>& zonedata, DNSName  zname, bool upgradeContent):
+ZoneParserTNG::ZoneParserTNG(const vector<string>& zonedata, ZoneName zname, bool upgradeContent):
   d_zonename(std::move(zname)), d_zonedata(zonedata), d_defaultttl(3600),
   d_templatecounter(0), d_templatestop(0), d_templatestep(0),
   d_havedollarttl(false), d_fromfile(false), d_upgradeContent(upgradeContent)
@@ -314,7 +314,7 @@ static bool findAndElide(string& line, char c)
   return false;
 }
 
-DNSName ZoneParserTNG::getZoneName()
+ZoneName ZoneParserTNG::getZoneName()
 {
   return d_zonename;
 }
@@ -372,7 +372,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
       stackFile(fname);
     }
     else if(pdns_iequals(command, "$ORIGIN") && d_parts.size() > 1) {
-      d_zonename = DNSName(makeString(d_line, d_parts[1]));
+      d_zonename = ZoneName(makeString(d_line, d_parts[1]));
     }
     else if(pdns_iequals(command, "$GENERATE") && d_parts.size() > 2) {
       if (!d_generateEnabled) {
index 977fcb768210ae1c831556098f75df6163eecbb1..7a2961957ee321b4385d972a86f3c164416485bd 100644 (file)
 class ZoneParserTNG
 {
 public:
-  ZoneParserTNG(const string& fname, DNSName  zname=g_rootdnsname, string  reldir="", bool upgradeContent=false);
-  ZoneParserTNG(const vector<string>& zonedata, DNSName  zname, bool upgradeContent=false);
+  ZoneParserTNG(const string& fname, ZoneName zname=g_rootdnsname, string reldir="", bool upgradeContent=false);
+  ZoneParserTNG(const vector<string>& zonedata, ZoneName zname, bool upgradeContent=false);
 
   ~ZoneParserTNG();
   bool get(DNSResourceRecord& rr, std::string* comment=0);
   typedef runtime_error exception;
   typedef std::deque<pair<string::size_type, string::size_type> > parts_t;
-  DNSName getZoneName();
+  ZoneName getZoneName();
   string getLineOfFile(); // for error reporting purposes
   pair<string,int> getLineNumAndFile(); // idem
   void disableGenerate()
@@ -71,7 +71,7 @@ private:
   string d_reldir;
   string d_line;
   DNSName d_prevqname;
-  DNSName d_zonename;
+  ZoneName d_zonename;
   string d_templateline;
   vector<string> d_zonedata;
   vector<string>::iterator d_zonedataline;