home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_8a4d04772bcfd778a93242343e84dd38
< prev
next >
Wrap
Text File
|
2000-03-23
|
7KB
|
185 lines
<HTML>
<HEAD>
<TITLE>Net::DNS::Update - Create a DNS update packet</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::Update - Create a DNS update packet</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>
</UL>
<LI><A HREF="#examples">EXAMPLES</A></LI>
<UL>
<LI><A HREF="#add a new host">Add a new host</A></LI>
<LI><A HREF="#add an mx record for a name that already exists">Add an MX record for a name that already exists</A></LI>
<LI><A HREF="#add a txt record for a name that doesn't exist">Add a TXT record for a name that doesn't exist</A></LI>
<LI><A HREF="#delete all a records for a name">Delete all A records for a name</A></LI>
<LI><A HREF="#delete all rrs for a name">Delete all RRs for a name</A></LI>
</UL>
<LI><A HREF="#bugs">BUGS</A></LI>
<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::Update - Create a DNS update packet</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::Update;</CODE></P>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P><CODE>Net::DNS::Update</CODE> is a front-end for creating <CODE>Net::DNS::Packet</CODE>
objects to be used for making DNS dynamic updates. Programmers
should refer to RFC 2136 for the semantics of dynamic updates.</P>
<P>WARNING: This code is still under development and shouldn't be
used to maintain a production nameserver.</P>
<P>
<HR>
<H1><A NAME="methods">METHODS</A></H1>
<P>
<H2><A NAME="new">new</A></H2>
<PRE>
$packet = new Net::DNS::Update;
$packet = new Net::DNS::Update("foo.com");
$packet = new Net::DNS::Update("foo.com", "HS");</PRE>
<P>Returns a <CODE>Net::DNS::Packet</CODE> object suitable for performing a DNS
dynamic update. Specifically, it creates a packet with the header
opcode set to UPDATE and the zone record type to SOA (per RFC 2136,
Section 2.3).</P>
<P>Programs must use the <A HREF="../../../../lib/Pod/perlfunc.html#item_push"><CODE>push</CODE></A> method to add RRs to the prerequisite,
update, and additional sections before performing the update.</P>
<P>Arguments are the zone name and the class. If the zone is omitted,
the default domain will be taken from the resolver configuration.
If the class is omitted, it defaults to IN.</P>
<P>Future versions of <CODE>Net::DNS</CODE> may provide a simpler interface
for making dynamic updates.</P>
<P>
<HR>
<H1><A NAME="examples">EXAMPLES</A></H1>
<P>The first example below shows a complete program; subsequent examples
show only the creation of the update packet.</P>
<P>
<H2><A NAME="add a new host">Add a new host</A></H2>
<PRE>
#!/usr/local/bin/perl -w
</PRE>
<PRE>
use Net::DNS;</PRE>
<PRE>
# Create the update packet.
$update = new Net::DNS::Update("bar.com");</PRE>
<PRE>
# Prerequisite is that no A records exist for the name.
$update->push("pre", nxrrset("foo.bar.com. A"));</PRE>
<PRE>
# Add two A records for the name.
$update->push("update", rr_add("foo.bar.com. 86400 A 192.168.1.2"));
$update->push("update", rr_add("foo.bar.com. 86400 A 172.16.3.4"));</PRE>
<PRE>
# Send the update to the zone's primary master.
$res = new Net::DNS::Resolver;
$res->nameservers("primary-master.bar.com");
$reply = $res->send($update);</PRE>
<PRE>
# Did it work?
if (defined $reply) {
if ($reply->header->rcode eq "NOERROR") {
print "Update succeeded\n";
}
else {
print "Update failed: ", $reply->header->rcode, "\n";
}
}
else {
print "Update failed: ", $res->errorstring, "\n";
}</PRE>
<P>
<H2><A NAME="add an mx record for a name that already exists">Add an MX record for a name that already exists</A></H2>
<PRE>
$update = new Net::DNS::Update("foo.com");
$update->push("pre", yxdomain("foo.com"));
$update->push("update", rr_add("foo.com MX 10 mailhost.foo.com"));</PRE>
<P>
<H2><A NAME="add a txt record for a name that doesn't exist">Add a TXT record for a name that doesn't exist</A></H2>
<PRE>
$update = new Net::DNS::Update("foo.com");
$update->push("pre", nxdomain("info.foo.com"));
$update->push("update", rr_add("info.foo.com TXT 'yabba dabba doo'"));</PRE>
<P>
<H2><A NAME="delete all a records for a name">Delete all A records for a name</A></H2>
<PRE>
$update = new Net::DNS::Update("bar.com");
$update->push("pre", yxrrset("foo.bar.com A"));
$update->push("update", rr_del("foo.bar.com A"));</PRE>
<P>
<H2><A NAME="delete all rrs for a name">Delete all RRs for a name</A></H2>
<PRE>
$update = new Net::DNS::Update("foo.com");
$update->push("pre", yxdomain("byebye.foo.com"));
$update->push("update", rr_del("byebye.foo.com"));</PRE>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>This code is still under development and shouldn't be used to maintain
a production nameserver.</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/Header.html">the Net::DNS::Header manpage</A>,
<A HREF="../../../../site/lib/Net/DNS/Packet.html">the Net::DNS::Packet 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 2136</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::Update - Create a DNS update packet</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>