]> granicus.if.org Git - pdns/commitdiff
further DNSRecord/DNSResourceRecord conversion infra
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 1 Oct 2015 19:45:49 +0000 (21:45 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 1 Oct 2015 19:45:49 +0000 (21:45 +0200)
pdns/dnsparser.cc
pdns/dnsparser.hh

index e5a151923dc568cf653da1cff414529ca9f6daef..d1752d3b3ed7ac915701f2bf129082c71daa4b39 100644 (file)
@@ -207,6 +207,15 @@ DNSRecordContent::zmakermap_t& DNSRecordContent::getZmakermap()
   return zmakermap;
 }
 
+DNSRecord::DNSRecord(const DNSResourceRecord& rr)
+{
+  d_name = rr.qname;
+  d_type = rr.qtype.getCode();
+  d_ttl = rr.ttl;
+  d_class = rr.qclass;
+  d_content = std::shared_ptr<DNSRecordContent>(DNSRecordContent::mastermake(d_type, rr.qclass, rr.content));
+}
+
 void MOADNSParser::init(const char *packet, unsigned int len)
 {
   if(len < sizeof(dnsheader))
index 9c02b8079b086352c6ed0d4160dfa53d2f30182c..2a3e26986b9b4f96f20e9c7c76d5656a03f01345 100644 (file)
@@ -263,13 +263,15 @@ protected:
 
 struct DNSRecord
 {
+  DNSRecord() = default;
+  explicit DNSRecord(const DNSResourceRecord& rr);
   DNSName d_name;
   std::shared_ptr<DNSRecordContent> d_content;
   uint16_t d_type;
   uint16_t d_class;
   uint32_t d_ttl;
   uint16_t d_clen;
-  enum : uint8_t {Answer=1, Nameserver, Additional} d_place;
+  enum Place : uint8_t {Answer=1, Nameserver=2, Additional=3} d_place;
 
   bool operator<(const DNSRecord& rhs) const
   {