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));