function Net_DNS_RR_HINFO(&$rro, $data, $offset = '') { $this->name = $rro->name; $this->type = $rro->type; $this->class = $rro->class; $this->ttl = $rro->ttl; $this->rdlength = $rro->rdlength; $this->rdata = $rro->rdata; if ($offset) { if ($this->rdlength > 0) { list($cpu, $offset) = Net_DNS_Packet::label_extract($data, $offset); list($os, $offset) = Net_DNS_Packet::label_extract($data, $offset); $this->cpu = $cpu; $this->os = $os; } } else { $data = str_replace('\\\\', chr(1) . chr(1), $data); /* disguise escaped backslash */ $data = str_replace('\\"', chr(2) . chr(2), $data); /* disguise \" */ ereg('("[^"]*"|[^ \\t]*)[ \\t]+("[^"]*"|[^ \\t]*)[ \\t]*$', $data, $regs); foreach ($regs as $idx => $value) { $value = str_replace(chr(2) . chr(2), '\\"', $value); $value = str_replace(chr(1) . chr(1), '\\\\', $value); $regs[$idx] = stripslashes($value); } $this->cpu = $regs[1]; $this->os = $regs[2]; } }
function Net_DNS_RR_TXT(&$rro, $data, $offset = '') { $this->name = $rro->name; $this->type = $rro->type; $this->class = $rro->class; $this->ttl = $rro->ttl; $this->rdlength = $rro->rdlength; $this->rdata = $rro->rdata; if ($offset) { if ($this->rdlength > 0) { $maxoffset = $this->rdlength + $offset; while ($maxoffset > $offset) { list($text, $offset) = Net_DNS_Packet::label_extract($data, $offset); $this->text[] = $text; } } } else { $data = str_replace('\\\\', chr(1) . chr(1), $data); /* disguise escaped backslash */ $data = str_replace('\\"', chr(2) . chr(2), $data); /* disguise \" */ ereg('("[^"]*"|[^ \\t]*)[ \\t]*$', $data, $regs); $regs[1] = str_replace(chr(2) . chr(2), '\\"', $regs[1]); $regs[1] = str_replace(chr(1) . chr(1), '\\\\', $regs[1]); $regs[1] = stripslashes($regs[1]); $this->text = $regs[1]; } }
function Net_DNS_RR_NAPTR(&$rro, $data, $offset = '') { $this->name = $rro->name; $this->type = $rro->type; $this->class = $rro->class; $this->ttl = $rro->ttl; $this->rdlength = $rro->rdlength; $this->rdata = $rro->rdata; if ($offset) { if ($this->rdlength > 0) { $a = unpack("@{$offset}/norder/npreference", $data); $offset += 4; $packet = new Net_DNS_Packet(); list($flags, $offset) = Net_DNS_Packet::label_extract($data, $offset); list($services, $offset) = Net_DNS_Packet::label_extract($data, $offset); list($regex, $offset) = Net_DNS_Packet::label_extract($data, $offset); list($replacement, $offset) = $packet->dn_expand($data, $offset); $this->order = $a['order']; $this->preference = $a['preference']; $this->flags = $flags; $this->services = $services; $this->regex = $regex; $this->replacement = $replacement; } } elseif (is_array($data)) { $this->order = $data['order']; $this->preference = $data['preference']; $this->flags = $data['flags']; $this->services = $data['services']; $this->regex = $data['regex']; $this->replacement = $data['replacement']; } else { $data = str_replace('\\\\', chr(1) . chr(1), $data); /* disguise escaped backslash */ $data = str_replace('\\"', chr(2) . chr(2), $data); /* disguise \" */ preg_match('/([0-9]+)[ \\t]+([0-9]+)[ \\t]+("[^"]*"|[^ \\t]*)[ \\t]+("[^"]*"|[^ \\t]*)[ \\t]+("[^"]*"|[^ \\t]*)[ \\t]+(.*?)[ \\t]*$/', $data, $regs); $this->preference = $regs[1]; $this->weight = $regs[2]; foreach ($regs as $idx => $value) { $value = str_replace(chr(2) . chr(2), '\\"', $value); $value = str_replace(chr(1) . chr(1), '\\\\', $value); $regs[$idx] = stripslashes($value); } $this->flags = $regs[3]; $this->services = $regs[4]; $this->regex = $regs[5]; $this->replacement = $regs[6]; } }