]> granicus.if.org Git - pdns/commitdiff
use QClassEnum for qclass values
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 12 Nov 2013 20:25:49 +0000 (21:25 +0100)
committermind04 <mind04@monshouwer.org>
Wed, 13 Nov 2013 11:06:02 +0000 (12:06 +0100)
pdns/dnsrecords.cc
pdns/dnswriter.hh
pdns/packethandler.cc
pdns/pdnssec.cc
pdns/syncres.cc

index 96e4457c84fb46809b1721d80aeeaa77bcda611c..66e4f5b628fd23ce48c8cf01c6bc99415b09b223 100644 (file)
@@ -484,9 +484,9 @@ void reportBasicTypes()
   SOARecordContent::report();
   SRVRecordContent::report();
   PTRRecordContent::report();
-  DNSRecordContent::regist(3, ns_t_txt, &TXTRecordContent::make, &TXTRecordContent::make, "TXT");
+  DNSRecordContent::regist(QClass::CHAOS, ns_t_txt, &TXTRecordContent::make, &TXTRecordContent::make, "TXT");
   TXTRecordContent::report();
-  DNSRecordContent::regist(1, QType::ANY, 0, 0, "ANY");
+  DNSRecordContent::regist(QClass::IN, QType::ANY, 0, 0, "ANY");
 }
 
 void reportOtherTypes()
@@ -509,7 +509,7 @@ void reportOtherTypes()
    NSEC3PARAMRecordContent::report();
    TLSARecordContent::report();
    DLVRecordContent::report();
-   DNSRecordContent::regist(0xff, QType::TSIG, &TSIGRecordContent::make, &TSIGRecordContent::make, "TSIG");
+   DNSRecordContent::regist(QClass::ANY, QType::TSIG, &TSIGRecordContent::make, &TSIGRecordContent::make, "TSIG");
    //TSIGRecordContent::report();
    OPTRecordContent::report();
    EUI48RecordContent::report();
index a3c36c2323e3612f60bb3ac8aff08ea357caae18..17976bef00247a4af78acebcf08747f79b31f2bc 100644 (file)
@@ -21,7 +21,7 @@
     Calling convention:
 
     vector<uint8_t> content;
-    DNSPacketWriter dpw(content, const string& qname, uint16_t qtype, uint16_t qclass=1);  // sets the question
+    DNSPacketWriter dpw(content, const string& qname, uint16_t qtype, uint16_t qclass=QClass:IN);  // sets the question
     dpw.startrecord("this.is.an.ip.address.", ns_t_a);    // does nothing, except store qname and qtype
     dpw.xfr32BitInt(0x01020304);                         // adds 4 bytes (0x01020304) to the record buffer
     dpw.startrecord("this.is.an.ip.address.", ns_t_a);    // aha! writes out dnsrecord header containing qname and qtype and length 4, plus the recordbuffer, which gets emptied
@@ -41,11 +41,11 @@ public:
   enum Place {ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; 
 
   //! Start a DNS Packet in the vector passed, with question qname, qtype and qclass
-  DNSPacketWriter(vector<uint8_t>& content, const string& qname, uint16_t  qtype, uint16_t qclass=1, uint8_t opcode=0);
+  DNSPacketWriter(vector<uint8_t>& content, const string& qname, uint16_t  qtype, uint16_t qclass=QClass::IN, uint8_t opcode=0);
   
   /** Start a new DNS record within this packet for namq, qtype, ttl, class and in the requested place. Note that packets can only be written in natural order - 
       ANSWER, AUTHORITY, ADDITIONAL */
-  void startRecord(const string& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=1, Place place=ANSWER, bool compress=true);
+  void startRecord(const string& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=QClass::IN, Place place=ANSWER, bool compress=true);
 
   /** Shorthand way to add an Opt-record, for example for EDNS0 purposes */
   typedef vector<pair<uint16_t,std::string> > optvect_t;
index 32e0c0c46272eedae620dbed2b505026fc4c4bab..3437f4081654ca0bb2d8a125d39dcd07b92cb295 100644 (file)
@@ -1208,7 +1208,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
       return r;
     }
 
-    if(p->qclass==255) // any class query 
+    if(p->qclass==QClass::ANY) // any class query
       r->setA(false);
     else if(p->qclass != QClass::IN) // we only know about IN, so we don't find anything
       goto sendit;
index 48c33c894262405577f6e840cd05af6d232e50e8..f0ac2054793b1326311864e7aa4cf8d14e7948df 100644 (file)
@@ -627,7 +627,7 @@ void testSpeed(DNSSECKeeper& dk, const string& zone, const string& remote, int c
   rr.qtype=QType::A;
   rr.ttl=3600;
   rr.auth=1;
-  rr.qclass = 1;
+  rr.qclass = QClass::IN;
   rr.d_place=DNSResourceRecord::ANSWER;
   rr.priority=0;
   
index ec62704efefbca71a3a92f948c5f3ea441bda952..1b94a83d88dac6135f1b06c6251c23eec3f23eb9 100644 (file)
@@ -94,7 +94,7 @@ int SyncRes::beginResolve(const string &qname, const QType &qtype, uint16_t qcla
     DNSResourceRecord rr;
     rr.qname=qname;
     rr.qtype=qtype;
-    rr.qclass=1;
+    rr.qclass=QClass::IN;
     rr.ttl=86400;
     if(qtype.getCode()==QType::PTR)
       rr.content="localhost.";
@@ -104,7 +104,7 @@ int SyncRes::beginResolve(const string &qname, const QType &qtype, uint16_t qcla
     return 0;
   }
 
-  if(qclass==3 && qtype.getCode()==QType::TXT && 
+  if(qclass==QClass::CHAOS && qtype.getCode()==QType::TXT &&
         (pdns_iequals(qname, "version.bind.") || pdns_iequals(qname, "id.server.") || pdns_iequals(qname, "version.pdns.") ) 
      ) {
     ret.clear();
@@ -121,9 +121,9 @@ int SyncRes::beginResolve(const string &qname, const QType &qtype, uint16_t qcla
     return 0;
   }
   
-  if(qclass==0xff)
-    qclass=1;
-  else if(qclass!=1)
+  if(qclass==QClass::ANY)
+    qclass=QClass::IN;
+  else if(qclass!=QClass::IN)
     return -1;
   
   set<GetBestNSAnswer> beenthere;