diff --git a/bin/mdns-capture.js b/bin/mdns-capture.js index c927861..beae2a4 100644 --- a/bin/mdns-capture.js +++ b/bin/mdns-capture.js @@ -38,7 +38,7 @@ handlers.onListening = function () { /*jshint validthis:true*/ var server = this; console.log(server.address()); - + server.setBroadcast(true); server.addMembership('224.0.0.251'); }; diff --git a/dns.rdata.parse.js b/dns.rdata.parse.js index 979d480..2645056 100644 --- a/dns.rdata.parse.js +++ b/dns.rdata.parse.js @@ -17,7 +17,6 @@ exports.DNS_RDATA_PARSE = function (ab, packet, record) { ); } - if (!record.typeName) { throw new Error("Support for DNS Type " + record.type.toString(16) + "(" + record.type + ")" + " is not implemented yet. Open an issue if you actually need support" diff --git a/dns.type.a.js b/dns.type.a.js index 906af75..1ec3f07 100644 --- a/dns.type.a.js +++ b/dns.type.a.js @@ -1,10 +1,12 @@ (function (exports) { 'use strict'; +// An 'A' record is a 32-bit value representing the IP address + exports.DNS_TYPE_A = function (rdata) { var ui8 = new Uint8Array(rdata); - // i.e. 127.0.0.1 + return ui8[0] + '.' + ui8[1] + '.' + ui8[2] + '.' + ui8[3]; }; diff --git a/dns.type.aaaa.js b/dns.type.aaaa.js new file mode 100644 index 0000000..bc328a0 --- /dev/null +++ b/dns.type.aaaa.js @@ -0,0 +1,31 @@ +(function (exports) { +'use strict'; + +// Value: IP Address +// Meaning:Use: 16 octets represting the IP address + + + +exports.DNS_TYPE_AAAA = function (rdata) { + console.log('*****************************************'); + + // // var rrTokens = rdata.trim().split(/\s+/g); + // // var len = rrTokens.length; + // // var result = { + // // name: rrTokens[0], + // // ip: rrTokens[len-1] + // // }; + + + // // if(!isNaN(rrTokens[1])) result.ttl = parseInt(rrTokens[1], 10); + // // return result; + // console.log(rdata.length.toString()); + + // var ui8 = new Uint8Array(rdata); + + + + + +}; +}('undefined' !== typeof window ? window : exports)); diff --git a/dns.type.any.js b/dns.type.any.js new file mode 100644 index 0000000..398da49 --- /dev/null +++ b/dns.type.any.js @@ -0,0 +1,12 @@ +(function (exports) { +'use strict'; +// TODO. Not yet implemented + +// Meaning:Use: Requests ANY resource record (typicall wants SOA, +// MX, NS, and MX) + +exports.DNS_TYPE_ANY = function (rdata) { + + +}; +}('undefined' !== typeof window ? window : exports)); diff --git a/dns.type.cname.js b/dns.type.cname.js new file mode 100644 index 0000000..96b3d5e --- /dev/null +++ b/dns.type.cname.js @@ -0,0 +1,19 @@ +(function (exports) { +'use strict'; + +// TODO. Not yet implemented + +// A CNAME reocord maps a single alias or nickname to the real or +// Canonical name which may lie outside the current zone. +// Canonical simply means the expected or real name. + + + +exports.DNS_TYPE_CNAME = function (rdata) { + + + +}; + +}('undefined' !== typeof window ? window : exports)); + diff --git a/dns.type.mx.js b/dns.type.mx.js new file mode 100644 index 0000000..8e32d43 --- /dev/null +++ b/dns.type.mx.js @@ -0,0 +1,21 @@ +(function (exports) { +'use strict'; + +// TODO. Not yet implemented + +// Value: Preference +// Meaning/Use: Unsigned 16-bit integer +//------------------------------------- +// Value: Mail Exchanger +// Meaning/Use: The name host name that provides the service. +// May be a label, pointer or any combination + + +exports.DNS_TYPE_MX = function (rdata) { + + + +}; + +}('undefined' !== typeof window ? window : exports)); + diff --git a/dns.type.ns.js b/dns.type.ns.js new file mode 100644 index 0000000..47f9acc --- /dev/null +++ b/dns.type.ns.js @@ -0,0 +1,16 @@ +(function (exports) { +'use strict'; +// Comes in variable lengths. It is the name of the primary Master for the Domain. +// For example 'ns1.example.com' +// It may be a label, pointer or any combination + + +exports.DNS_TYPE_NS = function (rdata) { + + + +}; + +}('undefined' !== typeof window ? window : exports)); + + diff --git a/dns.type.ptr.js b/dns.type.ptr.js index e69de29..0fa96b2 100644 --- a/dns.type.ptr.js +++ b/dns.type.ptr.js @@ -0,0 +1,17 @@ +(function (exports) { +'use strict'; +// TODO. Not yet implemented + +// Pointer records are the opposite of A and AAAA and are +// used in Reverse Map zone files to map an IP address (IPv4 or IPv6) +// to a host name. + +// FORMAT: +// ame ttl class rr name +// 15 IN PTR www.example.com. + +exports.DNS_TYPE_PTR = function (rdata) { + + +}; +}('undefined' !== typeof window ? window : exports)); diff --git a/dns.type.srv.js b/dns.type.srv.js new file mode 100644 index 0000000..d5ed104 --- /dev/null +++ b/dns.type.srv.js @@ -0,0 +1,13 @@ +(function (exports) { +'use strict'; +// TODO. Not yet implemented + +// SRV identifies the host(s) that will support a particular service. It +// is a general purpose RR to discover any service. + + +exports.DNS_TYPE_SRV = function (rdata) { + + +}; +}('undefined' !== typeof window ? window : exports)); diff --git a/pure-parser.js b/pure-parser.js index 8aac46c..7472420 100644 --- a/pure-parser.js +++ b/pure-parser.js @@ -158,7 +158,10 @@ pdns.unpack = function (ab) { q.className = classes[q.class]; q.typeName = types[q.type]; - + + console.log('*********************'); + console.log(q.typeName); + return q; }