Branch data Line data Source code
1 : : // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
2 : : //
3 : : // Permission to use, copy, modify, and/or distribute this software for any
4 : : // purpose with or without fee is hereby granted, provided that the above
5 : : // copyright notice and this permission notice appear in all copies.
6 : : //
7 : : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8 : : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9 : : // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
10 : : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11 : : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
12 : : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13 : : // PERFORMANCE OF THIS SOFTWARE.
14 : :
15 : : // XXX: we have another exceptions.h, so we need to use a prefix "DNS_" in
16 : : // the include guard. More preferably, we should define a consistent naming
17 : : // style for the header guide (e.g. module-name_file-name_H) throughout the
18 : : // package.
19 : :
20 : : #ifndef __DNS_EXCEPTIONS_H
21 : : #define __DNS_EXCEPTIONS_H 1
22 : :
23 : : #include <exceptions/exceptions.h>
24 : :
25 : : namespace isc {
26 : : namespace dns {
27 : :
28 : : ///
29 : : /// \brief A standard DNS module exception ...[TBD]
30 : : ///
31 : : class Rcode; // forward declaration
32 : :
33 : 86 : class DNSProtocolError : public isc::Exception {
34 : : public:
35 : : DNSProtocolError(const char* file, size_t line, const char* what) :
36 [ + - ][ + - ]: 121 : isc::Exception(file, line, what) {}
[ + - ][ + - ]
[ + - ][ # # ]
[ + - ]
37 : : virtual const Rcode& getRcode() const = 0;
38 : : };
39 : :
40 : 79 : class DNSMessageFORMERR : public DNSProtocolError {
41 : : public:
42 : 35 : DNSMessageFORMERR(const char* file, size_t line, const char* what) :
43 : 123 : DNSProtocolError(file, line, what) {}
44 : : virtual const Rcode& getRcode() const;
45 : : };
46 : :
47 : 7 : class DNSMessageBADVERS : public DNSProtocolError {
48 : : public:
49 : : DNSMessageBADVERS(const char* file, size_t line, const char* what) :
50 : 14 : DNSProtocolError(file, line, what) {}
51 : : virtual const Rcode& getRcode() const;
52 : : };
53 : : }
54 : : }
55 : : #endif // __DNS_EXCEPTIONS_H
56 : :
57 : : // Local Variables:
58 : : // mode: c++
59 : : // End:
|