Net::Frame::Layer::DNS - Domain Name System layer object
use Net::Frame::Layer::DNS qw(:consts);
my $dns = Net::Frame::Layer::DNS->new(
id => getRandom16bitsInt(),
qr => NF_DNS_QR_QUERY,
opcode => NF_DNS_OPCODE_QUERY,
flags => NF_DNS_FLAGS_RD,
rcode => NF_DNS_RCODE_NOERROR,
qdCount => 1,
anCount => 0,
nsCount => 0,
arCount => 0,
# Read a raw layer
my $layer = Net::Frame::Layer::DNS->new(raw => $raw);
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
This modules implements the encoding and decoding of the DNS layer.
See also Net::Frame::Layer for other attributes and methods.
Identification - used to match request/reply packets.
Qr, opcode, flags and rcode fields. See CONSTANTS.
Number of entries in the question list.
Number of entries in the answer resource record that were returned.
Number of entries in the authority resource record list that were returned.
Number of entries in the additional resource record list that were returned.
The following are inherited attributes. See Net::Frame::Layer for more information.
Object constructor. You can pass attributes that will overwrite default ones. See SYNOPSIS for default values.
These two methods are basically used to increase the speed when using recv method from Net::Frame::Simple. Usually, you write them when you need to write match method.
This method is mostly used internally. You pass a Net::Frame::Layer::DNS layer as a parameter, and it returns true if this is a response corresponding for the request, or returns false if not.
The following are inherited methods. Some of them may be overriden in this layer, and some others may not be meaningful in this layer. See Net::Frame::Layer for more information.
Load them: use Net::Frame::Layer::DNS qw(:subs);
Takes domain name and returns the network form.
Takes domain name in network format, and returns the domain name human form and number of bytes read. Call with:
my ($name, $bytesRead) = dnsNtoa( ... ) # returns name, bytes read
my ($name) = dnsNtoa( ... ) # returns name only
Load them: use Net::Frame::Layer::DNS qw(:consts);
Query / Response flag.
While this module can decode DNS compression with pointers, it does not automatically encode compression with pointers.
RData encoder / decoders are provided for common RData types, but not all RData types. If an RData type is encountered during decoding for which a decoder is not present, the RData is simply displayed as a hex stream.
For a non Net::Frame::Layer DNS solution in Perl, Net::DNS.
Copyright (c) 2012, Michael Vincent
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
To install Net::Frame::Layer::DNS, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.