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

Class: Net_IPv6

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

Class Overview


Class to validate and to work with IPv6 addresses.


Author(s):

Version:

  • CVS: $Id: IPv6.php,v 1.15 2007/11/16 00:22:28 alexmerz Exp $

Copyright:

  • 2003-2005 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

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


[ Top ]


Method Detail

checkIPv6   [line 465]

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 394]

string 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: Net_IPv6::Uncompress()
  • Access: public

Parameters:

string   $ip   —  a valid IPv6-adress (hex format)

[ Top ]

getAddressType   [line 264]

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 173]

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 148]

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 ]

isInNetmask   [line 208]

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 ]

removeNetmaskSpec   [line 128]

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 ]

SplitV64   [line 439]

array SplitV64( string $ip)

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)

[ Top ]

Uncompress   [line 322]

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


Parameters:

string   $ip   —  a valid IPv6-adress (hex format)

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:11:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.