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
* Marco Kaiser <bate@php.net>
* Florian Anderiasch <fa@php.net>
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
require_once("Net/DNS/RR/A.php");
require_once("Net/DNS/RR/AAAA.php");
require_once("Net/DNS/RR/NS.php");
require_once("Net/DNS/RR/CNAME.php");
require_once("Net/DNS/RR/PTR.php");
require_once("Net/DNS/RR/SOA.php");
require_once("Net/DNS/RR/MX.php");
require_once("Net/DNS/RR/TSIG.php");
require_once("Net/DNS/RR/TXT.php");
require_once("Net/DNS/RR/HINFO.php");
require_once("Net/DNS/RR/SRV.php");
require_once("Net/DNS/RR/NAPTR.php");
require_once("Net/DNS/RR/RP.php");
require_once("Net/DNS/RR/SPF.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
function &factory($rrdata, $update_type = '')
} 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 = '') {{{ */
while (count($parts) > 0 ) {
$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;
$obj = new $scn($rr, $rdata);
/* Net_DNS_RR::new_from_array($rrarray) {{{ */
foreach ($rrarray as $k => $v) {
if (! strlen ($rr->name )) {
$scn = 'Net_DNS_RR_' . $rr->type;
$obj = new $scn($rr, !empty ($rr->rdata) ? $rr->rdata : $rrarray);
/* 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 15:41:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|