本文整理匯總了PHP中Net_DNS_Resolver::nextid方法的典型用法代碼示例。如果您正苦於以下問題:PHP Net_DNS_Resolver::nextid方法的具體用法?PHP Net_DNS_Resolver::nextid怎麽用?PHP Net_DNS_Resolver::nextid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Net_DNS_Resolver
的用法示例。
在下文中一共展示了Net_DNS_Resolver::nextid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Net_DNS_Header
/**
* Initializes the default values for the Header object.
*
* Builds a header object from either default values, or from a DNS
* packet passed into the constructor as $data
*
* @param string $data A DNS packet of which the header will be parsed.
* @return object Net_DNS_Header
* @access public
*/
function Net_DNS_Header($data = '')
{
if ($data != '') {
/*
* The header MUST be at least 12 bytes.
* Passing the full datagram to this constructor
* will examine only the header section of the DNS packet
*/
if (strlen($data) < 12) {
return false;
}
$a = unpack('nid/C2flags/n4counts', $data);
$this->id = $a['id'];
$this->qr = $a['flags1'] >> 7 & 0x1;
$this->opcode = $a['flags1'] >> 3 & 0xf;
$this->aa = $a['flags1'] >> 2 & 0x1;
$this->tc = $a['flags1'] >> 1 & 0x1;
$this->rd = $a['flags1'] & 0x1;
$this->ra = $a['flags2'] >> 7 & 0x1;
$this->rcode = $a['flags2'] & 0xf;
$this->qdcount = $a['counts1'];
$this->ancount = $a['counts2'];
$this->nscount = $a['counts3'];
$this->arcount = $a['counts4'];
} else {
$this->id = Net_DNS_Resolver::nextid();
$this->qr = 0;
$this->opcode = 0;
$this->aa = 0;
$this->tc = 0;
$this->rd = 1;
$this->ra = 0;
$this->rcode = 0;
$this->qdcount = 1;
$this->ancount = 0;
$this->nscount = 0;
$this->arcount = 0;
}
if (Net_DNS::opcodesbyval($this->opcode)) {
$this->opcode = Net_DNS::opcodesbyval($this->opcode);
}
if (Net_DNS::rcodesbyval($this->rcode)) {
$this->rcode = Net_DNS::rcodesbyval($this->rcode);
}
}