• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Net_DNS2_Packet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Net_DNS2_Packet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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->mboxdname) > 0) {

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

        return null;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:21,代码来源:RP.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->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


示例3: rrSet

 /**
  * parses the rdata of the Net_DNS2_Packet object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
  *
  * @return boolean
  * @access protected
  *
  */
 protected function rrSet(Net_DNS2_Packet &$packet)
 {
     if ($this->rdlength > 0) {
         //
         // unpack
         //
         $x = unpack('ntc/Calgorithm/Clabels/Norigttl/Nsigexp/Nsigincep/nkeytag', $this->rdata);
         $this->typecovered = Net_DNS2_Lookups::$rr_types_by_id[$x['tc']];
         $this->algorithm = $x['algorithm'];
         $this->labels = $x['labels'];
         $this->origttl = $x['origttl'];
         //
         // the dates are in GM time
         //
         $this->sigexp = gmdate('YmdHis', $x['sigexp']);
         $this->sigincep = gmdate('YmdHis', $x['sigincep']);
         //
         // get the keytag
         //
         $this->keytag = $x['keytag'];
         //
         // get teh signers name and signature
         //
         $offset = $packet->offset + 18;
         $sigoffset = $offset;
         $this->signname = strtolower(Net_DNS2_Packet::expand($packet, $sigoffset));
         $this->signature = base64_encode(substr($this->rdata, 18 + ($sigoffset - $offset)));
         return true;
     }
     return false;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:40,代码来源:SIG.php


示例4: parse

 /**
  * parses a binary packet, and returns the appropriate Net_DNS2_RR object,
  * based on the RR type of the binary content.
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet used for
  *                                 decompressing names
  *
  * @return mixed                   returns a new Net_DNS2_RR_* object for
  *                                 the given RR
  * @throws Net_DNS2_Exception
  * @access public
  *
  */
 public static function parse(Net_DNS2_Packet &$packet)
 {
     $object = array();
     //
     // expand the name
     //
     $object['name'] = $packet->expand($packet, $packet->offset);
     if (is_null($object['name'])) {
         throw new Net_DNS2_Exception('failed to parse resource record: failed to expand name.', Net_DNS2_Lookups::E_PARSE_ERROR);
     }
     if ($packet->rdlength < $packet->offset + 10) {
         throw new Net_DNS2_Exception('failed to parse resource record: packet too small.', Net_DNS2_Lookups::E_PARSE_ERROR);
     }
     //
     // unpack the RR details
     //
     $object['type'] = ord($packet->rdata[$packet->offset++]) << 8 | ord($packet->rdata[$packet->offset++]);
     $object['class'] = ord($packet->rdata[$packet->offset++]) << 8 | ord($packet->rdata[$packet->offset++]);
     $object['ttl'] = ord($packet->rdata[$packet->offset++]) << 24 | ord($packet->rdata[$packet->offset++]) << 16 | ord($packet->rdata[$packet->offset++]) << 8 | ord($packet->rdata[$packet->offset++]);
     $object['rdlength'] = ord($packet->rdata[$packet->offset++]) << 8 | ord($packet->rdata[$packet->offset++]);
     if ($packet->rdlength < $packet->offset + $object['rdlength']) {
         return null;
     }
     //
     // lookup the class to use
     //
     $o = null;
     $class = Net_DNS2_Lookups::$rr_types_id_to_class[$object['type']];
     if (isset($class)) {
         $o = new $class($packet, $object);
         if ($o) {
             $packet->offset += $object['rdlength'];
         }
     } else {
         throw new Net_DNS2_Exception('un-implemented resource record type: ' . $object['type'], Net_DNS2_Lookups::E_RR_INVALID);
     }
     return $o;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:51,代码来源:RR.php


示例5: 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


示例6: rrSet

 /**
  * parses the rdata of the Net_DNS2_Packet object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
  *
  * @return boolean
  * @access protected
  *
  */
 protected function rrSet(Net_DNS2_Packet &$packet)
 {
     if ($this->rdlength > 0) {
         //
         // parse off the precedence, gateway type and algorithm
         //
         $x = unpack('Cprecedence/Cgateway_type/Calgorithm', $this->rdata);
         $this->precedence = $x['precedence'];
         $this->gateway_type = $x['gateway_type'];
         $this->algorithm = $x['algorithm'];
         $offset = 3;
         //
         // extract the gatway based on the type
         //
         switch ($this->gateway_type) {
             case self::GATEWAY_TYPE_NONE:
                 $this->gateway = '';
                 break;
             case self::GATEWAY_TYPE_IPV4:
                 $this->gateway = inet_ntop(substr($this->rdata, $offset, 4));
                 $offset += 4;
                 break;
             case self::GATEWAY_TYPE_IPV6:
                 $ip = unpack('n8', substr($this->rdata, $offset, 16));
                 if (count($ip) == 8) {
                     $this->gateway = vsprintf('%x:%x:%x:%x:%x:%x:%x:%x', $ip);
                     $offset += 16;
                 } else {
                     return false;
                 }
                 break;
             case self::GATEWAY_TYPE_DOMAIN:
                 $doffset = $offset + $packet->offset;
                 $this->gateway = Net_DNS2_Packet::expand($packet, $doffset);
                 $offset = $doffset - $packet->offset;
                 break;
             default:
                 return false;
         }
         //
         // extract the key
         //
         switch ($this->algorithm) {
             case self::ALGORITHM_NONE:
                 $this->key = '';
                 break;
             case self::ALGORITHM_DSA:
             case self::ALGORITHM_RSA:
                 $this->key = base64_encode(substr($this->rdata, $offset));
                 break;
             default:
                 return false;
         }
         return true;
     }
     return false;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:66,代码来源:IPSECKEY.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 ( (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


示例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->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


示例9: rrSet

    /**
     * parses the rdata of the Net_DNS2_Packet object
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
     *
     * @return boolean
     * @access protected
     *
     */
    protected function rrSet(Net_DNS2_Packet &$packet)
    {
        if ($this->rdlength > 0) {
            
            $length = $packet->offset + $this->rdlength;
            $offset = $packet->offset;

            while ($length > $offset) {

                $this->text[] = Net_DNS2_Packet::label($packet, $offset);
            }

            return true;
        }

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


示例10: rrSet

 /**
  * parses the rdata of the Net_DNS2_Packet object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
  *
  * @return boolean
  * @access protected
  *
  */
 protected function rrSet(Net_DNS2_Packet &$packet)
 {
     if ($this->rdlength > 0) {
         //
         // parse the preference
         //
         $x = unpack('npreference', $this->rdata);
         $this->preference = $x['preference'];
         //
         // get the exchange entry server)
         //
         $offset = $packet->offset + 2;
         $this->exchange = Net_DNS2_Packet::label($packet, $offset);
         return true;
     }
     return false;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:26,代码来源:KX.php


示例11: sendPacket

 /**
  * sends a standard Net_DNS2_Packet_Request packet
  *
  * @param Net_DNS2_Packet $request a Net_DNS2_Packet_Request object
  * @param boolean         $use_tcp true/false if the function should
  *                                 use TCP for the request
  *
  * @return mixed returns a Net_DNS2_Packet_Response object, or false on error
  * @throws Net_DNS2_Exception
  * @access protected
  *
  */
 protected function sendPacket(Net_DNS2_Packet $request, $use_tcp)
 {
     //
     // get the data from the packet
     //
     $data = $request->get();
     if (strlen($data) < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
         throw new Net_DNS2_Exception('invalid or empty packet for sending!', Net_DNS2_Lookups::E_PACKET_INVALID, null, $request);
     }
     reset($this->nameservers);
     //
     // randomize the name server list if it's asked for
     //
     if ($this->ns_random == true) {
         shuffle($this->nameservers);
     }
     //
     // loop so we can handle server errors
     //
     $response = null;
     $ns = '';
     $socket_type = null;
     $tcp_fallback = false;
     while (1) {
         //
         // grab the next DNS server
         //
         if ($tcp_fallback == false) {
             $ns = each($this->nameservers);
             if ($ns === false) {
                 throw new Net_DNS2_Exception('every name server provided has failed: ' . $this->_last_socket_error, Net_DNS2_Lookups::E_NS_FAILED);
             }
             $ns = $ns[1];
         }
         //
         // if the use TCP flag (force TCP) is set, or the packet is bigger
         // than 512 bytes, use TCP for sending the packet
         //
         if ($use_tcp == true || strlen($data) > Net_DNS2_Lookups::DNS_MAX_UDP_SIZE || $tcp_fallback == true) {
             $tcp_fallback = false;
             $socket_type = Net_DNS2_Socket::SOCK_STREAM;
             //
             // create the socket object
             //
             if (!isset($this->sock['tcp'][$ns]) || !$this->sock['tcp'][$ns] instanceof Net_DNS2_Socket) {
                 if ($this->sockets_enabled === true) {
                     $this->sock['tcp'][$ns] = new Net_DNS2_Socket_Sockets(Net_DNS2_Socket::SOCK_STREAM, $ns, $this->dns_port, $this->timeout);
                 } else {
                     $this->sock['tcp'][$ns] = new Net_DNS2_Socket_Streams(Net_DNS2_Socket::SOCK_STREAM, $ns, $this->dns_port, $this->timeout);
                 }
             }
             //
             // if a local IP address / port is set, then add it
             //
             if (strlen($this->local_host) > 0) {
                 $this->sock['tcp'][$ns]->bindAddress($this->local_host, $this->local_port);
             }
             //
             // open it; if it fails, continue in the while loop
             //
             if ($this->sock['tcp'][$ns]->open() === false) {
                 $this->_last_socket_error = $this->sock['tcp'][$ns]->last_error;
                 continue;
             }
             //
             // write the data to the socket; if it fails, continue on
             // the while loop
             //
             if ($this->sock['tcp'][$ns]->write($data) === false) {
                 $this->_last_socket_error = $this->sock['tcp'][$ns]->last_error;
                 continue;
             }
             //
             // read the content, using select to wait for a response
             //
             $size = 0;
             $result = null;
             //
             // handle zone transfer requests differently than other requests.
             //
             if ($request->question[0]->qtype == 'AXFR') {
                 $soa_count = 0;
                 while (1) {
                     //
                     // read the data off the socket
                     //
                     $result = $this->sock['tcp'][$ns]->read($size);
                     if ($result === false || $size < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
//.........这里部分代码省略.........
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:101,代码来源:DNS2.php


示例12: sendPacket

 /**
  * sends a standard Net_DNS2_Packet_Request packet
  *
  * @param Net_DNS2_Packet $request a Net_DNS2_Packet_Request object
  * @param boolean         $use_tcp true/false if the function should
  *                                 use TCP for the request
  *
  * @return mixed returns a Net_DNS2_Packet_Response object, or false on error
  * @throws Net_DNS2_Exception
  * @access protected
  *
  */
 protected function sendPacket(Net_DNS2_Packet $request, $use_tcp)
 {
     //
     // get the data from the packet
     //
     $data = $request->get();
     if (strlen($data) < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
         throw new Net_DNS2_Exception('invalid or empty packet for sending!', Net_DNS2_Lookups::E_PACKET_INVALID, null, $request);
     }
     reset($this->nameservers);
     //
     // randomize the name server list if it's asked for
     //
     if ($this->ns_random == true) {
         shuffle($this->nameservers);
     }
     //
     // loop so we can handle server errors
     //
     $response = null;
     $ns = '';
     while (1) {
         //
         // grab the next DNS server
         //
         $ns = each($this->nameservers);
         if ($ns === false) {
             if (is_null($this->last_exception) == false) {
                 throw $this->last_exception;
             } else {
                 throw new Net_DNS2_Exception('every name server provided has failed', Net_DNS2_Lookups::E_NS_FAILED);
             }
         }
         $ns = $ns[1];
         //
         // if the use TCP flag (force TCP) is set, or the packet is bigger than our
         // max allowed UDP size- which is either 512, or if this is DNSSEC request,
         // then whatever the configured dnssec_payload_size is.
         //
         $max_udp_size = Net_DNS2_Lookups::DNS_MAX_UDP_SIZE;
         if ($this->dnssec == true) {
             $max_udp_size = $this->dnssec_payload_size;
         }
         if ($use_tcp == true || strlen($data) > $max_udp_size) {
             try {
                 $response = $this->sendTCPRequest($ns, $data, $request->question[0]->qtype == 'AXFR' ? true : false);
             } catch (Net_DNS2_Exception $e) {
                 $this->last_exception = $e;
                 $this->last_exception_list[$ns] = $e;
                 continue;
             }
             //
             // otherwise, send it using UDP
             //
         } else {
             try {
                 $response = $this->sendUDPRequest($ns, $data);
                 //
                 // check the packet header for a trucated bit; if it was truncated,
                 // then re-send the request as TCP.
                 //
                 if ($response->header->tc == 1) {
                     $response = $this->sendTCPRequest($ns, $data);
                 }
             } catch (Net_DNS2_Exception $e) {
                 $this->last_exception = $e;
                 $this->last_exception_list[$ns] = $e;
                 continue;
             }
         }
         //
         // make sure header id's match between the request and response
         //
         if ($request->header->id != $response->header->id) {
             $this->last_exception = new Net_DNS2_Exception('invalid header: the request and response id do not match.', Net_DNS2_Lookups::E_HEADER_INVALID, null, $request, $response);
             $this->last_exception_list[$ns] = $this->last_exception;
             continue;
         }
         //
         // make sure the response is actually a response
         //
         // 0 = query, 1 = response
         //
         if ($response->header->qr != Net_DNS2_Lookups::QR_RESPONSE) {
             $this->last_exception = new Net_DNS2_Exception('invalid header: the response provided is not a response packet.', Net_DNS2_Lookups::E_HEADER_INVALID, null, $request, $response);
             $this->last_exception_list[$ns] = $this->last_exception;
             continue;
         }
//.........这里部分代码省略.........
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:101,代码来源:DNS2.php


示例13: sendPacket

 /**
  * sends a standard Net_DNS2_Packet_Request packet
  *
  * @param Net_DNS2_Packet $request a Net_DNS2_Packet_Request object
  * @param boolean         $use_tcp true/false if the function should
  *                                 use TCP for the request
  *
  * @return mixed returns a Net_DNS2_Packet_Response object, or false on error
  * @throws Net_DNS2_Exception
  * @access protected
  *
  */
 protected function sendPacket(Net_DNS2_Packet $request, $use_tcp)
 {
     //
     // get the data from the packet
     //
     $data = $request->get();
     if (strlen($data) < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
         throw new Net_DNS2_Exception('invalid or empty packet for sending!', Net_DNS2_Lookups::E_PACKET_INVALID);
     }
     reset($this->nameservers);
     //
     // randomize the name server list if it's asked for
     //
     if ($this->ns_random == true) {
         shuffle($this->nameservers);
     }
     //
     // loop so we can handle server errors
     //
     $response = null;
     $ns = '';
     $tcp_fallback = false;
     while (1) {
         //
         // grab the next DNS server
         //
         if ($tcp_fallback == false) {
             $ns = each($this->nameservers);
             if ($ns === false) {
                 throw new Net_DNS2_Exception('every name server provided has failed: ' . $this->_last_socket_error, Net_DNS2_Lookups::E_NS_FAILED);
             }
             $ns = $ns[1];
         }
         //
         // if the use TCP flag (force TCP) is set, or the packet is bigger
         // than 512 bytes, use TCP for sending the packet
         //
         if ($use_tcp == true || strlen($data) > Net_DNS2_Lookups::DNS_MAX_UDP_SIZE || $tcp_fallback == true) {
             $tcp_fallback = false;
             //
             // create the socket object
             //
             if (!isset($this->sock['tcp'][$ns]) || !$this->sock['tcp'][$ns] instanceof Net_DNS2_Socket) {
                 if ($this->sockets_enabled === true) {
                     $this->sock['tcp'][$ns] = new Net_DNS2_Socket_Sockets(SOCK_STREAM, $ns, $this->dns_port, $this->timeout);
                 } else {
                     $this->sock['tcp'][$ns] = new Net_DNS2_Socket_Streams(SOCK_STREAM, $ns, $this->dns_port, $this->timeout);
                 }
             }
             //
             // if a local IP address / port is set, then add it
             //
             if (strlen($this->local_host) > 0) {
                 $this->sock['tcp'][$ns]->bindAddress($this->local_host, $this->local_port);
             }
             //
             // open it; if it fails, continue in the while loop
             //
             if ($this->sock['tcp'][$ns]->open() === false) {
                 $this->_last_socket_error = $this->sock['tcp'][$ns]->last_error;
                 continue;
             }
             //
             // write the data to the socket; if it fails, continue on
             // the while loop
             //
             if ($this->sock['tcp'][$ns]->write($data) === false) {
                 $this->_last_socket_error = $this->sock['tcp'][$ns]->last_error;
                 continue;
             }
             //
             // read the content, using select to wait for a response
             //
             $size = 0;
             $result = $this->sock['tcp'][$ns]->read($size);
             if ($result === false || $size < Net_DNS2_Lookups::DNS_HEADER_SIZE) {
                 $this->_last_socket_error = $this->sock['tcp'][$ns]->last_error;
                 continue;
             }
             //
             // create the packet object
             //
             $response = new Net_DNS2_Packet_Response($result, $size);
             break;
         } else {
             //
             // create the socket object
             //
//.........这里部分代码省略.........
开发者ID:altesien,项目名称:FinalProject,代码行数:101,代码来源:DNS2.php


示例14: 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


示例15: rrSet

    /**
     * parses the rdata of the Net_DNS2_Packet object
     *
     * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
     *
     * @return boolean
     * @access protected
     *
     */
    protected function rrSet(Net_DNS2_Packet &$packet)
    {
        if ($this->rdlength > 0) {

            $this->isdnaddress = Net_DNS2_Packet::label($packet, $packet->offset);

            //
            // look for a SA (sub address) - it's optional
            //
            if ( (strlen($this->isdnaddress) + 1) < $this->rdlength) {

                $this->sa = Net_DNS2_Packet::label($packet, $packet->offset);
            } else {
            
                $this->sa = '';
            }

            return true;
        }

        return false;
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:31,代码来源:ISDN.php


示例16: 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


示例17: rrSet

 /**
  * parses the rdata of the Net_DNS2_Packet object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
  *
  * @return boolean
  * @access protected
  *
  */
 protected function rrSet(Net_DNS2_Packet &$packet)
 {
     if ($this->rdlength > 0) {
         $offset = $packet->offset;
         $this->previous = Net_DNS2_Packet::label($packet, $offset);
         $this->next = Net_DNS2_Packet::label($packet, $offset);
         return true;
     }
     return false;
 }
开发者ID:martinsv,项目名称:phpipam,代码行数:19,代码来源:TALINK.php


示例18: 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->algorithm) > 0) {

            //
            // make sure the size values are correct
            //
            $this->key_size     = strlen($this->key_data);
            $this->other_size   = strlen($this->other_data);

            //
            // add the algorithm without compression
            //
            $data = Net_DNS2_Packet::pack($this->algorithm);

            //
            // pack in the inception, expiration, mode, error and key size
            //
            $data .= pack(
                'NNnnn', $this->inception, $this->expiration, 
                $this->mode, 0, $this->key_size
            );

            //
            // if the key_size > 0, then add the key
            //
            if ($this->key_size > 0) {
            
                $data .= $this->key_data;
            }

            //
            // pack in the other size
            //
            $data .= pack('n', $this->other_size);
            if ($this->other_size > 0) {

                $data .= $this->other_data;
            }

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

            return $data;
        }

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


示例19: rrSet

 /**
  * parses the rdata of the Net_DNS2_Packet object
  *
  * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
  *
  * @return boolean
  * @access protected
  *
  */
 protected function rrSet(Net_DNS2_Packet &$packet)
 {
     if ($this->rdlength > 0) {
         $this->psdnaddress = Net_DNS2_Packet::label($packet, $packet->offset);
         return true;
     }
     return false;
 }
开发者ID:TeamSF,项目名称:itdb-green,代码行数:17,代码来源:X25.php


示例20: expand

 /**
  * expands the domain name stored at a given offset in a DNS Packet
  *
  * This logic was based on the Net::DNS::Packet::dn_expand() function
  * by Michanel Fuhr
  *
  * @param Net_DNS2_Packet &$packet the DNS packet to look in for the domain name
  * @param integer         &$offset the offset into the given packet object
  *
  * @return mixed either the domain name or null if it's not found.
  * @access public
  *
  */
 public static function expand(Net_DNS2_Packet &$packet, &$offset)
 {
     $name = '';
     while (1) {
         if ($packet->rdlength < $offset + 1) {
             return null;
         }
         $xlen = ord($packet->rdata[$offset]);
         if ($xlen == 0) {
             ++$offset;
             break;
         } else {
             if (($xlen & 0xc0) == 0xc0) {
                 if ($packet->rdlength < $offset + 2) {
                     return null;
                 }
                 $ptr = ord($packet->rdata[$offset]) << 8 | ord($packet->rdata[$offset + 1]);
                 $ptr = $ptr & 0x3fff;
                 $name2 = Net_DNS2_Packet::expand($packet, $ptr);
                 if (is_null($name2)) {
                     return null;
                 }
                 $name .= $name2;
                 $offset += 2;
                 break;
             } else {
                 ++$offset;
                 if ($packet->rdlength < $offset + $xlen) {
                     return null;
                 }
                 $elem = '';
                 $elem = substr($packet->rdata, $offset, $xlen);
                 $name .= $elem . '.';
                 $offset += $xlen;
             }
         }
     }
     return trim($name, '.');
 }
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:52,代码来源:Packet.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Net_DNS_Resolver类代码示例发布时间:2022-05-23
下一篇:
PHP NetDevice类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap