From f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:15:43 +0200 Subject: Adding upstream version 2.4.1. Signed-off-by: Daniel Baumann --- src/lib/dns/exceptions.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/lib/dns/exceptions.h (limited to 'src/lib/dns/exceptions.h') diff --git a/src/lib/dns/exceptions.h b/src/lib/dns/exceptions.h new file mode 100644 index 0000000..40f2cc1 --- /dev/null +++ b/src/lib/dns/exceptions.h @@ -0,0 +1,76 @@ +// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// XXX: we have another exceptions.h, so we need to use a prefix "DNS_" in +// the include guard. More preferably, we should define a consistent naming +// style for the header guide (e.g. module-name_file-name_H) throughout the +// package. + +#ifndef DNS_EXCEPTIONS_H +#define DNS_EXCEPTIONS_H 1 + +#include + +namespace isc { +namespace dns { + +/// +/// \brief A standard DNS module exception ...[TBD] +/// +class Rcode; // forward declaration + +class Exception : public isc::Exception { +public: + Exception(const char* file, size_t line, const char* what) : + isc::Exception(file, line, what) {} +}; + +/// +/// \brief Base class for all sorts of text parse errors. +/// +class DNSTextError : public isc::dns::Exception { +public: + DNSTextError(const char* file, size_t line, const char* what) : + isc::dns::Exception(file, line, what) {} +}; + +/// +/// \brief Base class for name parser exceptions. +/// +class NameParserException : public DNSTextError { +public: + NameParserException(const char* file, size_t line, const char* what) : + DNSTextError(file, line, what) {} +}; + +class DNSProtocolError : public isc::dns::Exception { +public: + DNSProtocolError(const char* file, size_t line, const char* what) : + isc::dns::Exception(file, line, what) {} + virtual const Rcode& getRcode() const = 0; +}; + +class DNSMessageFORMERR : public DNSProtocolError { +public: + DNSMessageFORMERR(const char* file, size_t line, const char* what) : + DNSProtocolError(file, line, what) {} + virtual const Rcode& getRcode() const; +}; + +class DNSMessageBADVERS : public DNSProtocolError { +public: + DNSMessageBADVERS(const char* file, size_t line, const char* what) : + DNSProtocolError(file, line, what) {} + virtual const Rcode& getRcode() const; +}; + +} +} +#endif // DNS_EXCEPTIONS_H + +// Local Variables: +// mode: c++ +// End: -- cgit v1.2.3