Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  STANFORD::DNSSERVER (3)

.ds Aq ’


Stanford::DNSserver - A DNS Name Server Framework for Perl.



  use Stanford::DNSserver;

  $ns = new Stanford::DNSserver;

  $ns->add_static($domain, $type, $value, $ttl);
  $ns->add_dynamic($domain, $handler);



<B>Stanford::DNSserverB> is a DNS name server framework. It allows you to make any information accessible with perl available via DNS. To put it another way, it’s a name server with a perl back end.


<B>newB> [ %arguments ]

Allocates and returns a new <B>Stanford::DNSserverB> object. The optional arguments can be used to tailor how the name server works. Here they are:
o <B>listen_onB> => \@interfaces

A reference to an array of interfaces to listen on. Interfaces can be specified by name or IP address. If listen_on is not specified, the host name is used.

o <B>portB> => PORT

The port to listen on. The default is 53.

o <B>defttlB> => SECONDS

The default time to live value for answers given out by the name server. The default is 3600 seconds.

o <B>debugB> => LEVEL

The debug level.

o <B>daemonB> => ’yes’ | ’no’

Tells whether the name server should become a detached daemon. The default is ’yes’.

o <B>pidfileB> => FILENAME

File in which to store the process ID of the name server process. No file is created unless this argument is present.

o <B>logfuncB> => \&function

A reference to a function taking a single string argument. This function is called with any messages the name server logs. No logging is performed unless this argument is present.

o <B>loopfuncB> => \&function

A reference to a function to run every time through the inner server loop, i.e. for each query or every 10 minutes if there are no queries. Use this to do any periodic maintenance.

o <B>exitfuncB> => \&function

A reference to a function to run when the name server exits. Use this for any final cleanup. Note that <B>Stanford::DNSserverB> catches <B>INTB>, <B>QUITB>, and <B>TERMB> signals, so providing an <B>exitfuncB> is the only way to clean up when any of those signals are received.

o <B>dontwaitB> => 0 | 1

<B>Stanford::DNSserverB> forks to handle TCP DNS queries. It catches <B>SIGCHLDB> in order to wait(3) for these processes. Setting <B>dontwaitB> to 1 tells <B>Stanford::DNSserverB> not to catch <B>SIGCHLDB> nor wait for those forked processes. Use <B>dontwaitB> when your program provides a <B>SIGCHLDB> handler - just be sure to wait(3) for the forked TCP processes.

<B>add_staticB> $domain, $type, $value, $ttl

Add a domain with the specified properties to the DNS server. When the DNS server is queried for this domain it will respond with the given answer.

<B>add_dynamicB> $domain, $handler

Add a domain with the specified handler to the DNS server. When the DNS server is queried for any name in this domain, it runs the specified handler as follows:

&$handler($domain, $residual, $type, $class, $dnsmsg, $from);

o $domain is the domain in the query.
o $residual is the name in the query.
o $type is the type of the query.
o $class is the class of the query.
o $dnsmsg is a pointer to the DNS message. The handler may add answers and/or authority records to the DNS message using functions from the <B>Stanford::DNSB> module.
o $from is the name or IP address of the system that made the query.

Start listening for DNS queries and answer them as specified by previous calls to <B>add_staticB> and <B>add_dynamicB>.


<B>Stanford::DNSserverB> is based on <B>lbnamedB> by Roland Schemers. Initial transformation from <B>lbnamedB> into <B>Stanford::DNSserverB> by Marco d’Itri. Multiple interface support by Dan Astoorian. Further suggestions and code from Aidan Cully and Mike Mitchell. Module name suggested by Ivan Kohler. Integration, modernization, documentation and final assembly by Rob Riepel.


Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 DNSSERVER (3) 2003-09-22

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.