| 1 | package Net::DNS::ToolKit::RR::RP; | ||
| 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.01 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; | |
| 9 | |||
| 10 | 1 | require Net::DNS::ToolKit::RR::MINFO; | |
| 11 | |||
| 12 | 1 | *get = \&Net::DNS::ToolKit::RR::MINFO::get; | |
| 13 | 1 | *put = \&Net::DNS::ToolKit::RR::MINFO::put; | |
| 14 | 1 | *parse = \&Net::DNS::ToolKit::RR::MINFO::parse; | |
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | Net::DNS::ToolKit::RR::RP - Resource Record Handler | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | DO NOT use Net::DNS::ToolKit::RR::RP | ||
| 23 | DO NOT require Net::DNS::ToolKit::RR::RP | ||
| 24 | |||
| 25 | Net::DNS::ToolKit::RR::RP 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 | $rname,$tname) = $get->RP(\$buffer,$offset); | ||
| 34 | |||
| 35 | Note: the $get->RP method is normally called | ||
| 36 | via: @stuff = $get->next(\$buffer,$offset); | ||
| 37 | |||
| 38 | ($newoff,@dnptrs)=$put->RP(\$buffer,$offset,\@dnptrs, | ||
| 39 | $name,$type,$class,$ttl,$rname,$tname); | ||
| 40 | |||
| 41 | $NAME,$TYPE,$CLASS,$TTL,$rdlength,$RP) | ||
| 42 | = $parse->XYZ($name,$type,$class,$ttl,$rdlength, | ||
| 43 | $rname,$tname); | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | B<Net::DNS::ToolKit::RR:RP> appends an RP resource record to a DNS packet under | ||
| 48 | construction, recovers an RP 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 and RFC1183.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 | RFC1183 2.2. The Responsible Person RR | ||
| 98 | 1 1 1 1 1 1 | ||
| 99 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | ||
| 100 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 101 | | RNAME | | ||
| 102 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 103 | | TNAME | | ||
| 104 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 105 | |||
| 106 | Both RDATA fields are required in all RP RRs. | ||
| 107 | |||
| 108 | The first field, RNAME, is a domain name that specifies the | ||
| 109 | mailbox for the responsible person. Its format in master files uses | ||
| 110 | the DNS convention for mailbox encoding, identical to that used for | ||
| 111 | the RNAME mailbox field in the SOA RR. The root domain name (just | ||
| 112 | ".") may be specified for <mbox-dname> to indicate that no mailbox is | ||
| 113 | available. | ||
| 114 | |||
| 115 | The second field, TNAME, is a domain name for which TXT RR's | ||
| 116 | exist. A subsequent query can be performed to retrieve the | ||
| 117 | associated TXT resource records at <txt-dname>. This provides a | ||
| 118 | level of indirection so that the entity can be referred to from | ||
| 119 | multiple places in the DNS. The root domain name (just ".") may be | ||
| 120 | specified for <txt-dname> to indicate that the TXT_DNAME is absent, | ||
| 121 | and no associated TXT RR exists. | ||
| 122 | |||
| 123 | The format of the RP RR is class insensitive. RP records cause no | ||
| 124 | additional section processing. | ||
| 125 | |||
| 126 | =over 4 | ||
| 127 | |||
| 128 | =item * @stuff = $get->RP(\$buffer,$offset); | ||
| 129 | |||
| 130 | Get the contents of the resource record. | ||
| 131 | |||
| 132 | USE: @stuff = $get->next(\$buffer,$offset); | ||
| 133 | |||
| 134 | where: @stuff = ( | ||
| 135 | $newoff $name,$type,$class,$ttl,$rdlength, | ||
| 136 | $rname,$tname ); | ||
| 137 | |||
| 138 | All except the last item, B<$cname>, is provided by | ||
| 139 | the class loader, B<Net::DNS::ToolKit::RR>. The code in this method knows | ||
| 140 | how to retrieve B<$cname>. | ||
| 141 | |||
| 142 | input: pointer to buffer, | ||
| 143 | offset into buffer | ||
| 144 | returns: offset to next resource, | ||
| 145 | @common RR elements, | ||
| 146 | responsible.person.mail.box | ||
| 147 | domain.where.txt.records.exist | ||
| 148 | |||
| 149 | =item * ($newoff,@dnptrs)=$put->RP(\$buffer,$offset,\@dnptrs, | ||
| 150 | $name,$type,$class,$ttl,$rname,$tname); | ||
| 151 | |||
| 152 | Append an RP record to $buffer. | ||
| 153 | |||
| 154 | where @common = ( | ||
| 155 | $name,$type,$class,$ttl); | ||
| 156 | |||
| 157 | The method will insert the $rdlength, $rname and $tname, then | ||
| 158 | pass through the updated pointer to the array of compressed names | ||
| 159 | |||
| 160 | The class loader, B<Net::DNS::ToolKit::RR>, inserts the @common elements and | ||
| 161 | returns updated @dnptrs. This module knows how to insert its RDATA and | ||
| 162 | calculate the $rdlength. | ||
| 163 | |||
| 164 | input: pointer to buffer, | ||
| 165 | offset (normally end of buffer), | ||
| 166 | pointer to compressed name array, | ||
| 167 | @common RR elements, | ||
| 168 | responsible.person.mail.box | ||
| 169 | domain.where.txt.records.exist | ||
| 170 | output: offset to next RR, | ||
| 171 | new compressed name pointer array, | ||
| 172 | or empty list () on error. | ||
| 173 | |||
| 174 | =item * (@COMMON,$RP) = $parse->RP(@common,$rname,$tname); | ||
| 175 | |||
| 176 | Converts binary/numeric field data into human readable form. The common RR | ||
| 177 | elements are supplied by the class loader, B<Net::DNS::ToolKit::RR>. | ||
| 178 | For RP RR's, this returns the $cname terminated with '.' | ||
| 179 | |||
| 180 | input: responsible.person.mail.box, | ||
| 181 | domain.where.txt.records.exist | ||
| 182 | returns: responsible.person.mail.box., | ||
| 183 | domain.where.txt.records.exist. | ||
| 184 | |||
| 185 | =back | ||
| 186 | |||
| 187 | =head1 DEPENDENCIES | ||
| 188 | |||
| 189 | Net::DNS::ToolKit | ||
| 190 | Net::DNS::Codes | ||
| 191 | Net::DNS::ToolKit::RR::NS | ||
| 192 | |||
| 193 | =head1 EXPORT | ||
| 194 | |||
| 195 | none | ||
| 196 | |||
| 197 | =head1 AUTHOR | ||
| 198 | |||
| 199 | Michael Robinton <michael@bizsystems.com> | ||
| 200 | |||
| 201 | =head1 COPYRIGHT | ||
| 202 | |||
| 203 | Copyright 2003 - 2011, Michael Robinton <michael@bizsystems.com> | ||
| 204 | |||
| 205 | Michael Robinton <michael@bizsystems.com> | ||
| 206 | |||
| 207 | All rights reserved. | ||
| 208 | |||
| 209 | This program is free software; you can redistribute it and/or modify | ||
| 210 | it under the terms of either: | ||
| 211 | |||
| 212 | a) the GNU General Public License as published by the Free | ||
| 213 | Software Foundation; either version 2, or (at your option) any | ||
| 214 | later version, or | ||
| 215 | |||
| 216 | b) the "Artistic License" which comes with this distribution. | ||
| 217 | |||
| 218 | This program is distributed in the hope that it will be useful, | ||
| 219 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 220 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either | ||
| 221 | the GNU General Public License or the Artistic License for more details. | ||
| 222 | |||
| 223 | You should have received a copy of the Artistic License with this | ||
| 224 | distribution, in the file named "Artistic". If not, I'll be glad to provide | ||
| 225 | one. | ||
| 226 | |||
| 227 | You should also have received a copy of the GNU General Public License | ||
| 228 | along with this program in the file named "Copying". If not, write to the | ||
| 229 | |||
| 230 | Free Software Foundation, Inc. | ||
| 231 | 59 Temple Place, Suite 330 | ||
| 232 | Boston, MA 02111-1307, USA | ||
| 233 | |||
| 234 | or visit their web page on the internet at: | ||
| 235 | |||
| 236 | http://www.gnu.org/copyleft/gpl.html. | ||
| 237 | |||
| 238 | =head1 See also: | ||
| 239 | |||
| 240 | Net::DNS::Codes(3), Net::DNS::ToolKit(3) | ||
| 241 | |||
| 242 | =cut | ||
| 243 | |||
| 244 | 1 | 1; | |