Kea  2.3.2-git
dns/exceptions.h
Go to the documentation of this file.
1 // Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 // XXX: we have another exceptions.h, so we need to use a prefix "DNS_" in
8 // the include guard. More preferably, we should define a consistent naming
9 // style for the header guide (e.g. module-name_file-name_H) throughout the
10 // package.
11 
12 #ifndef DNS_EXCEPTIONS_H
13 #define DNS_EXCEPTIONS_H 1
14 
15 #include <exceptions/exceptions.h>
16 
17 namespace isc {
18 namespace dns {
19 
23 class Rcode; // forward declaration
24 
25 class Exception : public isc::Exception {
26 public:
27  Exception(const char* file, size_t line, const char* what) :
28  isc::Exception(file, line, what) {}
29 };
30 
35 public:
36  DNSTextError(const char* file, size_t line, const char* what) :
37  isc::dns::Exception(file, line, what) {}
38 };
39 
44 public:
45  NameParserException(const char* file, size_t line, const char* what) :
46  DNSTextError(file, line, what) {}
47 };
48 
50 public:
51  DNSProtocolError(const char* file, size_t line, const char* what) :
52  isc::dns::Exception(file, line, what) {}
53  virtual const Rcode& getRcode() const = 0;
54 };
55 
57 public:
58  DNSMessageFORMERR(const char* file, size_t line, const char* what) :
59  DNSProtocolError(file, line, what) {}
60  virtual const Rcode& getRcode() const;
61 };
62 
64 public:
65  DNSMessageBADVERS(const char* file, size_t line, const char* what) :
66  DNSProtocolError(file, line, what) {}
67  virtual const Rcode& getRcode() const;
68 };
69 
70 }
71 }
72 #endif // DNS_EXCEPTIONS_H
73 
74 // Local Variables:
75 // mode: c++
76 // End:
DNSMessageBADVERS(const char *file, size_t line, const char *what)
DNSMessageFORMERR(const char *file, size_t line, const char *what)
Base class for all sorts of text parse errors.
Base class for name parser exceptions.
DNSProtocolError(const char *file, size_t line, const char *what)
DNS Response Codes (RCODEs) class.
Definition: rcode.h:40
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception(const char *file, size_t line, const char *what)
DNSTextError(const char *file, size_t line, const char *what)
NameParserException(const char *file, size_t line, const char *what)
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.