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

NAME

DNS::Bananafonana - Perl extension for Bananafonana encoding / decoding

SYNOPSIS

  use DNS::Bananafonana;

  $bigint = from_bananafonana($number);
  $bafostr = to_bananafonana($bigint);
  $hostname = bananafonana($ptr, $domain, $prefix);
  $ip = bananafonana($hostname, $domain, $prefix);

DESCRIPTION

RFC 1924 describes a compact, fixed-size representation of IPv6 addresses which uses a base 85 number system. The base 85 numbers (from 0 to 84) are as follows:

    0..9 A..Z a..z ! # $ % & ( ) * + - ; < = > ? @ ^ _ ` { | } ~

In order to let human beings pronounce the resulting string more easily and to be able to use base 85 encoding in DNS naming schemes, an alternative encoding scheme is used, based on 85 consonant-vowel pairs, as suggested by DGolden on Slashdot (http://tech.slashdot.org/comments.pl?sid=649579&cid=24654733).

This module has a variable called $DNS::Bananafonana::bananafonana_strings, which is a string containing the 85 two-character strings that make up the bananafonana "alphabet" from lowest to highest , in that order.

Additionally, the following three functions are defined for general use. (They will be exported upon request.)

from_bananafonana

Parameters

A string composed of valid bananafonana strings.

Returns

A DNS::BigInt object representing the number.

to_bananafonana

Parameters

A DNS::BigInt object.

Optionally:

A markup character to split the string in more readable parts. Can be -, _ or .. Defaults to -.

A blocksize that determines the number of consonant-vowel combinations between each markup character. Defaults to 5.

Returns

A string of bananafonana strings representing the number.

bananafonana

Parameters

A string

A string containing the domain name of the record. It will be appended to the result when a pointer record is asked and removed from the input for hostname lookups.

Optionally:

A string containing a prefix that needs to be added before the bananafonana representation of the ip address. Defaults to empty.

A markup character to split the string in more readable parts. Can be -, _ or .. Defaults to -.

A blocksize that determines the number of consonant-vowel combinations between each markup character. Defaults to 5.

Returns

A string containing either the bananafonana representation of the ip address (presented in 1.2.3.4.in-addr.arpa or a.b...e.f.ip6.arpa notation) or a string representing the ip address determined from the bonananfonana encoded hostname (for all domains not ending in in-addr|ip6.arpa).

BUGS

The bananafonana function is currently decoding all hostnames with 10 character bonanafonana encoded addresses as IPv4 addresses. This prevends the correct encoding and decoding for IPv6 addresses in the range ::/96, which should not be a big limitation in practice.

AUTHOR

Michiel Fokke <michiel@fokke.org> Based upon work from Tony Monroe <tmonroe+perl@nog.net>

SEE ALSO

perl(1).