Source for file RR.php
Documentation is available at RR.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
require_once(" $phpdns_basedir/DNS/RR/A.php" );
require_once(" $phpdns_basedir/DNS/RR/AAAA.php" );
require_once(" $phpdns_basedir/DNS/RR/NS.php" );
require_once(" $phpdns_basedir/DNS/RR/CNAME.php" );
require_once(" $phpdns_basedir/DNS/RR/PTR.php" );
require_once(" $phpdns_basedir/DNS/RR/SOA.php" );
require_once(" $phpdns_basedir/DNS/RR/MX.php" );
require_once(" $phpdns_basedir/DNS/RR/TSIG.php" );
require_once(" $phpdns_basedir/DNS/RR/TXT.php" );
require_once(" $phpdns_basedir/DNS/RR/HINFO.php" );
require_once(" $phpdns_basedir/DNS/RR/SRV.php" );
require_once(" $phpdns_basedir/DNS/RR/NAPTR.php" );
/* Net_DNS_RR object definition {{{ */
* Resource Record object definition
* Builds or parses resource record sections of the DNS packet including
* the answer, authority, and additional sections of the packet.
/* class variable definitions {{{ */
* Use Net_DNS_RR::factory() instead
/* class constructor - Net_DNS_RR($rrdata) {{{ */
if ($rrdata != 'getRR') { //BC check/warning remove later
* Returns an RR object, use this instead of constructor
* @param mixed $rr_rdata Options as string, array or data
* @return object Net_DNS_RR or Net_DNS_RR_<type>
* @see Net_DNS_RR::new_from_array Net_DNS_RR::new_from_data Net_DNS_RR::new_from_string
} elseif (count($rrdata) == 7 ) {
list ($name, $rrtype, $rrclass, $ttl, $rdlength, $data, $offset) = $rrdata;
/* Net_DNS_RR::new_from_data($name, $ttl, $rrtype, $rrclass, $rdlength, $data, $offset) {{{ */
function &new_from_data($name, $rrtype, $rrclass, $ttl, $rdlength, $data, $offset)
$rr->rdlength = $rdlength;
$rr->rdata = substr($data, $offset, $rdlength);
$scn = 'Net_DNS_RR_' . $rrtype;
$rr = new $scn($rr, $data, $offset);
/* Net_DNS_RR::new_from_string($rrstring, $update_type = '') {{{ */
$rdata = join(' ', $parts);
$rdata = join(' ', $parts);
if (! strlen($rrtype) && strlen($rrclass) && $rrclass == 'ANY') {
} else if (! isset ($rrclass)) {
if ($update_type == 'yxrrset') {
} else if ($update_type == 'nxrrset') {
} else if ($update_type == 'yxdomain') {
} else if ($update_type == 'nxdomain') {
} else if (preg_match('/^(rr_)?add$/', $update_type)) {
} else if (preg_match('/^(rr_)?del(ete)?$/', $update_type)) {
$rrclass = $rdata ? 'NONE' : 'ANY';
$scn = 'Net_DNS_RR_' . $rrtype;
return new $scn($rr, $rdata);
/* Net_DNS_RR::new_from_array($rrarray) {{{ */
foreach ($rrarray as $k => $v) {
if (! strlen ($rr->name )) {
$scn = 'Net_DNS_RR_' . $rrtype;
return new $scn($rr, $rdata);
/* Net_DNS_RR::display() {{{ */
/* Net_DNS_RR::string() {{{ */
/* Net_DNS_RR::rdatastr() {{{ */
return '; rdlength = ' . $this->rdlength;
/* Net_DNS_RR::rdata() {{{ */
function rdata(&$packetORrdata, $offset = '')
return $this->rr_rdata($packetORrdata, $offset);
/* Net_DNS_RR::rr_rdata($packet, $offset) {{{ */
/* Net_DNS_RR::data() {{{ */
function data(&$packet, $offset)
$data = $packet->dn_comp ($this->name, $offset);
$offset += strlen($data) + 2; // The 2 extra bytes are for rdlength
$rdata = $this->rdata($packet, $offset);
* vim600: sw=4 ts=4 sts=4 cindent fdm=marker et
Documentation generated on Mon, 11 Mar 2019 14:35:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|