From: bert hubert Date: Thu, 1 Oct 2015 19:45:23 +0000 (+0200) Subject: add some DNSResourceRecord/DNSRecord conversion infra X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~28^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad5855b5cdebab6f2565364cb8ed0fb3fe8be436;p=thirdparty%2Fpdns.git add some DNSResourceRecord/DNSRecord conversion infra --- diff --git a/pdns/dns.cc b/pdns/dns.cc index 2e0639a94d..bebfb8a73e 100644 --- a/pdns/dns.cc +++ b/pdns/dns.cc @@ -9,6 +9,7 @@ #include #include #include +#include "dnsparser.hh" std::vector RCode::rcodes_s = boost::assign::list_of ("No Error") @@ -195,3 +196,18 @@ string& attodot(string &str) return str; } +vector convertRRS(const vector& in) +{ + vector out; + for(const auto& d : in) { + DNSResourceRecord rr; + rr.qname = d.d_name; + rr.qtype = QType(d.d_type); + rr.ttl = d.d_ttl; + rr.content = d.d_content->getZoneRepresentation(); + rr.auth = false; + rr.qclass = d.d_class; + out.push_back(rr); + } + return out; +} diff --git a/pdns/dns.hh b/pdns/dns.hh index d346f0883c..e0e4cdabf1 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -230,3 +230,5 @@ void fillSOAData(const string &content, SOAData &data); /** for use by DNSPacket, converts a SOAData class to a ascii line again */ string serializeSOAData(const SOAData &data); string &attodot(string &str); //!< for when you need to insert an email address in the SOA + +vector convertRRS(const vector& in);