{
    "content": [
        {
            "type": "text",
            "text": "# NetAddr::IP::InetBase (perldoc)\n\n## NAME\n\nNetAddr::IP::InetBase -- IPv4 and IPV6 utilities\n\n## SYNOPSIS\n\nuse NetAddr::IP::Base qw(\n:upper\ninetaton\ninetntoa\nipv6aton\nipv6ntoa\nipv6n2x\nipv6n2d\ninetany2n\ninetn2dx\ninetn2ad\ninetpton\ninetntop\npackzeros\nisIPv4\nisNewIPv4\nisAnyIPv4\nAFINET\nAFINET6\nfakeAFINET6\nfillIPv4\n);\nuse NetAddr::IP::Util qw(:all :inet :ipv4 :ipv6 :math)\n:ipv4   =>    inetaton, inetntoa, fillIPv4\n:ipv6   =>    ipv6aton, ipv6ntoa,ipv6n2x, ipv6n2d,\ninetany2n, inetn2dx, inetn2ad\ninetpton, inetntop, packzeros\n$dotquad = inetntoa($netaddr);\n$netaddr = inetaton($dotquad);\n$ipv6naddr = ipv6aton($ipv6text);\n$ipv6text = ipv6ntoa($ipv6naddr);\n$hextext = ipv6n2x($ipv6naddr);\n$dectext = ipv6n2d($ipv6naddr);\n$ipv6naddr = inetany2n($dotquad or $ipv6text);\n$dotquad or $hextext = inetn2dx($ipv6naddr);\n$dotquad or $dectext = inetn2ad($ipv6naddr);\n$netaddr = inetpton($AFfamily,$textaddr);\n$textaddr = inetntop($AFfamily,$netaddr);\n$hextext = packzeros($hextext);\n$rv = isIPv4($bits128);\n$rv = isNewIPv4($bits128);\n$rv = isAnyIPv4($bits128);\n$constant = AFINET();\n$constant = AFINET6();\n$trueif   = fakeAFINET6();\n$ipfilled = fillIPv4($shortIP);\nNetAddr::IP::InetBase::lower();\nNetAddr::IP::InetBase::upper();\n\n## DESCRIPTION\n\nNetAddr::IP::InetBase provides a suite network of conversion functions written in pure Perl for\nconverting both IPv4 and IPv6 addresses to and from network address format and text format.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **INSTALLATION**\n- **DESCRIPTION**\n- **EXPORTOK**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "NetAddr::IP::InetBase",
        "section": "",
        "mode": "perldoc",
        "summary": "NetAddr::IP::InetBase -- IPv4 and IPV6 utilities",
        "synopsis": "use NetAddr::IP::Base qw(\n:upper\ninetaton\ninetntoa\nipv6aton\nipv6ntoa\nipv6n2x\nipv6n2d\ninetany2n\ninetn2dx\ninetn2ad\ninetpton\ninetntop\npackzeros\nisIPv4\nisNewIPv4\nisAnyIPv4\nAFINET\nAFINET6\nfakeAFINET6\nfillIPv4\n);\nuse NetAddr::IP::Util qw(:all :inet :ipv4 :ipv6 :math)\n:ipv4   =>    inetaton, inetntoa, fillIPv4\n:ipv6   =>    ipv6aton, ipv6ntoa,ipv6n2x, ipv6n2d,\ninetany2n, inetn2dx, inetn2ad\ninetpton, inetntop, packzeros\n$dotquad = inetntoa($netaddr);\n$netaddr = inetaton($dotquad);\n$ipv6naddr = ipv6aton($ipv6text);\n$ipv6text = ipv6ntoa($ipv6naddr);\n$hextext = ipv6n2x($ipv6naddr);\n$dectext = ipv6n2d($ipv6naddr);\n$ipv6naddr = inetany2n($dotquad or $ipv6text);\n$dotquad or $hextext = inetn2dx($ipv6naddr);\n$dotquad or $dectext = inetn2ad($ipv6naddr);\n$netaddr = inetpton($AFfamily,$textaddr);\n$textaddr = inetntop($AFfamily,$netaddr);\n$hextext = packzeros($hextext);\n$rv = isIPv4($bits128);\n$rv = isNewIPv4($bits128);\n$rv = isAnyIPv4($bits128);\n$constant = AFINET();\n$constant = AFINET6();\n$trueif   = fakeAFINET6();\n$ipfilled = fillIPv4($shortIP);\nNetAddr::IP::InetBase::lower();\nNetAddr::IP::InetBase::upper();",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "IP",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/IP/3/json"
            },
            {
                "name": "Lite",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/Lite/3/json"
            },
            {
                "name": "Util",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/Util/3/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 54,
                "subsections": []
            },
            {
                "name": "INSTALLATION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 186,
                "subsections": []
            },
            {
                "name": "EXPORTOK",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "NetAddr::IP::InetBase -- IPv4 and IPV6 utilities\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use NetAddr::IP::Base qw(\n:upper\ninetaton\ninetntoa\nipv6aton\nipv6ntoa\nipv6n2x\nipv6n2d\ninetany2n\ninetn2dx\ninetn2ad\ninetpton\ninetntop\npackzeros\nisIPv4\nisNewIPv4\nisAnyIPv4\nAFINET\nAFINET6\nfakeAFINET6\nfillIPv4\n);\n\nuse NetAddr::IP::Util qw(:all :inet :ipv4 :ipv6 :math)\n\n:ipv4   =>    inetaton, inetntoa, fillIPv4\n\n:ipv6   =>    ipv6aton, ipv6ntoa,ipv6n2x, ipv6n2d,\ninetany2n, inetn2dx, inetn2ad\ninetpton, inetntop, packzeros\n\n$dotquad = inetntoa($netaddr);\n$netaddr = inetaton($dotquad);\n$ipv6naddr = ipv6aton($ipv6text);\n$ipv6text = ipv6ntoa($ipv6naddr);\n$hextext = ipv6n2x($ipv6naddr);\n$dectext = ipv6n2d($ipv6naddr);\n$ipv6naddr = inetany2n($dotquad or $ipv6text);\n$dotquad or $hextext = inetn2dx($ipv6naddr);\n$dotquad or $dectext = inetn2ad($ipv6naddr);\n$netaddr = inetpton($AFfamily,$textaddr);\n$textaddr = inetntop($AFfamily,$netaddr);\n$hextext = packzeros($hextext);\n$rv = isIPv4($bits128);\n$rv = isNewIPv4($bits128);\n$rv = isAnyIPv4($bits128);\n$constant = AFINET();\n$constant = AFINET6();\n$trueif   = fakeAFINET6();\n$ipfilled = fillIPv4($shortIP);\n\nNetAddr::IP::InetBase::lower();\nNetAddr::IP::InetBase::upper();\n",
                "subsections": []
            },
            "INSTALLATION": {
                "content": "Un-tar the distribution in an appropriate directory and type:\n\nperl Makefile.PL\nmake\nmake test\nmake install\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "NetAddr::IP::InetBase provides a suite network of conversion functions written in pure Perl for\nconverting both IPv4 and IPv6 addresses to and from network address format and text format.\n\nThe IPv6 functions support all rfc1884 formats.\n\ni.e.  x:x:x:x:x:x:x:x:x\nx:x:x:x:x:x:x:d.d.d.d\n::x:x:x\n::x:d.d.d.d\nand so on...\n\n*   $dotquad = inetntoa($netaddr);\n\nConvert a packed IPv4 network address to a dot-quad IP address.\n\ninput:        packed network address\nreturns:      IP address i.e. 10.4.12.123\n\n*   $netaddr = inetaton($dotquad);\n\nConvert a dot-quad IP address into an IPv4 packed network address.\n\ninput:        IP address i.e. 192.5.16.32\nreturns:      packed network address\n\n*   $ipv6addr = ipv6aton($ipv6text);\n\nTakes an IPv6 address of the form described in rfc1884 and returns a 128 bit binary RDATA\nstring.\n\ninput:        ipv6 text\nreturns:      128 bit RDATA string\n\n*   $ipv6text = ipv6ntoa($ipv6naddr);\n\nConvert a 128 bit binary IPv6 address to compressed rfc 1884 text representation.\n\ninput:        128 bit RDATA string\nreturns:      ipv6 text\n\n*   $hextext = ipv6n2x($ipv6addr);\n\nTakes an IPv6 RDATA string and returns an 8 segment IPv6 hex address\n\ninput:        128 bit RDATA string\nreturns:      x:x:x:x:x:x:x:x\n\nNote: this function does NOT compress adjacent\nstrings of 0:0:0:0 into the :: format\n\n*   $dectext = ipv6n2d($ipv6addr);\n\nTakes an IPv6 RDATA string and returns a mixed hex - decimal IPv6 address with the 6\nuppermost chunks in hex and the lower 32 bits in dot-quad representation.\n\ninput:        128 bit RDATA string\nreturns:      x:x:x:x:x:x:d.d.d.d\n\nNote: this function does NOT compress adjacent\nstrings of 0:0:0:0 into the :: format\n\n*   $ipv6naddr = inetany2n($dotquad or $ipv6text);\n\nThis function converts a text IPv4 or IPv6 address in text format in any standard notation\ninto a 128 bit IPv6 string address. It prefixes any dot-quad address (if found) with '::'\nand passes it to ipv6aton.\n\ninput:        dot-quad or rfc1844 address\nreturns:      128 bit IPv6 string\n\n*   $dotquad or $hextext = inetn2dx($ipv6naddr);\n\nThis function does the right thing and returns the text for either a dot-quad IPv4 or a hex\nnotation IPv6 address.\n\ninput:        128 bit IPv6 string\nreturns:      ddd.ddd.ddd.ddd\nor  x:x:x:x:x:x:x:x\n\nNote: this function does NOT compress adjacent\nstrings of 0:0:0:0 into the :: format\n\n*   $dotquad or $dectext = inetn2ad($ipv6naddr);\n\nThis function does the right thing and returns the text for either a dot-quad IPv4 or a\nhex::decimal notation IPv6 address.\n\ninput:        128 bit IPv6 string\nreturns:      ddd.ddd.ddd.ddd\nor  x:x:x:x:x:x:ddd.ddd.ddd.dd\n\nNote: this function does NOT compress adjacent\nstrings of 0:0:0:0 into the :: format\n\n*   $netaddr = inetpton($AFfamily,$textaddr);\n\nThis function takes an IP address in IPv4 or IPv6 text format and converts it into binary\nformat. The type of IP address conversion is controlled by the FAMILY argument.\n\nNOTE: inetpton, inetntop and AFINET6 come from the Socket6 library if it is present on\nthis host.\n\n*   $textaddr = inetntop($AFfamily,$netaddr);\n\nThis function takes and IP address in binary format and converts it into text format. The\ntype of IP address conversion is controlled by the FAMILY argument.\n\nNOTE: inetntop ALWAYS returns lowercase characters.\n\nNOTE: inetpton, inetntop and AFINET6 come from the Socket6 library if it is present on\nthis host.\n\n*   $hextext = packzeros($hextext);\n\nThis function optimizes and rfc 1884 IPv6 hex address to reduce the number of long strings\nof zero bits as specified in rfc 1884, 2.2 (2) by substituting :: for the first occurrence\nof the longest string of zeros in the address.\n\n*   $ipv6naddr = ipv4to6($netaddr);\n\nConvert an ipv4 network address into an ipv6 network address.\n\ninput:        32 bit network address\nreturns:      128 bit network address\n\n*   $rv = isIPv4($bits128);\n\nThis function returns true if there are no on bits present in the IPv6 portion of the 128\nbit string and false otherwise.\n\ni.e.  the address must be of the form - ::d.d.d.d\n\nNote: this is an old and deprecated ipV4 compatible ipV6 address\n\n*   $rv = isNewIPv4($bits128);\n\nThis function return true if the IPv6 128 bit string is of the form\n\n::ffff:d.d.d.d\n\n*   $rv = isAnyIPv4($bits128);\n\nThis function return true if the IPv6 bit string is of the form\n\n::d.d.d.d       or      ::ffff:d.d.d.d\n\n*   NetAddr::IP::InetBase::lower();\n\nReturn IPv6 strings in lowercase. This is the default.\n\n*   NetAddr::IP::InetBase::upper();\n\nReturn IPv6 strings in uppercase.\n\nThe default may be set to uppercase when the module is loaded by invoking the TAG :upper.\ni.e.\n\nuse NetAddr::IP::InetBase qw( :upper );\n\n*   $constant = AFINET;\n\nThis function returns the system value for AFINET.\n\n*   $constant = AFINET6;\n\nAFINET6 is sometimes present in the Socket library and always present in the Socket6\nlibrary. When the Socket library does not contain AFINET6 and when Socket6 is not present,\na place holder value is \"guessed\" based on the underlying host operating system. See\nfakeAFINET6 below.\n\nNOTE: inetpton, inetntop and AFINET6 come from the Socket6 library if it is present on\nthis host.\n\n*   $trueif = fakeAFINET6;\n\nThis function return FALSE if AFINET6 is provided by Socket or Socket6. Otherwise, it\nreturns the best guess value based on name of the host operating system.\n\n*   $ipfilled = fillIPv4($shortIP);\n\nThis function converts IPv4 addresses of the form 127.1 to the long form 127.0.0.1\n\nIf the function is passed an argument that does not match the form of an IP address, the\noriginal argument is returned. i.e. pass it a hostname or a short IP and it will return a\nhostname or a filled IP.\n",
                "subsections": []
            },
            "EXPORTOK": {
                "content": ":upper\ninetaton\ninetntoa\nipv6aton\nipv6ntoa\nipv6n2x\nipv6n2d\ninetany2n\ninetn2dx\ninetn2ad\ninetpton\ninetntop\npackzeros\nisIPv4\nisNewIPv4\nisAnyIPv4\nAFINET\nAFINET6\nfakeAFINET6\nfillIPv4\n\n%EXPORTTAGS\n:all\n:ipv4\n:ipv6\n:upper\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Michael Robinton <michael@bizsystems.com>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2003 - 2012, Michael Robinton <michael@bizsystems.com>\n\nAll rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it under the terms of\neither:\n\na) the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any\nlater version, or\n\nb) the \"Artistic License\" which comes with this distribution.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\neither the GNU General Public License or the Artistic License for more details.\n\nYou should have received a copy of the Artistic License with this distribution, in the file\nnamed \"Artistic\". If not, I'll be glad to provide one.\n\nYou should also have received a copy of the GNU General Public License along with this program\nin the file named \"Copying\". If not, write to the\n\nFree Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor\nBoston, MA 02110-1301 USA\n\nor visit their web page on the internet at:\n\nhttp://www.gnu.org/copyleft/gpl.html.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "NetAddr::IP(3), NetAddr::IP::Lite(3), NetAddr::IP::Util(3)\n",
                "subsections": []
            }
        }
    }
}