From: bert hubert Date: Tue, 21 Oct 2014 19:21:35 +0000 (+0200) Subject: we duplicated the ns_t_enums from resolv.h or arpa/nameser.h for no good reason.... X-Git-Tag: rec-3.7.0-rc1~199^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bb50daa1975a3b93479343b746700971fc678fb;p=thirdparty%2Fpdns.git we duplicated the ns_t_enums from resolv.h or arpa/nameser.h for no good reason. Shift to QType::enum. --- diff --git a/pdns/dns.hh b/pdns/dns.hh index 48f694bfe2..3b1bb32a28 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -144,67 +144,6 @@ struct EDNS0Record uint16_t Z; } GCCPACKATTRIBUTE; -enum { - ns_t_invalid = 0, /* Cookie. */ - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - ns_t_kx = 36, /* Key Exchange */ - ns_t_cert = 37, /* Certification record */ - ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ - ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /* Kitchen sink (experimental) */ - ns_t_opt = 41, /* EDNS0 option (meta-RR) */ - ns_t_ds = 43, /* Delegation signer */ - ns_t_ipseckey = 45, /* IPSEC Key */ - ns_t_rrsig = 46, /* Resoure Record signature */ - ns_t_nsec = 47, /* Next Record */ - ns_t_dnskey = 48, /* DNSKEY record */ - ns_t_nsec3 = 50, /* Next Record v3 */ - ns_t_nsec3param = 51, /* NSEC Parameters */ - ns_t_tlsa = 52, /* TLSA */ - ns_t_eui48 = 108, /* EUI-48 */ - ns_t_eui64 = 109, /* EUI-64 */ - ns_t_tsig = 250, /* Transaction signature. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ -}; - #if __FreeBSD__ || __APPLE__ || __OpenBSD__ || defined(__FreeBSD_kernel__) #include #elif __linux__ || __GNU__ diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 6642fa28f3..0bc47a8d03 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -83,9 +83,9 @@ DNSResourceRecord::DNSResourceRecord(const DNSRecord &p) { } -boilerplate_conv(A, ns_t_a, conv.xfrIP(d_ip)); +boilerplate_conv(A, QType::A, conv.xfrIP(d_ip)); -ARecordContent::ARecordContent(uint32_t ip) : DNSRecordContent(ns_t_a) +ARecordContent::ARecordContent(uint32_t ip) : DNSRecordContent(QType::A) { d_ip = ip; } @@ -101,26 +101,26 @@ void ARecordContent::doRecordCheck(const DNSRecord& dr) throw MOADNSException("Wrong size for A record ("+lexical_cast(dr.d_clen)+")"); } -boilerplate_conv(AAAA, ns_t_aaaa, conv.xfrIP6(d_ip6); ); +boilerplate_conv(AAAA, QType::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)); -boilerplate_conv(CNAME, ns_t_cname, conv.xfrLabel(d_content, true)); +boilerplate_conv(NS, QType::NS, conv.xfrLabel(d_content, true)); +boilerplate_conv(PTR, QType::PTR, conv.xfrLabel(d_content, true)); +boilerplate_conv(CNAME, QType::CNAME, conv.xfrLabel(d_content, true)); boilerplate_conv(ALIAS, QType::ALIAS, conv.xfrLabel(d_content, true)); -boilerplate_conv(DNAME, ns_t_dname, conv.xfrLabel(d_content)); -boilerplate_conv(MR, ns_t_mr, conv.xfrLabel(d_alias, true)); -boilerplate_conv(MINFO, ns_t_minfo, conv.xfrLabel(d_rmailbx, true); conv.xfrLabel(d_emailbx, true)); -boilerplate_conv(TXT, ns_t_txt, conv.xfrText(d_text, true)); +boilerplate_conv(DNAME, QType::DNAME, conv.xfrLabel(d_content)); +boilerplate_conv(MR, QType::MR, conv.xfrLabel(d_alias, true)); +boilerplate_conv(MINFO, QType::MINFO, conv.xfrLabel(d_rmailbx, true); conv.xfrLabel(d_emailbx, true)); +boilerplate_conv(TXT, QType::TXT, conv.xfrText(d_text, true)); boilerplate_conv(SPF, 99, conv.xfrText(d_text, true)); -boilerplate_conv(HINFO, ns_t_hinfo, conv.xfrText(d_cpu); conv.xfrText(d_host)); +boilerplate_conv(HINFO, QType::HINFO, conv.xfrText(d_cpu); conv.xfrText(d_host)); -boilerplate_conv(RP, ns_t_rp, +boilerplate_conv(RP, QType::RP, conv.xfrLabel(d_mbox); conv.xfrLabel(d_info) ); -boilerplate_conv(OPT, ns_t_opt, +boilerplate_conv(OPT, QType::OPT, conv.xfrBlob(d_data) ); @@ -142,7 +142,7 @@ void OPTRecordContent::getData(vector >& options) } } -boilerplate_conv(TSIG, ns_t_tsig, +boilerplate_conv(TSIG, QType::TSIG, conv.xfrLabel(d_algoName); conv.xfr48BitInt(d_time); conv.xfr16BitInt(d_fudge); @@ -156,21 +156,21 @@ boilerplate_conv(TSIG, ns_t_tsig, if (size>0) conv.xfrBlob(d_otherData, size); ); -MXRecordContent::MXRecordContent(uint16_t preference, const string& mxname) : DNSRecordContent(ns_t_mx), d_preference(preference), d_mxname(mxname) +MXRecordContent::MXRecordContent(uint16_t preference, const string& mxname) : DNSRecordContent(QType::MX), d_preference(preference), d_mxname(mxname) { } -boilerplate_conv(MX, ns_t_mx, +boilerplate_conv(MX, QType::MX, conv.xfr16BitInt(d_preference); conv.xfrLabel(d_mxname, true); ) -boilerplate_conv(KX, ns_t_kx, +boilerplate_conv(KX, QType::KX, conv.xfr16BitInt(d_preference); conv.xfrLabel(d_exchanger, false); ) -boilerplate_conv(IPSECKEY, ns_t_ipseckey, +boilerplate_conv(IPSECKEY, QType::IPSECKEY, conv.xfr8BitInt(d_preference); conv.xfr8BitInt(d_gatewaytype); conv.xfr8BitInt(d_algorithm); @@ -209,13 +209,13 @@ boilerplate_conv(DHCID, 49, ) -boilerplate_conv(AFSDB, ns_t_afsdb, +boilerplate_conv(AFSDB, QType::AFSDB, conv.xfr16BitInt(d_subtype); conv.xfrLabel(d_hostname); ) -boilerplate_conv(NAPTR, ns_t_naptr, +boilerplate_conv(NAPTR, QType::NAPTR, conv.xfr16BitInt(d_order); conv.xfr16BitInt(d_preference); conv.xfrText(d_flags); conv.xfrText(d_services); conv.xfrText(d_regexp); conv.xfrLabel(d_replacement); @@ -223,21 +223,21 @@ boilerplate_conv(NAPTR, ns_t_naptr, SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const string& target) - : DNSRecordContent(ns_t_srv), d_preference(preference), d_weight(weight), d_port(port), d_target(target) +: DNSRecordContent(QType::SRV), d_preference(preference), d_weight(weight), d_port(port), d_target(target) {} -boilerplate_conv(SRV, ns_t_srv, +boilerplate_conv(SRV, QType::SRV, conv.xfr16BitInt(d_preference); conv.xfr16BitInt(d_weight); conv.xfr16BitInt(d_port); conv.xfrLabel(d_target); ) SOARecordContent::SOARecordContent(const string& mname, const string& rname, const struct soatimes& st) - : DNSRecordContent(ns_t_soa), d_mname(mname), d_rname(rname) +: DNSRecordContent(QType::SOA), d_mname(mname), d_rname(rname) { d_st=st; } -boilerplate_conv(SOA, ns_t_soa, +boilerplate_conv(SOA, QType::SOA, conv.xfrLabel(d_mname, true); conv.xfrLabel(d_rname, true); conv.xfr32BitInt(d_st.serial); @@ -247,7 +247,7 @@ boilerplate_conv(SOA, ns_t_soa, conv.xfr32BitInt(d_st.minimum); ); #undef KEY -boilerplate_conv(KEY, ns_t_key, +boilerplate_conv(KEY, QType::KEY, conv.xfr16BitInt(d_flags); conv.xfr8BitInt(d_protocol); conv.xfr8BitInt(d_algorithm); @@ -326,7 +326,7 @@ RKEYRecordContent::RKEYRecordContent() : DNSRecordContent(57) {} /* EUI48 start */ void EUI48RecordContent::report(void) { - regist(1, ns_t_eui48, &make, &make, "EUI48"); + regist(1, QType::EUI48, &make, &make, "EUI48"); } DNSRecordContent* EUI48RecordContent::make(const DNSRecord &dr, PacketReader& pr) { @@ -369,7 +369,7 @@ string EUI48RecordContent::getZoneRepresentation() const void EUI64RecordContent::report(void) { - regist(1, ns_t_eui64, &make, &make, "EUI64"); + regist(1, QType::EUI64, &make, &make, "EUI64"); } DNSRecordContent* EUI64RecordContent::make(const DNSRecord &dr, PacketReader& pr) { @@ -474,7 +474,7 @@ void reportBasicTypes() SOARecordContent::report(); SRVRecordContent::report(); PTRRecordContent::report(); - DNSRecordContent::regist(QClass::CHAOS, ns_t_txt, &TXTRecordContent::make, &TXTRecordContent::make, "TXT"); + DNSRecordContent::regist(QClass::CHAOS, QType::TXT, &TXTRecordContent::make, &TXTRecordContent::make, "TXT"); TXTRecordContent::report(); DNSRecordContent::regist(QClass::IN, QType::ANY, 0, 0, "ANY"); } diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 4f864483a2..6ecdce4a54 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -471,7 +471,7 @@ class LOCRecordContent : public DNSRecordContent { public: static void report(void); - LOCRecordContent() : DNSRecordContent(ns_t_loc) + LOCRecordContent() : DNSRecordContent(QType::LOC) {} LOCRecordContent(const string& content, const string& zone=""); @@ -491,7 +491,7 @@ class WKSRecordContent : public DNSRecordContent { public: static void report(void); - WKSRecordContent() : DNSRecordContent(ns_t_wks) + WKSRecordContent() : DNSRecordContent(QType::WKS) {} WKSRecordContent(const string& content, const string& zone=""); @@ -525,7 +525,7 @@ private: class EUI48RecordContent : public DNSRecordContent { public: - EUI48RecordContent() : DNSRecordContent(ns_t_eui48) {}; + EUI48RecordContent() : DNSRecordContent(QType::EUI48) {}; static void report(void); static DNSRecordContent* make(const DNSRecord &dr, PacketReader& pr); static DNSRecordContent* make(const string& zone); @@ -539,7 +539,7 @@ private: class EUI64RecordContent : public DNSRecordContent { public: - EUI64RecordContent() : DNSRecordContent(ns_t_eui64) {}; + EUI64RecordContent() : DNSRecordContent(QType::EUI64) {}; static void report(void); static DNSRecordContent* make(const DNSRecord &dr, PacketReader& pr); static DNSRecordContent* make(const string& zone); diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index 227761dc2d..c495402d55 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -96,7 +96,7 @@ void DNSPacketWriter::addOpt(int udpsize, int extRCode, int Z, const vectorfirst); xfr16BitInt(iter->second.length()); diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 27430fdc13..afba9cbdb9 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -80,7 +80,7 @@ public: static int chartocode(const char *p); //!< convert a character string to a code // more solaris fun #undef DS - enum typeenum {A=1, NS=2, CNAME=5, SOA=6, MR=9, PTR=12, HINFO=13, MX=15, TXT=16, RP=17, AFSDB=18, SIG=24, KEY=25, AAAA=28, LOC=29, SRV=33, NAPTR=35, KX=36, + enum typeenum {A=1, NS=2, CNAME=5, SOA=6, MR=9, WKS=11, PTR=12, HINFO=13, MINFO=14, MX=15, TXT=16, RP=17, AFSDB=18, SIG=24, KEY=25, AAAA=28, LOC=29, SRV=33, NAPTR=35, KX=36, CERT=37, A6=38, DNAME=39, OPT=41, DS=43, SSHFP=44, IPSECKEY=45, RRSIG=46, NSEC=47, DNSKEY=48, DHCID=49, NSEC3=50, NSEC3PARAM=51, TLSA=52, SPF=99, EUI48=108, EUI64=109, TSIG=250, IXFR=251, AXFR=252, MAILB=253, MAILA=254, ANY=255, URL=256, MBOXFW=257, CURL=258, ADDR=259, ALIAS=260, DLV=32769} types; typedef pair namenum; diff --git a/pdns/sillyrecords.cc b/pdns/sillyrecords.cc index d3806075d9..6553ec65a9 100644 --- a/pdns/sillyrecords.cc +++ b/pdns/sillyrecords.cc @@ -149,8 +149,8 @@ latlon2ul(const char **latlonstrptr, int *which) void LOCRecordContent::report(void) { - regist(1, ns_t_loc, &make, &make, "LOC"); - regist(254, ns_t_loc, &make, &make, "LOC"); + regist(1, QType::LOC, &make, &make, "LOC"); + regist(254, QType::LOC, &make, &make, "LOC"); } DNSRecordContent* LOCRecordContent::make(const string& content) @@ -186,7 +186,7 @@ LOCRecordContent::DNSRecordContent* LOCRecordContent::make(const DNSRecord &dr, return ret; } -LOCRecordContent::LOCRecordContent(const string& content, const string& zone) : DNSRecordContent(ns_t_loc) +LOCRecordContent::LOCRecordContent(const string& content, const string& zone) : DNSRecordContent(QType::LOC) { // 51 59 00.000 N 5 55 00.000 E 4.00m 1.00m 10000.00m 10.00m // convert this to d_version, d_size, d_horiz/vertpre, d_latitude, d_longitude, d_altitude