~edb/quam-plures/cronjob_stuff

« back to all changes in this revision

Viewing changes to qp_plugins/basic_antispam_plugin/Net/DNS/RR/PTR.php

  • Committer: EdB
  • Date: 2011-03-08 04:39:47 UTC
  • mfrom: (7592.1.1 quam-plures)
  • Revision ID: 1912webworks@gmail.com-20110308043947-apiklf384cgnwb7s
new stuff in core now here - woohoo!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
*  License Information:
 
4
*
 
5
*  Net_DNS:  A resolver library for PHP
 
6
*  Copyright (c) 2002-2003 Eric Kilfoil eric@ypass.net
 
7
*  Maintainers:
 
8
*  Marco Kaiser <bate@php.net>
 
9
*  Florian Anderiasch <fa@php.net>
 
10
*
 
11
* PHP versions 4 and 5
 
12
*
 
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.
 
18
*/
 
19
 
 
20
/* Net_DNS_RR_PTR definition {{{ */
 
21
/**
 
22
 * A representation of a resource record of type <b>PTR</b>
 
23
 *
 
24
 * @package Net_DNS
 
25
 */
 
26
class Net_DNS_RR_PTR extends Net_DNS_RR
 
27
{
 
28
    /* class variable definitions {{{ */
 
29
    var $name;
 
30
    var $type;
 
31
    var $class;
 
32
    var $ttl;
 
33
    var $rdlength;
 
34
    var $rdata;
 
35
    var $ptrdname;
 
36
 
 
37
    /* }}} */
 
38
    /* class constructor - RR(&$rro, $data, $offset = '') {{{ */
 
39
    function Net_DNS_RR_PTR(&$rro, $data, $offset = '')
 
40
    {
 
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;
 
47
 
 
48
 
 
49
        if ($offset) {
 
50
            if ($this->rdlength > 0) {
 
51
                $packet = new Net_DNS_Packet();
 
52
 
 
53
                list($ptrdname, $offset) = $packet->dn_expand($data, $offset);
 
54
                $this->ptrdname = $ptrdname;
 
55
            }
 
56
        } elseif (is_array($data)) {
 
57
            $this->ptrdname = $data['ptrdname'];
 
58
        } else {
 
59
            $this->ptrdname = preg_replace("/[ \t]+(.+)[ \t]*$/", '\\1', $data);
 
60
        }
 
61
    }
 
62
 
 
63
    /* }}} */
 
64
    /* Net_DNS_RR_PTR::rdatastr() {{{ */
 
65
    function rdatastr()
 
66
    {
 
67
        if (strlen($this->ptrdname)) {
 
68
            return $this->ptrdname . '.';
 
69
        }
 
70
        return '; no data';
 
71
    }
 
72
 
 
73
    /* }}} */
 
74
    /* Net_DNS_RR_PTR::rr_rdata($packet, $offset) {{{ */
 
75
    function rr_rdata($packet, $offset)
 
76
    {
 
77
        if (strlen($this->ptrdname)) {
 
78
            return $packet->dn_comp($this->ptrdname, $offset);
 
79
        }
 
80
        return null;
 
81
    }
 
82
 
 
83
    /* }}} */
 
84
}
 
85
/* }}} */
 
86
/* VIM settings {{{
 
87
 * Local variables:
 
88
 * tab-width: 4
 
89
 * c-basic-offset: 4
 
90
 * soft-stop-width: 4
 
91
 * c indent on
 
92
 * End:
 
93
 * vim600: sw=4 ts=4 sts=4 cindent fdm=marker et
 
94
 * vim<600: sw=4 ts=4
 
95
 * }}} */
 
96
?>