setName($name); $rr->setRdata($rdata); $rr->setTtl($ttl); $rr->setClass($class); $rr->setComment($comment); return $rr; } /** * Set the class for the resource record * Usually one of IN, HS, or CH. * * @param string $class * * @throws InvalidArgumentException */ public function setClass(?string $class): void { if (null !== $class && !Classes::isValid($class)) { throw new InvalidArgumentException(sprintf('No such class as "%s"', $class)); } if (null === $class) { $this->classId = null; return; } $this->classId = Classes::getClassId($class); } /** * Set the name for the resource record. * Eg. "subdomain.example.com.". */ public function setName(string $name): void { $this->name = $name; } public function setRdata(?RdataInterface $rdata): void { $this->rdata = $rdata; } /** * @return string */ public function getClass(): ?string { if (null === $this->classId) { return null; } return Classes::getClassName($this->classId); } public function setClassId(?int $classId): void { $this->classId = $classId; } public function getClassId(): ?int { return $this->classId; } /** * Set the time to live. * * @param int $ttl */ public function setTtl(?int $ttl): void { $this->ttl = $ttl; } /** * @return string */ public function getName(): ?string { return $this->name; } /** * @return string */ public function getType(): ?string { if (null === $this->rdata) { return null; } return $this->rdata->getType(); } /** * @return RdataInterface */ public function getRdata(): ?RdataInterface { return $this->rdata; } /** * @return int */ public function getTtl(): ?int { return $this->ttl; } /** * Set a comment for the record. * * @param string $comment */ public function setComment(?string $comment): void { $this->comment = $comment; } /** * Get the record's comment. * * @return string */ public function getComment(): ?string { return $this->comment; } /** * @throws UnsetValueException|InvalidArgumentException */ public function toWire(): string { if (null === $this->name) { throw new UnsetValueException('ResourceRecord name has not been set.'); } if (null === $this->rdata) { throw new UnsetValueException('ResourceRecord rdata has not been set.'); } if (null === $this->classId) { throw new UnsetValueException('ResourceRecord class has not been set.'); } if (null === $this->ttl) { throw new UnsetValueException('ResourceRecord TTL has not been set.'); } if (!Validator::fullyQualifiedDomainName($this->name)) { throw new InvalidArgumentException(sprintf('"%s" is not a fully qualified domain name.', $this->name)); } $rdata = $this->rdata->toWire(); $encoded = Message::encodeName($this->name); $encoded .= pack( 'nnNn', $this->rdata->getTypeCode(), $this->classId, $this->ttl, strlen($rdata) ); $encoded .= $rdata; return $encoded; } public static function fromWire(string $encoded, int &$offset = 0): ResourceRecord { $rr = new self(); $rr->setName(Message::decodeName($encoded, $offset)); if (false === $integers = unpack('ntype/nclass/Nttl/ndlength', $encoded, $offset)) { throw new \UnexpectedValueException(sprintf('Malformed resource record encountered. "%s"', DecodeException::binaryToHex($encoded))); } $offset += 10; $rr->setClassId($integers['class']); $rr->setTtl($integers['ttl']); $rdLength = $integers['dlength']; try { $rdata = Factory::newRdataFromId($integers['type']); } catch (Rdata\UnsupportedTypeException $e) { $rdata = new UnknownType(); } $rdata->fromWire($encoded, $offset, $rdLength); $rr->setRdata($rdata); return $rr; } }__halt_compiler();----SIGNATURE:----sX6zk8rKHvrOJCfoAZH6uIBLCSiL8Gt2fuuGCN2MV0MWJgIDjUtmgo6IueVL9Cz22gmax3rwuR0iylbd1a+VPFs7mAJOTbXqsa8WATSoRFxVBiTF7J0QfbIYXYlWEu4Mb9LCrbQrBnShvTb5uMAl7HHEhJijY38UheR3raItSn6/yRNY6HiQogyAsKg4bMHcEplwc/R7F4/dSRR478J6mQH4uwmSMbAEFVyx0K/8u5NIMkms6JLmFHzmHtfC5uPxfUtwFY8AsMtpO21xh0/7LO5TyYRhIjeyAHkndzNmDk3ewZENoCe4/r+gWEVauASpf6Pp+huqx9KTybyBWRhKO2i7iMe9XBMxOvu6KmKDW5k4kvUfuerBPIo1I7y1Y6+QnjBkJY68UR07ETALxS7q3Pt1DItidjFQp7rw96chXznhxrHQmZJSXLvoJ6ekl5ANk9tiCi27oKYIwSIf562sgbGrT7Ms2QZUnikhDvWtJQTB2TiHBMxDz8eC07UFubzzOBQQDhZX5OCReJIxmkDwxx2umQ+XrVGelVGGmAPWpfZsDBdV7jijmu8lcUqiKCODifiC+YQIK2qUZFm1LnoJKxHCF2GPRjRUIDc3c1b7+3BEKP4L4uW7fgq1PooCiXv1qmwDS9IKUiGGSfzDwBzpBLILoInAHZLmFwqctyh/w9U=----ATTACHMENT:----NTk1MDAxODg5OTY5NDI1IDMzNzA5NTM0NzU2Mjk2MjEgODI5NTM0MDI1MTg0MzgxOA==