Net_DNS
[ class tree: Net_DNS ] [ index: Net_DNS ] [ all elements ]

Source for file HINFO.php

Documentation is available at HINFO.php

  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.  *
  8.  *    This library is free software; you can redistribute it and/or
  9.  *    modify it under the terms of the GNU Lesser General Public
  10.  *    License as published by the Free Software Foundation; either
  11.  *    version 2.1 of the License, or (at your option) any later version.
  12.  *
  13.  *    This library is distributed in the hope that it will be useful,
  14.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  *    Lesser General Public License for more details.
  17.  *
  18.  *    You should have received a copy of the GNU Lesser General Public
  19.  *    License along with this library; if not, write to the Free Software
  20.  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21.  */
  22.  
  23. /* Net_DNS_RR_HINFO definition {{{ */
  24. /**
  25.  * A representation of a resource record of type <b>HINFO</b>
  26.  *
  27.  * @package Net_DNS
  28.  */
  29. class Net_DNS_RR_HINFO extends Net_DNS_RR
  30. {
  31.     /* class variable definitions {{{ */
  32.     var $name;
  33.     var $type;
  34.     var $class;
  35.     var $ttl;
  36.     var $rdlength;
  37.     var $rdata;
  38.     var $cpu;
  39.     var $os;
  40.  
  41.     /* }}} */
  42.     /* class constructor - RR(&$rro, $data, $offset = '') {{{ */
  43.     function Net_DNS_RR_HINFO(&$rro$data$offset '')
  44.     {
  45.         $this->name = $rro->name;
  46.         $this->type = $rro->type;
  47.         $this->class = $rro->class;
  48.         $this->ttl = $rro->ttl;
  49.         $this->rdlength = $rro->rdlength;
  50.         $this->rdata = $rro->rdata;
  51.  
  52.         if ($offset{
  53.             if ($this->rdlength > 0{
  54.                 list($cpu$offsetNet_DNS_Packet::label_extract($data$offset);
  55.                 list($os,  $offsetNet_DNS_Packet::label_extract($data$offset);
  56.  
  57.                 $this->cpu = $cpu;
  58.                 $this->os  = $os;
  59.             }
  60.         else {
  61.             $data str_replace('\\\\'chr(1chr(1)$data)/* disguise escaped backslash */
  62.             $data str_replace('\\"'chr(2chr(2)$data)/* disguise \" */
  63.  
  64.             ereg('("[^"]*"|[^ \t]*)[ \t]+("[^"]*"|[^ \t]*)[ \t]*$'$data$regs);
  65.             foreach($regs as $idx => $value{
  66.                 $value str_replace(chr(2chr(2)'\\"'$value);
  67.                 $value str_replace(chr(1chr(1)'\\\\'$value);
  68.                 $regs[$idxstripslashes($value);
  69.             }
  70.  
  71.             $this->cpu = $regs[1];
  72.             $this->os = $regs[2];
  73.         }
  74.     }
  75.  
  76.     /* }}} */
  77.     /* Net_DNS_RR_HINFO::rdatastr() {{{ */
  78.     function rdatastr()
  79.     {
  80.         if ($this->text{
  81.             return '"' addslashes($this->cpu'" "' addslashes($this->os'"';
  82.         else return '; no data';
  83.     }
  84.  
  85.     /* }}} */
  86.     /* Net_DNS_RR_HINFO::rr_rdata($packet, $offset) {{{ */
  87.     function rr_rdata($packet$offset)
  88.     {
  89.         if ($this->text{
  90.             $rdata  pack('C'strlen($this->cpu)) $this->cpu;
  91.             $rdata .= pack('C'strlen($this->os))  $this->os;
  92.             return $rdata;
  93.         }
  94.         return null;
  95.     }
  96.  
  97.     /* }}} */
  98. }
  99. /* }}} */
  100. /* VIM settings {{{
  101.  * Local variables:
  102.  * tab-width: 4
  103.  * c-basic-offset: 4
  104.  * soft-stop-width: 4
  105.  * c indent on
  106.  * End:
  107.  * vim600: sw=4 ts=4 sts=4 cindent fdm=marker et
  108.  * vim<600: sw=4 ts=4
  109.  * }}} */
  110. ?>

Documentation generated on Mon, 11 Mar 2019 14:35:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.