Beispiel #1
0
 /**
  * Decode a Char field
  *
  * @param \LibDNS\Decoder\DecodingContext $decodingContext
  * @param \LibDNS\Records\Types\Char $char 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 decodeChar(DecodingContext $decodingContext, Char $char)
 {
     $value = unpack('C', $this->readDataFromPacket($decodingContext->getPacket(), 1))[1];
     $char->setValue($value);
     return 1;
 }
Beispiel #2
0
 /**
  * Encode a Char field
  *
  * @param \LibDNS\Records\Types\Char $char
  * @return string
  */
 private function encodeChar(Char $char)
 {
     return chr($char->getValue());
 }