Esempio n. 1
0
 /**
  * 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)
 {
     //
     // pull the salt and build the length
     //
     $salt = pack('H*', $this->salt);
     $this->salt_length = strlen($salt);
     //
     // pack the algorithm, flags, iterations and salt length
     //
     $data = pack('CCnC', $this->algorithm, $this->flags, $this->iterations, $this->salt_length);
     $data .= $salt;
     //
     // add the hash length and hash
     //
     $data .= chr($this->hash_length);
     if ($this->hash_length > 0) {
         $data .= base64_decode($this->hashed_owner_name);
     }
     //
     // conver the array of RR names to a type bitmap
     //
     $data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
     return $data;
 }
Esempio n. 2
0
    /**
     * 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;
    }
Esempio n. 3
0
 /**
  * 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)
 {
     //
     // pack the serial and flags values
     //
     $data = pack('Nn', $this->serial, $this->flags);
     //
     // convert the array of RR names to a type bitmap
     //
     $data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
     //
     // advance the offset
     //
     $packet->offset += strlen($data);
     return $data;
 }