Ejemplo n.º 1
0
 /**
  * Returns the binary data containing the properties of the header
  *
  * Packs the properties of the Header object into a binary string
  * suitable for using as the Header section of a DNS packet.
  *
  * @return string   binary representation of the header object
  * @access public
  */
 function data()
 {
     $opcode = Net_DNS::opcodesbyname($this->opcode);
     $rcode = Net_DNS::rcodesbyname($this->rcode);
     $byte2 = $this->qr << 7 | $opcode << 3 | $this->aa << 2 | $this->tc << 1 | $this->rd;
     $byte3 = $this->ra << 7 | $rcode;
     return pack('nC2n4', $this->id, $byte2, $byte3, $this->qdcount, $this->ancount, $this->nscount, $this->arcount);
 }