MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/local/share/man/man3/Net::DNS::Packet.3
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Net::DNS::Packet 3"
.TH Net::DNS::Packet 3 "2012-01-27" "perl v5.8.8" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Net::DNS::Packet \- DNS protocol packet
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use Net::DNS::Packet;
\&
\&    $packet = new Net::DNS::Packet(\*(Aqexample.com\*(Aq, \*(AqMX\*(Aq, \*(AqIN\*(Aq);
\&
\&    $resolver\->send($packet);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
A \f(CW\*(C`Net::DNS::Packet\*(C'\fR object represents a \s-1DNS\s0 protocol packet.
.SH "METHODS"
.IX Header "METHODS"
.SS "new"
.IX Subsection "new"
.Vb 2
\&    $packet = new Net::DNS::Packet(\*(Aqexample.com\*(Aq);
\&    $packet = new Net::DNS::Packet(\*(Aqexample.com\*(Aq, \*(AqMX\*(Aq, \*(AqIN\*(Aq);
\&
\&    $packet = new Net::DNS::Packet();
.Ve
.PP
If passed a domain, type, and class, \f(CW\*(C`new\*(C'\fR creates a packet
object appropriate for making a \s-1DNS\s0 query for the requested
information.  The type and class can be omitted; they default
to A and \s-1IN\s0.
.PP
If called with an empty argument list, \f(CW\*(C`new\*(C'\fR creates an empty packet.
.PP
.Vb 2
\&    $packet = new Net::DNS::Packet(\e$data);
\&    $packet = new Net::DNS::Packet(\e$data, 1);          # set debugging
\&
\&    ($packet, $err) = new Net::DNS::Packet(\e$data);
.Ve
.PP
If passed a reference to a scalar containing \s-1DNS\s0 packet data,
\&\f(CW\*(C`new\*(C'\fR creates a packet object by decoding the data.  The optional
second argument can be passed to turn on debugging output.
.PP
If called in array context, returns a packet object and an
error string.  The content of the error string is unspecified
if the packet object was successfully created.
.PP
Returns undef if unable to create a packet object (e.g., if
the packet data is truncated).
.SS "data"
.IX Subsection "data"
.Vb 1
\&    $data = $packet\->data;
.Ve
.PP
Returns the packet data in binary format, suitable for sending to
a nameserver.
.SS "header"
.IX Subsection "header"
.Vb 1
\&    $header = $packet\->header;
.Ve
.PP
Returns a \f(CW\*(C`Net::DNS::Header\*(C'\fR object representing the header section
of the packet.
.SS "question, zone"
.IX Subsection "question, zone"
.Vb 1
\&    @question = $packet\->question;
.Ve
.PP
Returns a list of \f(CW\*(C`Net::DNS::Question\*(C'\fR objects representing the
question section of the packet.
.PP
In dynamic update packets, this section is known as \f(CW\*(C`zone\*(C'\fR and
specifies the zone to be updated.
.SS "answer, pre, prerequisite"
.IX Subsection "answer, pre, prerequisite"
.Vb 1
\&    @answer = $packet\->answer;
.Ve
.PP
Returns a list of \f(CW\*(C`Net::DNS::RR\*(C'\fR objects representing the answer
section of the packet.
.PP
In dynamic update packets, this section is known as \f(CW\*(C`pre\*(C'\fR or
\&\f(CW\*(C`prerequisite\*(C'\fR and specifies the RRs or RRsets which must or
must not preexist.
.SS "authority, update"
.IX Subsection "authority, update"
.Vb 1
\&    @authority = $packet\->authority;
.Ve
.PP
Returns a list of \f(CW\*(C`Net::DNS::RR\*(C'\fR objects representing the authority
section of the packet.
.PP
In dynamic update packets, this section is known as \f(CW\*(C`update\*(C'\fR and
specifies the RRs or RRsets to be added or deleted.
.SS "additional"
.IX Subsection "additional"
.Vb 1
\&    @additional = $packet\->additional;
.Ve
.PP
Returns a list of \f(CW\*(C`Net::DNS::RR\*(C'\fR objects representing the additional
section of the packet.
.SS "print"
.IX Subsection "print"
.Vb 1
\&    $packet\->print;
.Ve
.PP
Prints the packet data on the standard output in an \s-1ASCII\s0 format
similar to that used in \s-1DNS\s0 zone files.
.SS "string"
.IX Subsection "string"
.Vb 1
\&    print $packet\->string;
.Ve
.PP
Returns a string representation of the packet.
.SS "answerfrom"
.IX Subsection "answerfrom"
.Vb 1
\&    print "packet received from ", $packet\->answerfrom, "\en";
.Ve
.PP
Returns the \s-1IP\s0 address from which we received this packet.  User-created
packets will return undef for this method.
.SS "answersize"
.IX Subsection "answersize"
.Vb 1
\&    print "packet size: ", $packet\->answersize, " bytes\en";
.Ve
.PP
Returns the size of the packet in bytes as it was received from a
nameserver.  User-created packets will return undef for this method
(use \f(CW\*(C`length $packet\->data\*(C'\fR instead).
.SS "push"
.IX Subsection "push"
.Vb 3
\&    $ancount = $packet\->push(pre        => $rr);
\&    $nscount = $packet\->push(update     => $rr);
\&    $arcount = $packet\->push(additional => $rr);
\&
\&    $nscount = $packet\->push(update => $rr1, $rr2, $rr3);
\&    $nscount = $packet\->push(update => @rr);
.Ve
.PP
Adds RRs to the specified section of the packet.
.PP
Returns the number of resource records in the specified section.
.SS "unique_push"
.IX Subsection "unique_push"
.Vb 3
\&    $ancount = $packet\->unique_push(pre        => $rr);
\&    $nscount = $packet\->unique_push(update     => $rr);
\&    $arcount = $packet\->unique_push(additional => $rr);
\&
\&    $nscount = $packet\->unique_push(update => $rr1, $rr2, $rr3);
\&    $nscount = $packet\->unique_push(update => @rr);
.Ve
.PP
Adds RRs to the specified section of the packet provided that
the RRs do not already exist in the packet.
.PP
Returns the number of resource records in the specified section.
.SS "pop"
.IX Subsection "pop"
.Vb 4
\&    my $rr = $packet\->pop("pre");
\&    my $rr = $packet\->pop("update");
\&    my $rr = $packet\->pop("additional");
\&    my $rr = $packet\->pop("question");
.Ve
.PP
Removes RRs from the specified section of the packet.
.SS "dn_comp"
.IX Subsection "dn_comp"
.Vb 1
\&    $compname = $packet\->dn_comp("foo.example.com", $offset);
.Ve
.PP
Returns a domain name compressed for a particular packet object, to
be stored beginning at the given offset within the packet data.  The
name will be added to a running list of compressed domain names for
future use.
.SS "dn_expand"
.IX Subsection "dn_expand"
.Vb 2
\&    use Net::DNS::Packet qw(dn_expand);
\&    ($name, $nextoffset) = dn_expand(\e$data, $offset);
\&
\&    ($name, $nextoffset) = Net::DNS::Packet::dn_expand(\e$data, $offset);
.Ve
.PP
Expands the domain name stored at a particular location in a \s-1DNS\s0
packet.  The first argument is a reference to a scalar containing
the packet data.  The second argument is the offset within the
packet where the (possibly compressed) domain name is stored.
.PP
Returns the domain name and the offset of the next location in the
packet.
.PP
Returns undef if the domain name could not be expanded.
.SS "sign_tsig"
.IX Subsection "sign_tsig"
.Vb 2
\&    $key_name = "tsig\-key";
\&    $key      = "awwLOtRfpGE+rRKF2+DEiw==";
\&
\&    $update = Net::DNS::Update\->new("example.com");
\&    $update\->push("update", rr_add("foo.example.com A 10.1.2.3"));
\&
\&    $update\->sign_tsig($key_name, $key);
\&
\&    $response = $res\->send($update);
.Ve
.PP
Attaches a \s-1TSIG\s0 resource record object containing a key, which will
be used to signs a packet with a \s-1TSIG\s0 resource record (see \s-1RFC\s0 2845).
Uses the following defaults:
.PP
.Vb 3
\&    algorithm   = HMAC\-MD5.SIG\-ALG.REG.INT
\&    time_signed = current time
\&    fudge       = 300 seconds
.Ve
.PP
If you wish to customize the \s-1TSIG\s0 record, you'll have to create it
yourself and call the appropriate Net::DNS::RR::TSIG methods.  The
following example creates a \s-1TSIG\s0 record and sets the fudge to 60
seconds:
.PP
.Vb 2
\&    $key_name = "tsig\-key";
\&    $key      = "awwLOtRfpGE+rRKF2+DEiw==";
\&
\&    $tsig = Net::DNS::RR\->new("$key_name TSIG $key");
\&    $tsig\->fudge(60);
\&
\&    $query = Net::DNS::Packet\->new("www.example.com");
\&    $query\->sign_tsig($tsig);
\&
\&    $response = $res\->send($query);
.Ve
.SS "sign_sig0"
.IX Subsection "sign_sig0"
\&\s-1SIG0\s0 support is provided through the Net::DNS::RR::SIG class. This class is not part
of the default Net::DNS distribution but resides in the Net::DNS::SEC distribution.
.PP
.Vb 3
\&    $update = Net::DNS::Update\->new("example.com");
\&    $update\->push("update", rr_add("foo.example.com A 10.1.2.3"));
\&    $update\->sign_sig0("Kexample.com+003+25317.private");
.Ve
.PP
\&\s-1SIG0\s0 support is experimental see Net::DNS::RR::SIG for details.
.PP
The method will call \f(CW\*(C`Carp::croak()\*(C'\fR if Net::DNS::RR::SIG cannot be found.
.SS "truncate"
.IX Subsection "truncate"
The truncate method takes a maximum length as argument and then tries
to truncate the packet an set the \s-1TC\s0 bit according to the rules of
\&\s-1RFC2181\s0 Section 9.
.PP
The minimum maximum length that is honored is 512 octets.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c)1997\-2002 Michael Fuhr.
.PP
Portions Copyright (c)2002\-2004 Chris Reinhardt.
.PP
Portions Copyright (c)2002\-2009 Olaf Kolkman
.PP
Portions Copyright (c)2007\-2008 Dick Franks
.PP
All rights reserved.
.PP
This program is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
perl, Net::DNS, Net::DNS::Resolver, Net::DNS::Update,
Net::DNS::Header, Net::DNS::Question, Net::DNS::RR,
\&\s-1RFC\s0 1035 Section 4.1, \s-1RFC\s0 2136 Section 2, \s-1RFC\s0 2845