blib/lib/Net/DNS/ToolKit/RR/HINFO.pm

filter: Statementstmt 100% 17 / 17 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 88.0% 22 / 25 CC 3 SCAR 8.3
CC
3
Cov
90%
put
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« blib/lib/Net/DNS/ToolKit/RR/NULL.pm ↑ Summary blib/lib/Net/DNS/ToolKit/Question.pm »
1 package Net::DNS::ToolKit::RR::HINFO;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #use warnings;
5  
6 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 $VERSION = do { my @r = (q$Revision: 0.02 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
9  
10 1 require Net::DNS::ToolKit::RR::TXT;
11  
12 1 *get = \&Net::DNS::ToolKit::RR::TXT::get;
13 1 *parse = \&Net::DNS::ToolKit::RR::TXT::parse;
14  
15 =head1 NAME
16  
17 Net::DNS::ToolKit::RR::HINFO - Resource Record Handler
18  
19 =head1 SYNOPSIS
20  
21 DO NOT use Net::DNS::ToolKit::RR::HINFO
22 DO NOT require Net::DNS::ToolKit::RR::HINFO
23  
24 Net::DNS::ToolKit::RR::HINFO is autoloaded by
25 class Net::DNS::ToolKit::RR and its methods
26 are instantiated in a 'special' manner.
27  
28 use Net::DNS::ToolKit::RR;
29 ($get,$put,$parse) = new Net::DNS::ToolKit::RR;
30  
31 ($newoff,$name,$type,$class,$ttl,$rdlength,
32 @txtstrings) = $get->HINFO(\$buffer,$offset);
33  
34 Note: the $get->HINFO method is normally called
35 via: @stuff = $get->next(\$buffer,$offset);
36  
37 ($newoff,@dnptrs)=$put->HINFO(\$buffer,$offset,\@dnptrs,
38 $name,$type,$class,$ttl,$rdlength,@txtstrings);
39  
40 $NAME,$TYPE,$CLASS,$TTL,$rdlength,@txtstrings)
41 = $parse->HINFO($name,$type,$class,$ttl,$rdlength,
42 @txtstrings);
43  
44 =head1 DESCRIPTION
45  
46 B<Net::DNS::ToolKit::RR:HINFO> appends an HINFO resource record to a DNS packet under
47 construction, recovers an HINFO resource record from a packet being decoded, and
48 converts the numeric/binary portions of the resource record to human
49 readable form.
50  
51 Description from RFC1035.txt
52  
53 3.2.1. Format
54  
55 All RRs have the same top level format shown below:
56  
57 1 1 1 1 1 1
58 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
59 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60 | NAME |
61 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62 | TYPE |
63 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64 | CLASS |
65 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
66 | TTL |
67 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
68 | RDLENGTH |
69 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
70 | RDATA |
71 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
72  
73 NAME an owner name, i.e., the name of the node to which this
74 resource record pertains.
75  
76 TYPE two octets containing one of the RR TYPE codes.
77  
78 CLASS two octets containing one of the RR CLASS codes.
79  
80 TTL a 32 bit signed integer that specifies the time interval
81 that the resource record may be cached before the source
82 of the information should again be consulted. Zero
83 values are interpreted to mean that the RR can only be
84 used for the transaction in progress, and should not be
85 cached. For example, SOA records are always distributed
86 with a zero TTL to prohibit caching. Zero values can
87 also be used for extremely volatile data.
88  
89 RDLENGTH an unsigned 16 bit integer that specifies the length
90 in octets of the RDATA field.
91  
92 RDATA a variable length string of octets that describes the
93 resource. The format of this information varies
94 according to the TYPE and CLASS of the resource record.
95  
96 3.3.2. HINFO RDATA format
97  
98 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
99 / CPU /
100 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
101 / OS /
102 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
103  
104 where:
105  
106 CPU A <character-string> which specifies the CPU type.
107  
108 OS A <character-string> which specifies the operating
109 system type.
110  
111 Standard values for CPU and OS can be found in [RFC-1010].
112  
113 HINFO records are used to acquire general information about a host. The
114 main use is for protocols such as FTP that can use special procedures
115 when talking between machines or operating systems of the same type.
116  
117 =over 4
118  
119 =item * @stuff = $get->HINFO(\$buffer,$offset);
120  
121 Get the contents of the resource record.
122  
123 USE: @stuff = $get->next(\$buffer,$offset);
124  
125 where: @stuff = (
126 $newoff $name,$type,$class,$ttl,$rdlength,
127 @txtstrings );
128  
129 All except the last item, B<@txtstrings>, is provided by
130 the class loader, B<Net::DNS::ToolKit::RR>. The code in this method knows
131 how to retrieve B<$anydata>.
132  
133 input: pointer to buffer,
134 offset into buffer
135 returns: offset to next resource,
136 @common RR elements,
137 2 text strings
138  
139 =item * ($newoff,@dnptrs)=$put->HINFO(\$buffer,$offset,\@dnptrs,
140 $name,$type,$class,$ttl,$rdlength,@txtstrings);
141  
142 Append a HINFO record to $buffer.
143  
144 where @common = (
145 $name,$type,$class,$ttl);
146  
147 The method will insert the $rdlength and @txtstrings, then
148 pass through the updated pointer to the array of compressed names
149  
150 The class loader, B<Net::DNS::ToolKit::RR>, inserts the @common elements and
151 returns updated @dnptrs. This module knows how to insert its RDATA of two
152 text strings up to 255 characters long and
153 calculate the $rdlength of the entire record.
154  
155 input: pointer to buffer,
156 offset (normally end of buffer),
157 pointer to compressed name array,
158 @common RR elements,
159 2 text strings =< 255 characters
160 output: offset to next RR,
161 new compressed name pointer array,
162 or empty list () on error.
163  
164 =cut
165  
166 1 ▶sub put {
Subroutine put: called CC=3 SCAR=11.4
Pod undocumented
167 1 ▶ return () unless @_; # always return on error
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 1 1
168 1 my($self,$bp,$off,$dnp,@textdata) = @_;
169 1 ▶ return () unless @textdata == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @textdata == 2 0 1 1
170 1 goto &Net::DNS::ToolKit::RR::TXT::put;
171 }
172  
173 =item * (@COMMON,@txtstrings)=$parse->HINFO(@common,@txtstrings);
174  
175 Converts binary/numeric field data into human readable form. The common RR
176 elements are supplied by the class loader, B<Net::DNS::ToolKit::RR>.
177 For HINFO RR's, this is a null operation.
178  
179 input: 2 text strings
180 returns: 2 text strings
181  
182 =back
183  
184 =head1 DEPENDENCIES
185  
186 Net::DNS::ToolKit
187 Net::DNS::Codes
188  
189 =head1 EXPORT
190  
191 none
192  
193 =head1 AUTHOR
194  
195 Michael Robinton <michael@bizsystems.com>
196  
197 =head1 COPYRIGHT
198  
199 Copyright 2003 - 2011, Michael Robinton <michael@bizsystems.com>
200
201 Michael Robinton <michael@bizsystems.com>
202  
203 All rights reserved.
204  
205 This program is free software; you can redistribute it and/or modify
206 it under the terms of either:
207  
208 a) the GNU General Public License as published by the Free
209 Software Foundation; either version 2, or (at your option) any
210 later version, or
211  
212 b) the "Artistic License" which comes with this distribution.
213  
214 This program is distributed in the hope that it will be useful,
215 but WITHOUT ANY WARRANTY; without even the implied warranty of
216 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
217 the GNU General Public License or the Artistic License for more details.
218  
219 You should have received a copy of the Artistic License with this
220 distribution, in the file named "Artistic". If not, I'll be glad to provide
221 one.
222  
223 You should also have received a copy of the GNU General Public License
224 along with this program in the file named "Copying". If not, write to the
225  
226 Free Software Foundation, Inc.
227 59 Temple Place, Suite 330
228 Boston, MA 02111-1307, USA
229  
230 or visit their web page on the internet at:
231  
232 http://www.gnu.org/copyleft/gpl.html.
233  
234 =head1 See also:
235  
236 Net::DNS::Codes(3), Net::DNS::ToolKit(3)
237  
238 =cut
239  
240 1 1;
« blib/lib/Net/DNS/ToolKit/RR/NULL.pm ↑ Summary blib/lib/Net/DNS/ToolKit/Question.pm »