From bb0598b2ca240f4ecaf06bcbef25ce73f1f2bfb0 Mon Sep 17 00:00:00 2001 From: Fred Morcos Date: Tue, 31 May 2022 13:35:58 +0200 Subject: [PATCH] Implement toString() for DNSRecord --- pdns/dnsparser.hh | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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)) -- 2.47.2