1 | <?php |
||
22 | class DHCID implements RdataInterface |
||
23 | { |
||
24 | 1 | use RdataTrait; |
|
25 | |||
26 | const TYPE = 'DHCID'; |
||
27 | const TYPE_CODE = 49; |
||
28 | |||
29 | /** |
||
30 | * 16-bit DHCID RR Identifier Type Code specifies what data from the DHCP |
||
31 | * client's request was used as input into the hash function. |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | private $identifierType; |
||
36 | |||
37 | /** |
||
38 | * The 1-octet 'htype' followed by 'hlen' octets of 'chaddr' from a DHCPv4 |
||
39 | * client's DHCPREQUEST. |
||
40 | * |
||
41 | * The data octets (i.e., the Type and Client-Identifier fields) from a |
||
42 | * DHCPv4 client's Client Identifier option. |
||
43 | * |
||
44 | * The client's DUID (i.e., the data octets of a DHCPv6 client's Client |
||
45 | * Identifier option or the DUID field from a DHCPv4 client's Client |
||
46 | * Identifier option). |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | private $identifier; |
||
51 | |||
52 | /** |
||
53 | * Hardware Type {@link https://tools.ietf.org/html/rfc2131}. |
||
54 | * |
||
55 | * @var int Hardware type used if identifier is DHCPv4 DHCPREQUEST carrying client hardware address (chaddr or MAC) |
||
56 | */ |
||
57 | private $htype = 1; |
||
58 | |||
59 | /** |
||
60 | * The Fully Qualified Domain Name of the DHCP client. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | private $fqdn; |
||
65 | |||
66 | /** |
||
67 | * The digest type. Only one type is defined by IANA, SHA256 with value 1. |
||
68 | * |
||
69 | * @var int |
||
70 | */ |
||
71 | private $digestType = 1; |
||
72 | |||
73 | /** |
||
74 | * The digest. This is calculated from the other parameters. Stored in raw binary. |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | private $digest; |
||
79 | |||
80 | 13 | public function setIdentifierType(int $identifierType): void |
|
87 | |||
88 | 6 | public function getIdentifierType(): int |
|
92 | |||
93 | 3 | public function getIdentifier(): string |
|
97 | |||
98 | 1 | public function getHtype(): int |
|
102 | |||
103 | 1 | public function setHtype(int $htype): void |
|
110 | |||
111 | /** |
||
112 | * @throws \InvalidArgumentException |
||
113 | */ |
||
114 | 12 | public function setIdentifier(int $identifierType, string $identifier): void |
|
119 | |||
120 | 1 | public function getFqdn(): string |
|
124 | |||
125 | 14 | public function setFqdn(string $fqdn): void |
|
132 | |||
133 | 6 | public function getDigestType(): int |
|
137 | |||
138 | 6 | public function setDigestType(int $digestType): void |
|
142 | |||
143 | /** |
||
144 | * @return string Digest in raw binary |
||
145 | */ |
||
146 | 9 | public function getDigest(): string |
|
150 | |||
151 | /** |
||
152 | * @param string $digest Digest as raw binary |
||
153 | */ |
||
154 | 9 | public function setDigest(string $digest): void |
|
158 | |||
159 | /** |
||
160 | * Calculate the digest from the identifier and fully qualified domain name already set on the object. |
||
161 | * |
||
162 | * @throws \BadMethodCallException |
||
163 | */ |
||
164 | 13 | public function calculateDigest(): void |
|
178 | |||
179 | /** |
||
180 | * @throws \BadMethodCallException |
||
181 | */ |
||
182 | 12 | public function toText(): string |
|
186 | |||
187 | 12 | public function toWire(): string |
|
195 | |||
196 | /** |
||
197 | * @throws \Exception |
||
198 | */ |
||
199 | 3 | public function fromText(string $text): void |
|
207 | |||
208 | 6 | public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void |
|
221 | } |
||
222 |