GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::DNS::RESOLVER::PROGRAMMABLE (3)

.ds Aq ’

NAME

Net::DNS::Resolver::Programmable - programmable DNS resolver class for offline emulation of DNS

CONTENTS

VERSION

0.003

SYNOPSIS



    use Net::DNS::Resolver::Programmable;
    use Net::DNS::RR;
   
    my $resolver = Net::DNS::Resolver::Programmable->new(
        records         => {
            example.com     => [
                Net::DNS::RR->new(example.com.     NS  ns.example.org.),
                Net::DNS::RR->new(example.com.     A   192.168.0.1)
            ],
            ns.example.org  => [
                Net::DNS::RR->new(ns.example.org.  A   192.168.1.1)
            ]
        },
       
        resolver_code   => sub {
            my ($domain, $rr_type, $class) = @_;
            ...
            return ($result, $aa, @rrs);
        }
    );



DESCRIPTION

<B>Net::DNS::Resolver::ProgrammableB> is a <B>Net::DNS::ResolverB> descendant class that allows a virtual DNS to be emulated instead of querying the real DNS. A set of static DNS records may be supplied, or arbitrary code may be specified as a means for retrieving DNS records, or even generating them on the fly.

    Constructor

The following constructor is provided:
<B>new(%options)B>: returns Net::DNS::Resolver::Programmable Creates a new programmed DNS resolver object.

%options is a list of key/value pairs representing any of the following options:
<B>recordsB> A reference to a hash of arrays containing a static set of Net::DNS::RR objects. The hash entries must be indexed by fully qualified domain names (lower-case, without any trailing dots), and the entries themselves must be arrays of the RR objects pertaining to these domain names. For example:



    records => {
        example.com     => [
            Net::DNS::RR->new(example.com.     NS  ns.example.org.),
            Net::DNS::RR->new(example.com.     A   192.168.0.1)
        ],
        www.example.com => [
            Net::DNS::RR->new(www.example.com. A   192.168.0.2)
        ],
        ns.example.org  => [
            Net::DNS::RR->new(ns.example.org.  A   192.168.1.1)
        ]
    }



If this option is specified, the resolver retrieves requested RRs from this data structure.

<B>resolver_codeB> A code reference used as a call-back for dynamically retrieving requested RRs.

The code must take the following query parameters as arguments: the domain, RR type, and class.

It must return a list composed of: the response’s RCODE (by name, as returned by Net::DNS::Header->rcode), the aa (authoritative answer) flag (boolean, use <B>undefB> if you don’t care), and the Net::DNS::RR answer objects. If an error string is returned instead of a valid RCODE, a Net::DNS::Packet object is not constructed but an error condition for the resolver is signaled instead.

For example:



    resolver_code => sub {
        my ($domain, $rr_type, $class) = @_;
        ...
        return ($result, $aa, @rrs);
    }



If both this and the records option are specified, then statically programmed records are used in addition to any that are returned by the configured resolver code.

<B>defnamesB>
<B>dnsrchB>
<B>domainB>
<B>searchlistB>
<B>debugB> These Net::DNS::Resolver options are also meaningful with Net::DNS::Resolver::Programmable. See Net::DNS::Resolver for their descriptions.

    Instance methods

The following instance methods of Net::DNS::Resolver are also supported by Net::DNS::Resolver::Programmable:
<B>searchB>: returns Net::DNS::Packet
<B>queryB>: returns Net::DNS::Packet
<B>sendB>: returns Net::DNS::Packet Performs an offline DNS query, using the statically programmed DNS RRs and/or the configured dynamic resolver code. See the new constructor’s records and resolver_code options. See the descriptions of search, query, and send for details about the calling syntax of these methods.
<B>printB>
<B>stringB>: returns string
<B>searchlistB>: returns list of string
<B>defnamesB>: returns boolean
<B>dnsrchB>: returns boolean
<B>debugB>: returns boolean
<B>errorstringB>: returns string
<B>answerfromB>: returns string
<B>answersizeB>: returns integer See METHODS in Net::DNS::Resolver.
Currently the following methods of Net::DNS::Resolver are <B>notB> supported: <B>axfrB>, <B>axfr_startB>, <B>axfr_nextB>, <B>nameserversB>, <B>portB>, <B>srcportB>, <B>srcaddrB>, <B>bgsendB>, <B>bgreadB>, <B>bgisreadyB>, <B>tsigB>, <B>retransB>, <B>retryB>, <B>recurseB>, <B>usevcB>, <B>tcp_timeoutB>, <B>udp_timeoutB>, <B>persistent_tcpB>, <B>persistent_udpB>, <B>igntcB>, <B>dnssecB>, <B>cdflagB>, <B>udppacketsizeB>. The effects of using these on Net::DNS::Resolver::Programmable objects are undefined.

SEE ALSO

Net::DNS::Resolver

For availability, support, and license information, see the README file included with Net::DNS::Resolver::Programmable.

AUTHORS

Julian Mehnle <julian@mehnle.net>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::DNS::RESOLVER::PROGRAMMABLE (3) 2016-04-03

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