2017-02-02 21:10:40 +00:00
|
|
|
(function (exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Used to provide the ability to associate some arbitrary and unformatted text
|
|
|
|
// with a host or other name, such as a human readable information about a server
|
|
|
|
// network, data center, and other accounting information.
|
|
|
|
|
2017-02-03 01:39:32 +00:00
|
|
|
var unpackLabels = exports.DNS_UNPACK_LABELS || require('./dns.unpack-labels.js').DNS_UNPACK_LABELS;
|
2017-02-02 21:10:40 +00:00
|
|
|
|
2017-02-03 01:39:32 +00:00
|
|
|
exports.DNS_TYPE_TXT = function (ab, packet, record) {
|
2017-02-02 21:10:40 +00:00
|
|
|
|
|
|
|
|
2017-02-03 01:39:32 +00:00
|
|
|
var rdataAb = ab.slice(record.rdstart, record.rdstart + record.rdlength);
|
|
|
|
console.log(rdataAb);
|
|
|
|
var dv = new DataView(rdataAb);
|
|
|
|
// var d = '';
|
|
|
|
// var string = '';
|
|
|
|
// for (var i = 0; i < dv.byteLength; i+= 1){
|
|
|
|
|
|
|
|
// d = dv.getUint8(i, false);
|
|
|
|
// string = String.fromCharCode(d);
|
|
|
|
// console.log("data at: " + i + " is: " + string);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
record.data = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name;
|
|
|
|
|
|
|
|
var l = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' });
|
|
|
|
|
|
|
|
console.log("labels: " + JSON.stringify(l));
|
|
|
|
return record;
|
2017-02-02 21:10:40 +00:00
|
|
|
};
|
|
|
|
}('undefined' !== typeof window ? window : exports));
|