dns-suite.js/parser/type.txt.js

19 lines
652 B
JavaScript
Raw Normal View History

2017-02-02 21:10:40 +00:00
(function (exports) {
'use strict';
2017-02-11 21:15:06 +00:00
// Used to provide the ability to associate some arbitrary and unformatted text
2017-02-02 21:10:40 +00:00
// with a host or other name, such as a human readable information about a server
// network, data center, and other accounting information.
2017-02-18 02:38:47 +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-18 02:38:47 +00:00
exports.DNS_PARSER_TYPE_TXT = function (ab, packet, record) {
2017-02-02 21:10:40 +00:00
2017-02-11 21:15:06 +00:00
var labels = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' });
record.data = [ labels.name ];
2017-02-02 21:10:40 +00:00
return record;
2017-02-02 21:10:40 +00:00
};
2017-02-11 21:15:06 +00:00
2017-02-02 21:10:40 +00:00
}('undefined' !== typeof window ? window : exports));