本文整理汇总了PHP中Net_DNS2_Packet::compress方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_DNS2_Packet::compress方法的具体用法?PHP Net_DNS2_Packet::compress怎么用?PHP Net_DNS2_Packet::compress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_DNS2_Packet
的用法示例。
在下文中一共展示了Net_DNS2_Packet::compress方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->map822) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->map822, $packet->offset);
$data .= $packet->compress($this->mapx400, $packet->offset);
return $data;
}
return null;
}
示例2: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ( (strlen($this->hit) > 0) && (strlen($this->public_key) > 0) ) {
//
// pack the length, algorithm and HIT values
//
$data = pack(
'CCnH*',
$this->hit_length,
$this->pk_algorithm,
$this->pk_length,
$this->hit
);
//
// add the public key
//
$data .= base64_decode($this->public_key);
//
// add the offset
//
$packet->offset += strlen($data);
//
// add each rendezvous server
//
foreach ($this->rendezvous_servers as $index => $server) {
$data .= $packet->compress($server, $packet->offset);
}
return $data;
}
return null;
}
示例3: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->next_domain_name) > 0) {
$data = $packet->compress($this->next_domain_name, $packet->offset);
$bitmap = Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
$packet->offset += strlen($bitmap);
return $data . $bitmap;
}
return null;
}
示例4: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->mname) > 0) {
$data = $packet->compress($this->mname, $packet->offset);
$data .= $packet->compress($this->rname, $packet->offset);
$data .= pack('N5', $this->serial, $this->refresh, $this->retry, $this->expire, $this->minimum);
$packet->offset += 20;
return $data;
}
return null;
}
示例5: get
/**
* returns a binary packed Net_DNS2_Question object
*
* @param Net_DNS2_Packet &$packet the Net_DNS2_Packet object this question is
* part of. This needs to be passed in so that
* the compressed qname value can be packed in
* with the names of the other parts of the
* packet.
*
* @return string
* @throws Net_DNS2_Exception
* @access public
*
*/
public function get(Net_DNS2_Packet &$packet)
{
//
// validate the type and class
//
$type = Net_DNS2_Lookups::$rr_types_by_name[$this->qtype];
$class = Net_DNS2_Lookups::$classes_by_name[$this->qclass];
if (!isset($type) || !isset($class)) {
throw new Net_DNS2_Exception('invalid question section: invalid type (' . $this->qtype . ') or class (' . $this->qclass . ') specified.', Net_DNS2_Lookups::E_QUESTION_INVALID);
}
$data = $packet->compress($this->qname, $packet->offset);
$data .= chr($type << 8) . chr($type) . chr($class << 8) . chr($class);
$packet->offset += 4;
return $data;
}
示例6: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->target) > 0) {
$data = pack('nn', $this->priority, $this->weight);
$packet->offset += 4;
$data .= $packet->compress(trim($this->target, '"'), $packet->offset);
return $data;
}
return null;
}
示例7: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->intermediatehost) > 0) {
$data = pack('n', $this->preference);
$packet->offset += 2;
$data .= $packet->compress($this->intermediatehost, $packet->offset);
return $data;
}
return null;
}
示例8: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->mboxdname) > 0) {
return $packet->compress($this->mboxdname, $packet->offset) .
$packet->compress($this->txtdname, $packet->offset);
}
return null;
}
示例9: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if ( (isset($this->order)) && (strlen($this->services) > 0) ) {
$data = pack('nn', $this->order, $this->preference);
$data .= chr(strlen($this->flags)) . $this->flags;
$data .= chr(strlen($this->services)) . $this->services;
$data .= chr(strlen($this->regexp)) . $this->regexp;
$packet->offset += strlen($data);
$data .= $packet->compress($this->replacement, $packet->offset);
return $data;
}
return null;
}
示例10: get
/**
* returns a binary packed DNS RR object
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet used for
* compressing names
*
* @return string
* @throws Net_DNS2_Exception
* @access public
*
*/
public function get(Net_DNS2_Packet &$packet)
{
$data = '';
$rdata = '';
//
// pack the name
//
$data = $packet->compress($this->name, $packet->offset);
//
// pack the main values
//
if ($this->type == 'OPT') {
//
// pre-build the TTL value
//
$this->preBuild();
//
// the class value is different for OPT types
//
$data .= pack('nnN', Net_DNS2_Lookups::$rr_types_by_name[$this->type], $this->class, $this->ttl);
} else {
$data .= pack('nnN', Net_DNS2_Lookups::$rr_types_by_name[$this->type], Net_DNS2_Lookups::$classes_by_name[$this->class], $this->ttl);
}
//
// increase the offset, and allow for the rdlength
//
$packet->offset += 10;
//
// get the RR specific details
//
if ($this->rdlength != -1) {
$rdata = $this->rrGet($packet);
}
//
// add the RR
//
$data .= pack('n', strlen($rdata)) . $rdata;
return $data;
}
示例11: rrGet
/**
* returns the rdata portion of the DNS packet
*
* @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
* compressed names
*
* @return mixed either returns a binary packed
* string or null on failure
* @access protected
*
*/
protected function rrGet(Net_DNS2_Packet &$packet)
{
if (strlen($this->hostname) > 0) {
$data = pack('n', $this->subtype);
$packet->offset += 2;
$data .= $packet->compress($this->hostname, $packet->offset);
return $data;
}
return null;
}