Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Perl Modules

    Net::DNSServer::Base 0.11

    Download button

    No screenshots available
    Downloads: 246  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Rob Brown | More programs
    Perl Artistic License / FREE
    April 1st, 2009, 15:44 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Net::DNSServer::Base description

    This is meant to be the base class for all resolving module handlers.

    Net::DNSServer::Base is a Perl module meant to be the base class for all resolving module handlers.

    SYNOPSIS

    Example Usage:

     #!/usr/bin/perl -w -T
     use strict;
     use Net::DNSServer;
     use Net::DNSServer::Cache;
     use MyTestResolver;
     my $resolver1 = new Net::DNSServer::Cache;
     my $resolver2 = new MyTestResolver {dom => "test.com"};
     run Net::DNSServer {
     priority => [$resolver1,$resolver2],
     }; # Never returns


    Example MyTestResolver.pm Contents:

     package MyTestResolver;
     use strict;
     use Exporter;
     use Net::DNSServer::Base;
     use Net::DNS::Packet;
     use vars qw(@ISA);
     @ISA = qw(Net::DNSServer::Base);

     # resolve subroutine must be defined
     sub resolve {
     my $self = shift;
     my $dns_packet = $self -> {question};
     my ($question) = $dns_packet -> question();
     if ($question -> qname eq $self->{dom} &&
     $question -> qtype eq "A") {
     my $response = bless \%{$dns_packet}, "Net::DNS::Packet"
     || die "Could not initialize response packet";
     $response->push("answer",
     [Net::DNS::RR->new
     ("$self->{dom} 1000 A 127.0.0.100")]);
     $response->push("authority",
     [Net::DNS::RR->new
     ("$self->{dom} 1000 NS ns1.$self->{dom}")]);
     $response->push("additional",
     [Net::DNS::RR->new
     ("ns1.$self->{dom} 1000 A 127.0.0.200")]);
     my $response_header = $response->header;
     $response_header->aa(1); # Make Authoritative
     return $response;
     }
     return undef;
     }


    The main invoker program should call the new() method for each resolver to create an instance of each. Each resolver ISA Net::DNSServer::Base which must explicitly define a resolve() method. A reference to a list of these objects is passed to run() as the "priority" argument as demonstrated in the SYNOPSIS above. Net::DNSServer->run() never returns.


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    module handlers | DNS server | Perl module | Perl | DNS | server



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM