Kea 2.2.0
opcode.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9#include <stdint.h>
10
11#include <ostream>
12
13#ifndef OPCODE_H
14#define OPCODE_H 1
15
16namespace isc {
17namespace dns {
18
32class Opcode {
33public:
35 enum CodeValue {
51 RESERVED15_CODE = 15
52 };
53
62
63
70 explicit Opcode(const uint8_t code);
72
78 CodeValue getCode() const { return (code_); }
79
88 bool equals(const Opcode& other) const
89 { return (code_ == other.code_); }
90
92 bool operator==(const Opcode& other) const { return (equals(other)); }
93
100 bool nequals(const Opcode& other) const
101 { return (code_ != other.code_); }
102
104 bool operator!=(const Opcode& other) const { return (nequals(other)); }
105
116 std::string toText() const;
117
119 static const Opcode& QUERY();
120
122 static const Opcode& IQUERY();
123
125 static const Opcode& STATUS();
126
128 static const Opcode& RESERVED3();
129
131 static const Opcode& NOTIFY();
132
134 static const Opcode& UPDATE();
135
137 static const Opcode& RESERVED6();
138
140 static const Opcode& RESERVED7();
141
143 static const Opcode& RESERVED8();
144
146 static const Opcode& RESERVED9();
147
149 static const Opcode& RESERVED10();
150
152 static const Opcode& RESERVED11();
153
155 static const Opcode& RESERVED12();
156
158 static const Opcode& RESERVED13();
159
161 static const Opcode& RESERVED14();
162
164 static const Opcode& RESERVED15();
165private:
166 CodeValue code_;
167};
168
169inline const Opcode&
171 static Opcode c(0);
172 return (c);
173}
174
175inline const Opcode&
177 static Opcode c(1);
178 return (c);
179}
180
181inline const Opcode&
183 static Opcode c(2);
184 return (c);
185}
186
187inline const Opcode&
189 static Opcode c(3);
190 return (c);
191}
192
193inline const Opcode&
195 static Opcode c(4);
196 return (c);
197}
198
199inline const Opcode&
201 static Opcode c(5);
202 return (c);
203}
204
205inline const Opcode&
207 static Opcode c(6);
208 return (c);
209}
210
211inline const Opcode&
213 static Opcode c(7);
214 return (c);
215}
216
217inline const Opcode&
219 static Opcode c(8);
220 return (c);
221}
222
223inline const Opcode&
225 static Opcode c(9);
226 return (c);
227}
228
229inline const Opcode&
231 static Opcode c(10);
232 return (c);
233}
234
235inline const Opcode&
237 static Opcode c(11);
238 return (c);
239}
240
241inline const Opcode&
243 static Opcode c(12);
244 return (c);
245}
246
247inline const Opcode&
249 static Opcode c(13);
250 return (c);
251}
252
253inline const Opcode&
255 static Opcode c(14);
256 return (c);
257}
258
259inline const Opcode&
261 static Opcode c(15);
262 return (c);
263}
264
275std::ostream& operator<<(std::ostream& os, const Opcode& opcode);
276}
277}
278#endif // OPCODE_H
279
280// Local Variables:
281// mode: c++
282// End:
The Opcode class objects represent standard OPCODEs of the header section of DNS messages as defined ...
Definition: opcode.h:32
static const Opcode & RESERVED3()
A constant object for a reserved (code 3) Opcode.
Definition: opcode.h:188
static const Opcode & RESERVED6()
A constant object for a reserved (code 6) Opcode.
Definition: opcode.h:206
static const Opcode & RESERVED8()
A constant object for a reserved (code 8) Opcode.
Definition: opcode.h:218
std::string toText() const
Convert the Opcode to a string.
Definition: opcode.cc:53
static const Opcode & RESERVED12()
A constant object for a reserved (code 12) Opcode.
Definition: opcode.h:242
static const Opcode & RESERVED11()
A constant object for a reserved (code 11) Opcode.
Definition: opcode.h:236
static const Opcode & RESERVED13()
A constant object for a reserved (code 13) Opcode.
Definition: opcode.h:248
static const Opcode & RESERVED14()
A constant object for a reserved (code 14) Opcode.
Definition: opcode.h:254
static const Opcode & STATUS()
A constant object for the STATUS Opcode.
Definition: opcode.h:182
static const Opcode & RESERVED15()
A constant object for a reserved (code 15) Opcode.
Definition: opcode.h:260
static const Opcode & NOTIFY()
A constant object for the NOTIFY Opcode.
Definition: opcode.h:194
static const Opcode & UPDATE()
A constant object for the UPDATE Opcode.
Definition: opcode.h:200
bool nequals(const Opcode &other) const
Return true iff two Opcodes are not equal.
Definition: opcode.h:100
Opcode(const uint8_t code)
Constructor from the code value.
Definition: opcode.cc:44
bool operator==(const Opcode &other) const
Same as equals().
Definition: opcode.h:92
CodeValue getCode() const
Returns the Opcode code value.
Definition: opcode.h:78
static const Opcode & RESERVED9()
A constant object for a reserved (code 9) Opcode.
Definition: opcode.h:224
static const Opcode & QUERY()
A constant object for the QUERY Opcode.
Definition: opcode.h:170
bool equals(const Opcode &other) const
Return true iff two Opcodes are equal.
Definition: opcode.h:88
static const Opcode & RESERVED7()
A constant object for a reserved (code 7) Opcode.
Definition: opcode.h:212
static const Opcode & RESERVED10()
A constant object for a reserved (code 10) Opcode.
Definition: opcode.h:230
bool operator!=(const Opcode &other) const
Same as nequals().
Definition: opcode.h:104
CodeValue
Constants for standard OPCODE values.
Definition: opcode.h:35
@ RESERVED13_CODE
13: Reserved for future use (RFC1035)
Definition: opcode.h:49
@ RESERVED15_CODE
15: Reserved for future use (RFC1035)
Definition: opcode.h:51
@ RESERVED12_CODE
12: Reserved for future use (RFC1035)
Definition: opcode.h:48
@ RESERVED10_CODE
10: Reserved for future use (RFC1035)
Definition: opcode.h:46
@ RESERVED11_CODE
11: Reserved for future use (RFC1035)
Definition: opcode.h:47
@ UPDATE_CODE
5: Dynamic update (RFC2136)
Definition: opcode.h:41
@ NOTIFY_CODE
4: Notify (RFC1996)
Definition: opcode.h:40
@ RESERVED7_CODE
7: Reserved for future use (RFC1035)
Definition: opcode.h:43
@ STATUS_CODE
2: Server status request (RFC1035)
Definition: opcode.h:38
@ IQUERY_CODE
1: Inverse query (RFC1035)
Definition: opcode.h:37
@ QUERY_CODE
0: Standard query (RFC1035)
Definition: opcode.h:36
@ RESERVED14_CODE
14: Reserved for future use (RFC1035)
Definition: opcode.h:50
@ RESERVED3_CODE
3: Reserved for future use (RFC1035)
Definition: opcode.h:39
@ RESERVED6_CODE
6: Reserved for future use (RFC1035)
Definition: opcode.h:42
@ RESERVED8_CODE
8: Reserved for future use (RFC1035)
Definition: opcode.h:44
@ RESERVED9_CODE
9: Reserved for future use (RFC1035)
Definition: opcode.h:45
static const Opcode & IQUERY()
A constant object for the IQUERY Opcode.
Definition: opcode.h:176
ostream & operator<<(std::ostream &os, const EDNS &edns)
Insert the EDNS as a string into stream.
Definition: edns.cc:172
Defines the logger used by the top-level component of kea-lfc.