Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    POE::Component::Server::DNS 0.20

    Download button

    No screenshots available
    Downloads: 265  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

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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