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()
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();
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
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;
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;
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;
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.";
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();
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;