finished TXT record type packer.

This commit is contained in:
Daplie 2017-03-23 17:33:55 -06:00
parent 937e93d1df
commit d00f83c625
1 changed files with 18 additions and 10 deletions

View File

@ -10,24 +10,32 @@ exports.DNS_PACKER_TYPE_TXT = function (ab, dv, total, record) {
var txtLen = 0;
var rdLenIndex = total;
total += 2;
total += 3;
// RDATA
console.log("what is my record data: " + typeof record.data[0]);
console.log("what are my labels? ");
// var res = record.data[0].split(" ");
// console.log("Res: " + res);
record.data.split('.').forEach(funtion(label){
txtLen += 1 + label.length;
console.log("for each rdata");
record.data.forEach(function(str){
dv.setUint8(total, label.length, false);
str.split('').forEach(function(ch){
txtLen += 1;
// console.log(chcim);
dv.setUint8(total, ch.charCodeAt(0), false);
total += 1;
label.split('').forEach(function (ch) {
dv.setUint8(total, ch.charCodeAt(0), false);
total += 1;
});
});
dv.setUint16(rdLenIndex, record.data.length + 1, flase);s
console.log("txt rdata length is: " + txtLen);
dv.setUint16(rdLenIndex, txtLen+1, false);
dv.setUint8(rdLenIndex+2, txtLen, false);
// total +=1;
return total;
};