当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_DNS2_Packet::compress方法代码示例

本文整理汇总了PHP中Net_DNS2_Packet::compress方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_DNS2_Packet::compress方法的具体用法?PHP Net_DNS2_Packet::compress怎么用?PHP Net_DNS2_Packet::compress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_DNS2_Packet的用法示例。


在下文中一共展示了Net_DNS2_Packet::compress方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rrGet

    /**
     * returns the rdata portion of the DNS packet
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
     *                                 compressed names
     *
     * @return mixed                   either returns a binary packed
     *                                 string or null on failure
     * @access protected
     *
     */
    protected function rrGet(Net_DNS2_Packet &$packet)
    {
        if (strlen($this->map822) > 0) {
            
            $data = pack('n', $this->preference);
            $packet->offset += 2;

            $data .= $packet->compress($this->map822, $packet->offset);
            $data .= $packet->compress($this->mapx400, $packet->offset);

            return $data;
        }

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:26,代码来源:PX.php

示例2: rrGet

    /**
     * returns the rdata portion of the DNS packet
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
     *                                 compressed names
     *
     * @return mixed                   either returns a binary packed
     *                                 string or null on failure
     * @access protected
     *
     */
    protected function rrGet(Net_DNS2_Packet &$packet)
    {
        if ( (strlen($this->hit) > 0) && (strlen($this->public_key) > 0) ) {

            //
            // pack the length, algorithm and HIT values
            //
            $data = pack(
                'CCnH*', 
                $this->hit_length, 
                $this->pk_algorithm, 
                $this->pk_length,
                $this->hit                
            );
            
            //
            // add the public key
            //
            $data .= base64_decode($this->public_key);

            //
            // add the offset
            //
            $packet->offset += strlen($data);

            //
            // add each rendezvous server
            //
            foreach ($this->rendezvous_servers as $index => $server) {

                $data .= $packet->compress($server, $packet->offset);
            }

            return $data;
        }

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:49,代码来源:HIP.php

示例3: rrGet

    /**
     * returns the rdata portion of the DNS packet
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
     *                                 compressed names
     *
     * @return mixed                   either returns a binary packed
     *                                 string or null on failure
     * @access protected
     *
     */
    protected function rrGet(Net_DNS2_Packet &$packet)
    {
        if (strlen($this->next_domain_name) > 0) {

            $data = $packet->compress($this->next_domain_name, $packet->offset);
            $bitmap = Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
    
            $packet->offset += strlen($bitmap);

            return $data . $bitmap;
        }

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:25,代码来源:NSEC.php

示例4: rrGet

 /**
  * returns the rdata portion of the DNS packet
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
  *                                 compressed names
  *
  * @return mixed                   either returns a binary packed
  *                                 string or null on failure
  * @access protected
  *
  */
 protected function rrGet(Net_DNS2_Packet &$packet)
 {
     if (strlen($this->mname) > 0) {
         $data = $packet->compress($this->mname, $packet->offset);
         $data .= $packet->compress($this->rname, $packet->offset);
         $data .= pack('N5', $this->serial, $this->refresh, $this->retry, $this->expire, $this->minimum);
         $packet->offset += 20;
         return $data;
     }
     return null;
 }
开发者ID:martinsv,项目名称:phpipam,代码行数:22,代码来源:SOA.php

示例5: get

 /**
  * returns a binary packed Net_DNS2_Question object
  *
  * @param Net_DNS2_Packet &$packet the Net_DNS2_Packet object this question is
  *                                 part of. This needs to be passed in so that
  *                                 the compressed qname value can be packed in
  *                                 with the names of the other parts of the
  *                                 packet.
  *
  * @return string
  * @throws Net_DNS2_Exception
  * @access public
  *
  */
 public function get(Net_DNS2_Packet &$packet)
 {
     //
     // validate the type and class
     //
     $type = Net_DNS2_Lookups::$rr_types_by_name[$this->qtype];
     $class = Net_DNS2_Lookups::$classes_by_name[$this->qclass];
     if (!isset($type) || !isset($class)) {
         throw new Net_DNS2_Exception('invalid question section: invalid type (' . $this->qtype . ') or class (' . $this->qclass . ') specified.', Net_DNS2_Lookups::E_QUESTION_INVALID);
     }
     $data = $packet->compress($this->qname, $packet->offset);
     $data .= chr($type << 8) . chr($type) . chr($class << 8) . chr($class);
     $packet->offset += 4;
     return $data;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:29,代码来源:Question.php

示例6: rrGet

 /**
  * returns the rdata portion of the DNS packet
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
  *                                 compressed names
  *
  * @return mixed                   either returns a binary packed
  *                                 string or null on failure
  * @access protected
  *
  */
 protected function rrGet(Net_DNS2_Packet &$packet)
 {
     if (strlen($this->target) > 0) {
         $data = pack('nn', $this->priority, $this->weight);
         $packet->offset += 4;
         $data .= $packet->compress(trim($this->target, '"'), $packet->offset);
         return $data;
     }
     return null;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:21,代码来源:URI.php

示例7: rrGet

 /**
  * returns the rdata portion of the DNS packet
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
  *                                 compressed names
  *
  * @return mixed                   either returns a binary packed
  *                                 string or null on failure
  * @access protected
  *
  */
 protected function rrGet(Net_DNS2_Packet &$packet)
 {
     if (strlen($this->intermediatehost) > 0) {
         $data = pack('n', $this->preference);
         $packet->offset += 2;
         $data .= $packet->compress($this->intermediatehost, $packet->offset);
         return $data;
     }
     return null;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:21,代码来源:RT.php

示例8: rrGet

    /**
     * returns the rdata portion of the DNS packet
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
     *                                 compressed names
     *
     * @return mixed                   either returns a binary packed
     *                                 string or null on failure
     * @access protected
     *
     */
    protected function rrGet(Net_DNS2_Packet &$packet)
    {
        if (strlen($this->mboxdname) > 0) {

            return $packet->compress($this->mboxdname, $packet->offset) .
                $packet->compress($this->txtdname, $packet->offset);
        }

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:21,代码来源:RP.php

示例9: rrGet

    /**
     * returns the rdata portion of the DNS packet
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
     *                                 compressed names
     *
     * @return mixed                   either returns a binary packed
     *                                 string or null on failure
     * @access protected
     *
     */
    protected function rrGet(Net_DNS2_Packet &$packet)
    {
        if ( (isset($this->order)) && (strlen($this->services) > 0) ) {
            
            $data = pack('nn', $this->order, $this->preference);

            $data .= chr(strlen($this->flags)) . $this->flags;
            $data .= chr(strlen($this->services)) . $this->services;
            $data .= chr(strlen($this->regexp)) . $this->regexp;

            $packet->offset += strlen($data);

            $data .= $packet->compress($this->replacement, $packet->offset);

            return $data;
        }

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:30,代码来源:NAPTR.php

示例10: get

 /**
  * returns a binary packed DNS RR object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet used for
  *                                 compressing names
  *
  * @return string
  * @throws Net_DNS2_Exception
  * @access public
  *
  */
 public function get(Net_DNS2_Packet &$packet)
 {
     $data = '';
     $rdata = '';
     //
     // pack the name
     //
     $data = $packet->compress($this->name, $packet->offset);
     //
     // pack the main values
     //
     if ($this->type == 'OPT') {
         //
         // pre-build the TTL value
         //
         $this->preBuild();
         //
         // the class value is different for OPT types
         //
         $data .= pack('nnN', Net_DNS2_Lookups::$rr_types_by_name[$this->type], $this->class, $this->ttl);
     } else {
         $data .= pack('nnN', Net_DNS2_Lookups::$rr_types_by_name[$this->type], Net_DNS2_Lookups::$classes_by_name[$this->class], $this->ttl);
     }
     //
     // increase the offset, and allow for the rdlength
     //
     $packet->offset += 10;
     //
     // get the RR specific details
     //
     if ($this->rdlength != -1) {
         $rdata = $this->rrGet($packet);
     }
     //
     // add the RR
     //
     $data .= pack('n', strlen($rdata)) . $rdata;
     return $data;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:50,代码来源:RR.php

示例11: rrGet

 /**
  * returns the rdata portion of the DNS packet
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
  *                                 compressed names
  *
  * @return mixed                   either returns a binary packed
  *                                 string or null on failure
  * @access protected
  *
  */
 protected function rrGet(Net_DNS2_Packet &$packet)
 {
     if (strlen($this->hostname) > 0) {
         $data = pack('n', $this->subtype);
         $packet->offset += 2;
         $data .= $packet->compress($this->hostname, $packet->offset);
         return $data;
     }
     return null;
 }
开发者ID:martinsv,项目名称:phpipam,代码行数:21,代码来源:AFSDB.php


注:本文中的Net_DNS2_Packet::compress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。