exceptions.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // $Id$
  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. #ifndef __DNS_EXCEPTIONS_H
  20. #define __DNS_EXCEPTIONS_H 1
  21. #include <exceptions/exceptions.h>
  22. namespace isc {
  23. namespace dns {
  24. ///
  25. /// \brief A standard DNS module exception ...[TBD]
  26. ///
  27. class Rcode; // forward declaration
  28. class DNSProtocolError : public isc::Exception {
  29. public:
  30. DNSProtocolError(const char* file, size_t line, const char* what) :
  31. isc::Exception(file, line, what) {}
  32. virtual const Rcode& getRcode() const = 0;
  33. };
  34. class DNSMessageFORMERR : public DNSProtocolError {
  35. public:
  36. DNSMessageFORMERR(const char* file, size_t line, const char* what) :
  37. DNSProtocolError(file, line, what) {}
  38. virtual const Rcode& getRcode() const;
  39. };
  40. class DNSMessageBADVERS : public DNSProtocolError {
  41. public:
  42. DNSMessageBADVERS(const char* file, size_t line, const char* what) :
  43. DNSProtocolError(file, line, what) {}
  44. virtual const Rcode& getRcode() const;
  45. };
  46. }
  47. }
  48. #endif // __DNS_EXCEPTIONS_H
  49. // Local Variables:
  50. // mode: c++
  51. // End: