1 | <?php |
||
22 | class TKEY implements RdataInterface |
||
23 | { |
||
24 | use RdataTrait; |
||
25 | |||
26 | const TYPE = 'TKEY'; |
||
27 | const TYPE_CODE = 249; |
||
28 | |||
29 | const ERROR_NONE = 0; |
||
30 | const ERROR_BADSIG = 16; |
||
31 | const ERROR_BADKEY = 17; |
||
32 | const ERROR_BADTIME = 18; |
||
33 | const ERROR_BADMODE = 19; |
||
34 | const ERROR_BADNAME = 20; |
||
35 | const ERROR_BADALG = 21; |
||
36 | |||
37 | /** |
||
38 | * The algorithm name is in the form of a domain name with the same |
||
39 | * meaning as in [RFC 2845]{@link https://tools.ietf.org/html/rfc2845}. |
||
40 | * The algorithm determines how the secret keying material agreed to |
||
41 | * using the TKEY RR is actually used to derive the algorithm specific key. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | private $algorithm; |
||
46 | |||
47 | /** |
||
48 | * @var \DateTime |
||
49 | */ |
||
50 | private $inception; |
||
51 | |||
52 | /** |
||
53 | * @var \DateTime |
||
54 | */ |
||
55 | private $expiration; |
||
56 | |||
57 | /** |
||
58 | * The mode field specifies the general scheme for key agreement or the |
||
59 | * purpose of the TKEY DNS message. 16-bit integer. |
||
60 | * |
||
61 | * The following values of the Mode octet are defined, available, or reserved: |
||
62 | * |
||
63 | * Value Description |
||
64 | * ----- ----------- |
||
65 | * 0 - reserved, see section 7 |
||
66 | * 1 server assignment |
||
67 | * 2 Diffie-Hellman exchange |
||
68 | * 3 GSS-API negotiation |
||
69 | * 4 resolver assignment |
||
70 | * 5 key deletion |
||
71 | * 6-65534 - available, see section 7 |
||
72 | * 65535 - reserved, see section 7 |
||
73 | * |
||
74 | * @var int |
||
75 | */ |
||
76 | private $mode; |
||
77 | |||
78 | /** |
||
79 | * The error code field is an extended RCODE. The following values are defined:. |
||
80 | * |
||
81 | * Value Description |
||
82 | * ----- ----------- |
||
83 | * 0 - no error |
||
84 | * 1-15 a non-extended RCODE |
||
85 | * 16 BADSIG (TSIG) |
||
86 | * 17 BADKEY (TSIG) |
||
87 | * 18 BADTIME (TSIG) |
||
88 | * 19 BADMODE |
||
89 | * 20 BADNAME |
||
90 | * 21 BADALG |
||
91 | * |
||
92 | * @var int |
||
93 | */ |
||
94 | private $error = 0; |
||
95 | |||
96 | /** |
||
97 | * @var string |
||
98 | */ |
||
99 | private $keyData; |
||
100 | |||
101 | /** |
||
102 | * @var string |
||
103 | */ |
||
104 | private $otherData; |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | 1 | public function getAlgorithm(): string |
|
113 | |||
114 | /** |
||
115 | * @param string $algorithm |
||
116 | */ |
||
117 | 4 | public function setAlgorithm(string $algorithm): void |
|
124 | |||
125 | /** |
||
126 | * @return \DateTime |
||
127 | */ |
||
128 | 1 | public function getInception(): \DateTime |
|
132 | |||
133 | /** |
||
134 | * @param \DateTime $inception |
||
135 | */ |
||
136 | 4 | public function setInception(\DateTime $inception): void |
|
140 | |||
141 | /** |
||
142 | * @return \DateTime |
||
143 | */ |
||
144 | 1 | public function getExpiration(): \DateTime |
|
148 | |||
149 | /** |
||
150 | * @param \DateTime $expiration |
||
151 | */ |
||
152 | 4 | public function setExpiration(\DateTime $expiration): void |
|
156 | |||
157 | /** |
||
158 | * @return int |
||
159 | */ |
||
160 | 1 | public function getMode(): int |
|
164 | |||
165 | /** |
||
166 | * @param int $mode |
||
167 | */ |
||
168 | 4 | public function setMode(int $mode): void |
|
175 | |||
176 | /** |
||
177 | * @return int |
||
178 | */ |
||
179 | 1 | public function getError(): int |
|
183 | |||
184 | /** |
||
185 | * @param int $error |
||
186 | */ |
||
187 | 4 | public function setError(int $error): void |
|
194 | |||
195 | /** |
||
196 | * @return string |
||
197 | */ |
||
198 | 1 | public function getKeyData(): string |
|
202 | |||
203 | /** |
||
204 | * @param string $keyData binary stream |
||
205 | */ |
||
206 | 4 | public function setKeyData(string $keyData): void |
|
210 | |||
211 | /** |
||
212 | * @return string |
||
213 | */ |
||
214 | 1 | public function getOtherData(): string |
|
218 | |||
219 | /** |
||
220 | * @param string $otherData binary stream |
||
221 | */ |
||
222 | 4 | public function setOtherData(string $otherData): void |
|
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | 1 | public function toText(): string |
|
242 | |||
243 | /** |
||
244 | * {@inheritdoc} |
||
245 | */ |
||
246 | 1 | public function toWire(): string |
|
262 | |||
263 | /** |
||
264 | * {@inheritdoc} |
||
265 | * |
||
266 | * @return TKEY |
||
267 | */ |
||
268 | 1 | public static function fromText(string $text): RdataInterface |
|
290 | |||
291 | /** |
||
292 | * {@inheritdoc} |
||
293 | * |
||
294 | * @return TKEY |
||
295 | */ |
||
296 | 1 | public static function fromWire(string $rdata): RdataInterface |
|
330 | } |
||
331 |