本文整理汇总了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);
}
}