line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::ToolKit::RR::MINFO; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1048
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
110
|
|
4
|
|
|
|
|
|
|
#use warnings; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
|
|
229
|
use Net::DNS::ToolKit qw( |
7
|
|
|
|
|
|
|
get16 |
8
|
|
|
|
|
|
|
get32 |
9
|
|
|
|
|
|
|
put16 |
10
|
|
|
|
|
|
|
put32 |
11
|
|
|
|
|
|
|
dn_comp |
12
|
|
|
|
|
|
|
dn_expand |
13
|
2
|
|
|
2
|
|
13
|
); |
|
2
|
|
|
|
|
5
|
|
14
|
2
|
|
|
2
|
|
13
|
use Net::DNS::Codes qw(:constants); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
737
|
|
15
|
2
|
|
|
2
|
|
55
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
999
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 0.01 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Net::DNS::ToolKit::RR::MINFO - Resource Record Handler |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
DO NOT use Net::DNS::ToolKit::RR::MINFO |
26
|
|
|
|
|
|
|
DO NOT require Net::DNS::ToolKit::RR::MINFO |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Net::DNS::ToolKit::RR::MINFO is autoloaded by |
29
|
|
|
|
|
|
|
class Net::DNS::ToolKit::RR and its methods |
30
|
|
|
|
|
|
|
are instantiated in a 'special' manner. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Net::DNS::ToolKit::RR; |
33
|
|
|
|
|
|
|
($get,$put,$parse) = new Net::DNS::ToolKit::RR; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
($newoff,$name,$type,$class,$ttl,$rdlength, |
36
|
|
|
|
|
|
|
) = $get->MINFO(\$buffer,$offset); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Note: the $get->MINFO method is normally called |
39
|
|
|
|
|
|
|
via: @stuff = $get->next(\$buffer,$offset); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
($newoff,@dnptrs)=$put->MINFO(\$buffer,$offset,\@dnptrs, |
42
|
|
|
|
|
|
|
$name,$type,$class,$ttl, |
43
|
|
|
|
|
|
|
$mname,$errname); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$NAME,$TYPE,$CLASS,$TTL,$rdlength, |
46
|
|
|
|
|
|
|
$MNAME,$RNAME,$serial,$refresh,$retry,$expire,$min) |
47
|
|
|
|
|
|
|
= $parse->MINFO($name,$type,$class,$ttl,$rdlength, |
48
|
|
|
|
|
|
|
$mname,$errname); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
B appends an MINFO resource record to a DNS packet |
53
|
|
|
|
|
|
|
under construction, recovers an MINFO resource record from a packet being decoded, and |
54
|
|
|
|
|
|
|
converts the numeric/binary portions of the resource record to human |
55
|
|
|
|
|
|
|
readable form. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Description from RFC1035.txt |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
3.2.1. Format |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
All RRs have the same top level format shown below: |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1 1 1 1 1 1 |
64
|
|
|
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
65
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
66
|
|
|
|
|
|
|
| NAME | |
67
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
68
|
|
|
|
|
|
|
| TYPE | |
69
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
70
|
|
|
|
|
|
|
| CLASS | |
71
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
72
|
|
|
|
|
|
|
| TTL | |
73
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
74
|
|
|
|
|
|
|
| RDLENGTH | |
75
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| |
76
|
|
|
|
|
|
|
| RDATA | |
77
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
NAME an owner name, i.e., the name of the node to which this |
80
|
|
|
|
|
|
|
resource record pertains. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
TYPE two octets containing one of the RR TYPE codes. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
CLASS two octets containing one of the RR CLASS codes. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
TTL a 32 bit signed integer that specifies the time interval |
87
|
|
|
|
|
|
|
that the resource record may be cached before the source |
88
|
|
|
|
|
|
|
of the information should again be consulted. Zero |
89
|
|
|
|
|
|
|
values are interpreted to mean that the RR can only be |
90
|
|
|
|
|
|
|
used for the transaction in progress, and should not be |
91
|
|
|
|
|
|
|
cached. For example, MINFO records are always distributed |
92
|
|
|
|
|
|
|
with a zero TTL to prohibit caching. Zero values can |
93
|
|
|
|
|
|
|
also be used for extremely volatile data. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
RDLENGTH an unsigned 16 bit integer that specifies the length |
96
|
|
|
|
|
|
|
in octets of the RDATA field. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
RDATA a variable length string of octets that describes the |
99
|
|
|
|
|
|
|
resource. The format of this information varies |
100
|
|
|
|
|
|
|
according to the TYPE and CLASS of the resource record. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
3.3.13. MINFO RDATA format |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
105
|
|
|
|
|
|
|
/ RMAILBX / |
106
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
107
|
|
|
|
|
|
|
/ EMAILBX / |
108
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
where: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
RMAILBX A which specifies a mailbox which is |
113
|
|
|
|
|
|
|
responsible for the mailing list or mailbox. If this |
114
|
|
|
|
|
|
|
domain name names the root, the owner of the MINFO RR is |
115
|
|
|
|
|
|
|
responsible for itself. Note that many existing mailing |
116
|
|
|
|
|
|
|
lists use a mailbox X-request for the RMAILBX field of |
117
|
|
|
|
|
|
|
mailing list X, e.g., Msgroup-request for Msgroup. This |
118
|
|
|
|
|
|
|
field provides a more general mechanism. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
EMAILBX A which specifies a mailbox which is to |
121
|
|
|
|
|
|
|
receive error messages related to the mailing list or |
122
|
|
|
|
|
|
|
mailbox specified by the owner of the MINFO RR (similar |
123
|
|
|
|
|
|
|
to the ERRORS-TO: field which has been proposed). If |
124
|
|
|
|
|
|
|
this domain name names the root, errors should be |
125
|
|
|
|
|
|
|
returned to the sender of the message. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
MINFO records cause no additional section processing. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=over 4 |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * @stuff = $get->MINFO(\$buffer,$offset); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Get the contents of the resource record. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
USE: @stuff = $get->next(\$buffer,$offset); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
where: @stuff = ( |
138
|
|
|
|
|
|
|
$newoff $name,$type,$class,$ttl,$rdlength, |
139
|
|
|
|
|
|
|
$rname,$errname); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
All except the last five (2) items, |
142
|
|
|
|
|
|
|
B<$mname,$errname>, are provided by |
143
|
|
|
|
|
|
|
the class loader, B. The code in this method knows |
144
|
|
|
|
|
|
|
how to retrieve B<$mname,$errname>. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
input: pointer to buffer, |
147
|
|
|
|
|
|
|
offset into buffer |
148
|
|
|
|
|
|
|
returns: offset to next resource, |
149
|
|
|
|
|
|
|
@common RR elements, |
150
|
|
|
|
|
|
|
responsible.mail.box |
151
|
|
|
|
|
|
|
error.mail.box |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub get { |
156
|
2
|
|
|
2
|
0
|
1013
|
my($self,$bp,$offset) = @_; |
157
|
2
|
|
|
|
|
14
|
$offset += INT16SZ; # don't need rdlength |
158
|
2
|
|
|
|
|
60
|
($offset, my $mname) = dn_expand($bp,$offset); |
159
|
2
|
|
|
|
|
11
|
($offset, my $errname) = dn_expand($bp,$offset); |
160
|
2
|
|
|
|
|
10
|
return($offset,$mname,$errname); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * ($newoff,@dnptrs)=$put->MINFO(\$buffer,$offset,\@dnptrs, |
164
|
|
|
|
|
|
|
$name,$type,$class,$ttl, |
165
|
|
|
|
|
|
|
$mname,$errname); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Append an MINFO record to $buffer. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
where @common = ( |
170
|
|
|
|
|
|
|
$name,$type,$class,$ttl); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
The method will insert the $rdlength, |
173
|
|
|
|
|
|
|
$mname, $errname then |
174
|
|
|
|
|
|
|
return the updated pointer to the array of compressed names |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
The class loader, B, inserts the @common elements and |
177
|
|
|
|
|
|
|
returns updated @dnptrs. This module knows how to insert its RDATA and |
178
|
|
|
|
|
|
|
calculate the $rdlength. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
input: pointer to buffer, |
181
|
|
|
|
|
|
|
offset (normally end of buffer), |
182
|
|
|
|
|
|
|
pointer to compressed name array, |
183
|
|
|
|
|
|
|
@common RR elements, |
184
|
|
|
|
|
|
|
responsible.mail.box |
185
|
|
|
|
|
|
|
error.mail.box |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
output: offset to next RR, |
188
|
|
|
|
|
|
|
new compressed name pointer array, |
189
|
|
|
|
|
|
|
or empty list () on error. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub put { |
194
|
2
|
50
|
|
2
|
0
|
918
|
return () unless @_; # always return on error |
195
|
2
|
|
|
|
|
5
|
my($self,$bp,$off,$dnp,$mname,$errname) = @_; |
196
|
2
|
|
|
|
|
6
|
my $rdlp = $off; # save pointer to rdlength |
197
|
2
|
|
|
|
|
3
|
my ($doff,@dnptrs); # data start, pointer array |
198
|
2
|
50
|
33
|
|
|
72
|
return () unless # check for valid and get |
|
|
|
33
|
|
|
|
|
199
|
|
|
|
|
|
|
($doff = put16($bp,$off,0)) && # offset for names |
200
|
|
|
|
|
|
|
(($off,@dnptrs) = dn_comp($bp,$doff,\$mname,$dnp)) && |
201
|
|
|
|
|
|
|
(($off,@dnptrs) = dn_comp($bp,$off,\$errname,\@dnptrs)); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# rdlength = new offset - previous offset |
204
|
2
|
|
|
|
|
11
|
put16($bp,$rdlp, $off - $doff); |
205
|
2
|
|
|
|
|
14
|
return($off,@dnptrs); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * (@COMMON,$MNAME,$ERRNAME) |
209
|
|
|
|
|
|
|
= $parse->A(@common, |
210
|
|
|
|
|
|
|
$mname,$errname); |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Converts binary/numeric field data into human readable form. The common RR |
213
|
|
|
|
|
|
|
elements are supplied by the class loader, B. |
214
|
|
|
|
|
|
|
For MINFO RR's, this returns $mxdname terminated with '.' |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
input: responsible.mail.box |
217
|
|
|
|
|
|
|
error.mail.box |
218
|
|
|
|
|
|
|
returns: responsible.mail.box '.' terminated |
219
|
|
|
|
|
|
|
error.mail.box '.' terminated |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub parse { |
226
|
4
|
|
|
4
|
0
|
1571
|
my($self,$mname,$errname) = @_; |
227
|
4
|
|
|
|
|
19
|
return($mname.'.',$errname.'.'); |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Net::DNS::ToolKit |
233
|
|
|
|
|
|
|
Net::DNS::Codes |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 EXPORT |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
none |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head1 AUTHOR |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Michael Robinton |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head1 COPYRIGHT |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Copyright 2003 - 2011, Michael Robinton |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Michael Robinton |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
All rights reserved. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
252
|
|
|
|
|
|
|
it under the terms of either: |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
a) the GNU General Public License as published by the Free |
255
|
|
|
|
|
|
|
Software Foundation; either version 2, or (at your option) any |
256
|
|
|
|
|
|
|
later version, or |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
b) the "Artistic License" which comes with this distribution. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
261
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
262
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either |
263
|
|
|
|
|
|
|
the GNU General Public License or the Artistic License for more details. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
You should have received a copy of the Artistic License with this |
266
|
|
|
|
|
|
|
distribution, in the file named "Artistic". If not, I'll be glad to provide |
267
|
|
|
|
|
|
|
one. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
You should also have received a copy of the GNU General Public License |
270
|
|
|
|
|
|
|
along with this program in the file named "Copying". If not, write to the |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Free Software Foundation, Inc. |
273
|
|
|
|
|
|
|
59 Temple Place, Suite 330 |
274
|
|
|
|
|
|
|
Boston, MA 02111-1307, USA |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
or visit their web page on the internet at: |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
http://www.gnu.org/copyleft/gpl.html. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head1 See also: |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
Net::DNS::Codes(3), Net::DNS::ToolKit(3) |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
1; |