Changeset 1050
- Timestamp:
- 05/13/07 23:07:18 (1 year ago)
- Files:
-
- trunk/pdns/pdns/dnsparser.cc (modified) (3 diffs)
- trunk/pdns/pdns/dnsparser.hh (modified) (2 diffs)
- trunk/pdns/pdns/recursor_cache.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pdns/pdns/dnsparser.cc
r1034 r1050 441 441 } 442 442 443 string simpleCompress(const string& label )443 string simpleCompress(const string& label, const string& root) 444 444 { 445 445 typedef vector<pair<unsigned int, unsigned int> > parts_t; … … 449 449 ret.reserve(label.size()+4); 450 450 for(parts_t::const_iterator i=parts.begin(); i!=parts.end(); ++i) { 451 if(!root.empty() && !strncasecmp(root.c_str(), label.c_str() + i->first, label.length() - i->first)) { 452 const char rootptr[2]={0xc0,0x11}; 453 ret.append(rootptr, 2); 454 return ret; 455 } 451 456 ret.append(1, (char)(i->second - i->first)); 452 457 ret.append(label.c_str() + i->first, i->second - i->first); … … 455 460 return ret; 456 461 } 462 457 463 458 464 void simpleExpandTo(const string& label, unsigned int frompos, string& ret) trunk/pdns/pdns/dnsparser.hh
r996 r1050 150 150 { 151 151 vector<uint8_t> packet; 152 DNSPacketWriter pw(packet, "", 1); 152 string empty; 153 DNSPacketWriter pw(packet, empty, 1); 153 154 154 155 pw.startRecord(qname, d_qtype); … … 311 312 }; 312 313 313 string simpleCompress(const string& label );314 string simpleCompress(const string& label, const string& root=""); 314 315 void simpleExpandTo(const string& label, unsigned int frompos, string& ret); 315 316 trunk/pdns/pdns/recursor_cache.cc
r972 r1050 86 86 return string((char*)&ip, 4); 87 87 } 88 else if(type==QType::NS) { 89 NSRecordContent ar(rr.content); 90 return ar.serialize(rr.qname); 91 } 92 else if(type==QType::CNAME) { 93 CNAMERecordContent ar(rr.content); 94 return ar.serialize(rr.qname); 95 } 88 else if(type==QType::NS || type==QType::CNAME) 89 return simpleCompress(rr.content, rr.qname); 96 90 else { 97 91 string ret;