ans.pl revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Copyright (C) 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
use strict;
use warnings;
$pidf->close or die "cannot close pid file: $!";
my $count = 0;
my $localaddr = "10.53.0.7";
my $localport = 5300;
my $verbose = 0;
sub reply_handler {
print ("request: $qname/$qtype\n");
$count += 1;
if ($qname eq "count" ) {
if ($qtype eq "TXT") {
print ("\tcount: $count\n");
}
$rcode = "NOERROR";
} elsif ($qname eq "reset") {
$count = 0;
$rcode = "NOERROR";
} else {
$rcode = "REFUSED";
}
# mark the answer as authoritive (by setting the 'aa' flag
}
'port=i' => \$localport,
'verbose!' => \$verbose,
);
ReplyHandler => \&reply_handler,
);