line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::ToolKit::RR::PTR; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2918
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
4
|
|
|
|
|
|
|
#use warnings; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
192
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 0.03 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Net::DNS::ToolKit::RR::NS; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
*get = \&Net::DNS::ToolKit::RR::NS::get; |
13
|
|
|
|
|
|
|
*put = \&Net::DNS::ToolKit::RR::NS::put; |
14
|
|
|
|
|
|
|
*parse = \&Net::DNS::ToolKit::RR::NS::parse; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Net::DNS::ToolKit::RR::PTR - Resource Record Handler |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
DO NOT use Net::DNS::ToolKit::RR::PTR |
23
|
|
|
|
|
|
|
DO NOT require Net::DNS::ToolKit::RR::PTR |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Net::DNS::ToolKit::RR::PTR is autoloaded by |
26
|
|
|
|
|
|
|
class Net::DNS::ToolKit::RR and its methods |
27
|
|
|
|
|
|
|
are instantiated in a 'special' manner. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Net::DNS::ToolKit::RR; |
30
|
|
|
|
|
|
|
($get,$put,$parse) = new Net::DNS::ToolKit::RR; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
($newoff,$name,$type,$class,$ttl,$rdlength, |
33
|
|
|
|
|
|
|
$ptrdname) = $get->PTR(\$buffer,$offset); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Note: the $get->PTR method is normally called |
36
|
|
|
|
|
|
|
via: @stuff = $get->next(\$buffer,$offset); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
($newoff,@dnptrs)=$put->PTR(\$buffer,$offset,\@dnptrs, |
39
|
|
|
|
|
|
|
$name,$type,$class,$ttl,$ptrdname); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$name,$TYPE,$CLASS,$TTL,$rdlength,$IPaddr) |
42
|
|
|
|
|
|
|
= $parse->XYZ($name,$type,$class,$ttl,$rdlength, |
43
|
|
|
|
|
|
|
$ptrdname); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
B appends an PTR resource record to a DNS packet under |
48
|
|
|
|
|
|
|
construction, recovers an PTR resource record from a packet being decoded, and |
49
|
|
|
|
|
|
|
converts the numeric/binary portions of the resource record to human |
50
|
|
|
|
|
|
|
readable form. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Description from RFC1035.txt |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
3.2.1. Format |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
All RRs have the same top level format shown below: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1 1 1 1 1 1 |
59
|
|
|
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
60
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
61
|
|
|
|
|
|
|
| NAME | |
62
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
63
|
|
|
|
|
|
|
| TYPE | |
64
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
65
|
|
|
|
|
|
|
| CLASS | |
66
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
67
|
|
|
|
|
|
|
| TTL | |
68
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
69
|
|
|
|
|
|
|
| RDLENGTH | |
70
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| |
71
|
|
|
|
|
|
|
| RDATA | |
72
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
NAME an owner name, i.e., the name of the node to which this |
75
|
|
|
|
|
|
|
resource record pertains. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
TYPE two octets containing one of the RR TYPE codes. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
CLASS two octets containing one of the RR CLASS codes. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
TTL a 32 bit signed integer that specifies the time interval |
82
|
|
|
|
|
|
|
that the resource record may be cached before the source |
83
|
|
|
|
|
|
|
of the information should again be consulted. Zero |
84
|
|
|
|
|
|
|
values are interpreted to mean that the RR can only be |
85
|
|
|
|
|
|
|
used for the transaction in progress, and should not be |
86
|
|
|
|
|
|
|
cached. For example, SOA records are always distributed |
87
|
|
|
|
|
|
|
with a zero TTL to prohibit caching. Zero values can |
88
|
|
|
|
|
|
|
also be used for extremely volatile data. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
RDLENGTH an unsigned 16 bit integer that specifies the length |
91
|
|
|
|
|
|
|
in octets of the RDATA field. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
RDATA a variable length string of octets that describes the |
94
|
|
|
|
|
|
|
resource. The format of this information varies |
95
|
|
|
|
|
|
|
according to the TYPE and CLASS of the resource record. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
3.3.12. PTR RDATA format |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
100
|
|
|
|
|
|
|
/ PTRDNAME / |
101
|
|
|
|
|
|
|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
where: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
PTRDNAME A which points to some location |
106
|
|
|
|
|
|
|
in the domain name space. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
PTR records cause no additional section processing. These RRs are used |
109
|
|
|
|
|
|
|
in special domains to point to some other location in the domain space. |
110
|
|
|
|
|
|
|
These records are simple data, and don't imply any special processing |
111
|
|
|
|
|
|
|
similar to that performed by CNAME, which identifies aliases. See the |
112
|
|
|
|
|
|
|
description of the IN-ADDR.ARPA domain for an example. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over 4 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * @stuff = $get->PTR(\$buffer,$offset); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Get the contents of the resource record. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
USE: @stuff = $get->next(\$buffer,$offset); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
where: @stuff = ( |
123
|
|
|
|
|
|
|
$newoff $name,$type,$class,$ttl,$rdlength, |
124
|
|
|
|
|
|
|
$ptrdname ); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
All except the last item, B<$ptrdname>, is provided by |
127
|
|
|
|
|
|
|
the class loader, B. The code in this method knows |
128
|
|
|
|
|
|
|
how to retrieve B<$ptrdname>. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
input: pointer to buffer, |
131
|
|
|
|
|
|
|
offset into buffer |
132
|
|
|
|
|
|
|
returns: offset to next resource, |
133
|
|
|
|
|
|
|
@common RR elements, |
134
|
|
|
|
|
|
|
PTR Domain Name |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * ($newoff,@dnptrs)=$put->PTR(\$buffer,$offset,\@dnptrs, |
137
|
|
|
|
|
|
|
$name,$type,$class,$ttl,$ptrdname); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Append an PTR record to $buffer. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
where @common = ( |
142
|
|
|
|
|
|
|
$name,$type,$class,$ttl); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The method will insert the $rdlength and $ptrdname, then |
145
|
|
|
|
|
|
|
pass through the updated pointer to the array of compressed names |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The class loader, B, inserts the @common elements and |
148
|
|
|
|
|
|
|
returns updated @dnptrs. This module knows how to insert its RDATA and |
149
|
|
|
|
|
|
|
calculate the $rdlength. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
input: pointer to buffer, |
152
|
|
|
|
|
|
|
offset (normally end of buffer), |
153
|
|
|
|
|
|
|
pointer to compressed name array, |
154
|
|
|
|
|
|
|
@common RR elements, |
155
|
|
|
|
|
|
|
PTR Domain Name |
156
|
|
|
|
|
|
|
output: offset to next RR, |
157
|
|
|
|
|
|
|
new compressed name pointer array, |
158
|
|
|
|
|
|
|
or empty list () on error. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * (@COMMON,$PTRDNAME) = $parse->PTR(@common,$ptrdname); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Converts binary/numeric field data into human readable form. The common RR |
163
|
|
|
|
|
|
|
elements are supplied by the class loader, B. |
164
|
|
|
|
|
|
|
For PTR RR's, this returns the $ptrdname terminated with '.' |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
input: PTR Domain Name |
167
|
|
|
|
|
|
|
returns: PTR Domain Name. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=back |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Net::DNS::ToolKit |
174
|
|
|
|
|
|
|
Net::DNS::Codes |
175
|
|
|
|
|
|
|
Net::DNS::ToolKit::RR::NS |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 EXPORT |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
none |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 AUTHOR |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Michael Robinton |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 COPYRIGHT |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Copyright 2003 - 2011, Michael Robinton |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Michael Robinton |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
All rights reserved. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
194
|
|
|
|
|
|
|
it under the terms of either: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
a) the GNU General Public License as published by the Free |
197
|
|
|
|
|
|
|
Software Foundation; either version 2, or (at your option) any |
198
|
|
|
|
|
|
|
later version, or |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
b) the "Artistic License" which comes with this distribution. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
203
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
204
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either |
205
|
|
|
|
|
|
|
the GNU General Public License or the Artistic License for more details. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
You should have received a copy of the Artistic License with this |
208
|
|
|
|
|
|
|
distribution, in the file named "Artistic". If not, I'll be glad to provide |
209
|
|
|
|
|
|
|
one. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
You should also have received a copy of the GNU General Public License |
212
|
|
|
|
|
|
|
along with this program in the file named "Copying". If not, write to the |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Free Software Foundation, Inc. |
215
|
|
|
|
|
|
|
59 Temple Place, Suite 330 |
216
|
|
|
|
|
|
|
Boston, MA 02111-1307, USA |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
or visit their web page on the internet at: |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
http://www.gnu.org/copyleft/gpl.html. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 See also: |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Net::DNS::Codes(3), Net::DNS::ToolKit(3) |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
1; |