}
- void xfrLabel(string &label, bool compress=false)
+ void xfrName(string &label, bool compress=false)
{
label=getLabel();
}
boilerplate_conv(AAAA, QType::AAAA, conv.xfrIP6(d_ip6); );
-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, 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(NS, QType::NS, conv.xfrName(d_content, true));
+boilerplate_conv(PTR, QType::PTR, conv.xfrName(d_content, true));
+boilerplate_conv(CNAME, QType::CNAME, conv.xfrName(d_content, true));
+boilerplate_conv(ALIAS, QType::ALIAS, conv.xfrName(d_content, true));
+boilerplate_conv(DNAME, QType::DNAME, conv.xfrName(d_content));
+boilerplate_conv(MR, QType::MR, conv.xfrName(d_alias, true));
+boilerplate_conv(MINFO, QType::MINFO, conv.xfrName(d_rmailbx, true); conv.xfrName(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, QType::HINFO, conv.xfrText(d_cpu); conv.xfrText(d_host));
boilerplate_conv(RP, QType::RP,
- conv.xfrLabel(d_mbox);
- conv.xfrLabel(d_info)
+ conv.xfrName(d_mbox);
+ conv.xfrName(d_info)
);
}
boilerplate_conv(TSIG, QType::TSIG,
- conv.xfrLabel(d_algoName);
+ conv.xfrName(d_algoName);
conv.xfr48BitInt(d_time);
conv.xfr16BitInt(d_fudge);
uint16_t size=d_mac.size();
boilerplate_conv(MX, QType::MX,
conv.xfr16BitInt(d_preference);
- conv.xfrLabel(d_mxname, true);
+ conv.xfrName(d_mxname, true);
)
boilerplate_conv(KX, QType::KX,
conv.xfr16BitInt(d_preference);
- conv.xfrLabel(d_exchanger, false);
+ conv.xfrName(d_exchanger, false);
)
boilerplate_conv(IPSECKEY, QType::IPSECKEY,
conv.xfrIP6(d_ip6);
break;
case 3: // DNS label
- conv.xfrLabel(d_gateway, false);
+ conv.xfrName(d_gateway, false);
break;
default:
throw MOADNSException("Parsing record content: invalid gateway type");
boilerplate_conv(AFSDB, QType::AFSDB,
conv.xfr16BitInt(d_subtype);
- conv.xfrLabel(d_hostname);
+ conv.xfrName(d_hostname);
)
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);
+ conv.xfrName(d_replacement);
)
boilerplate_conv(SRV, QType::SRV,
conv.xfr16BitInt(d_preference); conv.xfr16BitInt(d_weight); conv.xfr16BitInt(d_port);
- conv.xfrLabel(d_target);
+ conv.xfrName(d_target);
)
SOARecordContent::SOARecordContent(const string& mname, const string& rname, const struct soatimes& st)
}
boilerplate_conv(SOA, QType::SOA,
- conv.xfrLabel(d_mname, true);
- conv.xfrLabel(d_rname, true);
+ conv.xfrName(d_mname, true);
+ conv.xfrName(d_rname, true);
conv.xfr32BitInt(d_st.serial);
conv.xfr32BitInt(d_st.refresh);
conv.xfr32BitInt(d_st.retry);
conv.xfrTime(d_sigexpire);
conv.xfrTime(d_siginception);
conv.xfr16BitInt(d_tag);
- conv.xfrLabel(d_signer);
+ conv.xfrName(d_signer);
conv.xfrBlob(d_signature);
)
/* EUI64 end */
boilerplate_conv(TKEY, QType::TKEY,
- conv.xfrLabel(d_algo);
+ conv.xfrName(d_algo);
conv.xfr32BitInt(d_inception);
conv.xfr32BitInt(d_expiration);
conv.xfr16BitInt(d_mode);
vector<uint8_t> signVect;
DNSPacketWriter dw(signVect, "", 0);
if(!timersonly) {
- dw.xfrLabel(keyname, false);
+ dw.xfrName(keyname, false);
dw.xfr16BitInt(QClass::ANY); // class
dw.xfr32BitInt(0); // TTL
- dw.xfrLabel(toLower(trc.d_algoName), false);
+ dw.xfrName(toLower(trc.d_algoName), false);
}
uint32_t now = trc.d_time;
vector<uint8_t> signVect;
DNSPacketWriter dw(signVect, "", 0);
if(!timersonly) {
- dw.xfrLabel(tsigkeyname, false);
+ dw.xfrName(tsigkeyname, false);
dw.xfr16BitInt(QClass::ANY); // class
dw.xfr32BitInt(0); // TTL
- dw.xfrLabel(trc->d_algoName, false);
+ dw.xfrName(trc->d_algoName, false);
}
uint32_t now = trc->d_time;
dw.xfr48BitInt(now);
memcpy(dptr, ptr, sizeof(dnsheader));
d_stuff=0;
- xfrLabel(qname, false);
+ xfrName(qname, false);
len=d_content.size();
d_content.resize(len + d_record.size() + 4);
d_content.insert(d_content.end(), (const char *) &marker[0], (const char *) &marker[2]);
}
else {
- xfrLabel(d_recordqname, compress);
+ xfrName(d_recordqname, compress);
d_content.insert(d_content.end(), d_record.begin(), d_record.end());
d_record.clear();
}
}
// this is the absolute hottest function in the pdns recursor
-void DNSPacketWriter::xfrLabel(const string& Label, bool compress)
+void DNSPacketWriter::xfrName(const string& Label, bool compress)
{
string label = d_lowerCase ? toLower(Label) : Label;
labelparts_t parts;
if(compress && (li=find(d_labelmap, chopped))!=d_labelmap.end()) {
// cerr<<"\tFound a compression pointer to '"<<chopped<<"': "<<li->second<<endl;
if (d_record.size() - startRecordSize + chopped.size() > 253) // chopped does not include a length octet for the first label and the root label
- throw MOADNSException("DNSPacketWriter::xfrLabel() found overly large (compressed) name");
+ throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name");
uint16_t offset=li->second;
offset|=0xc000;
d_record.push_back((char)(offset >> 8));
}
if(pos - startPos == 1)
- throw MOADNSException("DNSPacketWriter::xfrLabel() found empty label in the middle of name");
+ throw MOADNSException("DNSPacketWriter::xfrName() found empty label in the middle of name");
if(pos - startPos > 64)
- throw MOADNSException("DNSPacketWriter::xfrLabel() found overly large label in name");
+ throw MOADNSException("DNSPacketWriter::xfrName() found overly large label in name");
}
d_record.push_back(0); // insert root label
if (d_record.size() - startRecordSize > 255)
- throw MOADNSException("DNSPacketWriter::xfrLabel() found overly large name");
+ throw MOADNSException("DNSPacketWriter::xfrName() found overly large name");
out:;
}
void xfr8BitInt(uint8_t val);
- void xfrLabel(const string& label, bool compress=false);
+ void xfrName(const string& label, bool compress=false);
void xfrText(const string& text, bool multi=false);
void xfrBlob(const string& blob, int len=-1);
void xfrBlobNoSpaces(const string& blob, int len=-1);
NSECRecordContent::NSECRecordContent(const string& content, const string& zone) : DNSRecordContent(47)
{
RecordTextReader rtr(content, zone);
- rtr.xfrLabel(d_next);
+ rtr.xfrName(d_next);
while(!rtr.eof()) {
uint16_t type;
void NSECRecordContent::toPacket(DNSPacketWriter& pw)
{
- pw.xfrLabel(d_next);
+ pw.xfrName(d_next);
uint8_t res[34];
set<uint16_t>::const_iterator i;
NSECRecordContent::DNSRecordContent* NSECRecordContent::make(const DNSRecord &dr, PacketReader& pr)
{
NSECRecordContent* ret=new NSECRecordContent();
- pr.xfrLabel(ret->d_next);
+ pr.xfrName(ret->d_next);
string bitmap;
pr.xfrBlob(bitmap);
{
string ret;
RecordTextWriter rtw(ret);
- rtw.xfrLabel(d_next);
+ rtw.xfrName(d_next);
for(set<uint16_t>::const_iterator i=d_set.begin(); i!=d_set.end(); ++i) {
ret+=" ";
memset(&tm, 0, sizeof(tm));
string tmp;
- xfrLabel(tmp); // ends on number, so this works
+ xfrName(tmp); // ends on number, so this works
sscanf(tmp.c_str(), "%04d%02d%02d" "%02d%02d%02d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
}
// this code should leave all the escapes around
-void RecordTextReader::xfrLabel(string& val, bool)
+void RecordTextReader::xfrName(string& val, bool)
{
skipSpaces();
val.clear();
}
// should not mess with the escapes
-void RecordTextWriter::xfrLabel(const string& val, bool)
+void RecordTextWriter::xfrName(const string& val, bool)
{
if(!d_string.empty())
d_string.append(1,' ');
rtr.xfrText(flags);
rtr.xfrText(services);
rtr.xfrText(regexp);
- rtr.xfrLabel(replacement);
+ rtr.xfrName(replacement);
cout<<"order: "<<order<<", pref: "<<pref<<"\n";
cout<<"flags: \""<<flags<<"\", services: \""<<services<<"\", regexp: \""<<regexp<<"\", replacement: "<<replacement<<"\n";
rtw.xfrText(flags);
rtw.xfrText(services);
rtw.xfrText(regexp);
- rtw.xfrLabel(replacement);
+ rtw.xfrName(replacement);
cout<<"Regenerated: '"<<out<<"'\n";
void xfrIP6(std::string& val);
void xfrTime(uint32_t& val);
- void xfrLabel(string& val, bool compress=false);
+ void xfrName(string& val, bool compress=false);
void xfrText(string& val, bool multi=false);
void xfrHexBlob(string& val, bool keepReading=false);
void xfrBase32HexBlob(string& val);
void xfrBase32HexBlob(const string& val);
void xfrType(const uint16_t& val);
- void xfrLabel(const string& val, bool compress=false);
+ void xfrName(const string& val, bool compress=false);
void xfrText(const string& val, bool multi=false);
void xfrBlobNoSpaces(const string& val, int len=-1);
void xfrBlob(const string& val, int len=-1);