/inet6.php

Description

IPv6 Address Functions for PHP

Functions to manipulate IPv6 addresses for PHP

Copyright (C) 2009 Ray Patrick Soucy

LICENSE:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Functions
inet6_compress (line 80)

Compress an IPv6 Address

This will take an IPv6 address and rewrite it in short form.

  • return: The address in short form notation
string inet6_compress (string $addr)
  • string $addr: A valid IPv6 address
inet6_expand (line 42)

Expand an IPv6 Address

This will take an IPv6 address written in short form and expand it to include all zeros.

  • return: The expanded notation IPv6 address
string inet6_expand (string $addr)
  • string $addr: A valid IPv6 address
inet6_prefix_to_mask (line 95)

Generate an IPv6 mask from prefix notation

This will convert a prefix to an IPv6 address mask (used for IPv6 math)

  • return: The IPv6 mask address for the prefix size
string inet6_prefix_to_mask (integer $prefix)
  • integer $prefix: The prefix size, an integer between 1 and 127 (inclusive)
inet6_to_int64 (line 150)

Convert an IPv6 address to two 64-bit integers.

This will translate an IPv6 address into two 64-bit integer values for storage in an SQL database.

  • return: An array with two strings containing the 64-bit interger values
array inet6_to_int64 (string $addr)
  • string $addr: A valid IPv6 address
inet6_to_range (line 120)

Convert an IPv6 address and prefix size to an address range for the network.

This will take an IPv6 address and prefix and return the first and last address available for the network.

  • return: An array with two strings containing the start and end address for the IPv6 network
array inet6_to_range (string $addr, integer $prefix)
  • string $addr: A valid IPv6 address
  • integer $prefix: The prefix size, an integer between 1 and 127 (inclusive)
int64_to_inet6 (line 174)

Convert two 64-bit integer values into an IPv6 address

This will translate an array of 64-bit integer values back into an IPv6 address

  • return: An IPv6 address
string int64_to_inet6 (array $val)
  • array $val: An array containing two strings representing 64-bit integer values

Documentation generated on Sat, 28 Mar 2009 00:37:05 -0400 by phpDocumentor 1.4.2