NAME
Net::DNS::Extlang - DNS extension language
SYNOPSIS
use Net::DNS::Extlang;
$extobj = new Net::DNS::Extlang(
domain => 'arpa',
file => '/etc/dnsext.txt',
lang => 'en',
resolver => $resobj
)
DESCRIPTION
The Net::DNS::Extlang module reads and stores RR descriptions from files or the DNS. If file is provided, it reads descriptions from that file, otherwise it looks in <name>.rrname.<domain> and <val>.rrtype.<domain> for descriptions in the desired language.
Provide a resolver if you want other than the default resolver settings.
METHODS
new
$extobj = new Net::DNS::Extlang(
domain => 'arpa',
file => '/etc/dnsext.txt',
lang => 'en',
resolver => new Net::DNS::Resolver()
)
Create an object corresponding to a set of extension language entries in a file or the DNS. Provide either a file or a domain argument. If you provide a domain, the lang and resolver are optional.
In addition to using its methods, Net::DNS::Extlang can be accessed by Net::DNS to create rrtype packages automatically as required.
domain, file, lang, resolver
Access method which returns extlang configuration attribute.
xlstorerecord
$rrr = $ext->xlstorerecord( $identifier, @field )
Store a record with rrname/number and list of fields.
getrr
$rrinfo = $ext->getrr(nameornumber)
Retrieve the rr description by number (if the argument is all digits) or name (otherwise.) $rrinfo is a reference to a hash with entries for mnemon, number, comment, and fields: the lines in the description stanza. Each field is a hash with entries type (field type), quals (optional qualifiers), name (optional field name), and comment.
Descriptions from a file are all loaded by new(), from the DNS are fetched as needed. If there's no description for that name or number it returns undef.
compile / compilerr
$code = $ext->compile(nameornumber)
$code = $ext->compilerr($rrr)
Compile the rr description into Net::DNS::RR:<name> and return the perl code, suitable to pass to eval(). nameornumber is looked up, $rrr is an rr description such as getrr() returns.
If there's no description it returns null.
Compiled methods include:
_decode_rdata, _encode_rdata, _format_rdata, _parse_rdata, _defaults
get/set for each field named to match the field, or fieldN if the field has no name or a duplicate name. If field names match built in names or perl keywords, the get/set method name is prefixed with 'f'.
Field types
I1, I2, I4 -- bigendian integers
Display is unsigned integer
R, R[L] - 16 bit RRTYPE, or NSEC grouped bitmap of RRTYPEs
Display is symbolic RRTYPE or typeN, or list thereof
A, AA, AAAA - 32, 64, 128 bit address
Display is 1.1.1.1 or xx:xx::xx
N - regular and compressed domain name, mailbox domain name
Display is a domain name. Option C means RFC1035 compression, option A means it's really a mailbox. Options only for the last field in a record: O means the name is optional.
S, S[M], S[X] - string, multiple strings, uncounted final string
Quoted string or strings. M and X must be last field.
B32/64 - base32/64
Display is string. B32 is preceded in the record by a length byte. B64 is uncounted so must be last field, display can have embedded spaces.
X, X[C] - hex, hex with one byte count.
Uncounted X must be the last field, display can contain spaces.
X6, X8 - EUI48 and EUI64
Display is six or eight bytes of hex with optional hyphens.
T. T6 - unix timestamp
T is four bytes, T6 is six bytes. Display is number of seconds since 1970 or yyyymmddhhmmss.
Z[...] - special cases
Defined in the spec but not implemented
COPYRIGHT
Copyright 2017 John R. Levine.
LICENSE
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SEE ALSO
perl, Net::DNS:RR, draft-levine-dnsextlang