Source for file AAAA.php
Documentation is available at AAAA.php
* Net_DNS: A resolver library for PHP
* Copyright (c) 2002-2003 Eric Kilfoil eric@ypass.net
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Net_DNS_RR_AAAA object definition {{{ */
* A representation of a resource record of type <b>AAAA</b>
/* class variable definitions {{{ */
/* class constructor - Net_DNS_RR_AAAA(&$rro, $data, $offset = '') {{{ */
$this->name = $rro->name;
$this->type = $rro->type;
$this->class = $rro->class;
$this->rdata = $rro->rdata;
if (!preg_match('/^[0-9A-F]{0,4}$/i', $addr)) return;
/* Net_DNS_RR_AAAA::rdatastr() {{{ */
/* Net_DNS_RR_AAAA::rr_rdata($packet, $offset) {{{ */
/* Net_DNS_RR_AAAA::ipv6_compress($addr) {{{ */
if ($numparts < 3 || $numparts > 8 ||
!preg_match('/^([0-9A-F]{0,4}:){0,7}(:[0-9A-F]{0,4}){0,7}$/i', $addr)) {
/* Non-sensical IPv6 address */
return pack('n8', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 );
if (strpos($addr, '::') !== false ) {
/* First we have to normalize the address, turn :: into :0:0:0:0: */
if (substr($addr, 0 , 2 ) == '::') {
if (substr($addr, -2 , 2 ) == '::') {
/* Net_DNS_RR_AAAA::ipv6_decompress($pack) {{{ */
/* Must be 8 shorts long */
$addr = vsprintf("%x:%x:%x:%x:%x:%x:%x:%x", $a);
/* Shorthand the first :0:0: set into a :: */
/* TODO: Make this is a single replacement pattern */
if (substr($addr, -4 ) == ':0:0') {
} elseif (substr($addr, 0 , 4 ) == '0:0:') {
return '0:0:'. substr($addr, 4 );
* vim600: sw=4 ts=4 sts=4 cindent fdm=marker et
Documentation generated on Mon, 11 Mar 2019 14:35:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|