Commit 3a866699 authored by Jelte Jansen's avatar Jelte Jansen

moved exceptions out of libdns and created libexceptions

don't forget to make clean and autoreconf again


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@735 e5f2f494-b856-4b98-b285-d166d9295462
parent 2bf34129
......@@ -44,6 +44,7 @@ include:
ln -s ${abs_top_srcdir}/src/lib/cc/cpp include/cc
ln -s ${abs_top_srcdir}/src/lib/config/cpp include/config
ln -s ${abs_top_srcdir}/src/lib/dns/cpp include/dns
ln -s ${abs_top_srcdir}/src/lib/exceptions/cpp include/exceptions
stree_symlinks: pyshared include
.PHONY: stree_symlinks
......
......@@ -163,6 +163,8 @@ AC_CONFIG_FILES([Makefile
src/lib/config/python/isc/config/Makefile
src/lib/dns/Makefile
src/lib/dns/cpp/Makefile
src/lib/exceptions/cpp/Makefile
src/lib/exceptions/Makefile
src/lib/auth/Makefile
src/lib/auth/cpp/Makefile
])
......
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib/dns/cpp -I$(top_builddir)/include/dns/cpp -I$(top_builddir)/include -I$(top_srcdir)/ext
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib/dns/cpp -I$(top_builddir)/include/dns/cpp -I$(top_builddir)/include -I$(top_srcdir)/ext
pkglibexecdir = $(libexecdir)/@PACKAGE@
......@@ -10,6 +10,7 @@ b10_auth_LDADD = $(top_builddir)/src/lib/dns/cpp/.libs/libdns.a
b10_auth_LDADD += $(top_builddir)/src/lib/auth/cpp/.libs/libauth.a
b10_auth_LDADD += $(top_builddir)/src/lib/config/cpp/libcfgclient.a
b10_auth_LDADD += $(top_builddir)/src/lib/cc/cpp/libcc.a
b10_auth_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
# TODO: config.h.in is wrong because doesn't honor pkgdatadir
# and can't use @datadir@ because doesn't expand default ${prefix}
......
......@@ -3,3 +3,4 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib/dns/cpp -I$(t
bin_PROGRAMS = host
host_SOURCES = host.cc
host_LDADD = $(top_builddir)/src/lib/dns/cpp/.libs/libdns.a
host_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib/dns/cpp -I$(top_builddir)/include/dns/cpp -I$(top_builddir)/include -I$(top_srcdir)/ext
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib/dns/cpp -I$(top_builddir)/include/dns/cpp -I$(top_builddir)/include -I$(top_srcdir)/ext
pkglibexecdir = $(libexecdir)/@PACKAGE@
......@@ -12,6 +12,7 @@ b10_parkinglot_SOURCES += builtin.h builtin.cc
b10_parkinglot_LDADD = $(top_builddir)/src/lib/dns/cpp/.libs/libdns.a
b10_parkinglot_LDADD += $(top_builddir)/src/lib/config/cpp/libcfgclient.a
b10_parkinglot_LDADD += $(top_builddir)/src/lib/cc/cpp/libcc.a
b10_parkinglot_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
b10_parkinglotdir = $(DESTDIR)$(pkgdatadir)
b10_parkinglot_DATA = parkinglot.spec
......@@ -20,3 +21,4 @@ b10_parkinglot_DATA = parkinglot.spec
bin_PROGRAMS = builtin_bench
builtin_bench_SOURCES = builtin_bench.cc builtin.h builtin.cc
builtin_bench_LDADD = $(top_builddir)/src/lib/dns/cpp/.libs/libdns.a
builtin_bench_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
SUBDIRS = dns cc config auth
SUBDIRS = exceptions dns cc config auth
......@@ -19,7 +19,7 @@
#include <queue>
#include <dns/exceptions.h>
#include <exceptions/exceptions.h>
#include <dns/name.h>
#include <dns/message.h>
#include <dns/rrset.h>
......@@ -42,7 +42,7 @@ enum QueryStatus {
class MalformedMessage : public Exception {
public:
MalformedMessage(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
// An individual task to be carried out by the query logic
......
......@@ -11,6 +11,7 @@ run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = libcc.a $(GTEST_LDADD)
run_unittests_LDADD += $(top_builddir)/src/lib/dns/cpp/.libs/libdns.a
run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
endif
noinst_PROGRAMS = $(TESTS)
......@@ -22,7 +22,7 @@
#include <map>
#include <boost/shared_ptr.hpp>
#include <stdexcept>
#include <dns/exceptions.h>
#include <exceptions/exceptions.h>
namespace isc { namespace data {
......@@ -36,10 +36,10 @@ typedef boost::shared_ptr<Element> ElementPtr;
/// ListElement)
///
// todo: include types and called function in the exception
class TypeError : public isc::dns::Exception {
class TypeError : public isc::Exception {
public:
TypeError(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......
......@@ -10,7 +10,7 @@ run_unittests_SOURCES = data_def_unittests.cc run_unittests.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = libcfgclient.a $(GTEST_LDADD)
run_unittests_LDADD += $(top_builddir)/src/lib/dns/cpp/libdns.la
run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/cpp/libexceptions.la
run_unittests_LDADD += $(top_builddir)/src/lib/cc/cpp/libcc.a
endif
......
AM_CPPFLAGS = -I$(top_srcdir)/ext
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/ext
CLEANFILES = *.gcno *.gcda
CLEANFILES += rrclass.h rrtype.h rrparamregistry.cc rdataclass.h rdataclass.cc
......@@ -16,7 +16,6 @@ libdns_la_SOURCES += rrset.h rrset.cc
libdns_la_SOURCES += question.h question.cc
libdns_la_SOURCES += message.h message.cc
libdns_la_SOURCES += base64.h base64.cc
libdns_la_SOURCES += exceptions.h exceptions.cc
rrclass.h: rrclass-placeholder.h
rrtype.h: rrtype-placeholder.h
......@@ -29,7 +28,7 @@ if HAVE_GTEST
TESTS += run_unittests
run_unittests_SOURCES = unittest_util.h unittest_util.cc
run_unittests_SOURCES += buffer_unittest.cc name_unittest.cc
run_unittests_SOURCES += messagerenderer_unittest.cc exceptions_unittest.cc
run_unittests_SOURCES += messagerenderer_unittest.cc
run_unittests_SOURCES += rrclass_unittest.cc rrtype_unittest.cc
run_unittests_SOURCES += rrttl_unittest.cc
run_unittests_SOURCES += rdata_unittest.cc
......@@ -39,9 +38,10 @@ run_unittests_SOURCES += rrparamregistry_unittest.cc
run_unittests_SOURCES += message_unittest.cc
run_unittests_SOURCES += base64_unittest.cc
run_unittests_SOURCES += run_unittests.cc
run_unittests_CPPFLAGS = $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(GTEST_LDFLAGS)
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = .libs/libdns.a $(GTEST_LDADD)
run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/cpp/.libs/libexceptions.a
endif
noinst_PROGRAMS = $(TESTS)
......@@ -24,7 +24,7 @@
#include <boost/archive/iterators/transform_width.hpp>
#include "base64.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
using namespace std;
using namespace boost::archive::iterators;
......
......@@ -20,7 +20,7 @@
#include <string>
#include <vector>
#include "exceptions.h"
#include <exceptions/exceptions.h>
//
// Note: this helper module isn't specific to the DNS protocol per se.
......@@ -38,7 +38,7 @@ namespace dns {
class BadBase64String : public Exception {
public:
BadBase64String(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
std::string encodeBase64(const std::vector<char>& binary);
......
......@@ -23,7 +23,7 @@
#include <stdint.h>
#include "exceptions.h"
#include <exceptions/exceptions.h>
namespace isc {
namespace dns {
......@@ -35,7 +35,7 @@ namespace dns {
class InvalidBufferPosition : public Exception {
public:
InvalidBufferPosition(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///\brief The \c InputBuffer class is a buffer abstraction for manipulating
......
......@@ -22,7 +22,7 @@
#include <boost/shared_ptr.hpp>
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "question.h"
#include "rrset.h"
......@@ -35,13 +35,13 @@ namespace dns {
class MessageTooShort : public Exception {
public:
MessageTooShort(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
class InvalidMessageSection : public Exception {
public:
InvalidMessageSection(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
typedef uint8_t rcode_t; // we actually only need 4 bits of it
......
......@@ -22,7 +22,7 @@
#include <string>
#include <vector>
#include "exceptions.h"
#include <exceptions/exceptions.h>
namespace isc {
namespace dns {
......@@ -37,7 +37,7 @@ class MessageRenderer;
class EmptyLabel : public Exception {
public:
EmptyLabel(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -47,7 +47,7 @@ public:
class TooLongName : public Exception {
public:
TooLongName(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -57,7 +57,7 @@ public:
class TooLongLabel : public Exception {
public:
TooLongLabel(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -69,7 +69,7 @@ public:
class BadLabelType : public Exception {
public:
BadLabelType(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -79,7 +79,7 @@ public:
class BadEscape : public Exception {
public:
BadEscape(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -89,7 +89,7 @@ public:
class BadPointer : public Exception {
public:
BadPointer(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -102,7 +102,7 @@ public:
class IncompleteName : public Exception {
public:
IncompleteName(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......
......@@ -41,7 +41,7 @@ namespace rdata {
class InvalidRdataLength : public Exception {
public:
InvalidRdataLength(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -51,7 +51,7 @@ public:
class InvalidRdataText : public Exception {
public:
InvalidRdataText(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -60,7 +60,7 @@ public:
class CharStringTooLong : public Exception {
public:
CharStringTooLong(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
class Rdata;
......
......@@ -17,7 +17,7 @@
#include <string>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rdata.h"
#include "rdataclass.h"
......
......@@ -19,7 +19,7 @@
#include <boost/lexical_cast.hpp>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "name.h"
#include "messagerenderer.h"
#include "rdata.h"
......
......@@ -19,7 +19,7 @@
#include <boost/lexical_cast.hpp>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "name.h"
#include "messagerenderer.h"
#include "rdata.h"
......
......@@ -17,7 +17,7 @@
#include <string>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rdata.h"
#include "rdataclass.h"
......
......@@ -22,7 +22,7 @@
#include <arpa/inet.h> // XXX: for inet_pton/ntop(), not exist in C++ standards
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rdata.h"
#include "rdataclass.h"
......
......@@ -22,7 +22,7 @@
#include <arpa/inet.h> // XXX: for inet_pton/ntop(), not exist in C++ standards
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rdata.h"
#include "rdataclass.h"
......
......@@ -17,7 +17,7 @@
#ifndef __RRCLASS_H
#define __RRCLASS_H 1
#include "exceptions.h"
#include <exceptions/exceptions.h>
namespace isc {
namespace dns {
......@@ -34,7 +34,7 @@ class MessageRenderer;
class InvalidRRClass : public Exception {
public:
InvalidRRClass(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -44,7 +44,7 @@ public:
class IncompleteRRClass : public Exception {
public:
IncompleteRRClass(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......
......@@ -19,7 +19,7 @@
#include <stdint.h>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rrparamregistry.h"
#include "rrclass.h"
......
......@@ -27,7 +27,7 @@
#include <boost/shared_ptr.hpp>
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "rrparamregistry.h"
#include "rrclass.h"
#include "rrtype.h"
......
......@@ -23,7 +23,7 @@
#include <boost/shared_ptr.hpp>
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "rdata.h"
namespace isc {
......@@ -39,7 +39,7 @@ struct RRParamRegistryImpl;
class RRTypeExists : public Exception {
public:
RRTypeExists(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -49,13 +49,13 @@ public:
class RRClassExists : public Exception {
public:
RRClassExists(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
class InvalidRdataText : public Exception {
public:
InvalidRdataText(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
namespace rdata {
......
......@@ -19,7 +19,7 @@
#include <stdint.h>
#include "exceptions.h"
#include <exceptions/exceptions.h>
namespace isc {
namespace dns {
......@@ -36,7 +36,7 @@ class MessageRenderer;
class InvalidRRTTL : public Exception {
public:
InvalidRRTTL(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -46,7 +46,7 @@ public:
class IncompleteRRTTL : public Exception {
public:
IncompleteRRTTL(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......
......@@ -17,7 +17,7 @@
#ifndef __RRTYPE_H
#define __RRTYPE_H 1
#include "exceptions.h"
#include <exceptions/exceptions.h>
namespace isc {
namespace dns {
......@@ -34,7 +34,7 @@ class MessageRenderer;
class InvalidRRType : public Exception {
public:
InvalidRRType(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -44,7 +44,7 @@ public:
class IncompleteRRType : public Exception {
public:
IncompleteRRType(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......
......@@ -19,7 +19,7 @@
#include <stdint.h>
#include "buffer.h"
#include "exceptions.h"
#include <exceptions/exceptions.h>
#include "messagerenderer.h"
#include "rrparamregistry.h"
#include "rrtype.h"
......
......@@ -18,15 +18,14 @@
#include "exceptions.h"
using isc::dns::Exception;
using isc::Exception;
namespace isc {
namespace dns {
const char*
Exception::what() const throw()
{
const char* whatstr = "isc::dns::Exception";
const char* whatstr = "isc::Exception";
// XXX: even though it's very unlikely that c_str() throws an exception,
// it's still not 100% guaranteed. To meet the exception specification
......@@ -42,4 +41,3 @@ Exception::what() const throw()
}
}
}
......@@ -21,7 +21,6 @@
#include <string>
namespace isc {
namespace dns {
///
/// This is a base class for exceptions thrown from the DNS library module.
......@@ -100,7 +99,7 @@ private:
class OutOfRange : public Exception {
public:
OutOfRange(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -110,7 +109,7 @@ public:
class Unexpected : public Exception {
public:
Unexpected(const char* file, size_t line, const char* what) :
isc::dns::Exception(file, line, what) {}
isc::Exception(file, line, what) {}
};
///
......@@ -118,7 +117,6 @@ public:
///
#define dns_throw(type, args...) throw type(__FILE__, __LINE__, args)
}
}
#endif // __EXCEPTIONS_H
......
......@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
using isc::dns::Exception;
using isc::Exception;
namespace {
......
// Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
// $Id: run_unittests.cc 476 2010-01-19 00:29:28Z jinmei $
#include <gtest/gtest.h>
int
main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment