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

    POE::Component::Server::DNS 0.20

    Download button

    No screenshots available
    Downloads: 218  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Chris Williams | More programs
    Perl Artistic License / FREE
    January 14th, 2010, 20:35 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    POE::Component::Server::DNS description

    A non-blocking, concurrent DNS server POE component

    POE::Component::Server::DNS is a POE component that implements a DNS server.

    It uses POE::Component::Client::DNS to handle resolving when configured as 'forward_only' and Net::DNS::Resolver::Recurse wrapped by POE::Component::Generic to perform recursion.

    One may add handlers to massage and manipulate responses to particular queries which is vaguely modelled after Net::DNS::Nameserver.

    SYNOPSIS

     use strict;
     use Net::DNS::RR;
     use POE qw(Component::Server::DNS);

     my $dns_server = POE::Component::Server::DNS->spawn( alias => 'dns_server' );

     POE::Session->create(
     package_states => [ 'main' => [ qw(_start handler log) ], ],
     );

     $poe_kernel->run();
     exit 0;

     sub _start {
     my ($kernel,$heap) = @_[KERNEL,HEAP];

     # Tell the component that we want log events to go to 'log'
     $kernel->post( 'dns_server', 'log_event', 'log' );

     # register a handler for any foobar.com suffixed domains
     $kernel->post( 'dns_server', add_handler,
     {
     event => 'handler',
     label => 'foobar',
     match => 'foobar.com$',
     }
     );
     undef;
     }

     sub handler {
     my ($qname,$qclass,$qtype,$callback) = @_[ARG0..ARG3];
     my ($rcode, @ans, @auth, @add);

     if ($qtype eq "A") {
     my ($ttl, $rdata) = (3600, "10.1.2.3");
     push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata");
     $rcode = "NOERROR";
     } else {
     $rcode = "NXDOMAIN";
     }

     $callback->($rcode, @ans, @auth, @add, { aa => 1 });
     undef;
     }

     sub log {
     my ($ip_port,$net_dns_packet) = @_[ARG0..ARG1];
     $net_dns_packet->print();
     undef;
     }



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    POE component | DNS server | Perl module | POE | 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