]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
AAAA now uses boilerplate_conv
authorAki Tuomi <cmouse@desteem.org>
Mon, 13 May 2013 15:38:20 +0000 (18:38 +0300)
committerAki Tuomi <cmouse@desteem.org>
Mon, 13 May 2013 19:05:05 +0000 (22:05 +0300)
pdns/dnsrecords.cc
pdns/dnsrecords.hh

index 47d379ecb7e3840eef843fa6f5c94387985a8e78..10a6c30216d87b8c7b23e707410fde110418ebef 100644 (file)
@@ -38,59 +38,7 @@ void ARecordContent::doRecordCheck(const DNSRecord& dr)
     throw MOADNSException("Wrong size for A record ("+lexical_cast<string>(dr.d_clen)+")");
 }
 
-class AAAARecordContent : public DNSRecordContent
-{
-public:
-  AAAARecordContent() : DNSRecordContent(ns_t_aaaa)
-  {}
-
-  static void report(void)
-  {
-    regist(1, ns_t_aaaa, &make, &make, "AAAA");
-  }
-
-  static DNSRecordContent* make(const DNSRecord &dr, PacketReader& pr) 
-  {
-    if(dr.d_clen!=16)
-      throw MOADNSException("Wrong size for AAAA record");
-
-    AAAARecordContent* ret=new AAAARecordContent();
-    pr.copyRecord((unsigned char*) &ret->d_ip6, 16);
-    return ret;
-  }
-
-  static DNSRecordContent* make(const string& zone) 
-  {
-    AAAARecordContent *ar=new AAAARecordContent();
-    if(Utility::inet_pton( AF_INET6, zone.c_str(), static_cast< void * >( ar->d_ip6 )) <= 0)
-      throw MOADNSException("Asked to encode '"+zone+"' as an IPv6 address, but does not parse");
-    return ar;
-  }
-
-  void toPacket(DNSPacketWriter& pw)
-  {
-    string blob(d_ip6, d_ip6+16);
-    pw.xfrBlob(blob);
-  }
-  
-  string getZoneRepresentation() const
-  {
-    struct sockaddr_in6 addr;
-    memset(&addr, 0, sizeof(addr));
-    addr.sin6_family=AF_INET6;
-    memcpy(&addr.sin6_addr, d_ip6, 16);
-
-    char tmp[128];
-    tmp[0]=0;
-    Utility::inet_ntop(AF_INET6, (const char*)& addr.sin6_addr, tmp, sizeof(tmp));
-    return tmp;
-  }
-
-private:
-  unsigned char d_ip6[16];
-};
-
-
+boilerplate_conv(AAAA, ns_t_aaaa, conv.xfrIP6(d_ip6); );
 
 boilerplate_conv(NS, ns_t_ns, conv.xfrLabel(d_content, true));
 boilerplate_conv(PTR, ns_t_ptr, conv.xfrLabel(d_content, true));
index c60d3824e20e0f8c545c860a3f9c100852f6cecc..63d140cb3d028f7375733625fabc3461fc048741 100644 (file)
@@ -64,6 +64,15 @@ private:
   uint32_t d_ip;
 };
 
+class AAAARecordContent : public DNSRecordContent
+{
+public:
+  AAAARecordContent(std::string &val);
+  includeboilerplate(AAAA);
+private:
+  std::string d_ip6;
+};
+
 class MXRecordContent : public DNSRecordContent
 {
 public: