]> granicus.if.org Git - pdns/commitdiff
liberate getAddr() helper from sortlist.cc for wider use
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Feb 2016 10:37:24 +0000 (11:37 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Feb 2016 10:37:24 +0000 (11:37 +0100)
pdns/dnsrecords.cc
pdns/dnsrecords.hh
pdns/sortlist.cc

index 9bf357e322fc754b5b89b88f2cb3970018fd728b..a2775bdbea8a4f8a9ba55cd58085905965b4a852 100644 (file)
@@ -608,6 +608,16 @@ void reportAllTypes()
   reportOtherTypes();
 }
 
+ComboAddress getAddr(const DNSRecord& dr, uint16_t defport)
+{
+  if(auto addr=getRR<ARecordContent>(dr)) {
+    return addr->getCA(defport);
+  }
+  else
+    return getRR<AAAARecordContent>(dr)->getCA(defport);
+}
+
+
 #if 0
 static struct Reporter
 {
index 0cdff09b8ce57071e56df15febf882050eb1ad4f..91df95aab35ed45ffe16968a1851d70aae4dc1d8 100644 (file)
@@ -708,5 +708,5 @@ DNSRecord makeOpt(int udpsize, int extRCode, int Z);
 void reportBasicTypes();
 void reportOtherTypes();
 void reportAllTypes();
-
+ComboAddress getAddr(const DNSRecord& dr, uint16_t defport=0);
 #endif 
index 4a014f04d73ebf26dbb64bf0f160386c440699e3..f840844f0cfdb6f256e85995f7ca3cf7f63e8d56 100644 (file)
@@ -52,14 +52,6 @@ bool SortListOrderCmp::operator()(const ComboAddress& a, const ComboAddress& b)
   return aOrder < bOrder;
 }
 
-static ComboAddress getAddr(const DNSRecord& dr)
-{
-  if(auto addr=getRR<ARecordContent>(dr)) {
-    return addr->getCA();
-  }
-  else
-    return getRR<AAAARecordContent>(dr)->getCA();
-}
 bool SortListOrderCmp::operator()(const DNSRecord& ar, const DNSRecord& br) const
 {
   if(ar.d_type < br.d_type)