NAME

Net::Frame::Layer::DNS::RR - DNS Resource Record type object

SYNOPSIS

use Net::Frame::Layer::DNS::RR qw(:consts);

my $layer = Net::Frame::Layer::DNS::RR->new(
   name     => 'localhost',
   type     => NF_DNS_TYPE_A,
   class    => NF_DNS_CLASS_IN,
   ttl      => 0,
   rdlength => 0,
   rdata    => '',
);
$layer->pack;

print 'RAW: '.$layer->dump."\n";

# Create RR with rdata
use Net::Frame::Layer::DNS::RR::A;

my $rdata = Net::Frame::Layer::DNS::RR::A->new;
my $layer = Net::Frame::Layer::DNS::RR->new(
   rdata => $rdata->pack,
);
$layer->pack;

# Read a raw layer
my $layer = Net::Frame::Layer::DNS::RR->new(raw => $raw);

print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
   if $layer->payload;

DESCRIPTION

This modules implements the encoding and decoding of the DNS Resource Record object.

See also Net::Frame::Layer for other attributes and methods.

ATTRIBUTES

name

Resource name (hostname / domain).

type

Record type. See CONSTANTS for more information.

class

Class type. See CONSTANTS for more information.

ttl

Time interval (in seconds) that the resource record may be cached before it should be discarded. Zero (0) means the RR can only be used for the current transaction and should not be cached.

rdlength

Length in octets of the RDATA field.

rdata

String of octets that describes the resource. Can be created with any Net::Frame::Layer::DNS::RR::* modules. See SYNOPSIS for example.

The following are inherited attributes. See Net::Frame::Layer for more information.

raw
payload
nextLayer

METHODS

new
new (hash)

Object constructor. You can pass attributes that will overwrite default ones. See SYNOPSIS for default values.

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.

layer
computeLengths
computeChecksums
pack
unpack
encapsulate
getLength
getPayloadLength
print
dump

CONSTANTS

Load them: use Net::Frame::Layer::DNS::RR qw(:consts);

See Net::Frame::Layer::DNS::Constants for more information.

SEE ALSO

Net::Frame::Layer::DNS, Net::Frame::Layer

AUTHOR

Michael Vincent

COPYRIGHT AND LICENSE

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.