Skip to content

Commit

Permalink
printrecord.c: Support TXT RR.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiro-dSn committed Dec 19, 2011
1 parent dcb4f3e commit e39741d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions printrecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ unsigned int printrecord_cat(stralloc *out,const char *buf,unsigned int len,unsi
if (!stralloc_catulong0(out,ch,0)) return 0;
}
}
else if (byte_equal(misc,2,DNS_T_TXT)) {
if (!stralloc_cats(out," TXT ")) return 0;
while (datalen) {
pos = dns_packet_copy(buf,len,pos,misc,1); if (!pos) return 0;
datalen--;
for (i = (int) misc[0]; i > 0; i--) {
pos = dns_packet_copy(buf,len,pos,misc,1); if (!pos) return 0;
if ((misc[0] >= 32) && (misc[0] <= 126) && (misc[0] != '\\')) {
if (!stralloc_catb(out,misc,1)) return 0;
}
else {
ch = misc[0];
misc[3] = '0' + (7 & ch); ch >>= 3;
misc[2] = '0' + (7 & ch); ch >>= 3;
misc[1] = '0' + (7 & ch);
misc[0] = '\\';
if (!stralloc_catb(out,misc,4)) return 0;
}
datalen--;
}
}
}
else {
if (!stralloc_cats(out," ")) return 0;
uint16_unpack_big(misc,&u16);
Expand Down

0 comments on commit e39741d

Please sign in to comment.