This commit is contained in:
AJ ONeal 2017-02-01 21:41:33 -07:00
parent bb87a2ea63
commit 2f87cd3797
2 changed files with 14 additions and 23 deletions

View File

@ -72,14 +72,14 @@ pdns.unpack = function (ab) {
function unpackQuestion(ab, dv, ui8, total) { function unpackQuestion(ab, dv, ui8, total) {
var ototal = total; var ototal = total;
var q = pdns._unpackLabels(ui8, total, { var q = pdns._unpackLabels(ui8, total, {
name: '' name: '' // ex: daplie.com
, type: 0 , type: 0 // ex: 1
, typeName: '' , typeName: '' // ex: A
, class: 0 , class: 0 // ex: 1
, className: '' , className: '' // ex: IN
, byteLength: 0 , byteLength: 0 // the total byte length (including pointers, but not their labels)
, labels: [] , labels: [] // an array of the labels individually
, cpcount: 0 , cpcount: 0 // the number of compression pointers traversed
}); });
//console.log('unpackQuestion QNAME:'); //console.log('unpackQuestion QNAME:');
//console.log(q); //console.log(q);

View File

@ -1,8 +1,6 @@
(function (exports) { (function (exports) {
'use strict'; 'use strict';
// TODO. Not yet implemented
// Value: Preference // Value: Preference
// Meaning/Use: Unsigned 16-bit integer // Meaning/Use: Unsigned 16-bit integer
//------------------------------------- //-------------------------------------
@ -14,20 +12,13 @@
var unpackLabels = exports.DNS_UNPACK_LABELS || require('./dns.unpack-labels.js').DNS_UNPACK_LABELS; var unpackLabels = exports.DNS_UNPACK_LABELS || require('./dns.unpack-labels.js').DNS_UNPACK_LABELS;
exports.DNS_TYPE_MX = function (ab, packet, record) { exports.DNS_TYPE_MX = function (ab, packet, record) {
var rdataAb = ab.slice(record.rdstart, record.rdstart + record.rdlength);
var dv = new DataView(rdataAb);
var rdataAb = ab.slice(record.rdstart, record.rdstart + record.rdlength) return {
var dv = new DataView(rdataAb); priority: dv.getUint16(0, false)
, exchange: unpackLabels(new Uint8Array(ab), record.rdstart+2, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name
var s = { };
priority: dv.getUint16(0, false)
, exchange: unpackLabels(new Uint8Array(ab), record.rdstart+2, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name
};
return s;
}; };