Changeset 650
- Timestamp:
- 04/03/06 22:29:20 (4 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 7 modified
-
dnsparser.cc (modified) (1 diff)
-
dnsparser.hh (modified) (1 diff)
-
dnsrecords.cc (modified) (2 diffs)
-
dnswriter.cc (modified) (1 diff)
-
dnswriter.hh (modified) (1 diff)
-
rcpgenerator.cc (modified) (2 diffs)
-
rcpgenerator.hh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnsparser.cc
r637 r650 391 391 d_pos = d_startrecordpos + d_recordlen; 392 392 } 393 394 void PacketReader::xfrHexBlob(string& blob) 395 { 396 xfrBlob(blob); 397 } -
trunk/pdns/pdns/dnsparser.hh
r612 r650 123 123 124 124 void xfrBlob(string& blob); 125 void xfrHexBlob(string& blob); 125 126 126 127 static uint16_t get16BitInt(const vector<unsigned char>&content, uint16_t& pos); -
trunk/pdns/pdns/dnsrecords.cc
r649 r650 253 253 conv.xfr8BitInt(d_algorithm); 254 254 conv.xfr8BitInt(d_fptype); 255 conv.xfr Blob(d_fingerprint);255 conv.xfrHexBlob(d_fingerprint); 256 256 ) 257 257 … … 297 297 RRSIGRecordContent::report(); 298 298 DSRecordContent::report(); 299 SSHFPRecordContent::report(); 299 300 NSECRecordContent::report(); 300 301 OPTRecordContent::report(); -
trunk/pdns/pdns/dnswriter.cc
r643 r650 163 163 } 164 164 165 void DNSPacketWriter::xfrHexBlob(const string& blob) 166 { 167 xfrBlob(blob); 168 } 169 170 165 171 void DNSPacketWriter::getRecords(string& records) 166 172 { -
trunk/pdns/pdns/dnswriter.hh
r517 r650 84 84 void xfrText(const string& text); 85 85 void xfrBlob(const string& blob); 86 void xfrHexBlob(const string& blob); 86 87 87 88 uint16_t d_pos; -
trunk/pdns/pdns/rcpgenerator.cc
r542 r650 141 141 B64Decode(tmp, val); 142 142 } 143 144 145 static inline uint8_t hextodec(uint8_t val) 146 { 147 if(val >= '0' && val<='9') 148 return val-'0'; 149 else if(val >= 'A' && val<='F') 150 return 10+(val-'A'); 151 else if(val >= 'a' && val<='f') 152 return 10+(val-'a'); 153 else 154 throw RecordTextException("Unknown hexadecimal character '"+lexical_cast<string>(val)+"'"); 155 } 156 157 158 void HEXDecode(const char* begin, const char* end, string& val) 159 { 160 if((end - begin)%2) 161 throw RecordTextException("Hexadecimal blob with odd number of characters"); 162 163 int limit=(end-begin)/2; 164 val.resize(limit); 165 for(int n=0; n < limit; ++n) { 166 val[n] = hextodec(begin[2*n])*16 + hextodec(begin[2*n+1]); 167 } 168 } 169 170 void RecordTextReader::xfrHexBlob(string& val) 171 { 172 skipSpaces(); 173 int pos=d_pos; 174 while(d_pos < d_end && !dns_isspace(d_string[d_pos])) 175 d_pos++; 176 177 HEXDecode(d_string.c_str()+pos, d_string.c_str() + d_pos, val); 178 } 179 143 180 144 181 void RecordTextReader::xfrText(string& val) … … 280 317 } 281 318 319 void RecordTextWriter::xfrHexBlob(const string& val) 320 { 321 if(!d_string.empty()) 322 d_string.append(1,' '); 323 324 string::size_type limit=val.size(); 325 char tmp[5]; 326 for(string::size_type n = 0; n < limit; ++n) { 327 snprintf(tmp, sizeof(tmp)-1, "%02x", (unsigned char)val[n]); 328 d_string+=tmp; 329 } 330 } 331 282 332 void RecordTextWriter::xfrText(const string& val) 283 333 { -
trunk/pdns/pdns/rcpgenerator.hh
r510 r650 48 48 void xfrLabel(string& val, bool compress=false); 49 49 void xfrText(string& val); 50 void xfrHexBlob(string& val); 50 51 void xfrBlob(string& val); 51 52 … … 73 74 void xfrText(const string& val); 74 75 void xfrBlob(const string& val); 76 void xfrHexBlob(const string& val); 75 77 76 78 private: