]> granicus.if.org Git - pdns/commitdiff
It compiles.
authorRuben d'Arco <cyclops@prof-x.net>
Thu, 4 Jun 2015 11:20:19 +0000 (13:20 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 30 Jun 2015 06:12:45 +0000 (08:12 +0200)
pdns/dnsname.cc
pdns/dnsname.hh
pdns/packetcache.cc
pdns/packetcache.hh

index 329fa58de47ae3385a9ac6a824026bde02fbee97..b13c899d31e0a51fbb660ba291dd6437395bd0cd 100644 (file)
@@ -89,6 +89,10 @@ std::string DNSName::toDNSString() const
   return ret;
 }
 
+const char* DNSName::toCString() const {
+  return this->toString().c_str();
+}
+
 // are WE part of parent
 bool DNSName::isPartOf(const DNSName& parent) const
 {
index af243d33b56ff14eb5a5843b91c392bbba32660b..3939fa9e098e95a6cef1773a9af9cfd419768c4f 100644 (file)
@@ -37,6 +37,7 @@ public:
 
   std::string toString() const;              //!< Our human-friendly, escaped, representation
   std::string toDNSString() const;           //!< Our representation in DNS native format
+  const char* toCString() const;             //!< Easy access to toString().c_str();
   void appendRawLabel(const std::string& str); //!< Append this unescaped label
   void prependRawLabel(const std::string& str); //!< Prepend this unescaped label
   std::vector<std::string> getRawLabels() const; //!< Individual raw unescaped labels
index ced4b0e2133566e036038b78a834d04839b6c234..12cf7fe28d386b20803b029772fea1c01689261c 100644 (file)
@@ -229,7 +229,7 @@ int PacketCache::purge(const string &match)
       cmap_t::const_iterator start=iter;
 
       for(; iter != mc.d_map.end(); ++iter) {
-       if(iter->qname.compare(0, zone.size(), zone) != 0) {
+       if(iter->qname.toString().compare(0, zone.size(), zone) != 0) { //TODO: check if there is a nicer method for this
          break;
        }
        delcount++;
index 3b4e936dba3f36110da0d7502e15355cebfc05f5..fb8666c50e3809ea923f9061e0215b570a3d08c5 100644 (file)
@@ -98,7 +98,7 @@ private:
                 ordered_unique<
                       composite_key< 
                         CacheEntry,
-                        member<CacheEntry,string,&CacheEntry::qname>,
+                        member<CacheEntry,DNSName,&CacheEntry::qname>,
                         member<CacheEntry,uint16_t,&CacheEntry::qtype>,
                         member<CacheEntry,uint16_t, &CacheEntry::ctype>,
                         member<CacheEntry,int, &CacheEntry::zoneID>,
@@ -107,7 +107,7 @@ private:
                         member<CacheEntry,bool, &CacheEntry::dnssecOk>,
                         member<CacheEntry,bool, &CacheEntry::hasEDNS>
                         >,
-                        composite_key_compare<std::less<string>, std::less<uint16_t>, std::less<uint16_t>, std::less<int>, std::less<bool>, 
+                        composite_key_compare<std::less<DNSName>, std::less<uint16_t>, std::less<uint16_t>, std::less<int>, std::less<bool>, 
                           std::less<unsigned int>, std::less<bool>, std::less<bool> >
                             >,
                            sequenced<>
@@ -122,9 +122,9 @@ private:
   };
 
   vector<MapCombo> d_maps;
-  MapCombo& getMap(const std::string& qname) 
+  MapCombo& getMap(const DNSName& qname) 
   {
-    return d_maps[burtle((const unsigned char*)qname.c_str(), qname.length(), 0) % d_maps.size()];
+    return d_maps[burtle((const unsigned char*)qname.toCString(), qname.toString().length(), 0) % d_maps.size()];
   }