Net_IPv6
[ class tree: Net_IPv6 ] [ index: Net_IPv6 ] [ all elements ]

Class: Net_IPv6

Source Location: /Net_IPv6-1.1.0b2/IPv6.php

Class Overview


Class to validate and to work with IPv6 addresses.


Author(s):

Version:

  • Release: 1.1.0RC5

Copyright:

  • 2003-2005 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

[line 117]
Class to validate and to work with IPv6 addresses.


[ Top ]


Method Detail

checkIPv6   [line 657]

Boolean checkIPv6( String $ip)

Checks an IPv6 adress

Checks if the given IP is IPv6-compatible

  • Return: true if $ip is an IPv6 adress
  • Access: public

Parameters:

String   $ip     a valid IPv6-adress

[ Top ]

compress   [line 530]

tring compress( String $ip)

Compresses an IPv6 adress

RFC 2373 allows you to compress zeros in an adress to '::'. This function expects an valid IPv6 adress and compresses successive zeros to '::'

Example: FF01:0:0:0:0:0:0:101 -> FF01::101 0:0:0:0:0:0:0:1 -> ::1

  • Return: the compressed IPv6-adress (hex format)
  • Author: elfrink at introweb dot nl
  • See: Uncompress()
  • Access: public

Parameters:

String   $ip     a valid IPv6-adress (hex format)

[ Top ]

getAddressType   [line 325]

int getAddressType( String $ip)

Returns the type of an IPv6 address.

RFC 1883, Section 2.3 describes several types of addresses in the IPv6 addresse space. Several addresse types are markers for reserved spaces and as consequence a subject to change.


Parameters:

String   $ip     the IP address in Hex format, compressed IPs are allowed

[ Top ]

getNetmask   [line 195]

String getNetmask( String $ip, [int $bits = null])

Calculates the network prefix based on the netmask bits.
  • Return: the network prefix
  • Since: 1.1.0
  • Access: public

Parameters:

String   $ip     the (compressed) IP in Hex format
int   $bits     if the number of netmask bits is not part of the IP you must provide the number of bits

[ Top ]

getNetmaskSpec   [line 161]

String getNetmaskSpec( String $ip)

Returns a possible existing netmask specification at an IP addresse.
  • Return: the netmask spec
  • Since: 1.1.0
  • Access: public

Parameters:

String   $ip     the (compressed) IP as Hex representation

[ Top ]

getPrefixLength   [line 743]

Mixed getPrefixLength( String $ip)

Tests for a prefix length specification in the address and returns the prefix length, if exists
  • Return: the prefix as String or false, if no prefix was found
  • Access: public

Parameters:

String   $ip     a valid ipv6 address

[ Top ]

isInNetmask   [line 245]

boolean isInNetmask( String $ip, String $netmask, [int $bits = null])

Checks if an (compressed) IP is in a specific address space.

IF the IP does not contains the number of netmask bits (F8000::FFFF/16) then you have to use the $bits parameter.

  • Return: true if $ip is in the netmask
  • Since: 1.1.0
  • Access: public

Parameters:

String   $ip     the IP to check (eg. F800::FFFF)
String   $netmask     the netmask (eg F800::)
int   $bits     the number of netmask bits to compare, if not given in $ip

[ Top ]

parseAddress   [line 808]

Array parseAddress( String $ipToParse, [String $bits = null])

Returns the lowest and highest IPv6 address for a given IP and netmask specification

The netmask may be a part of the $ip or the number of netwask bits is provided via $bits

The result is an indexed array. The key 'start' contains the lowest possible IP adress. The key 'end' the highest address.

  • Return: ['start', 'end'] the lowest and highest IPv6 address
  • Author: Nicholas Williams
  • Access: public

Parameters:

String   $ipToParse     the IPv6 address
String   $bits     the optional count of netmask bits

[ Top ]

removeNetmaskSpec   [line 132]

String removeNetmaskSpec( String $ip)

Removes a possible existing netmask specification at an IP addresse.
  • Return: the IP without netmask length
  • Since: 1.1.0
  • Access: public

Parameters:

String   $ip     the (compressed) IP as Hex representation

[ Top ]

removePrefixLength   [line 771]

String removePrefixLength( String $ip)

Tests for a prefix length specification in the address and removes the prefix length, if exists
  • Return: the address without a prefix length
  • Access: public

Parameters:

String   $ip     a valid ipv6 address

[ Top ]

SplitV64   [line 618]

Array SplitV64( String $ip, [Boolean $uncompress = true])

Splits an IPv6 adress into the IPv6 and a possible IPv4 part

RFC 2373 allows you to note the last two parts of an IPv6 adress as an IPv4 compatible adress

Example: 0:0:0:0:0:0:13.1.68.3 0:0:0:0:0:FFFF:129.144.52.38

  • Return: [0] contains the IPv6 part, [1] the IPv4 part (hex format)
  • Access: public

Parameters:

String   $ip     a valid IPv6-adress (hex format)
Boolean   $uncompress     if true, the address will be uncompressed before processing

[ Top ]

uncompress   [line 409]

String uncompress( String $ip)

Uncompresses an IPv6 adress

RFC 2373 allows you to compress zeros in an adress to '::'. This function expects an valid IPv6 adress and expands the '::' to the required zeros.

Example: FF01::101 -> FF01:0:0:0:0:0:0:101 ::1 -> 0:0:0:0:0:0:0:1

  • Return: the uncompressed IPv6-adress (hex format)
  • See: Compress()
  • Access: public

Parameters:

String   $ip     a valid IPv6-adress (hex format)

[ Top ]


Documentation generated on Mon, 18 May 2009 02:30:03 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.