mirror of https://github.com/Icinga/icinga2.git
Merge branch 'master' into compatido
This commit is contained in:
commit
454adc5a90
|
@ -37,3 +37,4 @@ stamp-h1
|
|||
.libs
|
||||
icinga-app/icinga
|
||||
docs/dev
|
||||
m4/ylwrap
|
||||
|
|
24
INSTALL
24
INSTALL
|
@ -12,15 +12,16 @@ Build Requirements
|
|||
------------------
|
||||
|
||||
The following requirements need to be fulfilled in order to build the
|
||||
application using a dist tarball (package names in parenthesis):
|
||||
application using a dist tarball (package names for RHEL and Debian in
|
||||
parenthesis):
|
||||
|
||||
* GNU make (make on RHEL and Debian)
|
||||
* GNU make (make)
|
||||
* C++ compiler (gcc-c++ on RHEL, build-essential on Debian)
|
||||
* OpenSSL library and header files (openssl-devel on RHEL, libssl-dev
|
||||
on Debian)
|
||||
* Boost library and header files (boost-devel on RHEL, libboost-all-dev
|
||||
on Debian)
|
||||
* optional: Doxygen (doxygen on RHEL and Debian)
|
||||
* optional: Doxygen (doxygen)
|
||||
|
||||
Packaging Requirements
|
||||
----------------------
|
||||
|
@ -29,12 +30,12 @@ In order to build a dist tarball for the application the following external
|
|||
software components need to be installed in addition to the build requirements
|
||||
mentioned above:
|
||||
|
||||
* GNU Automake (automake on RHEL and Debian)
|
||||
* GNU Autoconf (autoconf on RHEL and Debian)
|
||||
* GNU Automake (automake)
|
||||
* GNU Autoconf (autoconf)
|
||||
* GNU Libtool (libtool and libtool-ltdl-devel on RHEL, libtool and
|
||||
libltdl-dev on Debian)
|
||||
* GNU bison (bison on RHEL and Debian)
|
||||
* GNU flex (flex on RHEL and Debian)
|
||||
* GNU bison (bison)
|
||||
* GNU flex (flex)
|
||||
|
||||
Debian Packages
|
||||
---------------
|
||||
|
@ -58,6 +59,12 @@ The configure script supports all the usual parameters one comes to expect
|
|||
from autoconf. In particular you may want to use --prefix to specify an
|
||||
alternative installation prefix.
|
||||
|
||||
Note: The Git repository does not contain any auto-generated Autotools files,
|
||||
i.e. there is no 'configure' script. In this case you will need to regenerate
|
||||
the 'configure' script by running 'autogen.sh'. However, as an end-user you
|
||||
should reconsider whether you really want to use the code from the Git
|
||||
repository. In general it is advisable to use one of the dist tarballs instead.
|
||||
|
||||
Running Icinga 2
|
||||
----------------
|
||||
|
||||
|
@ -73,3 +80,6 @@ Icinga 2 reads a single configuration file which is used to specify all
|
|||
configuration settings (global settings, hosts, services, etc.). The
|
||||
configuration format is explained in detail in the docs/icinga2-config.txt
|
||||
file.
|
||||
|
||||
By default "make install" installs example configuration files to /etc/icinga2
|
||||
unless you have specified a different prefix or sysconfdir.
|
||||
|
|
2
README
2
README
|
@ -7,5 +7,7 @@ information about how to install it.
|
|||
The documentation file docs/icinga2-intro.txt contains an in-depth overview
|
||||
of currently implemented and planned features for Icinga 2.
|
||||
|
||||
Read the INSTALL file for information on how to install Icinga 2.
|
||||
|
||||
Check the project website at http://www.icinga.org/ for status updates and
|
||||
https://www.icinga.org/support/ if you want to contact us.
|
||||
|
|
|
@ -30,7 +30,7 @@ void CheckerComponent::Start(void)
|
|||
m_Endpoint->RegisterSubscription("checker");
|
||||
|
||||
Service::OnCheckerChanged.connect(bind(&CheckerComponent::CheckerChangedHandler, this, _1));
|
||||
DynamicObject::OnUnregistered.connect(bind(&CheckerComponent::ServiceRemovedHandler, this, _1));
|
||||
DynamicObject::OnUnregistered.connect(bind(&CheckerComponent::ObjectRemovedHandler, this, _1));
|
||||
|
||||
m_CheckTimer = boost::make_shared<Timer>();
|
||||
m_CheckTimer->SetInterval(1);
|
||||
|
@ -184,7 +184,7 @@ void CheckerComponent::CheckerChangedHandler(const Service::Ptr& service)
|
|||
}
|
||||
}
|
||||
|
||||
void CheckerComponent::ServiceRemovedHandler(const DynamicObject::Ptr& object)
|
||||
void CheckerComponent::ObjectRemovedHandler(const DynamicObject::Ptr& object)
|
||||
{
|
||||
Service::Ptr service = dynamic_pointer_cast<Service>(object);
|
||||
|
||||
|
@ -197,3 +197,4 @@ void CheckerComponent::ServiceRemovedHandler(const DynamicObject::Ptr& object)
|
|||
}
|
||||
|
||||
EXPORT_COMPONENT(checker, CheckerComponent);
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup checker
|
||||
*/
|
||||
struct ServiceNextCheckExtractor
|
||||
{
|
||||
typedef double result_type;
|
||||
|
@ -71,10 +74,7 @@ private:
|
|||
void AdjustCheckTimer(void);
|
||||
|
||||
void CheckerChangedHandler(const Service::Ptr& service);
|
||||
void ServiceRemovedHandler(const DynamicObject::Ptr& object);
|
||||
|
||||
//void AssignServiceRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
|
||||
//void ClearServicesRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
|
||||
void ObjectRemovedHandler(const DynamicObject::Ptr& object);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -187,6 +187,7 @@ void CompatComponent::StatusTimerHandler(void)
|
|||
<< "\n";
|
||||
|
||||
statusfp << "programstatus {" << "\n"
|
||||
<< "icinga_pid=" << Utility::GetPid() << "\n"
|
||||
<< "\t" << "daemon_mode=1" << "\n"
|
||||
<< "\t" << "program_start=" << IcingaApplication::GetInstance()->GetStartTime() << "\n"
|
||||
<< "\t" << "active_service_checks_enabled=1" << "\n"
|
||||
|
|
|
@ -26,8 +26,8 @@ using namespace icinga;
|
|||
*/
|
||||
void ConvenienceComponent::Start(void)
|
||||
{
|
||||
ConfigItem::OnCommitted.connect(boost::bind(&ConvenienceComponent::HostCommittedHandler, this, _1));
|
||||
ConfigItem::OnRemoved.connect(boost::bind(&ConvenienceComponent::HostRemovedHandler, this, _1));
|
||||
ConfigItem::OnCommitted.connect(boost::bind(&ConvenienceComponent::ObjectCommittedHandler, this, _1));
|
||||
ConfigItem::OnRemoved.connect(boost::bind(&ConvenienceComponent::ObjectRemovedHandler, this, _1));
|
||||
}
|
||||
|
||||
template<typename TDict>
|
||||
|
@ -68,7 +68,7 @@ static void CopyServiceAttributes(const Host::Ptr& host, TDict serviceDesc,
|
|||
Service::ResolveDependencies(host, hostchecks));
|
||||
}
|
||||
|
||||
void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
|
||||
void ConvenienceComponent::ObjectCommittedHandler(const ConfigItem::Ptr& item)
|
||||
{
|
||||
if (item->GetType() != "Host")
|
||||
return;
|
||||
|
@ -139,7 +139,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
|
|||
host->Set("convenience_services", newServices);
|
||||
}
|
||||
|
||||
void ConvenienceComponent::HostRemovedHandler(const ConfigItem::Ptr& item)
|
||||
void ConvenienceComponent::ObjectRemovedHandler(const ConfigItem::Ptr& item)
|
||||
{
|
||||
if (item->GetType() != "Host")
|
||||
return;
|
||||
|
@ -161,3 +161,4 @@ void ConvenienceComponent::HostRemovedHandler(const ConfigItem::Ptr& item)
|
|||
}
|
||||
|
||||
EXPORT_COMPONENT(convenience, ConvenienceComponent);
|
||||
|
||||
|
|
|
@ -32,9 +32,8 @@ public:
|
|||
virtual void Start(void);
|
||||
|
||||
private:
|
||||
void HostAddedHandler(const ConfigItem::Ptr& item);
|
||||
void HostCommittedHandler(const ConfigItem::Ptr& item);
|
||||
void HostRemovedHandler(const ConfigItem::Ptr& item);
|
||||
void ObjectCommittedHandler(const ConfigItem::Ptr& item);
|
||||
void ObjectRemovedHandler(const ConfigItem::Ptr& item);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@ void DemoComponent::Start(void)
|
|||
{
|
||||
m_Endpoint = Endpoint::MakeEndpoint("demo", true);
|
||||
m_Endpoint->RegisterTopicHandler("demo::HelloWorld",
|
||||
boost::bind(&DemoComponent::HelloWorldRequestHandler, this, _2, _3));
|
||||
boost::bind(&DemoComponent::HelloWorldRequestHandler, this, _2,
|
||||
_3));
|
||||
|
||||
m_DemoTimer = boost::make_shared<Timer>();
|
||||
m_DemoTimer->SetInterval(5);
|
||||
|
@ -51,20 +52,25 @@ void DemoComponent::Stop(void)
|
|||
*/
|
||||
void DemoComponent::DemoTimerHandler(void)
|
||||
{
|
||||
Logger::Write(LogInformation, "demo", "Sending multicast 'hello world' message.");
|
||||
Logger::Write(LogInformation, "demo", "Sending multicast 'hello"
|
||||
" world' message.");
|
||||
|
||||
RequestMessage request;
|
||||
request.SetMethod("demo::HelloWorld");
|
||||
|
||||
EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint, request);
|
||||
EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint,
|
||||
request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes demo::HelloWorld messages.
|
||||
*/
|
||||
void DemoComponent::HelloWorldRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
|
||||
void DemoComponent::HelloWorldRequestHandler(const Endpoint::Ptr& sender,
|
||||
const RequestMessage& request)
|
||||
{
|
||||
Logger::Write(LogInformation, "demo", "Got 'hello world' from address=" + sender->GetAddress() + ", identity=" + sender->GetName());
|
||||
Logger::Write(LogInformation, "demo", "Got 'hello world' from"
|
||||
" address=" + sender->GetAddress() + ", identity=" +
|
||||
sender->GetName());
|
||||
}
|
||||
|
||||
EXPORT_COMPONENT(demo, DemoComponent);
|
||||
|
|
|
@ -51,7 +51,7 @@ AM_PROG_LEX
|
|||
AC_PROG_YACC
|
||||
AC_PROG_LIBTOOL
|
||||
AX_CXX_GCC_ABI_DEMANGLE
|
||||
AX_BOOST_BASE([1.46], [], [AC_MSG_ERROR([You need the Boost headers and libraries in order to build this application])])
|
||||
AX_BOOST_BASE([1.41], [], [AC_MSG_ERROR([You need the Boost headers and libraries in order to build this application])])
|
||||
AX_BOOST_SIGNALS
|
||||
AX_BOOST_THREAD
|
||||
AX_BOOST_SYSTEM
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[git-buildpackage]
|
||||
prebuild = NOCONFIGURE=1 ./autogen.sh
|
|
@ -648,7 +648,7 @@ WARN_LOGFILE =
|
|||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = @top_srcdir@/base @top_srcdir@/jsonrpc @top_srcdir@/icinga @top_srcdir@/components @top_srcdir@/icinga-app
|
||||
INPUT = lib/base lib/config lib/icinga lib/remoting components icinga-app
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
|
@ -694,7 +694,7 @@ EXCLUDE_SYMLINKS = NO
|
|||
# against the file with absolute path, so to exclude all test directories
|
||||
# for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_PATTERNS = */lib/config/config_parser* */lib/config/config_lexer*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
|
|
|
@ -4,12 +4,12 @@ SUBDIRS = \
|
|||
config
|
||||
|
||||
bin_PROGRAMS = \
|
||||
icinga
|
||||
icinga2
|
||||
|
||||
icinga_SOURCES = \
|
||||
icinga2_SOURCES = \
|
||||
icinga.cpp
|
||||
|
||||
icinga_CPPFLAGS = \
|
||||
icinga2_CPPFLAGS = \
|
||||
-DI2_ICINGALAUNCHER_BUILD \
|
||||
$(LTDLINCL) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
|
@ -19,10 +19,10 @@ icinga_CPPFLAGS = \
|
|||
-I${top_srcdir}/lib/icinga \
|
||||
-I${top_srcdir}
|
||||
|
||||
icinga_LDFLAGS = \
|
||||
icinga2_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS)
|
||||
|
||||
icinga_LDADD = \
|
||||
icinga2_LDADD = \
|
||||
$(LIBLTDL) \
|
||||
$(BOOST_SIGNALS_LIB) \
|
||||
$(BOOST_THREAD_LIB) \
|
||||
|
@ -38,6 +38,6 @@ icinga_LDADD = \
|
|||
-dlopen ${top_builddir}/components/delegation/delegation.la \
|
||||
-dlopen ${top_builddir}/components/demo/demo.la
|
||||
|
||||
icinga_DEPENDENCIES = \
|
||||
icinga2_DEPENDENCIES = \
|
||||
${top_builddir}/components/replication/replication.la \
|
||||
${top_builddir}/components/convenience/convenience.la
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
icinga2confdir = $(sysconfdir)/icinga2
|
||||
icinga2conf_DATA = \
|
||||
icinga2.conf.dist \
|
||||
example-ca.crt \
|
||||
example-ca.key \
|
||||
icinga-c1.pem \
|
||||
icinga-c2.pem \
|
||||
icinga-c3.pem
|
||||
|
||||
EXTRA_DIST = $(icinga2conf_DATA)
|
|
@ -24,8 +24,6 @@
|
|||
# define ICINGA_VERSION VERSION ", " GIT_MESSAGE
|
||||
|
||||
# include <ltdl.h>
|
||||
#else /* _WIN32 */
|
||||
# define ICINGA_VERSION VERSION
|
||||
#endif /* _WIN32 */
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -51,7 +49,11 @@ int main(int argc, char **argv)
|
|||
* in the base library. */
|
||||
Application::SetMainThread();
|
||||
|
||||
Logger::Write(LogInformation, "icinga", "Icinga application loader (version: " ICINGA_VERSION ")");
|
||||
Logger::Write(LogInformation, "icinga", "Icinga application loader"
|
||||
#ifndef _WIN32
|
||||
" (version: " ICINGA_VERSION ")"
|
||||
#endif /* _WIN32 */
|
||||
);
|
||||
|
||||
if (argc < 3 || strcmp(argv[1], "-c") != 0) {
|
||||
stringstream msgbuf;
|
||||
|
|
|
@ -33,7 +33,7 @@ make install DESTDIR=%{buildroot}
|
|||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/icinga
|
||||
%{_bindir}/icinga2
|
||||
%{_datadir}/doc/icinga2
|
||||
%{_libdir}/icinga2
|
||||
%{_sysconfdir}/icinga2
|
||||
|
|
|
@ -347,13 +347,7 @@ void Application::UpdatePidFile(const String& filename)
|
|||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifndef _WIN32
|
||||
pid_t pid = getpid();
|
||||
#else /* _WIN32 */
|
||||
DWORD pid = GetCurrentProcessId();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
fprintf(m_PidFile, "%d", pid);
|
||||
fprintf(m_PidFile, "%d", Utility::GetPid());
|
||||
fflush(m_PidFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,12 @@ public:
|
|||
|
||||
int Run(int argc, char **argv);
|
||||
|
||||
/**
|
||||
* Starts the application.
|
||||
*
|
||||
* @param args Arguments for the application.
|
||||
* @returns The exit code of the application.
|
||||
*/
|
||||
virtual int Main(const vector<String>& args) = 0;
|
||||
|
||||
static void Shutdown(void);
|
||||
|
|
|
@ -35,6 +35,9 @@ public:
|
|||
typedef shared_ptr<AsyncTask<TClass, TResult> > Ptr;
|
||||
typedef weak_ptr<AsyncTask<TClass, TResult> > WeakPtr;
|
||||
|
||||
/**
|
||||
* A completion callback for an AsyncTask.
|
||||
*/
|
||||
typedef function<void (const shared_ptr<TClass>&)> CompletionCallback;
|
||||
|
||||
/**
|
||||
|
@ -118,6 +121,11 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Begins executing the task. The Run method must ensure
|
||||
* that one of the Finish*() functions is executed on the task
|
||||
* object (possibly after the Run method has returned).
|
||||
*/
|
||||
virtual void Run(void) = 0;
|
||||
|
||||
private:
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
<ClCompile Include="tcpclient.cpp" />
|
||||
<ClCompile Include="tcpserver.cpp" />
|
||||
<ClCompile Include="tcpsocket.cpp" />
|
||||
<ClCompile Include="threadpool.cpp" />
|
||||
<ClCompile Include="timer.cpp" />
|
||||
<ClCompile Include="tlsclient.cpp" />
|
||||
<ClCompile Include="unix.cpp" />
|
||||
|
@ -69,7 +68,6 @@
|
|||
<ClInclude Include="tcpclient.h" />
|
||||
<ClInclude Include="tcpserver.h" />
|
||||
<ClInclude Include="tcpsocket.h" />
|
||||
<ClInclude Include="threadpool.h" />
|
||||
<ClInclude Include="timer.h" />
|
||||
<ClInclude Include="tlsclient.h" />
|
||||
<ClInclude Include="unix.h" />
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
<ClCompile Include="tcpsocket.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="threadpool.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="timer.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
|
@ -129,9 +126,6 @@
|
|||
<ClInclude Include="tcpsocket.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="threadpool.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="timer.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Interface for application extensions.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API IComponent : public Object
|
||||
{
|
||||
public:
|
||||
|
@ -36,7 +41,8 @@ protected:
|
|||
DynamicObject::Ptr GetConfig(void) const;
|
||||
|
||||
private:
|
||||
DynamicObject *m_Config;
|
||||
DynamicObject *m_Config; /**< The configuration object for this
|
||||
component. */
|
||||
|
||||
friend class Component;
|
||||
};
|
||||
|
@ -59,7 +65,8 @@ public:
|
|||
static void AddSearchDir(const String& componentDirectory);
|
||||
|
||||
private:
|
||||
IComponent::Ptr m_Impl;
|
||||
IComponent::Ptr m_Impl; /**< The implementation object for this
|
||||
component. */
|
||||
};
|
||||
|
||||
typedef IComponent *(*CreateComponentFunction)(void);
|
||||
|
|
|
@ -23,15 +23,31 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Compares the keys of dictionary keys using the less operator.
|
||||
* Compares dictionary keys using the less operator.
|
||||
*/
|
||||
struct DictionaryKeyLessComparer
|
||||
{
|
||||
/**
|
||||
* Compares two keys.
|
||||
*
|
||||
* @param a The first key.
|
||||
* @param b The second key.
|
||||
* @returns true if the first key is less than the second key, false
|
||||
* otherwise
|
||||
*/
|
||||
bool operator()(const pair<String, Value>& a, const char *b)
|
||||
{
|
||||
return a.first < b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two keys.
|
||||
*
|
||||
* @param a The first key.
|
||||
* @param b The second key.
|
||||
* @returns true if the first key is less than the second key, false
|
||||
* otherwise
|
||||
*/
|
||||
bool operator()(const char *a, const pair<String, Value>& b)
|
||||
{
|
||||
return a < b.first;
|
||||
|
@ -217,9 +233,8 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json)
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a dictionary to a JSON object.
|
||||
* Converts this dictionary to a JSON object.
|
||||
*
|
||||
* @param dictionary The dictionary.
|
||||
* @returns A JSON object that is equivalent to the dictionary. Values that
|
||||
* cannot be represented in JSON are omitted.
|
||||
*/
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
typedef shared_ptr<Dictionary> Ptr;
|
||||
typedef weak_ptr<Dictionary> WeakPtr;
|
||||
|
||||
/**
|
||||
* An iterator that can be used to iterate over dictionary elements.
|
||||
*/
|
||||
typedef map<String, Value>::iterator Iterator;
|
||||
|
||||
Value Get(const char *key) const;
|
||||
|
@ -56,7 +59,7 @@ public:
|
|||
cJSON *ToJson(void) const;
|
||||
|
||||
private:
|
||||
map<String, Value> m_Data;
|
||||
map<String, Value> m_Data; /**< The data for the dictionary. */
|
||||
};
|
||||
|
||||
inline Dictionary::Iterator range_begin(Dictionary::Ptr x)
|
||||
|
|
|
@ -85,15 +85,18 @@ Dictionary::Ptr DynamicObject::BuildUpdate(double sinceTx, int attributeTypes) c
|
|||
return update;
|
||||
}
|
||||
|
||||
void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate, int allowedTypes)
|
||||
void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
|
||||
int allowedTypes)
|
||||
{
|
||||
InternalApplyUpdate(serializedUpdate, allowedTypes, false);
|
||||
}
|
||||
|
||||
void DynamicObject::InternalApplyUpdate(const Dictionary::Ptr& serializedUpdate, int allowedTypes, bool suppressEvents)
|
||||
void DynamicObject::InternalApplyUpdate(const Dictionary::Ptr& serializedUpdate,
|
||||
int allowedTypes, bool suppressEvents)
|
||||
{
|
||||
double configTx = 0;
|
||||
if ((allowedTypes & Attribute_Config) != 0 && serializedUpdate->Contains("configTx")) {
|
||||
if ((allowedTypes & Attribute_Config) != 0 &&
|
||||
serializedUpdate->Contains("configTx")) {
|
||||
configTx = serializedUpdate->Get("configTx");
|
||||
|
||||
if (configTx > m_ConfigTx)
|
||||
|
@ -127,7 +130,8 @@ void DynamicObject::InternalApplyUpdate(const Dictionary::Ptr& serializedUpdate,
|
|||
}
|
||||
}
|
||||
|
||||
void DynamicObject::RegisterAttribute(const String& name, DynamicAttributeType type)
|
||||
void DynamicObject::RegisterAttribute(const String& name,
|
||||
DynamicAttributeType type)
|
||||
{
|
||||
DynamicAttribute attr;
|
||||
attr.Type = type;
|
||||
|
@ -155,7 +159,8 @@ Value DynamicObject::Get(const String& name) const
|
|||
return InternalGetAttribute(name);
|
||||
}
|
||||
|
||||
void DynamicObject::InternalSetAttribute(const String& name, const Value& data, double tx, bool suppressEvent)
|
||||
void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
||||
double tx, bool suppressEvent)
|
||||
{
|
||||
DynamicAttribute attr;
|
||||
attr.Type = Attribute_Transient;
|
||||
|
@ -214,16 +219,6 @@ void DynamicObject::ClearAttributesByType(DynamicAttributeType type)
|
|||
}
|
||||
}
|
||||
|
||||
DynamicObject::AttributeConstIterator DynamicObject::AttributeBegin(void) const
|
||||
{
|
||||
return m_Attributes.begin();
|
||||
}
|
||||
|
||||
DynamicObject::AttributeConstIterator DynamicObject::AttributeEnd(void) const
|
||||
{
|
||||
return m_Attributes.end();
|
||||
}
|
||||
|
||||
String DynamicObject::GetType(void) const
|
||||
{
|
||||
return Get("__type");
|
||||
|
@ -422,7 +417,8 @@ void DynamicObject::RestoreObjects(const String& filename)
|
|||
std::ifstream fp;
|
||||
fp.open(filename.CStr());
|
||||
|
||||
/* TODO: Fix this horrible mess. */
|
||||
/* TODO: Fix this horrible mess by implementing a class that provides
|
||||
* IOQueue functionality for files. */
|
||||
FIFO::Ptr fifo = boost::make_shared<FIFO>();
|
||||
while (fp) {
|
||||
char buffer[1024];
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* The type of an attribute for a DynamicObject.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
enum DynamicAttributeType
|
||||
{
|
||||
Attribute_Transient = 1,
|
||||
|
@ -43,15 +48,21 @@ enum DynamicAttributeType
|
|||
Attribute_All = Attribute_Transient | Attribute_Local | Attribute_Replicated | Attribute_Config
|
||||
};
|
||||
|
||||
/**
|
||||
* An attribute for a DynamicObject.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
struct DynamicAttribute
|
||||
{
|
||||
Value Data;
|
||||
DynamicAttributeType Type;
|
||||
double Tx;
|
||||
Value Data; /**< The current value of the attribute. */
|
||||
DynamicAttributeType Type; /**< The type of the attribute. */
|
||||
double Tx; /**< The timestamp of the last value change. */
|
||||
};
|
||||
|
||||
/**
|
||||
* A dynamic object that can be instantiated from the configuration file.
|
||||
* A dynamic object that can be instantiated from the configuration file
|
||||
* and that supports attribute replication to remote application instances.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
|
@ -86,9 +97,6 @@ public:
|
|||
|
||||
void ClearAttributesByType(DynamicAttributeType type);
|
||||
|
||||
AttributeConstIterator AttributeBegin(void) const;
|
||||
AttributeConstIterator AttributeEnd(void) const;
|
||||
|
||||
static boost::signal<void (const DynamicObject::Ptr&)> OnRegistered;
|
||||
static boost::signal<void (const DynamicObject::Ptr&)> OnUnregistered;
|
||||
static boost::signal<void (const set<DynamicObject::Ptr>&)> OnTransactionClosing;
|
||||
|
@ -147,6 +155,11 @@ private:
|
|||
void InternalApplyUpdate(const Dictionary::Ptr& serializedUpdate, int allowedTypes, bool suppressEvents);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper class for registering DynamicObject implementation classes.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class RegisterClassHelper
|
||||
{
|
||||
public:
|
||||
|
@ -157,6 +170,11 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Factory function for DynamicObject-based classes.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
template<typename T>
|
||||
shared_ptr<T> DynamicObjectFactory(const Dictionary::Ptr& serializedUpdate)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A thread-safe event that can be posted to the main thread's event queue.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API Event
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -86,6 +86,8 @@ DEFINE_EXCEPTION_CLASS(NotImplementedException);
|
|||
#ifdef _WIN32
|
||||
/**
|
||||
* A Win32 error encapsulated in an exception.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class Win32Exception : public Exception
|
||||
{
|
||||
|
@ -112,6 +114,8 @@ public:
|
|||
|
||||
/**
|
||||
* A Posix error encapsulated in an exception.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class PosixException : public Exception
|
||||
{
|
||||
|
@ -137,6 +141,8 @@ public:
|
|||
|
||||
/**
|
||||
* An OpenSSL error encapsulated in an exception.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class OpenSSLException : public Exception
|
||||
{
|
||||
|
|
|
@ -130,21 +130,6 @@ void FIFO::Read(void *buffer, size_t count)
|
|||
Optimize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pointer to the start of the write buffer.
|
||||
*
|
||||
* @param count Minimum size of the buffer; on return this parameter
|
||||
* contains the actual size of the available buffer which can
|
||||
* be larger than the requested size.
|
||||
*/
|
||||
/*void *FIFO::GetWriteBuffer(size_t *count)
|
||||
{
|
||||
ResizeBuffer(m_Offset + m_DataSize + *count);
|
||||
*count = m_AllocSize - m_Offset - m_DataSize;
|
||||
|
||||
return m_Buffer + m_Offset + m_DataSize;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Implements IOQueue::Write.
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace icinga
|
|||
|
||||
/**
|
||||
* An I/O queue.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class IOQueue
|
||||
{
|
||||
|
@ -41,8 +43,8 @@ public:
|
|||
* to read more data than is available in the queue is a programming error.
|
||||
* Use GetBytesAvailable() to check how much data is available.
|
||||
*
|
||||
* @buffer The buffer where data should be stored. May be NULL if you're
|
||||
* not actually interested in the data.
|
||||
* @param buffer The buffer where data should be stored. May be NULL if
|
||||
* you're not actually interested in the data.
|
||||
* @param count The number of bytes to read from the queue.
|
||||
*/
|
||||
virtual void Peek(void *buffer, size_t count) = 0;
|
||||
|
|
|
@ -24,10 +24,9 @@ using namespace icinga;
|
|||
REGISTER_CLASS(Logger);
|
||||
|
||||
/**
|
||||
* Constructor for the logger class.
|
||||
* Constructor for the Logger class.
|
||||
*
|
||||
* @param minSeverity The minimum severity of log messages that should be sent
|
||||
* to this logger.
|
||||
* @param properties A serialized dictionary containing attributes.
|
||||
*/
|
||||
Logger::Logger(const Dictionary::Ptr& properties)
|
||||
: DynamicObject(properties)
|
||||
|
@ -165,3 +164,14 @@ LogSeverity Logger::StringToSeverity(const String& severity)
|
|||
else
|
||||
throw_exception(invalid_argument("Invalid severity: " + severity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configuration object that belongs to this logger.
|
||||
*
|
||||
* @returns The configuration object.
|
||||
*/
|
||||
DynamicObject::Ptr ILogger::GetConfig(void) const
|
||||
{
|
||||
return m_Config->GetSelf();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,16 @@ enum LogSeverity
|
|||
* @ingroup base
|
||||
*/
|
||||
struct LogEntry {
|
||||
double Timestamp;
|
||||
LogSeverity Severity;
|
||||
String Facility;
|
||||
String Message;
|
||||
double Timestamp; /**< The timestamp when this log entry was created. */
|
||||
LogSeverity Severity; /**< The severity of this log entry. */
|
||||
String Facility; /**< The facility this log entry belongs to. */
|
||||
String Message; /**< The log entry's message. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for all loggers.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API ILogger : public Object
|
||||
{
|
||||
|
@ -57,6 +59,12 @@ public:
|
|||
typedef shared_ptr<ILogger> Ptr;
|
||||
typedef weak_ptr<ILogger> WeakPtr;
|
||||
|
||||
/**
|
||||
* Processes the log entry and writes it to the log that is
|
||||
* represented by this ILogger object.
|
||||
*
|
||||
* @param entry The log entry that is to be processed.
|
||||
*/
|
||||
virtual void ProcessLogEntry(const LogEntry& entry) = 0;
|
||||
|
||||
protected:
|
||||
|
@ -68,6 +76,11 @@ private:
|
|||
friend class Logger;
|
||||
};
|
||||
|
||||
/**
|
||||
* A log provider. Can be instantiated from the config.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API Logger : public DynamicObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -24,9 +24,9 @@ using namespace icinga;
|
|||
/**
|
||||
* Reads data from an IOQueue in netString format.
|
||||
*
|
||||
* @param fifo The IOQueue to read from.
|
||||
* @param[out] str The String that has been read from the FIFO.
|
||||
* @returns true if a complete String was read from the FIFO, false otherwise.
|
||||
* @param queue The IOQueue to read from.
|
||||
* @param[out] str The String that has been read from the IOQueue.
|
||||
* @returns true if a complete String was read from the IOQueue, false otherwise.
|
||||
* @exception invalid_argument The input stream is invalid.
|
||||
* @see https://github.com/PeterScott/netString-c/blob/master/netString.c
|
||||
*/
|
||||
|
@ -104,16 +104,16 @@ bool NetString::ReadStringFromIOQueue(IOQueue *queue, String *str)
|
|||
|
||||
free(buffer);
|
||||
|
||||
/* remove the data from the fifo */
|
||||
/* remove the data from the IOQueue */
|
||||
queue->Read(NULL, buffer_length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes data into a FIFO using the netString format.
|
||||
* Writes data into an IOQueue using the netString format.
|
||||
*
|
||||
* @param fifo The FIFO.
|
||||
* @param queue The IOQueue.
|
||||
* @param str The String that is to be written.
|
||||
*/
|
||||
void NetString::WriteStringToIOQueue(IOQueue *queue, const String& str)
|
||||
|
|
|
@ -24,9 +24,9 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* Helper functions for reading/writing messages in the netString format.
|
||||
* Helper functions for reading/writing messages in the netstring format.
|
||||
*
|
||||
* @see http://cr.yp.to/proto/netStrings.txt
|
||||
* @see http://cr.yp.to/proto/netstrings.txt
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
|
|
|
@ -42,14 +42,28 @@ public:
|
|||
|
||||
/**
|
||||
* Holds a shared pointer and provides support for implicit upcasts.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class SharedPtrHolder
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor for the SharedPtrHolder class.
|
||||
*
|
||||
* @param object The shared pointer that should be used to
|
||||
* construct this shared pointer holder.
|
||||
*/
|
||||
explicit SharedPtrHolder(const Object::Ptr& object)
|
||||
: m_Object(object)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Retrieves a shared pointer for the object that is associated
|
||||
* this holder instance.
|
||||
*
|
||||
* @returns A shared pointer.
|
||||
*/
|
||||
template<typename T>
|
||||
operator shared_ptr<T>(void) const
|
||||
{
|
||||
|
@ -63,6 +77,12 @@ public:
|
|||
return other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a weak pointer for the object that is associated
|
||||
* with this holder instance.
|
||||
*
|
||||
* @returns A weak pointer.
|
||||
*/
|
||||
template<typename T>
|
||||
operator weak_ptr<T>(void) const
|
||||
{
|
||||
|
@ -70,7 +90,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Object::Ptr m_Object;
|
||||
Object::Ptr m_Object; /**< The object that belongs to this
|
||||
holder instance */
|
||||
};
|
||||
|
||||
SharedPtrHolder GetSelf(void);
|
||||
|
@ -88,23 +109,33 @@ private:
|
|||
Object(const Object& other);
|
||||
Object& operator=(const Object& rhs);
|
||||
|
||||
static boost::mutex m_Mutex;
|
||||
static vector<Object::Ptr> m_HeldObjects;
|
||||
static boost::mutex m_Mutex; /**< Mutex which protects static members
|
||||
of the Object class. */
|
||||
static vector<Object::Ptr> m_HeldObjects; /**< Currently held
|
||||
objects. */
|
||||
#ifdef _DEBUG
|
||||
static set<Object *> m_AliveObjects;
|
||||
static set<Object *> m_AliveObjects; /**< Currently alive objects -
|
||||
for debugging purposes. */
|
||||
#endif /* _DEBUG */
|
||||
};
|
||||
|
||||
/**
|
||||
* Compares a weak pointer with a raw pointer.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
template<class T>
|
||||
struct WeakPtrEqual
|
||||
{
|
||||
private:
|
||||
const void *m_Ref;
|
||||
const void *m_Ref; /**< The object. */
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor for the WeakPtrEqual class.
|
||||
*
|
||||
* @param ref The object that should be compared with the weak pointer.
|
||||
*/
|
||||
WeakPtrEqual(const void *ref) : m_Ref(ref) { }
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* The result of a Process task.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
struct ProcessResult
|
||||
{
|
||||
double ExecutionStart;
|
||||
|
@ -31,6 +36,12 @@ struct ProcessResult
|
|||
String Output;
|
||||
};
|
||||
|
||||
/**
|
||||
* A process task. Executes an external application and returns the exit
|
||||
* code and console output.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API Process : public AsyncTask<Process, ProcessResult>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/******************************************************************************
|
||||
* 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 *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-base.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/******************************************************************************
|
||||
* 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 *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
|
@ -6,7 +25,7 @@ namespace icinga {
|
|||
/**
|
||||
* String class.
|
||||
*
|
||||
* Rationale: The std::string class has an ambiguous assignment
|
||||
* Rationale for having this: The std::string class has an ambiguous assignment
|
||||
* operator when used in conjunction with the Value class.
|
||||
*/
|
||||
class I2_BASE_API String
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A ring buffer that holds a pre-defined number of integers.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API RingBuffer
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,11 @@ namespace icinga
|
|||
|
||||
class ScriptTask;
|
||||
|
||||
/**
|
||||
* A script function that can be used to execute a script task.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API ScriptFunction : public Object
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A script task.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API ScriptTask : public AsyncTask<ScriptTask, Value>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -13,7 +13,6 @@ StreamLogger::StreamLogger(void)
|
|||
* Constructor for the StreamLogger class.
|
||||
*
|
||||
* @param stream The stream.
|
||||
* @param minSeverity Minimum severity for log messages.
|
||||
*/
|
||||
StreamLogger::StreamLogger(ostream *stream)
|
||||
: ILogger(), m_Stream(stream), m_OwnsStream(false)
|
||||
|
|
|
@ -5,7 +5,9 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* A logger that logs to stdout.
|
||||
* A logger that logs to an iostream.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API StreamLogger : public ILogger
|
||||
{
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/******************************************************************************
|
||||
* 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 *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-base.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/******************************************************************************
|
||||
* 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 *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef SYSLOGLOGGER_H
|
||||
#define SYSLOGLOGGER_H
|
||||
|
||||
|
@ -7,6 +26,8 @@ namespace icinga
|
|||
|
||||
/**
|
||||
* A logger that logs to syslog.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API SyslogLogger : public ILogger
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
TcpServer(void);
|
||||
|
||||
void SetClientFactory(const ClientFactory& function);
|
||||
void SetClientFactory(const ClientFactory& clientFactory);
|
||||
ClientFactory GetFactoryFunction(void) const;
|
||||
|
||||
void Listen(void);
|
||||
|
|
|
@ -145,10 +145,12 @@ String Utility::GetCertificateCN(const shared_ptr<X509>& certificate)
|
|||
{
|
||||
char buffer[256];
|
||||
|
||||
int rc = X509_NAME_get_text_by_NID(X509_get_subject_name(certificate.get()), NID_commonName, buffer, sizeof(buffer));
|
||||
int rc = X509_NAME_get_text_by_NID(X509_get_subject_name(certificate.get()),
|
||||
NID_commonName, buffer, sizeof(buffer));
|
||||
|
||||
if (rc == -1)
|
||||
throw_exception(OpenSSLException("X509 certificate has no CN attribute", ERR_get_error()));
|
||||
throw_exception(OpenSSLException("X509 certificate has no CN"
|
||||
" attribute", ERR_get_error()));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -165,14 +167,17 @@ shared_ptr<X509> Utility::GetX509Certificate(String pemfile)
|
|||
BIO *fpcert = BIO_new(BIO_s_file());
|
||||
|
||||
if (fpcert == NULL)
|
||||
throw_exception(OpenSSLException("BIO_new failed", ERR_get_error()));
|
||||
throw_exception(OpenSSLException("BIO_new failed",
|
||||
ERR_get_error()));
|
||||
|
||||
if (BIO_read_filename(fpcert, pemfile.CStr()) < 0)
|
||||
throw_exception(OpenSSLException("BIO_read_filename failed", ERR_get_error()));
|
||||
throw_exception(OpenSSLException("BIO_read_filename failed",
|
||||
ERR_get_error()));
|
||||
|
||||
cert = PEM_read_bio_X509_AUX(fpcert, NULL, NULL, NULL);
|
||||
if (cert == NULL)
|
||||
throw_exception(OpenSSLException("PEM_read_bio_X509_AUX failed", ERR_get_error()));
|
||||
throw_exception(OpenSSLException("PEM_read_bio_X509_AUX failed",
|
||||
ERR_get_error()));
|
||||
|
||||
BIO_free(fpcert);
|
||||
|
||||
|
@ -210,7 +215,8 @@ String Utility::DirName(const String& path)
|
|||
#else /* _WIN32 */
|
||||
if (!PathRemoveFileSpec(dir)) {
|
||||
free(dir);
|
||||
throw_exception(Win32Exception("PathRemoveFileSpec() failed", GetLastError()));
|
||||
throw_exception(Win32Exception("PathRemoveFileSpec() failed",
|
||||
GetLastError()));
|
||||
}
|
||||
|
||||
result = dir;
|
||||
|
@ -249,7 +255,7 @@ String Utility::BaseName(const String& path)
|
|||
/**
|
||||
* Null deleter. Used as a parameter for the shared_ptr constructor.
|
||||
*
|
||||
* @param -- The object that should be deleted.
|
||||
* @param - The object that should be deleted.
|
||||
*/
|
||||
void Utility::NullDeleter(void *)
|
||||
{
|
||||
|
@ -289,3 +295,17 @@ double Utility::GetTime(void)
|
|||
return tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the current process.
|
||||
*
|
||||
* @returns The PID.
|
||||
*/
|
||||
pid_t Utility::GetPid(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return getpid();
|
||||
#else /* _WIN32 */
|
||||
return GetCurrentProcessId();
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
|
|
@ -44,10 +44,12 @@ public:
|
|||
static String DirName(const String& path);
|
||||
static String BaseName(const String& path);
|
||||
|
||||
static void NullDeleter(void *obj);
|
||||
static void NullDeleter(void *);
|
||||
|
||||
static double GetTime(void);
|
||||
|
||||
static pid_t GetPid(void);
|
||||
|
||||
private:
|
||||
static bool m_SSLInitialized;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ cJSON *Value::ToJson(void) const
|
|||
/**
|
||||
* Deserializes the string representation of a variant.
|
||||
*
|
||||
* @params jsonString A JSON string obtained from Value::Serialize
|
||||
* @param jsonString A JSON string obtained from Value::Serialize
|
||||
* @returns The newly deserialized variant.
|
||||
*/
|
||||
Value Value::Deserialize(const String& jsonString)
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#endif /* __MINGW32__ */
|
||||
|
||||
typedef int socklen_t;
|
||||
typedef DWORD pid_t;
|
||||
|
||||
#define MAXPATHLEN MAX_PATH
|
||||
|
||||
|
|
|
@ -23,38 +23,78 @@ using std::ifstream;
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
ConfigCompiler::ConfigCompiler(const String& path, istream *input, HandleIncludeFunc includeHandler)
|
||||
/**
|
||||
* Constructor for the ConfigCompiler class.
|
||||
*
|
||||
* @param path The path of the configuration file (or another name that
|
||||
* identifies the source of the configuration text).
|
||||
* @param input Input stream for the configuration file.
|
||||
* @param includeHandler Handler function for #include directives.
|
||||
*/
|
||||
ConfigCompiler::ConfigCompiler(const String& path, istream *input,
|
||||
HandleIncludeFunc includeHandler)
|
||||
: m_Path(path), m_Input(input), m_HandleInclude(includeHandler)
|
||||
{
|
||||
InitializeScanner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor for the ConfigCompiler class.
|
||||
*/
|
||||
ConfigCompiler::~ConfigCompiler(void)
|
||||
{
|
||||
DestroyScanner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads data from the input stream. Used internally by the lexer.
|
||||
*
|
||||
* @param buffer Where to store data.
|
||||
* @param max_size The maximum number of bytes to read from the stream.
|
||||
* @returns The actual number of bytes read.
|
||||
*/
|
||||
size_t ConfigCompiler::ReadInput(char *buffer, size_t max_size)
|
||||
{
|
||||
m_Input->read(buffer, max_size);
|
||||
return static_cast<size_t>(m_Input->gcount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the scanner object.
|
||||
*
|
||||
* @returns The scanner object.
|
||||
*/
|
||||
void *ConfigCompiler::GetScanner(void) const
|
||||
{
|
||||
return m_Scanner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the result from the compiler.
|
||||
*
|
||||
* @returns A list of configuration items.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::GetResult(void) const
|
||||
{
|
||||
return m_Result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path for the input file.
|
||||
*
|
||||
* @returns The path.
|
||||
*/
|
||||
String ConfigCompiler::GetPath(void) const
|
||||
{
|
||||
return m_Path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an include directive by calling the include handler callback
|
||||
* function.
|
||||
*
|
||||
* @param include The path from the include directive.
|
||||
*/
|
||||
void ConfigCompiler::HandleInclude(const String& include)
|
||||
{
|
||||
String path = Utility::DirName(GetPath()) + "/" + include;
|
||||
|
@ -62,13 +102,27 @@ void ConfigCompiler::HandleInclude(const String& include)
|
|||
std::copy(items.begin(), items.end(), back_inserter(m_Result));
|
||||
}
|
||||
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::CompileStream(const String& path, istream *stream)
|
||||
/**
|
||||
* Compiles a stream.
|
||||
*
|
||||
* @param path A name identifying the stream.
|
||||
* @param stream The input stream.
|
||||
* @returns Configuration items.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::CompileStream(const String& path,
|
||||
istream *stream)
|
||||
{
|
||||
ConfigCompiler ctx(path, stream);
|
||||
ctx.Compile();
|
||||
return ctx.GetResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a file.
|
||||
*
|
||||
* @param path The path.
|
||||
* @returns Configuration items.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::CompileFile(const String& path)
|
||||
{
|
||||
ifstream stream;
|
||||
|
@ -82,18 +136,38 @@ vector<ConfigItem::Ptr> ConfigCompiler::CompileFile(const String& path)
|
|||
return CompileStream(path, &stream);
|
||||
}
|
||||
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::CompileText(const String& path, const String& text)
|
||||
/**
|
||||
* Compiles a snippet of text.
|
||||
*
|
||||
* @param path A name identifying the text.
|
||||
* @param text The text.
|
||||
* @returns Configuration items.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::CompileText(const String& path,
|
||||
const String& text)
|
||||
{
|
||||
stringstream stream(text);
|
||||
return CompileStream(path, &stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default include handler. Includes the file and returns a list of
|
||||
* configuration items.
|
||||
*
|
||||
* @param include The path from the include directive.
|
||||
* @returns A list of configuration objects.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::HandleFileInclude(const String& include)
|
||||
{
|
||||
/* TODO: implement wildcard includes */
|
||||
return CompileFile(include);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an object to the result.
|
||||
*
|
||||
* @param object The configuration item.
|
||||
*/
|
||||
void ConfigCompiler::AddObject(const ConfigItem::Ptr& object)
|
||||
{
|
||||
m_Result.push_back(object);
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* The configuration compiler can be used to compile a configuration file
|
||||
* into a number of configuration items.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
class I2_CONFIG_API ConfigCompiler
|
||||
{
|
||||
public:
|
||||
|
@ -34,9 +40,11 @@ public:
|
|||
|
||||
void Compile(void);
|
||||
|
||||
static vector<ConfigItem::Ptr> CompileStream(const String& path, istream *stream);
|
||||
static vector<ConfigItem::Ptr> CompileStream(const String& path,
|
||||
istream *stream);
|
||||
static vector<ConfigItem::Ptr> CompileFile(const String& path);
|
||||
static vector<ConfigItem::Ptr> CompileText(const String& path, const String& text);
|
||||
static vector<ConfigItem::Ptr> CompileText(const String& path,
|
||||
const String& text);
|
||||
|
||||
static vector<ConfigItem::Ptr> HandleFileInclude(const String& include);
|
||||
|
||||
|
|
|
@ -25,6 +25,15 @@ ConfigItem::ItemMap ConfigItem::m_Items;
|
|||
boost::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
|
||||
boost::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
|
||||
|
||||
/**
|
||||
* Constructor for the ConfigItem class.
|
||||
*
|
||||
* @param type The object type.
|
||||
* @param name The name of the item.
|
||||
* @param exprl Expression list for the item.
|
||||
* @param parents Parent objects for the item.
|
||||
* @param debuginfo Debug information.
|
||||
*/
|
||||
ConfigItem::ConfigItem(const String& type, const String& name,
|
||||
const ExpressionList::Ptr& exprl, const vector<String>& parents,
|
||||
const DebugInfo& debuginfo)
|
||||
|
@ -33,31 +42,63 @@ ConfigItem::ConfigItem(const String& type, const String& name,
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the type of the configuration item.
|
||||
*
|
||||
* @returns The type.
|
||||
*/
|
||||
String ConfigItem::GetType(void) const
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name of the configuration item.
|
||||
*
|
||||
* @returns The name.
|
||||
*/
|
||||
String ConfigItem::GetName(void) const
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the debug information for the configuration item.
|
||||
*
|
||||
* @returns The debug information.
|
||||
*/
|
||||
DebugInfo ConfigItem::GetDebugInfo(void) const
|
||||
{
|
||||
return m_DebugInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the expression list for the configuration item.
|
||||
*
|
||||
* @returns The expression list.
|
||||
*/
|
||||
ExpressionList::Ptr ConfigItem::GetExpressionList(void) const
|
||||
{
|
||||
return m_ExpressionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of parents for the configuration item.
|
||||
*
|
||||
* @returns The list of parents.
|
||||
*/
|
||||
vector<String> ConfigItem::GetParents(void) const
|
||||
{
|
||||
return m_Parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the object's properties based on parent objects and the object's
|
||||
* expression list.
|
||||
*
|
||||
* @param dictionary The dictionary that should be used to store the
|
||||
* properties.
|
||||
*/
|
||||
void ConfigItem::CalculateProperties(const Dictionary::Ptr& dictionary) const
|
||||
{
|
||||
BOOST_FOREACH(const String& name, m_Parents) {
|
||||
|
@ -65,7 +106,8 @@ void ConfigItem::CalculateProperties(const Dictionary::Ptr& dictionary) const
|
|||
|
||||
if (!parent) {
|
||||
stringstream message;
|
||||
message << "Parent object '" << name << "' does not exist (" << m_DebugInfo << ")";
|
||||
message << "Parent object '" << name << "' does not"
|
||||
" exist (" << m_DebugInfo << ")";
|
||||
throw_exception(domain_error(message.str()));
|
||||
}
|
||||
|
||||
|
@ -75,6 +117,12 @@ void ConfigItem::CalculateProperties(const Dictionary::Ptr& dictionary) const
|
|||
m_ExpressionList->Execute(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits the configuration item by creating or updating a DynamicObject
|
||||
* object.
|
||||
*
|
||||
* @returns The DynamicObject that was created/updated.
|
||||
*/
|
||||
DynamicObject::Ptr ConfigItem::Commit(void)
|
||||
{
|
||||
DynamicObject::Ptr dobj = m_DynamicObject.lock();
|
||||
|
@ -125,6 +173,9 @@ DynamicObject::Ptr ConfigItem::Commit(void)
|
|||
return dobj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters the configuration item.
|
||||
*/
|
||||
void ConfigItem::Unregister(void)
|
||||
{
|
||||
DynamicObject::Ptr dobj = m_DynamicObject.lock();
|
||||
|
@ -141,11 +192,23 @@ void ConfigItem::Unregister(void)
|
|||
OnRemoved(GetSelf());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the DynamicObject that belongs to the configuration item.
|
||||
*
|
||||
* @returns The DynamicObject.
|
||||
*/
|
||||
DynamicObject::Ptr ConfigItem::GetDynamicObject(void) const
|
||||
{
|
||||
return m_DynamicObject.lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a configuration item by type and name.
|
||||
*
|
||||
* @param type The type of the ConfigItem that is to be looked up.
|
||||
* @param name The name of the ConfigItem that is to be looked up.
|
||||
* @returns The configuration item.
|
||||
*/
|
||||
ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
|
||||
{
|
||||
ConfigItem::ItemMap::iterator it;
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A configuration item. Non-abstract configuration items can be used to
|
||||
* create configuration objects at runtime.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
class I2_CONFIG_API ConfigItem : public Object {
|
||||
public:
|
||||
typedef shared_ptr<ConfigItem> Ptr;
|
||||
|
@ -46,7 +52,8 @@ public:
|
|||
|
||||
DebugInfo GetDebugInfo(void) const;
|
||||
|
||||
static ConfigItem::Ptr GetObject(const String& type, const String& name);
|
||||
static ConfigItem::Ptr GetObject(const String& type,
|
||||
const String& name);
|
||||
|
||||
static boost::signal<void (const ConfigItem::Ptr&)> OnCommitted;
|
||||
static boost::signal<void (const ConfigItem::Ptr&)> OnRemoved;
|
||||
|
@ -54,17 +61,20 @@ public:
|
|||
private:
|
||||
void CalculateProperties(const Dictionary::Ptr& dictionary) const;
|
||||
|
||||
String m_Type;
|
||||
String m_Name;
|
||||
String m_Type; /**< The object type. */
|
||||
String m_Name; /**< The name. */
|
||||
|
||||
ExpressionList::Ptr m_ExpressionList;
|
||||
vector<String> m_Parents;
|
||||
DebugInfo m_DebugInfo;
|
||||
vector<String> m_Parents; /**< The names of parent configuration
|
||||
items. */
|
||||
DebugInfo m_DebugInfo; /**< Debug information. */
|
||||
|
||||
DynamicObject::WeakPtr m_DynamicObject;
|
||||
DynamicObject::WeakPtr m_DynamicObject; /**< The instantiated version
|
||||
of this configuration
|
||||
item */
|
||||
|
||||
typedef map<pair<String, String>, ConfigItem::Ptr> ItemMap;
|
||||
static ItemMap m_Items;
|
||||
static ItemMap m_Items; /**< All registered configuration items. */
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ void ConfigItemBuilder::AddExpression(const Expression& expr)
|
|||
m_ExpressionList->AddExpression(expr);
|
||||
}
|
||||
|
||||
void ConfigItemBuilder::AddExpression(const String& key, ExpressionOperator op, const Value& value)
|
||||
void ConfigItemBuilder::AddExpression(const String& key, ExpressionOperator op,
|
||||
const Value& value)
|
||||
{
|
||||
Expression expr(key, op, value, m_DebugInfo);
|
||||
AddExpression(expr);
|
||||
|
@ -101,5 +102,6 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
|
|||
Expression abstractExpr("__abstract", OperatorSet, m_Abstract, m_DebugInfo);
|
||||
exprl->AddExpression(abstractExpr);
|
||||
|
||||
return boost::make_shared<ConfigItem>(m_Type, m_Name, exprl, m_Parents, m_DebugInfo);
|
||||
return boost::make_shared<ConfigItem>(m_Type, m_Name, exprl, m_Parents,
|
||||
m_DebugInfo);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Config item builder. Used to dynamically build configuration objects
|
||||
* at runtime.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
class I2_CONFIG_API ConfigItemBuilder : public Object
|
||||
{
|
||||
public:
|
||||
|
@ -40,19 +46,21 @@ public:
|
|||
void AddParent(const String& parent);
|
||||
|
||||
void AddExpression(const Expression& expr);
|
||||
void AddExpression(const String& key, ExpressionOperator op, const Value& value);
|
||||
void AddExpression(const String& key, ExpressionOperator op,
|
||||
const Value& value);
|
||||
void AddExpressionList(const ExpressionList::Ptr& exprl);
|
||||
|
||||
ConfigItem::Ptr Compile(void);
|
||||
|
||||
private:
|
||||
String m_Type;
|
||||
String m_Name;
|
||||
bool m_Local;
|
||||
bool m_Abstract;
|
||||
vector<String> m_Parents;
|
||||
ExpressionList::Ptr m_ExpressionList;
|
||||
DebugInfo m_DebugInfo;
|
||||
String m_Type; /**< The object type. */
|
||||
String m_Name; /**< The name. */
|
||||
bool m_Local; /**< Whether the item is local. */
|
||||
bool m_Abstract; /**< Whether the item is abstract. */
|
||||
vector<String> m_Parents; /**< The names of parent configuration
|
||||
items. */
|
||||
ExpressionList::Ptr m_ExpressionList; /**< Expressions for this item. */
|
||||
DebugInfo m_DebugInfo; /**< Debug information. */
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Debug information for a configuration element.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
struct DebugInfo
|
||||
{
|
||||
String Path;
|
||||
|
@ -52,6 +57,13 @@ struct DebugInfo
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Outputs a DebugInfo struct to a stream.
|
||||
*
|
||||
* @param out The output stream.
|
||||
* @param val The DebugInfo struct.
|
||||
* @returns The output stream.
|
||||
*/
|
||||
inline ostream& operator<<(ostream& out, const DebugInfo& val)
|
||||
{
|
||||
out << "in " << val.Path << ": "
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
Expression::Expression(const String& key, ExpressionOperator op, const Value& value, const DebugInfo& debuginfo)
|
||||
Expression::Expression(const String& key, ExpressionOperator op,
|
||||
const Value& value, const DebugInfo& debuginfo)
|
||||
: m_Key(key), m_Operator(op), m_Value(value), m_DebugInfo(debuginfo)
|
||||
{
|
||||
}
|
||||
|
@ -69,7 +70,10 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
|
|||
if (!dict) {
|
||||
if (!oldValue.IsEmpty()) {
|
||||
stringstream message;
|
||||
message << "Wrong argument types for += (non-dictionary and dictionary) (" << m_DebugInfo << ")";
|
||||
message << "Wrong argument types for"
|
||||
" += (non-dictionary and"
|
||||
" dictionary) ("
|
||||
<< m_DebugInfo << ")";
|
||||
throw_exception(domain_error(message.str()));
|
||||
}
|
||||
|
||||
|
@ -88,7 +92,8 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
|
|||
}
|
||||
} else {
|
||||
stringstream message;
|
||||
message << "+= only works for dictionaries (" << m_DebugInfo << ")";
|
||||
message << "+= only works for dictionaries ("
|
||||
<< m_DebugInfo << ")";
|
||||
throw_exception(domain_error(message.str()));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* The operator in a configuration expression.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
enum ExpressionOperator
|
||||
{
|
||||
OperatorExecute,
|
||||
|
@ -33,10 +38,16 @@ enum ExpressionOperator
|
|||
OperatorDivide
|
||||
};
|
||||
|
||||
/**
|
||||
* A configuration expression.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
struct I2_CONFIG_API Expression
|
||||
{
|
||||
public:
|
||||
Expression(const String& key, ExpressionOperator op, const Value& value, const DebugInfo& debuginfo);
|
||||
Expression(const String& key, ExpressionOperator op, const Value& value,
|
||||
const DebugInfo& debuginfo);
|
||||
|
||||
void Execute(const Dictionary::Ptr& dictionary) const;
|
||||
|
||||
|
|
|
@ -21,16 +21,32 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Adds an expression to an expression list.
|
||||
*
|
||||
* @param expression The expression that should be added.
|
||||
*/
|
||||
void ExpressionList::AddExpression(const Expression& expression)
|
||||
{
|
||||
m_Expressions.push_back(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of items currently contained in the expression list.
|
||||
*
|
||||
* @returns The length of the list.
|
||||
*/
|
||||
size_t ExpressionList::GetLength(void) const
|
||||
{
|
||||
return m_Expressions.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the expression list.
|
||||
*
|
||||
* @param dictionary The dictionary that should be manipulated by the
|
||||
* expressions.
|
||||
*/
|
||||
void ExpressionList::Execute(const Dictionary::Ptr& dictionary) const
|
||||
{
|
||||
BOOST_FOREACH(const Expression& expression, m_Expressions) {
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A list of configuration expressions.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
class I2_CONFIG_API ExpressionList : public Object
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
#define I2CONFIG_H
|
||||
|
||||
/**
|
||||
* @defgroup config Dynamic object library
|
||||
* @defgroup config Configuration library
|
||||
*
|
||||
* The dynamic object library implements serializable objects which support
|
||||
* inheritance.
|
||||
* The configuration library implements a compiler for Icinga 2's configuration
|
||||
* format. It also provides functionality for creating configuration objects
|
||||
* at runtime.
|
||||
*/
|
||||
|
||||
#include <i2-base.h>
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Common Information Base class. Holds some statistics (and will likely be
|
||||
* removed/refactored).
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API CIB
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* An Icinga host.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API Host : public DynamicObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* An Icinga host group.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API HostGroup : public DynamicObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#define I2ICINGA_H
|
||||
|
||||
/**
|
||||
* @defgroup icinga Icinga application
|
||||
* @defgroup icinga Icinga library
|
||||
*
|
||||
* The Icinga application is in charge of boot-strapping the Icinga
|
||||
* environment and loading additional components.
|
||||
* The Icinga library implements all Icinga-specific functionality that is
|
||||
* common to all components (e.g. hosts, services, etc.).
|
||||
*/
|
||||
|
||||
#include <i2-base.h>
|
||||
|
|
|
@ -28,19 +28,19 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
const String IcingaApplication::DefaultPidPath = "icinga.pid";
|
||||
const String IcingaApplication::DefaultStatePath = "icinga.state";
|
||||
const String IcingaApplication::DefaultPidPath = "icinga2.pid";
|
||||
const String IcingaApplication::DefaultStatePath = "icinga2.state";
|
||||
|
||||
IcingaApplication::IcingaApplication(const Dictionary::Ptr& serializedUpdate)
|
||||
: Application(serializedUpdate)
|
||||
{
|
||||
/* load cibsync config component */
|
||||
ConfigItemBuilder::Ptr cibsyncComponentConfig = boost::make_shared<ConfigItemBuilder>();
|
||||
cibsyncComponentConfig->SetType("Component");
|
||||
cibsyncComponentConfig->SetName("cibsync");
|
||||
cibsyncComponentConfig->SetLocal(true);
|
||||
cibsyncComponentConfig->Compile()->Commit();
|
||||
cibsyncComponentConfig.reset();
|
||||
/* load replication config component */
|
||||
ConfigItemBuilder::Ptr replicationComponentConfig = boost::make_shared<ConfigItemBuilder>();
|
||||
replicationComponentConfig->SetType("Component");
|
||||
replicationComponentConfig->SetName("replication");
|
||||
replicationComponentConfig->SetLocal(true);
|
||||
replicationComponentConfig->Compile()->Commit();
|
||||
replicationComponentConfig.reset();
|
||||
|
||||
/* load convenience config component */
|
||||
ConfigItemBuilder::Ptr convenienceComponentConfig = boost::make_shared<ConfigItemBuilder>();
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Resolves macros.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API MacroProcessor
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Implements Nagios(TM)-style checks.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API NagiosCheckTask
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* Test class for additional check types. Implements the "null" check type.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API NullCheckTask
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* The state of a service.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
enum ServiceState
|
||||
{
|
||||
StateOK,
|
||||
|
@ -32,6 +37,11 @@ enum ServiceState
|
|||
StateUncheckable,
|
||||
};
|
||||
|
||||
/**
|
||||
* The state type of a service.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
enum ServiceStateType
|
||||
{
|
||||
StateTypeSoft,
|
||||
|
@ -41,6 +51,11 @@ enum ServiceStateType
|
|||
class CheckResultMessage;
|
||||
class ServiceStatusMessage;
|
||||
|
||||
/**
|
||||
* An Icinga service.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API Service : public DynamicObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* An Icinga service group.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API ServiceGroup : public DynamicObject
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
/**
|
||||
* A state change message for a service.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
class I2_ICINGA_API ServiceStateChangeMessage : public MessagePart
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -28,6 +28,11 @@ boost::signal<void (const Endpoint::Ptr&)> Endpoint::OnDisconnected;
|
|||
boost::signal<void (const Endpoint::Ptr&, const String& topic)> Endpoint::OnSubscriptionRegistered;
|
||||
boost::signal<void (const Endpoint::Ptr&, const String& topic)> Endpoint::OnSubscriptionUnregistered;
|
||||
|
||||
/**
|
||||
* Constructor for the Endpoint class.
|
||||
*
|
||||
* @param properties A serialized dictionary containing attributes.
|
||||
*/
|
||||
Endpoint::Endpoint(const Dictionary::Ptr& serializedUpdate)
|
||||
: DynamicObject(serializedUpdate)
|
||||
{
|
||||
|
@ -38,11 +43,23 @@ Endpoint::Endpoint(const Dictionary::Ptr& serializedUpdate)
|
|||
RegisterAttribute("client", Attribute_Transient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an endpoint with the specified name exists.
|
||||
*
|
||||
* @param name The name of the endpoint.
|
||||
* @returns true if the endpoint exists, false otherwise.
|
||||
*/
|
||||
bool Endpoint::Exists(const String& name)
|
||||
{
|
||||
return (DynamicObject::GetObject("Endpoint", name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an endpoint by name.
|
||||
*
|
||||
* @param name The name of the endpoint.
|
||||
* @returns The endpoint.
|
||||
*/
|
||||
Endpoint::Ptr Endpoint::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("Endpoint", name);
|
||||
|
@ -53,6 +70,13 @@ Endpoint::Ptr Endpoint::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<Endpoint>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for creating new endpoint objects.
|
||||
*
|
||||
* @param name The name of the new endpoint.
|
||||
* @param local Whether the new endpoint should be local.
|
||||
* @returns The new endpoint.
|
||||
*/
|
||||
Endpoint::Ptr Endpoint::MakeEndpoint(const String& name, bool local)
|
||||
{
|
||||
ConfigItemBuilder::Ptr endpointConfig = boost::make_shared<ConfigItemBuilder>();
|
||||
|
@ -334,11 +358,21 @@ void Endpoint::ClientClosedHandler(void)
|
|||
OnDisconnected(GetSelf());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the node address for this endpoint.
|
||||
*
|
||||
* @returns The node address (hostname).
|
||||
*/
|
||||
String Endpoint::GetNode(void) const
|
||||
{
|
||||
return Get("node");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service name for this endpoint.
|
||||
*
|
||||
* @returns The service name (port).
|
||||
*/
|
||||
String Endpoint::GetService(void) const
|
||||
{
|
||||
return Get("service");
|
||||
|
|
|
@ -28,7 +28,7 @@ class EndpointManager;
|
|||
/**
|
||||
* An endpoint that can be used to send and receive messages.
|
||||
*
|
||||
* @ingroup icinga
|
||||
* @ingroup remoting
|
||||
*/
|
||||
class I2_REMOTING_API Endpoint : public DynamicObject
|
||||
{
|
||||
|
|
|
@ -258,25 +258,9 @@ void EndpointManager::SendMulticastMessage(const Endpoint::Ptr& sender,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for each registered endpoint.
|
||||
*
|
||||
* @param callback The callback function.
|
||||
*/
|
||||
//void EndpointManager::ForEachEndpoint(function<void (const EndpointManager::Ptr&, const Endpoint::Ptr&)> callback)
|
||||
//{
|
||||
// map<String, Endpoint::Ptr>::iterator prev, i;
|
||||
// for (i = m_Endpoints.begin(); i != m_Endpoints.end(); ) {
|
||||
// prev = i;
|
||||
// i++;
|
||||
//
|
||||
// callback(GetSelf(), prev->second);
|
||||
// }
|
||||
//}
|
||||
|
||||
void EndpointManager::SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient,
|
||||
RequestMessage& message,
|
||||
function<void(const EndpointManager::Ptr&, const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> callback, double timeout)
|
||||
const EndpointManager::APICallback& callback, double timeout)
|
||||
{
|
||||
m_NextMessageID++;
|
||||
|
||||
|
@ -322,7 +306,8 @@ void EndpointManager::SubscriptionTimerHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
m_Endpoint->SetSubscriptions(subscriptions);
|
||||
if (m_Endpoint)
|
||||
m_Endpoint->SetSubscriptions(subscriptions);
|
||||
}
|
||||
|
||||
void EndpointManager::ReconnectTimerHandler(void)
|
||||
|
@ -354,7 +339,8 @@ void EndpointManager::RequestTimerHandler(void)
|
|||
map<String, PendingRequest>::iterator it;
|
||||
for (it = m_Requests.begin(); it != m_Requests.end(); it++) {
|
||||
if (it->second.HasTimedOut()) {
|
||||
it->second.Callback(GetSelf(), Endpoint::Ptr(), it->second.Request, ResponseMessage(), true);
|
||||
it->second.Callback(GetSelf(), Endpoint::Ptr(),
|
||||
it->second.Request, ResponseMessage(), true);
|
||||
|
||||
m_Requests.erase(it);
|
||||
|
||||
|
@ -363,7 +349,8 @@ void EndpointManager::RequestTimerHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender, const ResponseMessage& message)
|
||||
void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender,
|
||||
const ResponseMessage& message)
|
||||
{
|
||||
String id;
|
||||
if (!message.GetID(&id))
|
||||
|
@ -380,16 +367,6 @@ void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender, const
|
|||
m_Requests.erase(it);
|
||||
}
|
||||
|
||||
//EndpointManager::Iterator EndpointManager::Begin(void)
|
||||
//{
|
||||
// return m_Endpoints.begin();
|
||||
//}
|
||||
|
||||
//EndpointManager::Iterator EndpointManager::End(void)
|
||||
//{
|
||||
// return m_Endpoints.end();
|
||||
//}
|
||||
|
||||
EndpointManager::Ptr EndpointManager::GetInstance(void)
|
||||
{
|
||||
static EndpointManager::Ptr instance;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace icinga
|
|||
/**
|
||||
* Forwards messages between endpoints.
|
||||
*
|
||||
* @ingroup icinga
|
||||
* @ingroup remoting
|
||||
*/
|
||||
class I2_REMOTING_API EndpointManager : public Object
|
||||
{
|
||||
|
@ -51,15 +51,13 @@ public:
|
|||
void SendAnycastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
|
||||
void SendMulticastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
|
||||
|
||||
typedef function<void(const EndpointManager::Ptr&, const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> APICallback;
|
||||
|
||||
void SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient, RequestMessage& message,
|
||||
function<void(const EndpointManager::Ptr&, const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> callback, double timeout = 30);
|
||||
const APICallback& callback, double timeout = 30);
|
||||
|
||||
void ProcessResponseMessage(const Endpoint::Ptr& sender, const ResponseMessage& message);
|
||||
|
||||
// void ForEachEndpoint(function<void (const EndpointManager::Ptr&, const Endpoint::Ptr&)> callback);
|
||||
// Iterator Begin(void);
|
||||
// Iterator End(void);
|
||||
|
||||
boost::signal<void (const EndpointManager::Ptr&, const Endpoint::Ptr&)> OnNewEndpoint;
|
||||
|
||||
private:
|
||||
|
@ -78,7 +76,7 @@ private:
|
|||
/**
|
||||
* Information about a pending API request.
|
||||
*
|
||||
* @ingroup icinga
|
||||
* @ingroup remoting
|
||||
*/
|
||||
struct I2_REMOTING_API PendingRequest
|
||||
{
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#define I2REMOTING_H
|
||||
|
||||
/**
|
||||
* @defgroup remoting JSON-RPC library
|
||||
* @defgroup remoting Remoting library
|
||||
*
|
||||
* The JSON-RPC library implements server and client classes for the JSON-RPC
|
||||
* protocol.
|
||||
* Implements server and client classes for the JSON-RPC protocol. Also
|
||||
* supports endpoint-based communication using messages.
|
||||
*/
|
||||
|
||||
#include <i2-base.h>
|
||||
|
|
|
@ -30,7 +30,8 @@ using namespace icinga;
|
|||
JsonRpcClient::JsonRpcClient(TcpClientRole role, shared_ptr<SSL_CTX> sslContext)
|
||||
: TlsClient(role, sslContext)
|
||||
{
|
||||
OnDataAvailable.connect(boost::bind(&JsonRpcClient::DataAvailableHandler, this));
|
||||
OnDataAvailable.connect(boost::bind(&JsonRpcClient::DataAvailableHandler,
|
||||
this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,12 +60,16 @@ void JsonRpcClient::DataAvailableHandler(void)
|
|||
try {
|
||||
Value value = Value::Deserialize(jsonString);
|
||||
|
||||
if (!value.IsObjectType<Dictionary>())
|
||||
throw_exception(invalid_argument("JSON-RPC message must be a dictionary."));
|
||||
if (!value.IsObjectType<Dictionary>()) {
|
||||
throw_exception(invalid_argument("JSON-RPC"
|
||||
" message must be a dictionary."));
|
||||
}
|
||||
|
||||
OnNewMessage(GetSelf(), MessagePart(value));
|
||||
} catch (const exception& ex) {
|
||||
Logger::Write(LogCritical, "jsonrpc", "Exception while processing message from JSON-RPC client: " + String(ex.what()));
|
||||
Logger::Write(LogCritical, "remoting", "Exception"
|
||||
" while processing message from JSON-RPC client: " +
|
||||
String(ex.what()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +82,11 @@ void JsonRpcClient::DataAvailableHandler(void)
|
|||
* @param sslContext SSL context for the TLS connection.
|
||||
* @returns A new JSON-RPC client.
|
||||
*/
|
||||
JsonRpcClient::Ptr icinga::JsonRpcClientFactory(SOCKET fd, TcpClientRole role, shared_ptr<SSL_CTX> sslContext)
|
||||
JsonRpcClient::Ptr icinga::JsonRpcClientFactory(SOCKET fd, TcpClientRole role,
|
||||
shared_ptr<SSL_CTX> sslContext)
|
||||
{
|
||||
JsonRpcClient::Ptr client = boost::make_shared<JsonRpcClient>(role, sslContext);
|
||||
JsonRpcClient::Ptr client = boost::make_shared<JsonRpcClient>(role,
|
||||
sslContext);
|
||||
client->SetFD(fd);
|
||||
return client;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ Dictionary::Ptr MessagePart::GetDictionary(void) const
|
|||
* Retrieves a property's value.
|
||||
*
|
||||
* @param key The name of the property.
|
||||
* @param[out] The value.
|
||||
* @param[out] value The value.
|
||||
* @returns true if the value was retrieved, false otherwise.
|
||||
*/
|
||||
bool MessagePart::Get(String key, MessagePart *value) const
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
* Retrieves a property's value.
|
||||
*
|
||||
* @param key The name of the property.
|
||||
* @param[out] The value.
|
||||
* @param[out] value The value.
|
||||
* @returns true if the value was retrieved, false otherwise.
|
||||
*/
|
||||
template<typename T>
|
||||
|
|
|
@ -108,7 +108,7 @@ if test "x$want_boost" = "xyes"; then
|
|||
fi
|
||||
done
|
||||
elif test "$cross_compiling" != yes; then
|
||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local "`pwd`/compat" ; do
|
||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local /usr/g++ "`pwd`/compat" ; do
|
||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
|
|
|
@ -83,14 +83,14 @@ AC_DEFUN([AX_BOOST_SYSTEM],
|
|||
|
||||
LDFLAGS_SAVE=$LDFLAGS
|
||||
if test "x$ax_boost_user_system_lib" = "x"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/libboost_system*.a* $BOOSTLIBDIR/libboost_system*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.\(so\|a\).*$;\1;' | tac` ; do
|
||||
for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.dylib* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_system.*\)\.a.*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
if test "x$link_system" != "xyes"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.\(dll\|a\).*$;\1;' | tac` ; do
|
||||
for libextension in `ls $BOOSTLIBDIR/boost_system*.dll* $BOOSTLIBDIR/boost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
|
|
Loading…
Reference in New Issue