]> granicus.if.org Git - pdns/commitdiff
implement a canonical ordering mode for DNSName plus add testcases for it. Preliminar...
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 16 Jun 2015 11:14:32 +0000 (13:14 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 30 Jun 2015 06:12:50 +0000 (08:12 +0200)
pdns/dnsname.cc
pdns/dnsname.hh

index 28b281ff90660128e3c9456d4780d20b216d6225..530a209a161e1bda6fad3ebda3b0239c3c3632e8 100644 (file)
@@ -188,7 +188,6 @@ vector<string> DNSName::getRawLabels() const
   return ret;
 }
 
-
 bool DNSName::canonCompare(const DNSName& rhs) const
 {
   auto ours=getRawLabels(), rhsLabels = rhs.getRawLabels();
index 15d830bd3aa6db64a28f1d72f84947fecac4e5bb..a3f3d3296cc44c4156bd3a0ef0648f68e7aa5606 100644 (file)
@@ -78,6 +78,9 @@ public:
     ar & d_storage;
     ar & d_empty;
   }
+
+  bool canonCompare(const DNSName& rhs) const;
+  
 private:
   //  typedef __gnu_cxx::__sso_string string_t;
   typedef std::string string_t;
@@ -99,6 +102,14 @@ struct CanonDNSNameCompare: public std::binary_function<DNSName, DNSName, bool>
 };
 size_t hash_value(DNSName const& d);
 
+struct CanonDNSNameCompare: public std::binary_function<DNSName, DNSName, bool>
+{
+  bool operator()(const DNSName&a, const DNSName& b) const
+  {
+    return a.canonCompare(b);
+  }
+};
+
 inline DNSName operator+(const DNSName& lhs, const DNSName& rhs)
 {
   DNSName ret=lhs;