From: Fred Morcos Date: Tue, 31 May 2022 11:35:58 +0000 (+0200) Subject: Implement toString() for DNSRecord X-Git-Tag: auth-4.8.0-alpha0~63^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb0598b2ca240f4ecaf06bcbef25ce73f1f2bfb0;p=thirdparty%2Fpdns.git Implement toString() for DNSRecord --- diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 90070966bd..0354876d2c 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -24,6 +24,7 @@ #include #include #include +#include #include #include // #include @@ -304,6 +305,18 @@ struct DNSRecord uint16_t d_clen{}; DNSResourceRecord::Place d_place; + [[nodiscard]] std::string print(const std::string& indent = "") const + { + std::stringstream s; + s << indent << "Content = " << d_content->getZoneRepresentation() << std::endl; + s << indent << "Type = " << d_type << std::endl; + s << indent << "Class = " << d_class << std::endl; + s << indent << "TTL = " << d_ttl << std::endl; + s << indent << "clen = " << d_clen << std::endl; + s << indent << "Place = " << std::to_string(d_place) << std::endl; + return s.str(); + } + bool operator<(const DNSRecord& rhs) const { if(std::tie(d_name, d_type, d_class, d_ttl) < std::tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl))