Example #1
0
 /**
  * Decode a Long field
  *
  * @param \LibDNS\Decoder\DecodingContext $decodingContext
  * @param \LibDNS\Records\Types\Long $long The object to populate with the result
  * @return int The number of packet bytes consumed by the operation
  * @throws \UnexpectedValueException When the packet data is invalid
  */
 private function decodeLong(DecodingContext $decodingContext, Long $long)
 {
     $value = unpack('N', $this->readDataFromPacket($decodingContext->getPacket(), 4))[1];
     $long->setValue($value);
     return 4;
 }
Example #2
0
 /**
  * Encode a Long field
  *
  * @param \LibDNS\Records\Types\Long $long
  * @return string
  */
 private function encodeLong(Long $long)
 {
     return pack('N', $long->getValue());
 }