From: bert hubert Date: Thu, 1 Oct 2015 19:45:49 +0000 (+0200) Subject: further DNSRecord/DNSResourceRecord conversion infra X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~28^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbe2359127898ace4b5f025dd0a7e1435b1b161a;p=pdns further DNSRecord/DNSResourceRecord conversion infra --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index e5a151923..d1752d3b3 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -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::mastermake(d_type, rr.qclass, rr.content)); +} + void MOADNSParser::init(const char *packet, unsigned int len) { if(len < sizeof(dnsheader)) diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 9c02b8079..2a3e26986 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -263,13 +263,15 @@ protected: struct DNSRecord { + DNSRecord() = default; + explicit DNSRecord(const DNSResourceRecord& rr); DNSName d_name; std::shared_ptr 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 {