]> granicus.if.org Git - pdns/commitdiff
make getTag() const on DNSKEYRecordContent. WARNING! This does entail an internal...
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 18 Nov 2015 21:23:11 +0000 (22:23 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 18 Nov 2015 21:23:11 +0000 (22:23 +0100)
Also add DNSKEYRecordContent ordering

pdns/dnsrecords.cc
pdns/dnsrecords.hh

index 9c03ce64c0a387d36d81dce0925775ddcd53647e..9d47361c39fe2ce4eedfea7cdc2e70df75393e39 100644 (file)
@@ -476,9 +476,10 @@ boilerplate_conv(TKEY, QType::TKEY,
                  )
 TKEYRecordContent::TKEYRecordContent() { d_othersize = 0; } // fix CID#1288932
 
-uint16_t DNSKEYRecordContent::getTag()
+uint16_t DNSKEYRecordContent::getTag() const
 {
-  string data=this->serialize(DNSName()); 
+  DNSKEYRecordContent tmp(*this);
+  string data=tmp.serialize(DNSName());  // this can't be const for some reason
   const unsigned char* key=(const unsigned char*)data.c_str();
   unsigned int keysize=data.length();
 
index c5b9bdd12e407053d1ccb76e0cedae984585b037..21627478337cf1efb04821c385394b017a31cf38 100644 (file)
@@ -278,12 +278,17 @@ class DNSKEYRecordContent : public DNSRecordContent
 public:
   DNSKEYRecordContent();
   includeboilerplate(DNSKEY)
-  uint16_t getTag();
+  uint16_t getTag() const;
 
   uint16_t d_flags;
   uint8_t d_protocol;
   uint8_t d_algorithm;
   string d_key;
+  bool operator<(const DNSKEYRecordContent& rhs) const
+  {
+    return tie(d_flags, d_protocol, d_algorithm, d_key) < 
+      tie(rhs.d_flags, rhs.d_protocol, rhs.d_algorithm, rhs.d_key);
+  }
 };
 
 class CDNSKEYRecordContent : public DNSRecordContent