Kea 2.7.5
|
The Opcode
class objects represent standard OPCODEs of the header section of DNS messages as defined in RFC1035.
More...
#include <opcode.h>
Public Types | |
enum | CodeValue { QUERY_CODE = 0 , IQUERY_CODE = 1 , STATUS_CODE = 2 , RESERVED3_CODE = 3 , NOTIFY_CODE = 4 , UPDATE_CODE = 5 , RESERVED6_CODE = 6 , RESERVED7_CODE = 7 , RESERVED8_CODE = 8 , RESERVED9_CODE = 9 , RESERVED10_CODE = 10 , RESERVED11_CODE = 11 , RESERVED12_CODE = 12 , RESERVED13_CODE = 13 , RESERVED14_CODE = 14 , RESERVED15_CODE = 15 } |
Constants for standard OPCODE values. More... | |
Constructors and Destructor | |
We use the default versions of destructor, copy constructor, and assignment operator. The default constructor is hidden as a result of defining the other constructors. This is intentional; we don't want to allow an | |
Opcode (const uint8_t code) | |
Constructor from the code value. | |
CodeValue | getCode () const |
Returns the Opcode code value. | |
bool | equals (const Opcode &other) const |
Return true iff two Opcodes are equal. | |
bool | operator== (const Opcode &other) const |
Same as equals() . | |
bool | nequals (const Opcode &other) const |
Return true iff two Opcodes are not equal. | |
bool | operator!= (const Opcode &other) const |
Same as nequals() . | |
std::string | toText () const |
Convert the Opcode to a string. | |
static const Opcode & | QUERY () |
A constant object for the QUERY Opcode. | |
static const Opcode & | IQUERY () |
A constant object for the IQUERY Opcode. | |
static const Opcode & | STATUS () |
A constant object for the STATUS Opcode. | |
static const Opcode & | RESERVED3 () |
A constant object for a reserved (code 3) Opcode. | |
static const Opcode & | NOTIFY () |
A constant object for the NOTIFY Opcode. | |
static const Opcode & | UPDATE () |
A constant object for the UPDATE Opcode. | |
static const Opcode & | RESERVED6 () |
A constant object for a reserved (code 6) Opcode. | |
static const Opcode & | RESERVED7 () |
A constant object for a reserved (code 7) Opcode. | |
static const Opcode & | RESERVED8 () |
A constant object for a reserved (code 8) Opcode. | |
static const Opcode & | RESERVED9 () |
A constant object for a reserved (code 9) Opcode. | |
static const Opcode & | RESERVED10 () |
A constant object for a reserved (code 10) Opcode. | |
static const Opcode & | RESERVED11 () |
A constant object for a reserved (code 11) Opcode. | |
static const Opcode & | RESERVED12 () |
A constant object for a reserved (code 12) Opcode. | |
static const Opcode & | RESERVED13 () |
A constant object for a reserved (code 13) Opcode. | |
static const Opcode & | RESERVED14 () |
A constant object for a reserved (code 14) Opcode. | |
static const Opcode & | RESERVED15 () |
A constant object for a reserved (code 15) Opcode. | |
The Opcode
class objects represent standard OPCODEs of the header section of DNS messages as defined in RFC1035.
This is a straightforward value class encapsulating the OPCODE code values. Since OPCODEs are 4-bit integers that are used in limited places and it's unlikely that new code values will be assigned, we could represent them as simple integers (via constant variables or enums). However, we define a separate class so that we can benefit from C++ type safety as much as possible. For convenience we also provide an enum type for standard OPCDE values, but it is generally advisable to handle OPCODEs through this class. In fact, public interfaces of this library uses this class to pass or return OPCODEs instead of the bare code values.
Constants for standard OPCODE values.
|
explicit |
Constructor from the code value.
Since OPCODEs are 4-bit values, parameters larger than 15 are invalid. If code
is larger than 15 an exception of class isc::OutOfRange
will be thrown.
code | The underlying code value of the Opcode . |
Definition at line 44 of file opcode.cc.
References isc_throw.
|
inline |
Return true iff two Opcodes are equal.
Two Opcodes are equal iff their type codes are equal.
This method never throws an exception.
other | the Opcode object to compare against. |
Definition at line 90 of file opcode.h.
Referenced by operator==().
|
inline |
|
inlinestatic |
|
inline |
Return true iff two Opcodes are not equal.
This method never throws an exception.
other | the Opcode object to compare against. |
Definition at line 105 of file opcode.h.
Referenced by operator!=().
|
inlinestatic |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
string isc::dns::Opcode::toText | ( | ) | const |
Convert the Opcode
to a string.
This method returns a string representation of the "mnemonic' used for the enum and constant objects. For example, the string for code value 0 is "QUERY", etc.
If resource allocation for the string fails, a corresponding standard exception will be thrown.
Opcode
.
|
inlinestatic |