home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_a22eea8daac4afe2741bc291c16785e2
< prev
next >
Wrap
Text File
|
2000-03-23
|
8KB
|
213 lines
<HTML>
<HEAD>
<TITLE>Net::DNS::Packet - DNS packet object class</TITLE>
<LINK REL="stylesheet" HREF="../../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Net::DNS::Packet - DNS packet object class</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<LI><A HREF="#methods">METHODS</A></LI>
<UL>
<LI><A HREF="#new">new</A></LI>
<LI><A HREF="#data">data</A></LI>
<LI><A HREF="#header">header</A></LI>
<LI><A HREF="#question, zone">question, zone</A></LI>
<LI><A HREF="#answer, pre, prerequisite">answer, pre, prerequisite</A></LI>
<LI><A HREF="#authority, update">authority, update</A></LI>
<LI><A HREF="#additional">additional</A></LI>
<LI><A HREF="#print">print</A></LI>
<LI><A HREF="#string">string</A></LI>
<LI><A HREF="#answerfrom">answerfrom</A></LI>
<LI><A HREF="#answersize">answersize</A></LI>
<LI><A HREF="#push">push</A></LI>
<LI><A HREF="#dn_comp">dn_comp</A></LI>
<LI><A HREF="#dn_expand">dn_expand</A></LI>
</UL>
<LI><A HREF="#copyright">COPYRIGHT</A></LI>
<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>Net::DNS::Packet - DNS packet object class</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<P><CODE>use Net::DNS::Packet;</CODE></P>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>A <CODE>Net::DNS::Packet</CODE> object represents a DNS packet.</P>
<P>
<HR>
<H1><A NAME="methods">METHODS</A></H1>
<P>
<H2><A NAME="new">new</A></H2>
<PRE>
$packet = new Net::DNS::Packet(\$data);
$packet = new Net::DNS::Packet(\$data, 1); # set debugging</PRE>
<PRE>
$packet = new Net::DNS::Packet("foo.com");
$packet = new Net::DNS::Packet("foo.com", "MX", "IN");</PRE>
<PRE>
($packet, $err) = new Net::DNS::Packet(\$data);</PRE>
<P>If passed a reference to a scalar containing DNS packet data,
<CODE>new</CODE> creates a packet object from that data. A second argument
can be passed to turn on debugging output for packet parsing.</P>
<P>If passed a domain, type, and class, <CODE>new</CODE> creates a packet
object appropriate for making a DNS query for the requested
information. The type and class can be omitted; they default
to A and IN.</P>
<P>If called in array context, returns a packet object and an
error string. The error string will only be defined if the
packet object is undefined (i.e., couldn't be created).</P>
<P>Returns <STRONG>undef</STRONG> if unable to create a packet object (e.g., if
the packet data is truncated).</P>
<P>
<H2><A NAME="data">data</A></H2>
<PRE>
$data = $packet->data;</PRE>
<P>Returns the packet data in binary format, suitable for sending to
a nameserver.</P>
<P>
<H2><A NAME="header">header</A></H2>
<PRE>
$header = $packet->header;</PRE>
<P>Returns a <CODE>Net::DNS::Header</CODE> object representing the header section
of the packet.</P>
<P>
<H2><A NAME="question, zone">question, zone</A></H2>
<PRE>
@question = $packet->question;</PRE>
<P>Returns a list of <CODE>Net::DNS::Question</CODE> objects representing the
question section of the packet.</P>
<P>In dynamic update packets, this section is known as <CODE>zone</CODE> and
specifies the zone to be updated.</P>
<P>
<H2><A NAME="answer, pre, prerequisite">answer, pre, prerequisite</A></H2>
<PRE>
@answer = $packet->answer;</PRE>
<P>Returns a list of <CODE>Net::DNS::RR</CODE> objects representing the answer
section of the packet.</P>
<P>In dynamic update packets, this section is known as <CODE>pre</CODE> or
<CODE>prerequisite</CODE> and specifies the RRs or RRsets which must or
must not preexist.</P>
<P>
<H2><A NAME="authority, update">authority, update</A></H2>
<PRE>
@authority = $packet->authority;</PRE>
<P>Returns a list of <CODE>Net::DNS::RR</CODE> objects representing the authority
section of the packet.</P>
<P>In dynamic update packets, this section is known as <CODE>update</CODE> and
specifies the RRs or RRsets to be added or delted.</P>
<P>
<H2><A NAME="additional">additional</A></H2>
<PRE>
@additional = $packet->additional;</PRE>
<P>Returns a list of <CODE>Net::DNS::RR</CODE> objects representing the additional
section of the packet.</P>
<P>
<H2><A NAME="print">print</A></H2>
<PRE>
$packet->print;</PRE>
<P>Prints the packet data on the standard output in an ASCII format
similar to that used in DNS zone files.</P>
<P>
<H2><A NAME="string">string</A></H2>
<PRE>
print $packet->string;</PRE>
<P>Returns a string representation of the packet.</P>
<P>
<H2><A NAME="answerfrom">answerfrom</A></H2>
<PRE>
print "packet received from ", $packet->answerfrom, "\n";</PRE>
<P>Returns the IP address from which we received this packet. User-created
packets will return undef for this method.</P>
<P>
<H2><A NAME="answersize">answersize</A></H2>
<PRE>
print "packet size: ", $packet->answersize, " bytes\n";</PRE>
<P>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 <CODE>length $packet</CODE>-><CODE>data</CODE> instead).</P>
<P>
<H2><A NAME="push">push</A></H2>
<PRE>
$packet->push("pre", $rr);
$packet->push("update", $rr);
$packet->push("additional", $rr);</PRE>
<PRE>
$packet->push("update", $rr1, $rr2, $rr3);
$packet->push("update", @rr);</PRE>
<P>Adds RRs to the specified section of the packet.</P>
<P>
<H2><A NAME="dn_comp">dn_comp</A></H2>
<PRE>
$compname = $packet->dn_comp("foo.bar.com", $offset);</PRE>
<P>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.</P>
<P>
<H2><A NAME="dn_expand">dn_expand</A></H2>
<PRE>
use Net::DNS::Packet qw(dn_expand);
($name, $nextoffset) = dn_expand(\$data, $offset);</PRE>
<PRE>
($name, $nextoffset) = Net::DNS::Packet::dn_expand(\$data, $offset);</PRE>
<P>Expands the domain name stored at a particular location in a DNS
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.</P>
<P>Returns the domain name and the offset of the next location in the
packet.</P>
<P>Returns <STRONG>(undef, undef)</STRONG> if the domain name couldn't be expanded.</P>
<P>
<HR>
<H1><A NAME="copyright">COPYRIGHT</A></H1>
<P>Copyright (c) 1997 Michael Fuhr. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms as
Perl itself.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><EM>perl(1)</EM>, <A HREF="../../../../site/lib/Net/DNS.html">the Net::DNS manpage</A>, <A HREF="../../../../site/lib/Net/DNS/Resolver.html">the Net::DNS::Resolver manpage</A>, <A HREF="../../../../site/lib/Net/DNS/Update.html">the Net::DNS::Update manpage</A>,
<A HREF="../../../../site/lib/Net/DNS/Header.html">the Net::DNS::Header manpage</A>, <A HREF="../../../../site/lib/Net/DNS/Question.html">the Net::DNS::Question manpage</A>, <A HREF="../../../../site/lib/Net/DNS/RR.html">the Net::DNS::RR manpage</A>,
RFC 1035 Section 4.1, RFC 2136 Section 2</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Net::DNS::Packet - DNS packet object class</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>