2
2
PowerDNS Versatile Database Driven Nameserver
3
Copyright (C) 2005 PowerDNS.COM BV
3
Copyright (C) 2005 - 2007 PowerDNS.COM BV
5
5
This program is free software; you can redistribute it and/or modify
6
6
it under the terms of the GNU General Public License version 2 as
14
14
You should have received a copy of the GNU General Public License
15
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20
#include "dnsrecords.hh"
21
22
boilerplate_conv(A, ns_t_a, conv.xfrIP(d_ip));
24
uint32_t ARecordContent::getIP() const
23
29
void ARecordContent::doRecordCheck(const DNSRecord& dr)
26
throw MOADNSException("Wrong size for A record");
32
throw MOADNSException("Wrong size for A record ("+lexical_cast<string>(dr.d_clen)+")");
29
35
class AAAARecordContent : public DNSRecordContent
64
70
string getZoneRepresentation() const
69
for(size_t n=0; n< 16 ; n+=2) {
70
snprintf(hex,sizeof(hex)-1, "%x", d_ip6[n]);
72
snprintf(hex,sizeof(hex)-1, "%02x", d_ip6[n+1]);
72
struct sockaddr_in6 addr;
73
memset(&addr, 0, sizeof(addr));
74
addr.sin6_family=AF_INET6;
75
memcpy(&addr.sin6_addr, d_ip6, 16);
79
Utility::inet_ntop(AF_INET6, (const char*)& addr.sin6_addr, tmp, sizeof(tmp));
176
176
boilerplate_conv(NS, ns_t_ns, conv.xfrLabel(d_content, true));
177
177
boilerplate_conv(PTR, ns_t_ptr, conv.xfrLabel(d_content, true));
178
178
boilerplate_conv(CNAME, ns_t_cname, conv.xfrLabel(d_content, true));
179
boilerplate_conv(TXT, ns_t_txt, conv.xfrText(d_text));
180
boilerplate_conv(SPF, 99, conv.xfrText(d_text));
179
boilerplate_conv(MR, ns_t_mr, conv.xfrLabel(d_alias, false));
180
boilerplate_conv(TXT, ns_t_txt, conv.xfrText(d_text, true));
181
boilerplate_conv(SPF, 99, conv.xfrText(d_text, true));
181
182
boilerplate_conv(HINFO, ns_t_hinfo, conv.xfrText(d_cpu); conv.xfrText(d_host));
183
184
boilerplate_conv(RP, ns_t_rp,
199
200
conv.xfrLabel(d_mxname, true);
203
boilerplate_conv(AFSDB, ns_t_afsdb,
204
conv.xfr16BitInt(d_subtype);
205
conv.xfrLabel(d_hostname);
203
209
boilerplate_conv(NAPTR, ns_t_naptr,
204
210
conv.xfr16BitInt(d_order); conv.xfr16BitInt(d_preference);
211
216
SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const string& target)
212
217
: DNSRecordContent(ns_t_srv), d_preference(preference), d_weight(weight), d_port(port), d_target(target)
234
239
conv.xfr32BitInt(d_st.expire);
235
240
conv.xfr32BitInt(d_st.minimum);
243
boilerplate_conv(KEY, ns_t_key,
244
conv.xfr16BitInt(d_flags);
245
conv.xfr8BitInt(d_protocol);
246
conv.xfr8BitInt(d_algorithm);
247
conv.xfrBlob(d_certificate);
250
boilerplate_conv(CERT, 37,
251
conv.xfr16BitInt(d_type);
252
conv.xfr16BitInt(d_tag);
253
conv.xfr8BitInt(d_algorithm);
254
conv.xfrBlob(d_certificate);
239
257
boilerplate_conv(DS, 43,
240
258
conv.xfr16BitInt(d_tag);
241
259
conv.xfr8BitInt(d_algorithm);
242
260
conv.xfr8BitInt(d_digesttype);
243
conv.xfrBlob(d_digest);
261
conv.xfrHexBlob(d_digest);
264
boilerplate_conv(SSHFP, 44,
265
conv.xfr8BitInt(d_algorithm);
266
conv.xfr8BitInt(d_fptype);
267
conv.xfrHexBlob(d_fingerprint);
246
270
boilerplate_conv(RRSIG, 46,
266
290
void reportBasicTypes()
268
ARecordContent::report();
269
AAAARecordContent::report();
270
NSRecordContent::report();
271
CNAMERecordContent::report();
272
MXRecordContent::report();
273
SOARecordContent::report();
274
SRVRecordContent::report();
275
PTRRecordContent::report();
292
ARecordContent::report();
293
AAAARecordContent::report();
294
NSRecordContent::report();
295
CNAMERecordContent::report();
296
MXRecordContent::report();
297
SOARecordContent::report();
298
SRVRecordContent::report();
299
PTRRecordContent::report();
300
DNSRecordContent::regist(3, ns_t_txt, &TXTRecordContent::make, &TXTRecordContent::make, "TXT");
301
TXTRecordContent::report();
302
DNSRecordContent::regist(1, 255, 0, 0, "ANY");
278
305
void reportOtherTypes()
280
TXTRecordContent::report();
307
AFSDBRecordContent::report();
281
308
SPFRecordContent::report();
282
309
NAPTRRecordContent::report();
310
LOCRecordContent::report();
311
HINFORecordContent::report();
283
312
RPRecordContent::report();
313
KEYRecordContent::report();
284
314
DNSKEYRecordContent::report();
285
315
RRSIGRecordContent::report();
286
316
DSRecordContent::report();
317
SSHFPRecordContent::report();
318
CERTRecordContent::report();
287
319
NSECRecordContent::report();
288
320
OPTRecordContent::report();
289
DNSRecordContent::regist(1,255, 0, 0, "ANY");
292
323
void reportAllTypes()