## Process this file with automake to produce Makefile.in
## Created by Anjuta
-SUBDIRS = base \
+SUBDIRS = ltdl \
+ base \
+ jsonrpc \
configfilecomponent \
configrpccomponent \
icinga \
- jsonrpc \
miniapp
icinga2docdir = ${prefix}/doc/icinga2
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
ea->Source = shared_from_this();
- ea->ConfigObject = object;
+ ea->Object = object;
OnObjectCreated(ea);
}
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
ea->Source = shared_from_this();
- ea->ConfigObject = object;
+ ea->Object = object;
OnObjectRemoved(ea);
}
typedef shared_ptr<ConfigHiveEventArgs> RefType;
typedef weak_ptr<ConfigHiveEventArgs> WeakRefType;
- ConfigObject::RefType ConfigObject;
+ ConfigObject::RefType Object;
string Property;
string OldValue;
};
if (hive.get() != NULL) {
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
ea->Source = hive;
- ea->ConfigObject = static_pointer_cast<ConfigObject>(shared_from_this());
+ ea->Object = static_pointer_cast<ConfigObject>(shared_from_this());
ea->Property = name;
ea->OldValue = oldValue;
hive->OnPropertyChanged(ea);
}
}
-string ConfigObject::GetProperty(const string& name, const string& default) const
+string ConfigObject::GetProperty(const string& name, const string& defaultValue) const
{
map<string, string>::const_iterator vi = Properties.find(name);
if (vi == Properties.end())
- return default;
+ return defaultValue;
return vi->second;
}
-int ConfigObject::GetPropertyInteger(const string& name, int default) const
+int ConfigObject::GetPropertyInteger(const string& name, int defaultValue) const
{
string value = GetProperty(name);
if (value == string())
- return default;
+ return defaultValue;
return strtol(value.c_str(), NULL, 10);
}
-double ConfigObject::GetPropertyDouble(const string& name, double default) const
+double ConfigObject::GetPropertyDouble(const string& name, double defaultValue) const
{
string value = GetProperty(name);
if (value == string())
- return default;
+ return defaultValue;
return strtod(value.c_str(), NULL);
}
void SetPropertyInteger(const string& name, int value);
void SetPropertyDouble(const string& name, double value);
- string GetProperty(const string& name, const string& default = string()) const;
- int GetPropertyInteger(const string& name, int default = 0) const;
- double GetPropertyDouble(const string& name, double default = 0.0f) const;
+ string GetProperty(const string& name, const string& defaultValue = string()) const;
+ int GetPropertyInteger(const string& name, int defaultValue = 0) const;
+ double GetPropertyDouble(const string& name, double defaultValue = 0.0f) const;
};
}
#ifndef I2_BASE_H
#define I2_BASE_H
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
+#include <cstdlib>
+#include <cstdarg>
+#include <cstdio>
+#include <cstring>
+#include <cassert>
+#include <cerrno>
#include <memory>
#include <string>
#ifdef _WIN32
InitializeCriticalSection(&m_Mutex);
#else /* _WIN32 */
- pthread_mutex_init(&m_Mutex);
+ pthread_mutex_init(&m_Mutex, NULL);
#endif /* _WIN32 */
}
#ifdef _WIN32
DeleteCriticalSection(&m_Mutex);
#else /* _WIN32 */
- pthread_mutex_init(&m_Mutex);
+ pthread_mutex_destroy(&m_Mutex);
#endif /* _WIN32 */
}
#ifdef _WIN32
return (TryEnterCriticalSection(&m_Mutex) == TRUE);
#else /* _WIN32 */
- return pthread_mutex_tryenter(&m_Mutex);
+ return pthread_mutex_trylock(&m_Mutex);
#endif /* _WIN32 */
}
#ifdef _WIN32
EnterCriticalSection(&m_Mutex);
#else /* _WIN32 */
- pthread_mutex_enter(&m_Mutex);
+ pthread_mutex_lock(&m_Mutex);
#endif /* _WIN32 */
}
#ifdef _WIN32
LeaveCriticalSection(&m_Mutex);
#else /* _WIN32 */
- pthread_mutex_exit(&m_Mutex);
+ pthread_mutex_unlock(&m_Mutex);
#endif /* _WIN32 */
}
namespace icinga
{
-using std::function;
-
class thread
{
private:
#include <execinfo.h>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <pthread.h>
typedef int SOCKET;
## Process this file with automake to produce Makefile.in
+pkglib_LTLIBRARIES = \
+ libconfigfilecomponent.la
libconfigfilecomponent_la_SOURCES = \
configfilecomponent.cpp \
configfilecomponent.h \
i2-configfilecomponent.h
-libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base
+libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc
ifstream fp;
FIFO::RefType fifo = new_object<FIFO>();
- fp.open(GetConfig()->GetProperty("filename"), ifstream::in);
+ fp.open(GetConfig()->GetProperty("filename").c_str(), ifstream::in);
if (fp.fail())
throw exception(/*"Could not open config file"*/);
## Process this file with automake to produce Makefile.in
+pkglib_LTLIBRARIES = \
+ libconfigrpccomponent.la
libconfigrpccomponent_la_SOURCES = \
configrpccomponent.cpp \
configrpccomponent.h \
i2-configrpccomponent.h
-libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base
+libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc -I${top_srcdir}/icinga
int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
{
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
- connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectCreated", true));
+ connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectCreated", true));
return 0;
}
int ConfigRpcComponent::LocalObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
{
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
- connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false));
+ connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectRemoved", false));
return 0;
}
int ConfigRpcComponent::LocalPropertyChangedHandler(ConfigHiveEventArgs::RefType ea)
{
- JsonRpcMessage::RefType msg = MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false);
+ JsonRpcMessage::RefType msg = MakeObjectMessage(ea->Object, "config::ObjectRemoved", false);
cJSON *params = msg->GetParams();
cJSON_AddStringToObject(params, "property", ea->Property.c_str());
- string value = ea->ConfigObject->GetProperty(ea->Property);
+ string value = ea->Object->GetProperty(ea->Property);
cJSON_AddStringToObject(params, "value", value.c_str());
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
LT_INIT
-
+LT_CONFIG_LTDL_DIR([ltdl])
+LTDL_INIT
AC_OUTPUT([
Makefile
base/Makefile
+configfilecomponent/Makefile
+configrpccomponent/Makefile
+icinga/Makefile
jsonrpc/Makefile
miniapp/Makefile
bin_PROGRAMS = \
icinga
-miniapp_SOURCES = \
+icinga_SOURCES = \
icingaapplication.cpp \
icingaapplication.h
-miniapp_CXXFLAGS = -I${top_srcdir}/base \
+icinga_CXXFLAGS = -I${top_srcdir}/base \
-I${top_srcdir}/jsonrpc
-miniapp_LDFLAGS = $(top_builddir)/base/libbase.a \
+icinga_LDFLAGS = $(top_builddir)/base/libbase.a \
$(top_builddir)/jsonrpc/libjsonrpc.a
int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
{
- if (ea->ConfigObject->GetType() == "component") {
- LoadComponent(ea->ConfigObject->GetName());
+ if (ea->Object->GetType() == "component") {
+ LoadComponent(ea->Object->GetName());
}
return 0;
int IcingaApplication::ConfigObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
{
- if (ea->ConfigObject->GetType() == "component") {
- UnloadComponent(ea->ConfigObject->GetName());
+ if (ea->Object->GetType() == "component") {
+ UnloadComponent(ea->Object->GetName());
}
return 0;