{
    "content": [
        {
            "type": "text",
            "text": "# NetAddr::IP::UtilPP (perldoc)\n\n## NAME\n\nNetAddr::IP::UtilPP -- pure Perl functions for NetAddr::IP::Util\n\n## SYNOPSIS\n\nuse NetAddr::IP::UtilPP qw(\nhasbits\nshiftleft\naddconst\nadd128\nsub128\nnotcontiguous\nipv4to6\nmask4to6\nipanyto6\nmaskanyto6\nipv6to4\nbin2bcd\nbcd2bin\n);\nuse NetAddr::IP::UtilPP qw(:all)\n$rv = hasbits($bits128);\n$bitsX2 = shiftleft($bits128,$n);\n$carry = addconst($ipv6naddr,$signed32con);\n($carry,$ipv6naddr)=addconst($ipv6naddr,$signed32con);\n$carry = add128($ipv6naddr1,$ipv6naddr2);\n($carry,$ipv6naddr)=add128($ipv6naddr1,$ipv6naddr2);\n$carry = sub128($ipv6naddr1,$ipv6naddr2);\n($spurious,$cidr) = notcontiguous($mask128);\n($carry,$ipv6naddr)=sub128($ipv6naddr1,$ipv6naddr2);\n$ipv6naddr = ipv4to6($netaddr);\n$ipv6naddr = mask4to6($netaddr);\n$ipv6naddr = ipanyto6($netaddr);\n$ipv6naddr = maskanyto6($netaddr);\n$netaddr = ipv6to4($pv6naddr);\n$bcdtext = bin2bcd($bits128);\n$bits128 = bcd2bin($bcdtxt);\n\n## DESCRIPTION\n\nNetAddr::IP::UtilPP provides pure Perl functions for NetAddr::IP::Util\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **EXPORTOK**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "NetAddr::IP::UtilPP",
        "section": "",
        "mode": "perldoc",
        "summary": "NetAddr::IP::UtilPP -- pure Perl functions for NetAddr::IP::Util",
        "synopsis": "use NetAddr::IP::UtilPP qw(\nhasbits\nshiftleft\naddconst\nadd128\nsub128\nnotcontiguous\nipv4to6\nmask4to6\nipanyto6\nmaskanyto6\nipv6to4\nbin2bcd\nbcd2bin\n);\nuse NetAddr::IP::UtilPP qw(:all)\n$rv = hasbits($bits128);\n$bitsX2 = shiftleft($bits128,$n);\n$carry = addconst($ipv6naddr,$signed32con);\n($carry,$ipv6naddr)=addconst($ipv6naddr,$signed32con);\n$carry = add128($ipv6naddr1,$ipv6naddr2);\n($carry,$ipv6naddr)=add128($ipv6naddr1,$ipv6naddr2);\n$carry = sub128($ipv6naddr1,$ipv6naddr2);\n($spurious,$cidr) = notcontiguous($mask128);\n($carry,$ipv6naddr)=sub128($ipv6naddr1,$ipv6naddr2);\n$ipv6naddr = ipv4to6($netaddr);\n$ipv6naddr = mask4to6($netaddr);\n$ipv6naddr = ipanyto6($netaddr);\n$ipv6naddr = maskanyto6($netaddr);\n$netaddr = ipv6to4($pv6naddr);\n$bcdtext = bin2bcd($bits128);\n$bits128 = bcd2bin($bcdtxt);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 35,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 131,
                "subsections": []
            },
            {
                "name": "EXPORTOK",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 31,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "NetAddr::IP::UtilPP -- pure Perl functions for NetAddr::IP::Util\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use NetAddr::IP::UtilPP qw(\nhasbits\nshiftleft\naddconst\nadd128\nsub128\nnotcontiguous\nipv4to6\nmask4to6\nipanyto6\nmaskanyto6\nipv6to4\nbin2bcd\nbcd2bin\n);\n\nuse NetAddr::IP::UtilPP qw(:all)\n\n$rv = hasbits($bits128);\n$bitsX2 = shiftleft($bits128,$n);\n$carry = addconst($ipv6naddr,$signed32con);\n($carry,$ipv6naddr)=addconst($ipv6naddr,$signed32con);\n$carry = add128($ipv6naddr1,$ipv6naddr2);\n($carry,$ipv6naddr)=add128($ipv6naddr1,$ipv6naddr2);\n$carry = sub128($ipv6naddr1,$ipv6naddr2);\n($spurious,$cidr) = notcontiguous($mask128);\n($carry,$ipv6naddr)=sub128($ipv6naddr1,$ipv6naddr2);\n$ipv6naddr = ipv4to6($netaddr);\n$ipv6naddr = mask4to6($netaddr);\n$ipv6naddr = ipanyto6($netaddr);\n$ipv6naddr = maskanyto6($netaddr);\n$netaddr = ipv6to4($pv6naddr);\n$bcdtext = bin2bcd($bits128);\n$bits128 = bcd2bin($bcdtxt);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "NetAddr::IP::UtilPP provides pure Perl functions for NetAddr::IP::Util\n\n*   $rv = hasbits($bits128);\n\nThis function returns true if there are one's present in the 128 bit string and false if all\nthe bits are zero.\n\ni.e.  if (hasbits($bits128)) {\n&dosomething;\n}\n\nor    if (hasbits($bits128 & $mask128) {\n&dosomething;\n}\n\nThis allows the implementation of logical functions of the form of:\n\nif ($bits128 & $mask128) {\n...\n\ninput:        128 bit IPv6 string\nreturns:      true if any bits are present\n\n*   $bitsXn = shiftleft($bits128,$n);\n\ninput:        128 bit string variable,\nnumber of shifts [optional]\nreturns:      bits X n shifts\n\nNOTE: input bits are returned\nif $n is not specified\n\n*   addconst($ipv6naddr,$signed32con);\n\nAdd a signed constant to a 128 bit string variable.\n\ninput:        128 bit IPv6 string,\nsigned 32 bit integer\nreturns:  scalar      carry\narray       (carry, result)\n\n*   add128($ipv6naddr1,$ipv6naddr2);\n\nAdd two 128 bit string variables.\n\ninput:        128 bit string var1,\n128 bit string var2\nreturns:  scalar      carry\narray       (carry, result)\n\n*   sub128($ipv6naddr1,$ipv6naddr2);\n\nSubtract two 128 bit string variables.\n\ninput:        128 bit string var1,\n128 bit string var2\nreturns:  scalar      carry\narray       (carry, result)\n\nNote: The carry from this operation is the result of adding the one's complement of ARG2 +1\nto the ARG1. It is logically NOT borrow.\n\ni.e.    if ARG1 >= ARG2 then carry = 1\nor      if ARG1  < ARG2 then carry = 0\n\n*   ($spurious,$cidr) = notcontiguous($mask128);\n\nThis function counts the bit positions remaining in the mask when the rightmost '0's are\nremoved.\n\ninput:  128 bit netmask\nreturns true if there are spurious\nzero bits remaining in the\nmask, false if the mask is\ncontiguous one's,\n128 bit cidr\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*   $ipv6naddr = mask4to6($netaddr);\n\nConvert an ipv4 netowrk address into an ipv6 network mask.\n\ninput:        32 bit network/mask address\nreturns:      128 bit network/mask address\n\nNOTE: returns the high 96 bits as one's\n\n*   $ipv6naddr = ipanyto6($netaddr);\n\nSimilar to ipv4to6 except that this function takes either an IPv4 or IPv6 input and always\nreturns a 128 bit IPv6 network address.\n\ninput:        32 or 128 bit network address\nreturns:      128 bit network address\n\n*   $ipv6naddr = maskanyto6($netaddr);\n\nSimilar to mask4to6 except that this function takes either an IPv4 or IPv6 netmask and\nalways returns a 128 bit IPv6 netmask.\n\ninput:        32 or 128 bit network mask\nreturns:      128 bit network mask\n\n*   $netaddr = ipv6to4($pv6naddr);\n\nTruncate the upper 96 bits of a 128 bit address and return the lower 32 bits. Returns an\nIPv4 address as returned by inetaton.\n\ninput:        128 bit network address\nreturns:      32 bit inetaton network address\n\n*   $bcdtext = bin2bcd($bits128);\n\nConvert a 128 bit binary string into binary coded decimal text digits.\n\ninput:        128 bit string variable\nreturns:      string of bcd text digits\n\n*   $bits128 = bcd2bin($bcdtxt);\n\nConvert a bcd text string to 128 bit string variable\n\ninput:        string of bcd text digits\nreturns:      128 bit string variable\n",
                "subsections": []
            },
            "EXPORTOK": {
                "content": "hasbits\nshiftleft\naddconst\nadd128\nsub128\nnotcontiguous\nipv4to6\nmask4to6\nipanyto6\nmaskanyto6\nipv6to4\nbin2bcd\nbcd2bin\ncomp128\nbin2bcdn\nbcdn2txt\nbcdn2bin\nsimplepack\nthreads\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": []
            }
        }
    }
}