This is Info file pm.info, produced by Makeinfo version 1.68 from the
input file bigpm.texi.


File: pm.info,  Node: Net/DNS/RR/A,  Next: Net/DNS/RR/AAAA,  Prev: Net/DNS/RR,  Up: Module List

DNS A resource record
*********************

NAME
====

   Net::DNS::RR::A - DNS A resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Address (A) resource records.

METHODS
=======

address
-------

     print "address = ", $rr->address, "\n";

   Returns the RR's address field.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.4.1


File: pm.info,  Node: Net/DNS/RR/AAAA,  Next: Net/DNS/RR/AFSDB,  Prev: Net/DNS/RR/A,  Up: Module List

DNS AAAA resource record
************************

NAME
====

   Net::DNS::RR::AAAA - DNS AAAA resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS IPv6 Address (AAAA) resource records.

METHODS
=======

address
-------

     print "address = ", $rr->address, "\n";

   Returns the RR's address field.

BUGS
====

   The string method returns only the preferred method of address
representation ("x:x:x:x:x:x:x:x", as documented in RFC 1884, Section 2.2,
Para 1).

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1886 Section 2, RFC
1884 Sections 2.2 & 2.4.4


File: pm.info,  Node: Net/DNS/RR/AFSDB,  Next: Net/DNS/RR/CNAME,  Prev: Net/DNS/RR/AAAA,  Up: Module List

DNS AFSDB resource record
*************************

NAME
====

   Net::DNS::RR::AFSDB - DNS AFSDB resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS AFS Data Base (AFSDB) resource records.

METHODS
=======

subtype
-------

     print "subtype = ", $rr->subtype, "\n";

   Returns the RR's subtype field.  Use of the subtype field is documented
in RFC 1183.

hostname
--------

     print "hostname = ", $rr->hostname, "\n";

   Returns the RR's hostname field.  See RFC 1183.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1183 Section 1


File: pm.info,  Node: Net/DNS/RR/CNAME,  Next: Net/DNS/RR/EID,  Prev: Net/DNS/RR/AFSDB,  Up: Module List

DNS CNAME resource record
*************************

NAME
====

   Net::DNS::RR::CNAME - DNS CNAME resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Canonical Name (CNAME) resource records.

METHODS
=======

cname
-----

     print "cname = ", $rr->cname, "\n";

   Returns the RR's canonical name.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.1


File: pm.info,  Node: Net/DNS/RR/EID,  Next: Net/DNS/RR/HINFO,  Prev: Net/DNS/RR/CNAME,  Up: Module List

DNS EID resource record
***********************

NAME
====

   Net::DNS::RR::EID - DNS EID resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Endpoint Identifier (EID) resource records.

METHODS
=======

rdlength
--------

     print "rdlength = ", $rr->rdlength, "\n";

   Returns the length of the record's data section.

rdata
-----

     $rdata = $rr->rdata;

   Returns the record's data section as binary data.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,,
draft-ietf-nimrod-dns-*xx*.txt


File: pm.info,  Node: Net/DNS/RR/HINFO,  Next: Net/DNS/RR/ISDN,  Prev: Net/DNS/RR/EID,  Up: Module List

DNS HINFO resource record
*************************

NAME
====

   Net::DNS::RR::HINFO - DNS HINFO resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Host Information (HINFO) resource records.

METHODS
=======

cpu
---

     print "cpu = ", $rr->cpu, "\n";

   Returns the CPU type for this RR.

os
--

     print "os = ", $rr->os, "\n";

   Returns the operating system type for this RR.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.2


File: pm.info,  Node: Net/DNS/RR/ISDN,  Next: Net/DNS/RR/LOC,  Prev: Net/DNS/RR/HINFO,  Up: Module List

DNS ISDN resource record
************************

NAME
====

   Net::DNS::RR::ISDN - DNS ISDN resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS ISDN resource records.

METHODS
=======

address
-------

     print "address = ", $rr->address, "\n";

   Returns the RR's address field.

sa
--

     print "subaddress = ", $rr->sa, "\n";

   Returns the RR's subaddress field.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1183 Section 3.2


File: pm.info,  Node: Net/DNS/RR/LOC,  Next: Net/DNS/RR/MB,  Prev: Net/DNS/RR/ISDN,  Up: Module List

DNS LOC resource record
***********************

NAME
====

   Net::DNS::RR::LOC - DNS LOC resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Location (LOC) resource records.  See RFC 1876 for
details.

METHODS
=======

version
-------

     print "version = ", $rr->version, "\n";

   Returns the version number of the representation; programs should
always check this.  `Net::DNS' currently supports only version 0.

size
----

     print "size = ", $rr->size, "\n";

   Returns the diameter of a sphere enclosing the described entity, in
centimeters.

horiz_pre
---------

     print "horiz_pre = ", $rr->horiz_pre, "\n";

   Returns the horizontal precision of the data, in centimeters.

vert_pre
--------

     print "vert_pre = ", $rr->vert_pre, "\n";

   Returns the vertical precision of the data, in centimeters.

latitude
--------

     print "latitude = ", $rr->latitude, "\n";

   Returns the latitude of the center of the sphere described by the size
method, in thousandths of a second of arc.  2**31 represents the equator;
numbers above that are north latitude.

longitude
---------

     print "longitude = ", $rr->longitude, "\n";

   Returns the longitude of the center of the sphere described by the size
method, in thousandths of a second of arc.  2**31 represents the prime
meridian; numbers above that are east longitude.

latlon
------

     ($lat, $lon) = $rr->latlon;
     system("xearth", "-pos", "fixed $lat $lon");

   Returns the latitude and longitude as floating-point degrees.  Positive
numbers represent north latitude or east longitude; negative numbers
represent south latitude or west longitude.

altitude
--------

     print "altitude = ", $rr->altitude, "\n";

   Returns the altitude of the center of the sphere described by the size
method, in centimeters, from a base of 100,000m below the WGS 84 reference
spheroid used by GPS.

COPYRIGHT
=========

   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.

   Some of the code and documentation is based on RFC 1876 and on code
contributed by Christopher Davis.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1876


File: pm.info,  Node: Net/DNS/RR/MB,  Next: Net/DNS/RR/MG,  Prev: Net/DNS/RR/LOC,  Up: Module List

DNS MB resource record
**********************

NAME
====

   Net::DNS::RR::MB - DNS MB resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Mailbox (MB) resource records.

METHODS
=======

madname
-------

     print "madname = ", $rr->madname, "\n";

   Returns the domain name of the host which has the specified mailbox.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.3


File: pm.info,  Node: Net/DNS/RR/MG,  Next: Net/DNS/RR/MINFO,  Prev: Net/DNS/RR/MB,  Up: Module List

DNS MG resource record
**********************

NAME
====

   Net::DNS::RR::MG - DNS MG resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Mail Group (MG) resource records.

METHODS
=======

mgmname
-------

     print "mgmname = ", $rr->mgmname, "\n";

   Returns the RR's mailbox field.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.6


File: pm.info,  Node: Net/DNS/RR/MINFO,  Next: Net/DNS/RR/MR,  Prev: Net/DNS/RR/MG,  Up: Module List

DNS MINFO resource record
*************************

NAME
====

   Net::DNS::RR::MINFO - DNS MINFO resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Mailbox Information (MINFO) resource records.

METHODS
=======

rmailbx
-------

     print "rmailbx = ", $rr->rmailbx, "\n";

   Returns the RR's responsible mailbox field.  See RFC 1035.

emailbx
-------

     print "emailbx = ", $rr->emailbx, "\n";

   Returns the RR's error mailbox field.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.7


File: pm.info,  Node: Net/DNS/RR/MR,  Next: Net/DNS/RR/MX,  Prev: Net/DNS/RR/MINFO,  Up: Module List

DNS MR resource record
**********************

NAME
====

   Net::DNS::RR::MR - DNS MR resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Mail Rename (MR) resource records.

METHODS
=======

newname
-------

     print "newname = ", $rr->newname, "\n";

   Returns the RR's new name field.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.8


File: pm.info,  Node: Net/DNS/RR/MX,  Next: Net/DNS/RR/NAPTR,  Prev: Net/DNS/RR/MR,  Up: Module List

DNS MX resource record
**********************

NAME
====

   Net::DNS::RR::MX - DNS MX resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Mail Exchanger (MX) resource records.

METHODS
=======

preference
----------

     print "preference = ", $rr->preference, "\n";

   Returns the preference for this mail exchange.

exchange
--------

     print "exchange = ", $rr->exchange, "\n";

   Returns name of this mail exchange.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.9


File: pm.info,  Node: Net/DNS/RR/NAPTR,  Next: Net/DNS/RR/NIMLOC,  Prev: Net/DNS/RR/MX,  Up: Module List

DNS NAPTR resource record
*************************

NAME
====

   Net::DNS::RR::NAPTR - DNS NAPTR resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Naming Authority Pointer (NAPTR) resource records.

METHODS
=======

order
-----

     print "order = ", $rr->order, "\n";

   Returns the order field.

preference
----------

     print "preference = ", $rr->preference, "\n";

   Returns the preference field.

flags
-----

     print "flags = ", $rr->flags, "\n";

   Returns the flags field.

service
-------

     print "service = ", $rr->service, "\n";

   Returns the service field.

regexp
------

     print "regexp = ", $rr->regexp, "\n";

   Returns the regexp field.

replacement
-----------

     print "replacement = ", $rr->replacement, "\n";

   Returns the replacement field.

COPYRIGHT
=========

   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.

   *Net::DNS::RR::NAPTR* is based on code contributed by Ryan Moats.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 2168


File: pm.info,  Node: Net/DNS/RR/NIMLOC,  Next: Net/DNS/RR/NS,  Prev: Net/DNS/RR/NAPTR,  Up: Module List

DNS NIMLOC resource record
**************************

NAME
====

   Net::DNS::RR::NIMLOC - DNS NIMLOC resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Nimrod Locator (NIMLOC) resource records.

METHODS
=======

rdlength
--------

     print "rdlength = ", $rr->rdlength, "\n";

   Returns the length of the record's data section.

rdata
-----

     $rdata = $rr->rdata;

   Returns the record's data section as binary data.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,,
draft-ietf-nimrod-dns-*xx*.txt


File: pm.info,  Node: Net/DNS/RR/NS,  Next: Net/DNS/RR/NSAP,  Prev: Net/DNS/RR/NIMLOC,  Up: Module List

DNS NS resource record
**********************

NAME
====

   Net::DNS::RR::NS - DNS NS resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Name Server (NS) resource records.

METHODS
=======

nsdname
-------

     print "nsdname = ", $rr->nsdname, "\n";

   Returns the domain name of the nameserver.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.11


File: pm.info,  Node: Net/DNS/RR/NSAP,  Next: Net/DNS/RR/NULL,  Prev: Net/DNS/RR/NS,  Up: Module List

DNS NSAP resource record
************************

NAME
====

   Net::DNS::RR::NSAP - DNS NSAP resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Network Service Access Point (NSAP) resource records.

METHODS
=======

idp
---

     print "idp = ", $rr->idp, "\n";

   Returns the RR's initial domain part (the AFI and IDI fields).

dsp
---

     print "dsp = ", $rr->dsp, "\n";

   Returns the RR's domain specific part (the DFI, AA, Rsvd, RD, Area, ID,
and SEL fields).

afi
---

     print "afi = ", $rr->afi, "\n";

   Returns the RR's authority and format identifier.  `Net::DNS' currently
supports only AFI 47 (GOSIP Version 2).

idi
---

     print "idi = ", $rr->idi, "\n";

   Returns the RR's initial domain identifier.

dfi
---

     print "dfi = ", $rr->dfi, "\n";

   Returns the RR's DSP format identifier.

aa
--

     print "aa = ", $rr->aa, "\n";

   Returns the RR's administrative authority.

rsvd
----

     print "rsvd = ", $rr->rsvd, "\n";

   Returns the RR's reserved field.

rd
--

     print "rd = ", $rr->rd, "\n";

   Returns the RR's routing domain identifier.

area
----

     print "area = ", $rr->area, "\n";

   Returns the RR's area identifier.

id
--

     print "id = ", $rr->id, "\n";

   Returns the RR's system identifier.

sel
---

     print "sel = ", $rr->sel, "\n";

   Returns the RR's NSAP selector.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1706.


File: pm.info,  Node: Net/DNS/RR/NULL,  Next: Net/DNS/RR/PTR,  Prev: Net/DNS/RR/NSAP,  Up: Module List

DNS NULL resource record
************************

NAME
====

   Net::DNS::RR::NULL - DNS NULL resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Null (NULL) resource records.

METHODS
=======

rdlength
--------

     print "rdlength = ", $rr->rdlength, "\n";

   Returns the length of the record's data section.

rdata
-----

     $rdata = $rr->rdata;

   Returns the record's data section as binary data.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.10


File: pm.info,  Node: Net/DNS/RR/PTR,  Next: Net/DNS/RR/PX,  Prev: Net/DNS/RR/NULL,  Up: Module List

DNS PTR resource record
***********************

NAME
====

   Net::DNS::RR::PTR - DNS PTR resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Pointer (PTR) resource records.

METHODS
=======

ptrdname
--------

     print "ptrdname = ", $rr->ptrdname, "\n";

   Returns the domain name associated with this record.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.12


File: pm.info,  Node: Net/DNS/RR/PX,  Next: Net/DNS/RR/RP,  Prev: Net/DNS/RR/PTR,  Up: Module List

DNS PX resource record
**********************

NAME
====

   Net::DNS::RR::PX - DNS PX resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS X.400 Mail Mapping Information (PX) resource records.

METHODS
=======

preference
----------

     print "preference = ", $rr->preference, "\n";

   Returns the preference given to this RR.

map822
------

     print "map822 = ", $rr->map822, "\n";

   Returns the RFC822 part of the RFC1327 mapping information.

mapx400
-------

     print "mapx400 = ", $rr->mapx400, "\n";

   Returns the X.400 part of the RFC1327 mapping information.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1664 Section 4, RFC
1327


File: pm.info,  Node: Net/DNS/RR/RP,  Next: Net/DNS/RR/RT,  Prev: Net/DNS/RR/PX,  Up: Module List

DNS RP resource record
**********************

NAME
====

   Net::DNS::RR::RP - DNS RP resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Responsible Person (RP) resource records.

METHODS
=======

mbox
----

     print "mbox = ", $rr->mbox, "\n";

   Returns a domain name that specifies the mailbox for the responsible
person.

txtdname
--------

     print "txtdname = ", $rr->txtdname, "\n";

   Returns a domain name that specifies a TXT record containing further
information about the responsible person.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1183 Section 2.2


File: pm.info,  Node: Net/DNS/RR/RT,  Next: Net/DNS/RR/SOA,  Prev: Net/DNS/RR/RP,  Up: Module List

DNS RT resource record
**********************

NAME
====

   Net::DNS::RR::RT - DNS RT resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Route Through (RT) resource records.

METHODS
=======

preference
----------

     print "preference = ", $rr->preference, "\n";

   Returns the preference for this route.

intermediate
------------

     print "intermediate = ", $rr->intermediate, "\n";

   Returns the domain name of the intermediate host.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1183 Section 3.3


File: pm.info,  Node: Net/DNS/RR/SOA,  Next: Net/DNS/RR/SRV,  Prev: Net/DNS/RR/RT,  Up: Module List

DNS SOA resource record
***********************

NAME
====

   Net::DNS::RR::SOA - DNS SOA resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Start of Authority (SOA) resource records.

METHODS
=======

mname
-----

     print "mname = ", $rr->mname, "\n";

   Returns the domain name of the original or primary nameserver for this
zone.

rname
-----

     print "rname = ", $rr->rname, "\n";

   Returns a domain name that specifies the mailbox for the person
responsible for this zone.

serial
------

     print "serial = ", $rr->serial, "\n";

   Returns the zone's serial number.

refresh
-------

     print "refresh = ", $rr->refresh, "\n";

   Returns the zone's refresh interval.

retry
-----

     print "retry = ", $rr->retry, "\n";

   Returns the zone's retry interval.

expire
------

     print "expire = ", $rr->expire, "\n";

   Returns the zone's expire interval.

minimum
-------

     print "minimum = ", $rr->minimum, "\n";

   Returns the minimum (default) TTL for records in this zone.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.13


File: pm.info,  Node: Net/DNS/RR/SRV,  Next: Net/DNS/RR/TXT,  Prev: Net/DNS/RR/SOA,  Up: Module List

DNS SRV resource record
***********************

NAME
====

   Net::DNS::RR::SRV - DNS SRV resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Service (SRV) resource records.

METHODS
=======

priority
--------

     print "priority = ", $rr->priority, "\n";

   Returns the priority for this target host.

weight
------

     print "weight = ", $rr->weight, "\n";

   Returns the weight for this target host.

port
----

     print "port = ", $rr->port, "\n";

   Returns the port on this target host for the service.

target
------

     print "target = ", $rr->target, "\n";

   Returns the target host.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 2052


File: pm.info,  Node: Net/DNS/RR/TXT,  Next: Net/DNS/RR/X25,  Prev: Net/DNS/RR/SRV,  Up: Module List

DNS TXT resource record
***********************

NAME
====

   Net::DNS::RR::TXT - DNS TXT resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS Text (TXT) resource records.

METHODS
=======

txtdata
-------

     print "txtdata = ", $rr->txtdata, "\n";

   Returns the descriptive text.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1035 Section 3.3.14


File: pm.info,  Node: Net/DNS/RR/X25,  Next: Net/DNS/Resolver,  Prev: Net/DNS/RR/TXT,  Up: Module List

DNS X25 resource record
***********************

NAME
====

   Net::DNS::RR::X25 - DNS X25 resource record

SYNOPSIS
========

   `use Net::DNS::RR';

DESCRIPTION
===========

   Class for DNS X25 resource records.

METHODS
=======

psdn
----

     print "psdn = ", $rr->psdn, "\n";

   Returns the PSDN address.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Packet: Net/DNS/Packet,,
*Note Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 1183 Section 3.1


File: pm.info,  Node: Net/DNS/Resolver,  Next: Net/DNS/Update,  Prev: Net/DNS/RR/X25,  Up: Module List

DNS resolver class
******************

NAME
====

   Net::DNS::Resolver - DNS resolver class

SYNOPSIS
========

   `use Net::DNS::Resolver;'

DESCRIPTION
===========

   Instances of the `Net::DNS::Resolver' class represent resolver objects.
A program can have multiple resolver objects, each maintaining its own
state information such as the nameservers to be queried, whether recursion
is desired, etc.

   Resolver configuration is read from the following files, in the order
indicated:

     /etc/resolv.conf
     $HOME/.resolv.conf
     ./.resolv.conf

   The following keywords are recognized in resolver configuration files:

domain
     The default domain.

search
     A space-separated list of domains to put in the search list.

nameserver
     A space-separated list of nameservers to query.

   Files except for `/etc/resolv.conf' must be owned by the effective
userid running the program or they won't be read.  In addition, several
environment variables can also contain configuration information; see `'
in this node.

METHODS
=======

new
---

     $res = new Net::DNS::Resolver;

   Creates a new DNS resolver object.

print
-----

     $res->print;

   Prints the resolver state on the standard output.

string
------

     print $res->string;

   Returns a string representation of the resolver state.

searchlist
----------

     @searchlist = $res->searchlist;
     $res->searchlist("foo.com", "bar.com", "baz.org");

   Gets or sets the resolver search list.

nameservers
-----------

     @nameservers = $res->nameservers;
     $res->nameservers("192.168.1.1", "192.168.2.2", "192.168.3.3");

   Gets or sets the nameservers to be queried.

port
----

     print "sending queries to port ", $res->port, "\n";
     $res->port(9732);

   Gets or sets the port to which we send queries.  This can be useful for
testing a nameserver running on a non-standard port.  The default is port
53.

search
------

     $packet = $res->search("mailhost");
     $packet = $res->search("mailhost.foo.com");
     $packet = $res->search("192.168.1.1");
     $packet = $res->search("foo.com", "MX");
     $packet = $res->search("user.passwd.foo.com", "TXT", "HS");

   Performs a DNS query for the given name, applying the searchlist if
appropriate.  The search algorithm is as follows:

  1. If the name contains at least one dot, try it as is.

  2. If the name doesn't end in a dot then append each item in the search
     list to the name.  This is only done if dnsrch is true.

  3. If the name doesn't contain any dots, try it as is.

        The record type and class can be omitted; they default to A and
IN.  If the name looks like an IP address (4 dot-separated numbers), then
an appropriate PTR query will be performed.

   Returns a `Net::DNS::Packet' object, or undef if no answers were found.

query
-----

     $packet = $res->query("mailhost");
     $packet = $res->query("mailhost.foo.com");
     $packet = $res->query("192.168.1.1");
     $packet = $res->query("foo.com", "MX");
     $packet = $res->query("user.passwd.foo.com", "TXT", "HS");

   Performs a DNS query for the given name; the search list is not
applied.  If the name doesn't contain any dots and defnames is true then
the default domain will be appended.

   The record type and class can be omitted; they default to A and IN.  If
the name looks like an IP address (4 dot-separated numbers), then an
appropriate PTR query will be performed.

   Returns a `Net::DNS::Packet' object, or undef if no answers were found.

send
----

     $packet = $res->send($packet_object);
     $packet = $res->send("mailhost.foo.com");
     $packet = $res->send("foo.com", "MX");
     $packet = $res->send("user.passwd.foo.com", "TXT", "HS");

   Performs a DNS query for the given name.  Neither the searchlist nor
the default domain will be appended.

   The argument list can be either a `Net::DNS::Packet' object or a list
of strings.  The record type and class can be omitted; they default to A
and IN.  If the name looks like an IP address (4 dot-separated numbers),
then an appropriate PTR query will be performed.

   Returns a `Net::DNS::Packet' object whether there were any answers or
not.  Use `$packet'->header->`ancount' or `$packet'->`answer' to find out
if there were any records in the answer section.  Returns undef if there
was an error.

bgsend
------

     $socket = $res->bgsend($packet_object);
     $socket = $res->bgsend("mailhost.foo.com");
     $socket = $res->bgsend("foo.com", "MX");
     $socket = $res->bgsend("user.passwd.foo.com", "TXT", "HS");

   Performs a background DNS query for the given name, i.e., sends a query
packet to the first nameserver listed in $res->nameservers and returns
immediately without waiting for a response.  The program can then perform
other tasks while waiting for a response from the nameserver.

   The argument list can be either a `Net::DNS::Packet' object or a list
of strings.  The record type and class can be omitted; they default to A
and IN.  If the name looks like an IP address (4 dot-separated numbers),
then an appropriate PTR query will be performed.

   Returns an IO::Socket object.  The program must determine when the
socket is ready for reading and call $res->bgread to get the response
packet.  You can use $res->bgisready or IO::Select to find out if the
socket is ready before reading it.

bgread
------

     $packet = $res->bgread($socket);
     undef $socket;

   Reads the answer from a background query (see `' in this node).  The
argument is an IO::Socket object returned by bgsend.

   Returns a `Net::DNS::Packet' object or undef on error.

   The programmer should close or destroy the socket object after reading
it.

bgisready
---------

     $socket = $res->bgsend("foo.bar.com");
     until ($res->bgisready($socket)) {
     	# do some other processing
     }
     $packet = $res->bgread($socket);
     $socket = undef;

   Determines whether a socket is ready for reading.  The argument is an
IO::Socket object returned by $res->bgsend.

   Returns true if the socket is ready, false if not.

axfr
----

     @zone = $res->axfr;
     @zone = $res->axfr("foo.com");
     @zone = $res->axfr("passwd.foo.com", "HS");

   Performs a zone transfer from the first nameserver listed in
nameservers.  If the zone is omitted, it defaults to the first zone listed
in the resolver's search list.  If the class is omitted, it defaults to IN.

   Returns a list of `Net::DNS::RR' objects, or undef if the zone transfer
failed.

   The redundant SOA record that terminates the zone transfer is not
returned to the caller.

   Here's an example that uses a timeout:

     $res->tcp_timeout(10);
     @zone = $res->axfr("foo.com");
     if (@zone) {
         foreach $rr (@zone) {
             $rr->print;
         }
     }
     else {
         print "Zone transfer failed: ", $res->errorstring, "\n";
     }

tcp_timeout
-----------

     print "TCP timeout: ", $res->tcp_timeout, "\n";
     $res->tcp_timeout(10);

   Get or set the TCP timeout in seconds.  A timeout of undef means
indefinite.  The default is 120 seconds (2 minutes).

retrans
-------

     print "retrans interval: ", $res->retrans, "\n";
     $res->retrans(3);

   Get or set the retransmission interval.  The default is 5.

retry
-----

     print "number of tries: ", $res->retry, "\n";
     $res->retry(2);

   Get or set the number of times to try the query.  The default is 4.

recurse
-------

     print "recursion flag: ", $res->recurse, "\n";
     $res->recurse(0);

   Get or set the recursion flag.  If this is true, nameservers will be
requested to perform a recursive query.  The default is true.

defnames
--------

     print "defnames flag: ", $res->defnames, "\n";
     $res->defnames(0);

   Get or set the defnames flag.  If this is true, calls to query will
append the default domain to names that contain no dots.  The default is
true.

dnsrch
------

     print "dnsrch flag: ", $res->dnsrch, "\n";
     $res->dnsrch(0);

   Get or set the dnsrch flag.  If this is true, calls to search will
apply the search list.  The default is true.

debug
-----

     print "debug flag: ", $res->debug, "\n";
     $res->debug(1);

   Get or set the debug flag.  If set, calls to search, query, and send
will print debugging information on the standard output.  The default is
false.

usevc
-----

     print "usevc flag: ", $res->usevc, "\n";
     $res->usevc(1);

   Get or set the usevc flag.  If true, then queries will be performed
using virtual circuits (TCP) instead of datagrams (UDP).  The default is
false.

igntc
-----

     print "igntc flag: ", $res->igntc, "\n";
     $res->igntc(1);

   Get or set the igntc flag.  If true, truncated packets will be ignored.
If false, truncated packets will cause the query to be retried using TCP.
The default is false.

errorstring
-----------

     print "query status: ", $res->errorstring, "\n";

   Returns a string containing the status of the most recent query.

answerfrom
----------

     print "last answer was from: ", $res->answerfrom, "\n";

   Returns the IP address from which we received the last answer in
response to a query.

answersize
----------

     print "size of last answer: ", $res->answersize, "\n";

   Returns the size in bytes of the last answer we received in response to
a query.

ENVIRONMENT
===========

   The following environment variables can also be used to configure the
resolver:

RES_NAMESERVERS
---------------

     # Bourne Shell
     RES_NAMESERVERS="192.168.1.1 192.168.2.2 192.168.3.3"
     export RES_NAMESERVERS

     # C Shell
     setenv RES_NAMESERVERS "192.168.1.1 192.168.2.2 192.168.3.3"

   A space-separated list of nameservers to query.

RES_SEARCHLIST
--------------

     # Bourne Shell
     RES_SEARCHLIST="foo.com bar.com baz.org"
     export RES_SEARCHLIST

     # C Shell
     setenv RES_SEARCHLIST "foo.com bar.com baz.org"

   A space-separated list of domains to put in the search list.

LOCALDOMAIN
-----------

     # Bourne Shell
     LOCALDOMAIN=foo.com
     export LOCALDOMAIN

     # C Shell
     setenv LOCALDOMAIN foo.com

   The default domain.

RES_OPTIONS
-----------

     # Bourne Shell
     RES_OPTIONS="retrans:3 retry:2 debug"
     export RES_OPTIONS

     # C Shell
     setenv RES_OPTIONS "retrans:3 retry:2 debug"

   A space-separated list of resolver options to set.  Options that take
values are specified as option:value.

BUGS
====

   Error reporting and handling needs to be improved.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note Net/DNS/Packet:
Net/DNS/Packet,, *Note Net/DNS/Update: Net/DNS/Update,, *Note
Net/DNS/Header: Net/DNS/Header,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, `resolver(5)' in this
node, RFC 1035, RFC 1034 Section 4.3.5


File: pm.info,  Node: Net/DNS/Update,  Next: Net/Daemon,  Prev: Net/DNS/Resolver,  Up: Module List

Create a DNS update packet
**************************

NAME
====

   Net::DNS::Update - Create a DNS update packet

SYNOPSIS
========

   `use Net::DNS::Update;'

DESCRIPTION
===========

   `Net::DNS::Update' is a front-end for creating `Net::DNS::Packet'
objects to be used for making DNS dynamic updates.  Programmers should
refer to RFC 2136 for the semantics of dynamic updates.

   WARNING:  This code is still under development and shouldn't be used to
maintain a production nameserver.

METHODS
=======

new
---

     $packet = new Net::DNS::Update;
     $packet = new Net::DNS::Update("foo.com");
     $packet = new Net::DNS::Update("foo.com", "HS");

   Returns a `Net::DNS::Packet' 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).

   Programs must use the push method to add RRs to the prerequisite,
update, and additional sections before performing the update.

   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.

   Future versions of `Net::DNS' may provide a simpler interface for
making dynamic updates.

EXAMPLES
========

   The first example below shows a complete program; subsequent examples
show only the creation of the update packet.

Add a new host
--------------

     #!/usr/local/bin/perl -w
     
     use Net::DNS;
     
     # Create the update packet.
     $update = new Net::DNS::Update("bar.com");
     
     # Prerequisite is that no A records exist for the name.
     $update->push("pre", nxrrset("foo.bar.com. A"));
     
     # 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"));
     
     # Send the update to the zone's primary master.
     $res = new Net::DNS::Resolver;
     $res->nameservers("primary-master.bar.com");
     $reply = $res->send($update);
     
     # 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";
     }

Add an MX record for a name that already exists
-----------------------------------------------

     $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"));

Add a TXT record for a name that doesn't exist
----------------------------------------------

     $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'"));

Delete all A records for a name
-------------------------------

     $update = new Net::DNS::Update("bar.com");
     $update->push("pre", yxrrset("foo.bar.com A"));
     $update->push("update", rr_del("foo.bar.com A"));

Delete all RRs for a name
-------------------------

     $update = new Net::DNS::Update("foo.com");
     $update->push("pre", yxdomain("byebye.foo.com"));
     $update->push("update", rr_del("byebye.foo.com"));

BUGS
====

   This code is still under development and shouldn't be used to maintain
a production nameserver.

COPYRIGHT
=========

   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.

SEE ALSO
========

   `perl(1)' in this node, *Note Net/DNS: Net/DNS,, *Note
Net/DNS/Resolver: Net/DNS/Resolver,, *Note Net/DNS/Header: Net/DNS/Header,,
*Note Net/DNS/Packet: Net/DNS/Packet,, *Note Net/DNS/Question:
Net/DNS/Question,, *Note Net/DNS/RR: Net/DNS/RR,, RFC 2136


File: pm.info,  Node: Net/Daemon,  Next: Net/Daemon/Log,  Prev: Net/DNS/Update,  Up: Module List

Perl extension for portable daemons
***********************************

NAME
====

   Net::Daemon - Perl extension for portable daemons

SYNOPSIS
========

     # Create a subclass of Net::Daemon
     require Net::Daemon;
     package MyDaemon;
     @MyDaemon::ISA = qw(Net::Daemon);

     sub Run ($) {
       # This function does the real work; it is invoked whenever a
       # new connection is made.
     }

WARNING
=======

   THIS IS ALPHA SOFTWARE. It is *only* 'Alpha' because the interface (API)
is not finalised. The Alpha status does not reflect code quality or
stability.

DESCRIPTION
===========

   Net::Daemon is an abstract base class for implementing portable server
applications in a very simple way. The module is designed for Perl 5.005
and threads, but can work with fork() and Perl 5.004.

   The Net::Daemon class offers methods for the most common tasks a daemon
needs: Starting up, logging, accepting clients, authorization, restricting
its own environment for security and doing the true work. You only have to
override those methods that aren't appropriate for you, but typically
inheriting will safe you a lot of work anyways.

Constructors
------------

     $server = Net::Daemon->new($attr, $options);

     $connection = $server->Clone($socket);

   Two constructors are available: The new method is called upon startup
and creates an object that will basically act as an anchor over the
complete program. It supports command line parsing via `Getopt::Long (3)'
in this node.

   Arguments of new are *$attr*, an hash ref of attributes (see below) and
*$options* an array ref of options, typically command line arguments (for
example *\@ARGV*) that will be passed to *Getopt::Long::GetOptions*.

   The second constructor is Clone: It is called whenever a client
connects. It receives the main server object as input and returns a new
object. This new object will be passed to the methods that finally do the
true work of communicating with the client. Communication occurs over the
socket $socket, Clone's argument.

   Possible object attributes and the corresponding command line arguments
are:

catchint (*-nocatchint*)
     On some systems, in particular Solaris, the functions accept(),
     read() and so on are not safe against interrupts by signals. For
     example, if the user raises a USR1 signal (as typically used to
     reread config files), then the function returns an error EINTR.  If
     the catchint option is on (by default it is, use *-nocatchint* to
     turn this off), then the package will ignore EINTR errors whereever
     possible.

chroot (*-chroot=dir*)
     (UNIX only)  After doing a bind(), change root directory to the given
     directory by doing a chroot(). This is usefull for security
     operations, but it restricts programming a lot. For example, you
     typically have to load external Perl extensions before doing a
     chroot(), or you need to create hard links to Unix sockets. This is
     typically done in the config file, see the -configfile option. See
     also the -group and -user options.

     If you don't know chroot(), think of an FTP server where you can see a
     certain directory tree only after logging in.

clients
     An array ref with a list of clients. Clients are hash refs, the
     attributes accept (0 for denying access and 1 for permitting) and
     mask, a Perl regular expression for the clients IP number or its host
     name. See `"Access control"' in this node below.

configfile (*-configfile=file*)
     Net::Daemon supports the use of config files. These files are assumed
     to contain a single hash ref that overrides the arguments of the new
     method. However, command line arguments in turn take precedence over
     the config file. See the `"Config File"' in this node section below
     for details on the config file.

debug (*-debug*)
     Turn debugging mode on. Mainly this asserts that logging messages of
     level "debug" are created.

facility (*-facility=mode*)
     (UNIX only) Facility to use for `Sys::Syslog (3)' in this node. The
     default is *daemon*.

group (*-group=gid*)
     After doing a bind(), change the real and effective GID to the given.
     This is usefull, if you want your server to bind to a privileged port
     (<1024), but don't want the server to execute as root. See also the
     -user option.

     GID's can be passed as group names or numeric values.

localaddr (*-localaddr=ip*)
     By default a daemon is listening to any IP number that a machine has.
     This attribute allows to restrict the server to the given IP number.

localpath (*-localpath=path*)
     If you want to restrict your server to local services only, you'll
     prefer using Unix sockets, if available. In that case you can use
     this option for setting the path of the Unix socket being created.
     This option implies *-proto=unix*.

localport (*-localport=port*)
     This attribute sets the port on which the daemon is listening. It
     must be given somehow, as there's no default.

logfile (*-logfile=file*)
     By default logging messages will be written to the syslog (Unix) or
     to the event log (Windows NT). On other operating systems you need to
     specify a log file. The special value "STDERR" forces logging to
     stderr.

*loop-child* (*-loop-child*)
     This option forces creation of a new child for loops. (See the
     *loop-timeout* option.) By default the loops are serialized.

*loop-timeout* (*-loop-timeout=secs*)
     Some servers need to take an action from time to time. For example the
     Net::Daemon::Spooler attempts to empty its spooling queue every 5
     minutes. If this option is set to a positive value (zero being the
     default), then the server will call its Loop method every
     "loop-timeout" seconds.

     Don't trust too much on the precision of the interval: It depends on
     a number of factors, in particular the execution time of the Loop()
     method. The loop is implemented by using the select function. If you
     need an exact interval, you should better try to use the alarm()
     function and a signal handler. (And don't forget to look at the
     catchint option!)

     It is recommended to use the *loop-child* option in conjunction with
     *loop-timeout*.

mode (*-mode=modename*)
     The Net::Daemon server can run in three different modes, depending on
     the environment.

     If you are running Perl 5.005 and did compile it for threads, then
     the server will create a new thread for each connection. The thread
     will execute the server's Run() method and then terminate. This mode
     is the default, you can force it with "-mode=threads".

     If threads are not available, but you have a working fork(), then the
     server will behave similar by creating a new process for each
     connection.  This mode will be used automatically in the absence of
     threads or if you use the "-mode=fork" option.

     Finally there's a single-connection mode: If the server has accepted a
     connection, he will enter the Run() method. No other connections are
     accepted until the Run() method returns. This operation mode is
     usefull if you have neither threads nor fork(), for example on the
     Macintosh.  For debugging purposes you can force this mode with
     "-mode=single".

options
     Array ref of Command line options that have been passed to the server
     object via the new method.

parent
     When creating an object with Clone the original object becomes the
     parent of the new object. Objects created with new usually don't have
     a parent, thus this attribute is not set.

pidfile (*-pidfile=file*)
     (UNIX only) If this option is present, a PID file will be created at
     the given location.

proto (*-proto=proto*)
     The transport layer to use, by default *tcp* or *unix* for a Unix
     socket. It is not yet possible to combine both.

socket
     The socket that is connected to the client; passed as $client argument
     to the Clone method. If the server object was created with new, this
     attribute can be undef, as long as the Bind method isn't called.
     Sockets are assumed to be IO::Socket objects.

user (*-user=uid*)
     After doing a bind(), change the real and effective UID to the given.
     This is usefull, if you want your server to bind to a privileged port
     (<1024), but don't want the server to execute as root. See also the
     -group and the -chroot options.

     UID's can be passed as group names or numeric values.

version (*-version*)
     Supresses startup of the server; instead the version string will be
     printed and the program exits immediately.

   Note that most of these attributes (facility, mode, localaddr,
localport, pidfile, version) are meaningfull only at startup. If you set
them later, they will be simply ignored. As almost all attributes have
appropriate defaults, you will typically use the localport attribute only.

Command Line Parsing
--------------------

     my $optionsAvailable = Net::Daemon->Options();

     print Net::Daemon->Version(), "\n";

     Net::Daemon->Usage();

   The Options method returns a hash ref of possible command line options.
The keys are option names, the values are again hash refs with the
following keys:

template
     An option template that can be passed to *Getopt::Long::GetOptions*.

description
     A description of this option, as used in Usage

   The Usage method prints a list of all possible options and returns.  It
uses the Version method for printing program name and version.

Config File
-----------

   If the config file option is set in the command line options or in the
in the "new" args, then the method

     $server->ReadConfigFile($file, $options, $args)

   is invoked. By default the config file is expected to contain Perl
source that returns a hash ref of options. These options override the "new"
args and will in turn be overwritten by the command line options, as
present in the $options hash ref.

   A typical config file might look as follows, we use the DBI::ProxyServer
as an example:

     # Load external modules; this is not required unless you use
     # the chroot() option.
     #require DBD::mysql;
     #require DBD::CSV;

     {
     	# 'chroot' => '/var/dbiproxy',
     	'facility' => 'daemon',
     	'pidfile' => '/var/dbiproxy/dbiproxy.pid',
     	'user' => 'nobody',
     	'group' => 'nobody',
     	'localport' => '1003',
     	'mode' => 'fork'

     # Access control
             'clients' => [
         # Accept the local
         {
     	'mask' => '^192\.168\.1\.\d+$',
                     'accept' => 1
                 },
         # Accept myhost.company.com
         {
     	'mask' => '^myhost\.company\.com$',
                     'accept' => 1
                 }
         # Deny everything else
         {
     	'mask' => '.*',
     	'accept' => 0
         }
             ]
         }

Access control
--------------

   The Net::Daemon package supports a host based access control scheme. By
default access is open for anyone. However, if you create an attribute
$self->{'clients'}, typically in the config file, then access control is
disabled by default. For any connection the client list is processed: The
clients attribute is an array ref to a list of hash refs. Any of the hash
refs may contain arbitrary attributes, including the following:

mask
     A Perl regular expression that has to match the clients IP number or
     its host name. The list is processed from the left to the right,
     whenever a 'mask' attribute matches, then the related hash ref is
     choosen as client and processing the client list stops.

accept
     This may be set to true or false (default when omitting the
     attribute), the former means accepting the client.

Event logging
-------------

     $server->Log($level, $format, @args);
     $server->Debug($format, @args);
     $server->Error($format, @args);
     $server->Fatal($format, @args);

   The Log method is an interface to `Sys::Syslog (3)' in this node or
`Win32::EventLog (3)' in this node. It's arguments are *$level*, a syslog
level like debug, notice or err, a format string in the style of printf
and the format strings arguments.

   The Debug and Error methods are shorthands for calling Log with a level
of debug and err, respectively. The Fatal method is like Error, except it
additionally throws the given message as exception.

   See `Net::Daemon::Log(3)' in this node for details.

Flow of control
---------------

     $server->Bind();
     # The following inside Bind():
     if ($connection->Accept()) {
         $connection->Run();
     } else {
         $connection->Log('err', 'Connection refused');
     }

   The Bind method is called by the application when the server should
start. Typically this can be done right after creating the server object
$server. Bind usually never returns, except in case of errors.

   When a client connects, the server uses Clone to derive a connection
object *$connection* from the server object. A new thread or process is
created that uses the connection object to call your classes Accept
method. This method is intended for host authorization and should return
either FALSE (refuse the client) or TRUE (accept the client).

   If the client is accepted, the Run method is called which does the true
work. The connection is closed when Run returns and the corresponding
thread or process exits.

Error Handling
--------------

   All methods are supposed to throw Perl exceptions in case of errors.

MULTITHREADING CONSIDERATIONS
=============================

   All methods are working with lexically scoped data and handle data
only, the exception being the OpenLog method which is invoked before
threading starts. Thus you are safe as long as you don't share handles
between threads. I strongly recommend that your application behaves
similar.

EXAMPLE
=======

   As an example we'll write a simple calculator server. After connecting
to this server you may type expressions, one per line. The server
evaluates the expressions and prints the result. (Note this is an example,
in real life we'd never implement such a security hole. :-)

   For the purpose of example we add a command line option *-base* that
takes 'hex', 'oct' or 'dec' as values: The servers output will use the
given base.

     # -*- perl -*-
     #
     # Calculator server
     #
     require 5.004;
     use strict;

     require Net::Daemon;

     package Calculator;

     use vars qw($VERSION @ISA);
     $VERSION = '0.01';
     @ISA = qw(Net::Daemon); # to inherit from Net::Daemon

     sub Version ($) { 'Calculator Example Server, 0.01'; }

     # Add a command line option "--base"
     sub Options ($) {
         my($self) = @_;
         my($options) = $self->SUPER::Options();
         $options->{'base'} = { 'template' => 'base=s',
     			     'description' => '--base                  '
     				    . 'dec (default), hex or oct'
     			      };
         $options;
     }

     # Treat command line option in the constructor
     sub new ($$;$) {
         my($class, $attr, $args) = @_;
         my($self) = $class->SUPER::new($attr, $args);
         if ($self->{'parent'}) {
     	  # Called via Clone()
     	  $self->{'base'} = $self->{'parent'}->{'base'};
         } else {
     	  # Initial call
     	  if ($self->{'options'}  &&  $self->{'options'}->{'base'}) {
     	      $self->{'base'} = $self->{'options'}->{'base'}
             }
         }
         if (!$self->{'base'}) {
     	  $self->{'base'} = 'dec';
         }
         $self;
     }

     sub Run ($) {
         my($self) = @_;
         my($line, $sock);
         $sock = $self->{'socket'};
         while (1) {
     	  if (!defined($line = $sock->getline())) {
     	      if ($sock->error()) {
     		  $self->Error("Client connection error %s",
     			       $sock->error());
     	      }
     	      $sock->close();
     	      return;
     	  }
     	  $line =~ s/\s+$//; # Remove CRLF
     	  my($result) = eval $line;
     	  my($rc);
     	  if ($self->{'base'} eq 'hex') {
     	      $rc = printf $sock ("%x\n", $result);
     	  } elsif ($self->{'base'} eq 'oct') {
     	      $rc = printf $sock ("%o\n", $result);
     	  } else {
     	      $rc = printf $sock ("%d\n", $result);
     	  }
     	  if (!$rc) {
     	      $self->Error("Client connection error %s",
     			   $sock->error());
     	      $sock->close();
     	      return;
     	  }
         }
     }

     package main;

     my $server = Calculator->new({'pidfile' => 'none',
     				'localport' => 2000}, \@ARGV);
     $server->Bind();

KNOWN PROBLEMS
==============

   Most, or even any, known problems are related to the Sys::Syslog module
which is by default used for logging events under Unix. I'll quote some
examples:

Usage: Sys::Syslog::_PATH_LOG at ...
     This problem is treated in perl bug 20000712.003. A workaround is
     changing line 277 of Syslog.pm to

          my $syslog = &_PATH_LOG() || croak "_PATH_LOG not found in syslog.ph";

AUTHOR AND COPYRIGHT
====================

     Net::Daemon is Copyright (C) 1998, Jochen Wiedmann
                                        Am Eisteich 9
                                        72555 Metzingen
                                        Germany

     Phone: +49 7123 14887
     Email: joe@ispsoft.de

     All rights reserved.

     You may distribute this package under the terms of either the GNU
     General Public License or the Artistic License, as specified in the
     Perl README file.

SEE ALSO
========

   `RPC::pServer(3)' in this node, `Netserver::Generic(3)' in this node,
`Net::Daemon::Log(3)' in this node, `Net::Daemon::Test(3)' in this node


