| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::DNS::Method::Regexp; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1825
|
use Carp; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
148
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
61
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
63
|
|
|
8
|
2
|
|
|
2
|
|
9
|
use Net::DNS::Method; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
110
|
|
|
9
|
2
|
|
|
2
|
|
8
|
use vars qw($VERSION @ISA $AUTOLOAD); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1358
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '2.00'; |
|
12
|
|
|
|
|
|
|
our $DEBUG = 0; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = qw(Net::DNS::Method); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
1
|
|
|
1
|
0
|
3444
|
my $type = shift; |
|
18
|
1
|
|
50
|
|
|
9
|
my $class = ref($type) || $type || "Net::DNS::Method::Regexp"; |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
1
|
my $ref = shift; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
5
|
croak "Missing initialization parameters\n" unless ref($ref) eq 'HASH'; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
6
|
return bless { ref => $ref }, $class; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub ANY { |
|
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
29
|
0
|
|
|
|
|
|
my $q = shift; |
|
30
|
0
|
|
|
|
|
|
my $ans = shift; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
warn "inside ANY" if $DEBUG; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
0
|
0
|
|
|
|
return NS_FAIL unless $self and $q and $ans; |
|
|
|
|
0
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $qs = $q->qname . ' ' . $q->qclass . ' ' . $q->qtype; |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
for my $re (sort { length $b <=> length $a } keys %{$self->{ref}}) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
if ($qs =~ /$re/ix) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
warn "match on $re for question $qs" if $DEBUG; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $s = $self->{ref}->{$re}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# First, push RRs in the corresponding zones |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
for my $z (qw(answer authority additional question)) { |
|
49
|
0
|
0
|
0
|
|
|
|
next unless exists $s->{$z} and defined $s->{$z}; |
|
50
|
0
|
0
|
|
|
|
|
croak "$re->$z must be undef or an array reference" |
|
51
|
|
|
|
|
|
|
unless ref($s->{$z}) eq 'ARRAY'; |
|
52
|
0
|
|
|
|
|
|
for my $rr (@{$s->{$z}}) { |
|
|
0
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$ans->safe_push($z, $rr); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Next, set the answer bits to the requested |
|
58
|
|
|
|
|
|
|
# values |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
0
|
0
|
|
|
|
$ans->header->ra($s->{ra}) |
|
61
|
|
|
|
|
|
|
if exists $s->{ra} and defined $s->{ra}; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
0
|
0
|
|
|
|
$ans->header->rd($s->{rd}) |
|
64
|
|
|
|
|
|
|
if exists $s->{rd} and defined $s->{rd}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
0
|
|
|
|
$ans->header->aa($s->{aa}) |
|
67
|
|
|
|
|
|
|
if exists $s->{aa} and defined $s->{aa}; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
0
|
0
|
|
|
|
$ans->header->tc($s->{tc}) |
|
70
|
|
|
|
|
|
|
if exists $s->{tc} and defined $s->{tc}; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Next, set the answer's result code |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
0
|
0
|
|
|
|
if (exists $s->{code} and defined $s->{code}) { |
|
75
|
0
|
|
|
|
|
|
$ans->header->rcode($s->{code}); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
else { |
|
78
|
0
|
|
|
|
|
|
$ans->header->rcode('NOERROR'); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Finally, return the requested value or our |
|
82
|
|
|
|
|
|
|
# default |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
|
if (exists $s->{return} and defined $s->{return}) { |
|
85
|
0
|
|
|
|
|
|
return $s->{return}; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
else { |
|
88
|
0
|
|
|
|
|
|
return NS_OK | NS_STOP; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
|
|
|
|
|
return NS_FAIL; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
96
|
0
|
0
|
|
0
|
|
|
return undef if $AUTOLOAD eq 'Net::DNS::Method::Regexp::DESTROY'; |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
warn "call to $AUTOLOAD" if $DEBUG; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
goto &ANY; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
|
104
|
|
|
|
|
|
|
__END__ |