The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DNS::Extlang - DNS extension language

Version

Version 0.1.

SYNOPSIS

    use Net::DNS::Extlang;

    $ext = new Net::DNS::Extlang(file => '/etc/dnsext.txt',
     domain => 'arpa, 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

    $ext = new Net::DNS::Extlang(file => '/etc/dnsext.txt',
     domain => 'arpa', lang => 'en', resolver => resobj)

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, you can push the object onto @INC to let it automatically create rrtype routines as required.

getrr

     %rrinfo = $ext->getrr(nameornumber)

Retrieve the rr description by number (if the argument is all digits) or name (otherwise.) %rrinfo is a hash with fields 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