blib/lib/Net/DNS/ToolKit/RR/MF.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 18 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::DNS::ToolKit::RR::MF;
2  
3 use strict;
4 #use warnings;
5  
6 use vars qw($VERSION);
7  
8 $VERSION = do { my @r = (q$Revision: 0.02 $ =~ /\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::MF - Resource Record Handler
19  
20 =head1 SYNOPSIS
21  
22 DO NOT use Net::DNS::ToolKit::RR::MF
23 DO NOT require Net::DNS::ToolKit::RR::MF
24  
25 Net::DNS::ToolKit::RR::MF 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 $madname) = $get->MF(\$buffer,$offset);
34  
35 Note: the $get->MF method is normally called
36 via: @stuff = $get->next(\$buffer,$offset);
37  
38 ($newoff,@dnptrs)=$put->MF(\$buffer,$offset,\@dnptrs,
39 $name,$type,$class,$ttl,$madname);
40  
41 $NAME,$TYPE,$CLASS,$TTL,$rdlength,$MADNAME)
42 = $parse->XYZ($name,$type,$class,$ttl,$rdlength,
43 $madname);
44  
45 =head1 DESCRIPTION
46  
47 B<Net::DNS::ToolKit::RR:MF> appends an MF resource record to a DNS packet under
48 construction, recovers an MF 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.5. MF RDATA format (OBSOLETE)
98  
99 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
100 / MADNAME /
101 / /
102 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
103  
104 where:
105  
106 MADNAME A <domain-name> which specifies a host which has a
107 mail agent for the domain which will accept mail for
108 forwarding to the domain.
109  
110 MF records cause additional section processing which looks
111 up an A type record corresponding to MADNAME.
112  
113 MF is obsolete. See the definition of MX and [RFC-974]
114 for details of the new scheme. The recommended policy for
115 dealing with MD RRs found in a master file is to reject
116 them, or to convert them to MX RRs with a preference of 10.
117  
118 =over 4
119  
120 =item * @stuff = $get->MF(\$buffer,$offset);
121  
122 Get the contents of the resource record.
123  
124 USE: @stuff = $get->next(\$buffer,$offset);
125  
126 where: @stuff = (
127 $newoff $name,$type,$class,$ttl,$rdlength,
128 $madname );
129  
130 All except the last item, B<$madname>, is provided by
131 the class loader, B<Net::DNS::ToolKit::RR>. The code in this method knows
132 how to retrieve B<$madname>.
133  
134 input: pointer to buffer,
135 offset into buffer
136 returns: offset to next resource,
137 @common RR elements,
138 MF Domain Name
139  
140 =item * ($newoff,@dnptrs)=$put->MF(\$buffer,$offset,\@dnptrs,
141 $name,$type,$class,$ttl,$madname);
142  
143 Append an MF record to $buffer.
144  
145 where @common = (
146 $name,$type,$class,$ttl);
147  
148 The method will insert the $rdlength and $madname, then
149 pass through the updated pointer to the array of compressed names
150  
151 The class loader, B<Net::DNS::ToolKit::RR>, inserts the @common elements and
152 returns updated @dnptrs. This module knows how to insert its RDATA and
153 calculate the $rdlength.
154  
155 input: pointer to buffer,
156 offset (normally end of buffer),
157 pointer to compressed name array,
158 @common RR elements,
159 MF Domain Name
160 output: offset to next RR,
161 new compressed name pointer array,
162 or empty list () on error.
163  
164 =item * (@COMMON,$MADNAME) = $parse->MF(@common,$madname);
165  
166 Converts binary/numeric field data into human readable form. The common RR
167 elements are supplied by the class loader, B<Net::DNS::ToolKit::RR>.
168 For MF RR's, this returns the $madname terminated with '.'
169  
170 input: MF Domain Name
171 returns: MF Domain Name.
172  
173 =back
174  
175 =head1 DEPENDENCIES
176  
177 Net::DNS::ToolKit
178 Net::DNS::Codes
179 Net::DNS::ToolKit::RR::NS
180  
181 =head1 EXPORT
182  
183 none
184  
185 =head1 AUTHOR
186  
187 Michael Robinton <michael@bizsystems.com>
188  
189 =head1 COPYRIGHT
190  
191 Copyright 2003 - 2011, Michael Robinton <michael@bizsystems.com>
192
193 Michael Robinton <michael@bizsystems.com>
194  
195 All rights reserved.
196  
197 This program is free software; you can redistribute it and/or modify
198 it under the terms of either:
199  
200 a) the GNU General Public License as published by the Free
201 Software Foundation; either version 2, or (at your option) any
202 later version, or
203  
204 b) the "Artistic License" which comes with this distribution.
205  
206 This program is distributed in the hope that it will be useful,
207 but WITHOUT ANY WARRANTY; without even the implied warranty of
208 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
209 the GNU General Public License or the Artistic License for more details.
210  
211 You should have received a copy of the Artistic License with this
212 distribution, in the file named "Artistic". If not, I'll be glad to provide
213 one.
214  
215 You should also have received a copy of the GNU General Public License
216 along with this program in the file named "Copying". If not, write to the
217  
218 Free Software Foundation, Inc.
219 59 Temple Place, Suite 330
220 Boston, MA 02111-1307, USA
221  
222 or visit their web page on the internet at:
223  
224 http://www.gnu.org/copyleft/gpl.html.
225  
226 =head1 See also:
227  
228 Net::DNS::Codes(3), Net::DNS::ToolKit(3)
229  
230 =cut
231  
232 1;