1 | <?php |
||
18 | class Requests_IPv6 { |
||
19 | /** |
||
20 | * Uncompresses an IPv6 address |
||
21 | * |
||
22 | * RFC 4291 allows you to compress consecutive zero pieces in an address to |
||
23 | * '::'. This method expects a valid IPv6 address and expands the '::' to |
||
24 | * the required number of zero pieces. |
||
25 | * |
||
26 | * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 |
||
27 | * ::1 -> 0:0:0:0:0:0:0:1 |
||
28 | * |
||
29 | * @author Alexander Merz <[email protected]> |
||
30 | * @author elfrink at introweb dot nl |
||
31 | * @author Josh Peck <jmp at joshpeck dot org> |
||
32 | * @copyright 2003-2005 The PHP Group |
||
33 | * @license http://www.opensource.org/licenses/bsd-license.php |
||
34 | * @param string $ip An IPv6 address |
||
35 | * @return string The uncompressed IPv6 address |
||
36 | */ |
||
37 | public static function uncompress($ip) { |
||
70 | |||
71 | /** |
||
72 | * Compresses an IPv6 address |
||
73 | * |
||
74 | * RFC 4291 allows you to compress consecutive zero pieces in an address to |
||
75 | * '::'. This method expects a valid IPv6 address and compresses consecutive |
||
76 | * zero pieces to '::'. |
||
77 | * |
||
78 | * Example: FF01:0:0:0:0:0:0:101 -> FF01::101 |
||
79 | * 0:0:0:0:0:0:0:1 -> ::1 |
||
80 | * |
||
81 | * @see uncompress() |
||
82 | * @param string $ip An IPv6 address |
||
83 | * @return string The compressed IPv6 address |
||
84 | */ |
||
85 | public static function compress($ip) { |
||
114 | |||
115 | /** |
||
116 | * Splits an IPv6 address into the IPv6 and IPv4 representation parts |
||
117 | * |
||
118 | * RFC 4291 allows you to represent the last two parts of an IPv6 address |
||
119 | * using the standard IPv4 representation |
||
120 | * |
||
121 | * Example: 0:0:0:0:0:0:13.1.68.3 |
||
122 | * 0:0:0:0:0:FFFF:129.144.52.38 |
||
123 | * |
||
124 | * @param string $ip An IPv6 address |
||
125 | * @return string[] [0] contains the IPv6 represented part, and [1] the IPv4 represented part |
||
126 | */ |
||
127 | protected static function split_v6_v4($ip) { |
||
138 | |||
139 | /** |
||
140 | * Checks an IPv6 address |
||
141 | * |
||
142 | * Checks if the given IP is a valid IPv6 address |
||
143 | * |
||
144 | * @param string $ip An IPv6 address |
||
145 | * @return bool true if $ip is a valid IPv6 address |
||
146 | */ |
||
147 | public static function check_ipv6($ip) { |
||
190 | } |
||
191 |