Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
DNSserver(3)	      User Contributed Perl Documentation	  DNSserver(3)

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


       Stanford::DNSserver 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.

       new [ %arguments	]

       Allocates and returns a new Stanford::DNSserver object.	The optional
       arguments can be	used to	tailor how the name server works.  Here	they

       o   listen_on =>	\@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   port	=> PORT

	   The port to listen on.  The default is 53.

       o   defttl => SECONDS

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

       o   debug => LEVEL

	   The debug level.

       o   daemon => 'yes' | 'no'

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

       o   pidfile => FILENAME

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

       o   logfunc => \_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   loopfunc => \_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   exitfunc => \_function

	   A reference to a function to	run when the name server exits.	 Use
	   this	for any	final cleanup.	Note that Stanford::DNSserver catches
	   INT,	QUIT, and TERM signals,	so providing an	exitfunc is the	only
	   way to clean	up when	any of those signals are received.

       o   dontwait => 0 | 1

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

       add_static $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

       add_dynamic $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,A $residual,A $type,A $class,A	$dnsmsg,A $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 Stanford::DNS 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 add_static and	add_dynamic.

       Stanford::DNSserver is based on lbnamed by Roland Schemers.  Initial
       transformation from lbnamed into	Stanford::DNSserver 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.


perl v5.24.1			  2003-09-22			  DNSserver(3)


Want to link to this manual page? Use this URL:

home | help