/** * 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 // $offset = $packet->offset; $this->mname = Net_DNS2_Packet::expand($packet, $offset); $this->rname = Net_DNS2_Packet::expand($packet, $offset); // // get the SOA values // $x = unpack('@' . $offset . '/Nserial/Nrefresh/Nretry/Nexpire/Nminimum/', $packet->rdata); $this->serial = Net_DNS2::expandUint32($x['serial']); $this->refresh = Net_DNS2::expandUint32($x['refresh']); $this->retry = Net_DNS2::expandUint32($x['retry']); $this->expire = Net_DNS2::expandUint32($x['expire']); $this->minimum = Net_DNS2::expandUint32($x['minimum']); return true; } return false; }
/** * 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 = Net_DNS2::expandUint32($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; }
/** * 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) { // // expand the algorithm // $newoffset = $packet->offset; $this->algorithm = Net_DNS2_Packet::expand($packet, $newoffset); $offset = $newoffset - $packet->offset; // // unpack time, fudge and mac_size // $x = unpack('@' . $offset . '/ntime_high/Ntime_low/nfudge/nmac_size', $this->rdata); $this->time_signed = Net_DNS2::expandUint32($x['time_low']); $this->fudge = $x['fudge']; $this->mac_size = $x['mac_size']; $offset += 10; // // copy out the mac // if ($this->mac_size > 0) { $this->mac = substr($this->rdata, $offset, $this->mac_size); $offset += $this->mac_size; } // // unpack the original id, error, and other_length values // $x = unpack('@' . $offset . '/noriginal_id/nerror/nother_length', $this->rdata); $this->original_id = $x['original_id']; $this->error = $x['error']; $this->other_length = $x['other_length']; // // the only time there is actually any "other data", is when there's // a BADTIME error code. // // The other length should be 6, and the other data field includes the // servers current time - per RFC 2845 section 4.5.2 // if ($this->error == Net_DNS2_Lookups::RCODE_BADTIME) { if ($this->other_length != 6) { return false; } // // other data is a 48bit timestamp // $x = unpack('nhigh/nlow', substr($this->rdata, $offset + 6, $this->other_length)); $this->other_data = $x['low']; } return true; } return false; }
/** * 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) { // // expand the algorithm // $offset = $packet->offset; $this->algorithm = Net_DNS2_Packet::expand($packet, $offset); // // unpack inception, expiration, mode, error and key size // $x = unpack( '@' . $offset . '/Ninception/Nexpiration/nmode/nerror/nkey_size', $packet->rdata ); $this->inception = Net_DNS2::expandUint32($x['inception']); $this->expiration = Net_DNS2::expandUint32($x['expiration']); $this->mode = $x['mode']; $this->error = $x['error']; $this->key_size = $x['key_size']; $offset += 14; // // if key_size > 0, then copy out the key // if ($this->key_size > 0) { $this->key_data = substr($packet->rdata, $offset, $this->key_size); $offset += $this->key_size; } // // unpack the other length // $x = unpack('@' . $offset . '/nother_size', $packet->rdata); $this->other_size = $x['other_size']; $offset += 2; // // if other_size > 0, then copy out the data // if ($this->other_size > 0) { $this->other_data = substr( $packet->rdata, $offset, $this->other_size ); } return true; } return false; }
/** * 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 the serial and flags values // $x = unpack('@' . $packet->offset . '/Nserial/nflags', $packet->rdata); $this->serial = Net_DNS2::expandUint32($x['serial']); $this->flags = $x['flags']; // // parse out the RR bitmap // $this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(substr($this->rdata, 6)); return true; } return false; }