5
* Net_DNS: A resolver library for PHP
6
* Copyright (c) 2002-2003 Eric Kilfoil eric@ypass.net
8
* Marco Kaiser <bate@php.net>
9
* Florian Anderiasch <fa@php.net>
11
* PHP versions 4 and 5
13
* LICENSE: This source file is subject to version 3.01 of the PHP license
14
* that is available through the world-wide-web at the following URI:
15
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
16
* the PHP License and are unable to obtain it through the web, please
17
* send a note to license@php.net so we can mail you a copy immediately.
20
/* Net_DNS_RR_CNAME definition {{{ */
22
* A representation of a resource record of type <b>CNAME</b>
26
class Net_DNS_RR_CNAME extends Net_DNS_RR
28
/* class variable definitions {{{ */
38
/* class constructor - RR(&$rro, $data, $offset = '') {{{ */
39
function Net_DNS_RR_CNAME(&$rro, $data, $offset = '')
41
$this->name = $rro->name;
42
$this->type = $rro->type;
43
$this->class = $rro->class;
44
$this->ttl = $rro->ttl;
45
$this->rdlength = $rro->rdlength;
46
$this->rdata = $rro->rdata;
49
if ($this->rdlength > 0) {
50
$packet = new Net_DNS_Packet();
51
list($cname, $offset) = $packet->dn_expand($data, $offset);
52
$this->cname = $cname;
54
} elseif (is_array($data)) {
55
$this->cname = $data['cname'];
57
$this->cname = preg_replace("/[ \t]+(.+)[\. \t]*$/", '\\1', $data);
62
/* Net_DNS_RR_CNAME::rdatastr() {{{ */
65
if (strlen($this->cname)) {
66
return $this->cname . '.';
72
/* Net_DNS_RR_CNAME::rr_rdata($packet, $offset) {{{ */
73
function rr_rdata($packet, $offset)
75
if (strlen($this->cname)) {
76
return $packet->dn_comp($this->cname, $offset);
91
* vim600: sw=4 ts=4 sts=4 cindent fdm=marker et