line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::ToolKit::Question; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#use 5.006; |
4
|
14
|
|
|
14
|
|
76
|
use strict; |
|
14
|
|
|
|
|
64
|
|
|
14
|
|
|
|
|
637
|
|
5
|
|
|
|
|
|
|
#use diagnostics; |
6
|
|
|
|
|
|
|
#use warnings; |
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
|
|
1039
|
use Net::DNS::ToolKit qw( |
9
|
|
|
|
|
|
|
get16 |
10
|
|
|
|
|
|
|
put16 |
11
|
|
|
|
|
|
|
dn_comp |
12
|
|
|
|
|
|
|
dn_expand |
13
|
14
|
|
|
14
|
|
82
|
); |
|
14
|
|
|
|
|
43
|
|
14
|
14
|
|
|
14
|
|
160
|
use Net::DNS::Codes qw(TypeTxt ClassTxt); |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
1133
|
|
15
|
|
|
|
|
|
|
|
16
|
14
|
|
|
14
|
|
75
|
use vars qw($VERSION); |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
5710
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 0.03 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
0
|
sub DESTROY {} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::DNS::ToolKit::Question - Resource Handler |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
DO NOT use Net::DNS::ToolKit::Question |
29
|
|
|
|
|
|
|
DO NOT require Net::DNS::ToolKit::Question |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Net::DNS::ToolKit::Question is autoloaded by |
32
|
|
|
|
|
|
|
class Net::DNS::ToolKit::RR and its methods |
33
|
|
|
|
|
|
|
are instantiated in a 'special' manner. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item * ($newoff,$name,$type,$class) = |
40
|
|
|
|
|
|
|
$get->Question(\$buffer,$offset); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Get question from $buffer. Returns the expanded name, type and class. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
input: pointer to buffer, |
45
|
|
|
|
|
|
|
offset into buffer |
46
|
|
|
|
|
|
|
returns: new offset, |
47
|
|
|
|
|
|
|
expanded name, |
48
|
|
|
|
|
|
|
type, |
49
|
|
|
|
|
|
|
class |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get { |
54
|
13
|
|
|
13
|
0
|
5131
|
my($self,$bp,$off) = @_; |
55
|
13
|
|
|
|
|
103
|
($off, my $name) = dn_expand($bp,$off); |
56
|
13
|
|
|
|
|
71
|
(my $type,$off) = get16($bp,$off); |
57
|
13
|
|
|
|
|
65
|
(my $class,$off) = get16($bp,$off); |
58
|
13
|
|
|
|
|
116
|
return ($off,$name,$type,$class); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * ($newoff,@dnptrs) = |
62
|
|
|
|
|
|
|
$put->Question(\$buffer,$offset, |
63
|
|
|
|
|
|
|
$name,$type,$class,\@dnptrs); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Append a question to the $buffer. Returns a new pointer array for compressed |
66
|
|
|
|
|
|
|
names and the offset to the next RR. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
NOTE: it is up to the user to update the question count. See: L |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Since the B usually is the first record to be appended to the |
71
|
|
|
|
|
|
|
buffer, @dnptrs may be ommitted. See the details at L. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Usage: ($newoff,@dnptrs)=$put->Question(\$buffer,$offset, |
74
|
|
|
|
|
|
|
$name,$type,$class); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
input: pointer to buffer, |
77
|
|
|
|
|
|
|
offset into buffer, |
78
|
|
|
|
|
|
|
domain name, |
79
|
|
|
|
|
|
|
question type, |
80
|
|
|
|
|
|
|
question class, |
81
|
|
|
|
|
|
|
pointer to array of |
82
|
|
|
|
|
|
|
previously compressed names, |
83
|
|
|
|
|
|
|
returns: offset to next record, |
84
|
|
|
|
|
|
|
updated array of offsets to |
85
|
|
|
|
|
|
|
previous compressed names |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub put { |
90
|
13
|
|
|
13
|
0
|
741
|
my($self,$bp,$off,$name,$type,$class,$dp) = @_; |
91
|
13
|
|
|
|
|
479
|
($off, my @dnptrs)=dn_comp($bp,$off,\$name,$dp); |
92
|
13
|
|
|
|
|
140
|
$off = put16($bp,$off,$type); |
93
|
13
|
100
|
66
|
|
|
91
|
if (! $class && exists $self->{class}) { |
94
|
1
|
|
|
|
|
2
|
$class = $self->{class}; |
95
|
|
|
|
|
|
|
} |
96
|
13
|
|
|
|
|
46
|
$off = put16($bp,$off,$class); |
97
|
13
|
50
|
|
|
|
56
|
return $off unless wantarray; |
98
|
13
|
|
|
|
|
98
|
return($off,@dnptrs); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * ($name,$typeTXT,$classTXT) = |
102
|
|
|
|
|
|
|
$parse->Question($name,$type,$class); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Convert non-printable and numeric data |
105
|
|
|
|
|
|
|
into ascii text. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
input: domain name, |
108
|
|
|
|
|
|
|
question type (numeric) |
109
|
|
|
|
|
|
|
question class (numeric) |
110
|
|
|
|
|
|
|
returns: domain name, |
111
|
|
|
|
|
|
|
type TEXT, |
112
|
|
|
|
|
|
|
class TEXT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=back |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub parse { |
119
|
13
|
|
|
13
|
0
|
3095
|
my($self,$name,$type,$class) = @_; |
120
|
13
|
|
|
|
|
71
|
return ($name.'.',TypeTxt->{$type},ClassTxt->{$class}); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Net::DNS::ToolKit |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 EXPORT |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
none |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Michael Robinton |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Copyright 2003 - 2011, Michael Robinton |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Michael Robinton |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
All rights reserved. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
144
|
|
|
|
|
|
|
it under the terms of either: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
a) the GNU General Public License as published by the Free |
147
|
|
|
|
|
|
|
Software Foundation; either version 2, or (at your option) any |
148
|
|
|
|
|
|
|
later version, or |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
b) the "Artistic License" which comes with this distribution. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
153
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
154
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either |
155
|
|
|
|
|
|
|
the GNU General Public License or the Artistic License for more details. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
You should have received a copy of the Artistic License with this |
158
|
|
|
|
|
|
|
distribution, in the file named "Artistic". If not, I'll be glad to provide |
159
|
|
|
|
|
|
|
one. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
You should also have received a copy of the GNU General Public License |
162
|
|
|
|
|
|
|
along with this program in the file named "Copying". If not, write to the |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Free Software Foundation, Inc. |
165
|
|
|
|
|
|
|
59 Temple Place, Suite 330 |
166
|
|
|
|
|
|
|
Boston, MA 02111-1307, USA |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
or visit their web page on the internet at: |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
http://www.gnu.org/copyleft/gpl.html. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 See also: |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Net::DNS::ToolKit(3) |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|