2012-05-10 12:06:41 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
|
|
|
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
2012-05-11 13:33:57 +02:00
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
2012-05-10 12:06:41 +02:00
|
|
|
******************************************************************************/
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#ifndef I2BASE_H
|
|
|
|
#define I2BASE_H
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-05-18 22:21:28 +02:00
|
|
|
/**
|
2012-05-19 10:48:00 +02:00
|
|
|
* @mainpage Icinga Documentation
|
|
|
|
*
|
|
|
|
* Icinga implements a framework for run-time-loadable components which can
|
2012-05-21 23:42:54 +02:00
|
|
|
* pass messages between each other. These components can either be hosted in
|
|
|
|
* the same process or in several host processes (either on the same machine or
|
2012-05-19 10:48:00 +02:00
|
|
|
* on different machines).
|
|
|
|
*
|
|
|
|
* The framework's code critically depends on the following patterns:
|
|
|
|
*
|
2012-05-19 11:04:52 +02:00
|
|
|
* <list type="bullet">
|
|
|
|
* <item>Smart pointers
|
2012-05-19 10:48:00 +02:00
|
|
|
*
|
|
|
|
* The shared_ptr and weak_ptr template classes are used to simplify memory
|
2012-05-21 23:42:54 +02:00
|
|
|
* management and to avoid accidental memory leaks and use-after-free
|
|
|
|
* bugs.</item>
|
2012-05-19 10:48:00 +02:00
|
|
|
*
|
2012-05-19 11:04:52 +02:00
|
|
|
* <item>Observer pattern
|
2012-05-19 10:48:00 +02:00
|
|
|
*
|
|
|
|
* Framework classes expose events which other objects can subscribe to. This
|
|
|
|
* is used to decouple clients of a class from the class' internal
|
2012-05-19 11:04:52 +02:00
|
|
|
* implementation.</item>
|
|
|
|
* </list>
|
2012-05-18 22:21:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup base Base class library
|
|
|
|
*
|
2012-05-19 10:48:00 +02:00
|
|
|
* The base class library implements commonly-used functionality like
|
|
|
|
* event handling for sockets and timers.
|
2012-05-18 22:21:28 +02:00
|
|
|
*/
|
|
|
|
|
2012-04-03 15:47:32 +02:00
|
|
|
#ifdef _MSC_VER
|
2012-04-06 08:56:52 +02:00
|
|
|
# pragma warning(disable:4251)
|
2012-06-14 16:09:04 +02:00
|
|
|
# pragma warning(disable:4275)
|
2012-07-14 13:57:20 +02:00
|
|
|
# pragma warning(disable:4345)
|
2012-04-19 11:29:36 +02:00
|
|
|
# define _CRT_SECURE_NO_DEPRECATE
|
2012-05-10 13:46:04 +02:00
|
|
|
# define _CRT_SECURE_NO_WARNINGS
|
2012-04-03 15:47:32 +02:00
|
|
|
#else /* _MSC_VER */
|
2012-04-03 13:38:30 +02:00
|
|
|
# include "config.h"
|
|
|
|
#endif /* _MSC_VER */
|
|
|
|
|
2012-04-26 16:45:00 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
# include "win32.h"
|
|
|
|
#else
|
|
|
|
# include "unix.h"
|
|
|
|
#endif
|
|
|
|
|
2012-04-01 09:48:52 +02:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
|
|
|
#include <cassert>
|
|
|
|
#include <cerrno>
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2013-02-01 23:10:48 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2013-03-07 15:00:26 +01:00
|
|
|
#include <signal.h>
|
2013-02-01 23:10:48 +01:00
|
|
|
|
2012-03-28 13:24:49 +02:00
|
|
|
#include <string>
|
2012-05-25 16:56:47 +02:00
|
|
|
#include <exception>
|
2012-05-26 23:12:46 +02:00
|
|
|
#include <stdexcept>
|
2012-04-26 16:45:00 +02:00
|
|
|
#include <sstream>
|
2012-03-28 13:24:49 +02:00
|
|
|
#include <vector>
|
2012-04-19 08:46:41 +02:00
|
|
|
#include <set>
|
2012-03-28 13:24:49 +02:00
|
|
|
#include <iostream>
|
2012-07-10 15:14:45 +02:00
|
|
|
#include <fstream>
|
2012-03-28 13:24:49 +02:00
|
|
|
#include <list>
|
|
|
|
#include <typeinfo>
|
2012-04-02 09:03:29 +02:00
|
|
|
#include <map>
|
2012-03-28 13:24:49 +02:00
|
|
|
#include <list>
|
2012-05-13 10:44:03 +02:00
|
|
|
#include <algorithm>
|
2012-06-18 06:29:48 +02:00
|
|
|
#include <deque>
|
2013-02-27 21:49:03 +01:00
|
|
|
#include <iterator>
|
2012-05-25 14:40:10 +02:00
|
|
|
|
2012-06-15 19:32:41 +02:00
|
|
|
using std::vector;
|
|
|
|
using std::map;
|
|
|
|
using std::list;
|
|
|
|
using std::set;
|
|
|
|
using std::multimap;
|
2012-08-03 23:03:58 +02:00
|
|
|
using std::multiset;
|
2012-06-15 19:32:41 +02:00
|
|
|
using std::pair;
|
2012-06-18 06:29:48 +02:00
|
|
|
using std::deque;
|
2012-08-02 09:38:08 +02:00
|
|
|
using std::make_pair;
|
2012-06-15 19:32:41 +02:00
|
|
|
|
|
|
|
using std::stringstream;
|
2012-07-24 13:13:02 +02:00
|
|
|
using std::istream;
|
2012-07-10 15:14:45 +02:00
|
|
|
using std::ostream;
|
2012-11-23 11:02:34 +01:00
|
|
|
using std::fstream;
|
2012-07-24 13:13:02 +02:00
|
|
|
using std::ifstream;
|
2012-07-10 15:14:45 +02:00
|
|
|
using std::ofstream;
|
2012-11-23 11:02:34 +01:00
|
|
|
using std::iostream;
|
2012-06-15 19:32:41 +02:00
|
|
|
|
2012-07-10 15:14:45 +02:00
|
|
|
using std::exception;
|
2012-07-17 20:41:06 +02:00
|
|
|
using std::bad_alloc;
|
2012-07-11 20:55:46 +02:00
|
|
|
using std::bad_cast;
|
2012-06-15 19:32:41 +02:00
|
|
|
using std::runtime_error;
|
|
|
|
using std::logic_error;
|
|
|
|
using std::invalid_argument;
|
|
|
|
using std::domain_error;
|
|
|
|
|
2012-07-11 20:55:46 +02:00
|
|
|
using std::type_info;
|
|
|
|
|
2012-06-15 19:32:41 +02:00
|
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
#include <boost/make_shared.hpp>
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
#include <boost/function.hpp>
|
2013-02-17 19:14:34 +01:00
|
|
|
#include <boost/signals2.hpp>
|
2012-06-15 19:32:41 +02:00
|
|
|
#include <boost/algorithm/string/trim.hpp>
|
2012-06-15 22:26:25 +02:00
|
|
|
#include <boost/algorithm/string/split.hpp>
|
2013-03-10 03:09:01 +01:00
|
|
|
#include <boost/algorithm/string/join.hpp>
|
2012-10-23 15:57:45 +02:00
|
|
|
#include <boost/algorithm/string/compare.hpp>
|
2012-06-17 20:35:56 +02:00
|
|
|
#include <boost/thread.hpp>
|
2012-07-11 20:55:46 +02:00
|
|
|
#include <boost/variant.hpp>
|
|
|
|
#include <boost/lexical_cast.hpp>
|
2012-07-16 22:00:50 +02:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
#include <boost/tuple/tuple.hpp>
|
2013-01-30 09:08:48 +01:00
|
|
|
#include <boost/uuid/uuid.hpp>
|
|
|
|
#include <boost/uuid/uuid_generators.hpp>
|
|
|
|
#include <boost/uuid/uuid_io.hpp>
|
2013-02-02 23:22:27 +01:00
|
|
|
#include <boost/program_options.hpp>
|
2013-02-06 12:51:12 +01:00
|
|
|
#include <boost/exception/diagnostic_information.hpp>
|
2013-02-17 19:14:34 +01:00
|
|
|
#include <boost/multi_index_container.hpp>
|
|
|
|
#include <boost/multi_index/ordered_index.hpp>
|
|
|
|
#include <boost/multi_index/key_extractors.hpp>
|
2013-02-28 10:27:33 +01:00
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
2012-06-15 19:32:41 +02:00
|
|
|
|
|
|
|
using boost::shared_ptr;
|
|
|
|
using boost::weak_ptr;
|
|
|
|
using boost::enable_shared_from_this;
|
|
|
|
using boost::dynamic_pointer_cast;
|
|
|
|
using boost::static_pointer_cast;
|
|
|
|
using boost::function;
|
2012-06-17 20:35:56 +02:00
|
|
|
using boost::thread;
|
|
|
|
using boost::thread_group;
|
2013-02-17 19:14:34 +01:00
|
|
|
using boost::recursive_mutex;
|
2012-06-17 20:35:56 +02:00
|
|
|
using boost::condition_variable;
|
2012-06-24 02:56:48 +02:00
|
|
|
using boost::system_time;
|
2012-09-25 15:24:14 +02:00
|
|
|
using boost::posix_time::millisec;
|
2012-07-16 22:00:50 +02:00
|
|
|
using boost::tie;
|
2012-07-17 20:41:06 +02:00
|
|
|
using boost::rethrow_exception;
|
|
|
|
using boost::current_exception;
|
2013-02-06 12:51:12 +01:00
|
|
|
using boost::diagnostic_information;
|
2013-02-17 19:14:34 +01:00
|
|
|
using boost::multi_index_container;
|
|
|
|
using boost::multi_index::indexed_by;
|
|
|
|
using boost::multi_index::identity;
|
|
|
|
using boost::multi_index::ordered_unique;
|
|
|
|
using boost::multi_index::ordered_non_unique;
|
|
|
|
using boost::multi_index::nth_index;
|
2012-07-17 19:19:03 +02:00
|
|
|
|
|
|
|
namespace tuples = boost::tuples;
|
2013-02-17 19:14:34 +01:00
|
|
|
namespace signals2 = boost::signals2;
|
2012-06-14 15:16:41 +02:00
|
|
|
|
2012-04-24 19:58:32 +02:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2013-02-17 19:14:34 +01:00
|
|
|
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
2012-04-24 19:58:32 +02:00
|
|
|
#endif
|
|
|
|
|
2012-04-24 14:02:15 +02:00
|
|
|
#include <openssl/bio.h>
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
|
2013-02-14 10:55:15 +01:00
|
|
|
#if HAVE_GCC_ABI_DEMANGLE
|
2012-04-03 13:38:30 +02:00
|
|
|
# include <cxxabi.h>
|
|
|
|
#endif /* HAVE_GCC_ABI_DEMANGLE */
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
#ifdef I2_BASE_BUILD
|
|
|
|
# define I2_BASE_API I2_EXPORT
|
|
|
|
#else /* I2_BASE_BUILD */
|
|
|
|
# define I2_BASE_API I2_IMPORT
|
|
|
|
#endif /* I2_BASE_BUILD */
|
|
|
|
|
2012-08-02 09:38:08 +02:00
|
|
|
#include "qstring.h"
|
2012-04-22 16:45:31 +02:00
|
|
|
#include "utility.h"
|
2013-03-07 15:00:26 +01:00
|
|
|
#include "stacktrace.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
#include "object.h"
|
2013-02-24 01:10:34 +01:00
|
|
|
#include "objectlock.h"
|
2012-04-03 13:01:00 +02:00
|
|
|
#include "exception.h"
|
2013-02-15 06:47:26 +01:00
|
|
|
#include "eventqueue.h"
|
2012-08-02 09:38:08 +02:00
|
|
|
#include "value.h"
|
2013-01-29 14:19:54 +01:00
|
|
|
#include "convert.h"
|
2012-04-18 15:22:25 +02:00
|
|
|
#include "dictionary.h"
|
2013-03-10 09:08:59 +01:00
|
|
|
#include "array.h"
|
2012-06-28 15:43:49 +02:00
|
|
|
#include "ringbuffer.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
#include "timer.h"
|
2012-11-22 12:04:32 +01:00
|
|
|
#include "stream.h"
|
|
|
|
#include "stream_bio.h"
|
|
|
|
#include "connection.h"
|
2012-07-24 13:13:02 +02:00
|
|
|
#include "netstring.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
#include "fifo.h"
|
2012-11-23 11:02:34 +01:00
|
|
|
#include "stdiostream.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
#include "socket.h"
|
|
|
|
#include "tcpsocket.h"
|
2012-11-23 11:02:34 +01:00
|
|
|
#include "unixsocket.h"
|
2012-11-22 12:04:32 +01:00
|
|
|
#include "tlsstream.h"
|
2012-07-14 15:59:59 +02:00
|
|
|
#include "asynctask.h"
|
|
|
|
#include "process.h"
|
|
|
|
#include "scriptfunction.h"
|
|
|
|
#include "scripttask.h"
|
2013-03-04 15:52:42 +01:00
|
|
|
#include "attribute.h"
|
2012-07-30 10:17:29 +02:00
|
|
|
#include "dynamicobject.h"
|
2012-12-04 08:42:24 +01:00
|
|
|
#include "dynamictype.h"
|
2013-02-14 12:02:02 +01:00
|
|
|
#include "script.h"
|
|
|
|
#include "scriptinterpreter.h"
|
|
|
|
#include "scriptlanguage.h"
|
2012-07-27 16:05:02 +02:00
|
|
|
#include "logger.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
#include "application.h"
|
2012-03-31 15:18:09 +02:00
|
|
|
#include "component.h"
|
2012-07-10 15:14:45 +02:00
|
|
|
#include "streamlogger.h"
|
2012-07-10 13:31:17 +02:00
|
|
|
#include "sysloglogger.h"
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* I2BASE_H */
|