-#ifndef I2_APPLICATION_H
-#define I2_APPLICATION_H
+#ifndef APPLICATION_H
+#define APPLICATION_H
#include <map>
};
template<class T>
-int i2_main(int argc, char **argv)
+int application_main(int argc, char **argv)
{
int result;
#define SET_START_CLASS(klass) \
int main(int argc, char **argv) { \
- return i2_main<klass>(argc, argv); \
+ return application_main<klass>(argc, argv); \
}
}
-#endif /* I2_APPLICATION_H */
+#endif /* APPLICATION_H */
-#ifndef I2_COMPONENT_H
-#define I2_COMPONENT_H
+#ifndef COMPONENT_H
+#define COMPONENT_H
namespace icinga
{
}
-#endif /* I2_COMPONENT_H */
+#endif /* COMPONENT_H */
-#ifndef I2_CONDVAR_H
-#define I2_CONDVAR_H
+#ifndef CONDVAR_H
+#define CONDVAR_H
namespace icinga
{
}
-#endif /* I2_CONDVAR_H */
\ No newline at end of file
+#endif /* CONDVAR_H */
-#ifndef I2_CONFIGHIVE_H
-#define I2_CONFIGHIVE_H
+#ifndef CONFIGHIVE_H
+#define CONFIGHIVE_H
#include <map>
}
-#endif /* I2_CONFIGHIVE_H */
+#endif /* CONFIGHIVE_H */
-#ifndef I2_CONFIGOBJECT_H
-#define I2_CONFIGOBJECT_H
+#ifndef CONFIGOBJECT_H
+#define CONFIGOBJECT_H
#include <map>
}
-#endif /* I2_CONFIGOBJECT_H */
+#endif /* CONFIGOBJECT_H */
-#ifndef I2_DELEGATE_H
-#define I2_DELEGATE_H
+#ifndef DELEGATE_H
+#define DELEGATE_H
#include <list>
}
-#endif /* I2_DELEGATE_H */
\ No newline at end of file
+#endif /* DELEGATE_H */
-#ifndef I2_EVENT_H
-#define I2_EVENT_H
+#ifndef EVENT_H
+#define EVENT_H
namespace icinga
{
}
-#endif /* I2_EVENT_H */
+#endif /* EVENT_H */
-#ifndef I2_FIFO_H
-#define I2_FIFO_H
+#ifndef FIFO_H
+#define FIFO_H
namespace icinga
{
}
-#endif /* I2_FIFO_H */
\ No newline at end of file
+#endif /* FIFO_H */
-#ifndef I2_BASE_H
-#define I2_BASE_H
+#ifndef I2BASE_H
+#define I2BASE_H
#include <cstdlib>
#include <cstdarg>
#include "application.h"
#include "component.h"
-#endif /* I2_BASE_H */
\ No newline at end of file
+#endif /* I2BASE_H */
-#ifndef I2_MEMORY_H
-#define I2_MEMORY_H
+#ifndef MEMORY_H
+#define MEMORY_H
namespace icinga
{
}
-#endif /* I2_MEMORY_H */
\ No newline at end of file
+#endif /* MEMORY_H */
-#ifndef I2_MUTEX_H
-#define I2_MUTEX_H
+#ifndef MUTEX_H
+#define MUTEX_H
namespace icinga
{
}
-#endif /* I2_MUTEX_H */
+#endif /* MUTEX_H */
-#ifndef I2_OBJECT_H
-#define I2_OBJECT_H
+#ifndef OBJECT_H
+#define OBJECT_H
namespace icinga
{
}
-#endif /* I2_OBJECT_H */
+#endif /* OBJECT_H */
-#ifndef I2_SOCKET_H
-#define I2_SOCKET_H
+#ifndef SOCKET_H
+#define SOCKET_H
namespace icinga {
}
-#endif /* I2_SOCKET_H */
+#endif /* SOCKET_H */
-#ifndef I2_TCPCLIENT_H
-#define I2_TCPCLIENT_H
+#ifndef TCPCLIENT_H
+#define TCPCLIENT_H
namespace icinga
{
}
-#endif /* I2_TCPCLIENT_H */
+#endif /* TCPCLIENT_H */
-#ifndef I2_TCPSERVER_H
-#define I2_TCPSERVER_H
+#ifndef TCPSERVER_H
+#define TCPSERVER_H
namespace icinga
{
}
-#endif /* I2_TCPSERVER_H */
+#endif /* TCPSERVER_H */
-#ifndef I2_TCPSOCKET_H
-#define I2_TCPSOCKET_H
+#ifndef TCPSOCKET_H
+#define TCPSOCKET_H
namespace icinga
{
}
-#endif /* I2_TCPSOCKET_H */
\ No newline at end of file
+#endif /* TCPSOCKET_H */
-#ifndef I2_THREAD_H
-#define I2_THREAD_H
+#ifndef THREAD_H
+#define THREAD_H
namespace icinga
{
}
-#endif /* I2_THREAD_H */
+#endif /* THREAD_H */
-#ifndef I2_TIMER_H
-#define I2_TIMER_H
+#ifndef TIMER_H
+#define TIMER_H
#include <time.h>
}
-#endif /* I2_TIMER_H */
+#endif /* TIMER_H */
-#ifndef I2_UNIX_H
-#define I2_UNIX_H
+#ifndef UNIX_H
+#define UNIX_H
#include <ltdl.h>
#include <execinfo.h>
return lt_dlsym(module, function);
}
-#endif /* I2_UNIX_H */
\ No newline at end of file
+#endif /* UNIX_H */
-#ifndef I2_WIN32_H
-#define I2_WIN32_H
+#ifndef WIN32_H
+#define WIN32_H
#define NOGDI
#include <windows.h>
#define I2_EXPORT __declspec(dllexport)
#define I2_IMPORT __declspec(dllimport)
-#endif /* I2_WIN32_H */
\ No newline at end of file
+#endif /* WIN32_H */
FIFO::RefType fifo = new_object<FIFO>();
string filename;
- if (!GetConfig()->GetProperty("filename", &filename))
- throw exception(/*"Missing filename property"*/);
+ if (!GetConfig()->GetProperty("configFilename", &filename))
+ throw exception(/*"Missing configFilename property"*/);
fp.open(filename.c_str(), ifstream::in);
if (fp.fail())
-#ifndef I2_CONFIGFILECOMPONENT_H
-#define I2_CONFIGFILECOMPONENT_H
+#ifndef CONFIGFILECOMPONENT_H
+#define CONFIGFILECOMPONENT_H
namespace icinga
{
}
-#endif /* I2_CONFIGFILECOMPONENT_H */
\ No newline at end of file
+#endif /* CONFIGFILECOMPONENT_H */
-#ifndef I2_I2CONFIGFILECOMPONENT_H
-#define I2_I2CONFIGFILECOMPONENT_H
+#ifndef I2CONFIGFILECOMPONENT_H
+#define I2CONFIGFILECOMPONENT_H
#include <i2-base.h>
#include "configfilecomponent.h"
-#endif /* I2_I2CONFIGFILECOMPONENT_H */
+#endif /* I2CONFIGFILECOMPONENT_H */
-#ifndef I2_CONFIGRPCCOMPONENT_H
-#define I2_CONFIGRPCCOMPONENT_H
+#ifndef CONFIGRPCCOMPONENT_H
+#define CONFIGRPCCOMPONENT_H
namespace icinga
{
}
-#endif /* I2_CONFIGRPCCOMPONENT_H */
+#endif /* CONFIGRPCCOMPONENT_H */
-#ifndef I2_I2CONFIGCOMPONENT_H
-#define I2_I2CONFIGCOMPONENT_H
+#ifndef I2CONFIGCOMPONENT_H
+#define I2CONFIGCOMPONENT_H
#include <i2-base.h>
#include <i2-jsonrpc.h>
#include "configrpccomponent.h"
-#endif /* I2_I2CONFIGCOMPONENT_H */
+#endif /* I2CONFIGCOMPONENT_H */
-#ifndef I2_ICINGA_H
-#define I2_ICINGA_H
+#ifndef I2ICINGA_H
+#define I2ICINGA_H
#include <i2-base.h>
#include <i2-jsonrpc.h>
#include "icingaapplication.h"
-#endif /* I2_ICINGA_H */
+#endif /* I2ICINGA_H */
ConfigObject::RefType fileComponentConfig = new_object<ConfigObject>();
fileComponentConfig->SetName("configfilecomponent");
fileComponentConfig->SetType("component");
- fileComponentConfig->SetProperty("path", "libconfigfilecomponent.la");
- fileComponentConfig->SetProperty("filename", "icinga.conf");
+ fileComponentConfig->SetProperty("configFilename", "icinga.conf");
GetConfigHive()->AddObject(fileComponentConfig);
RunEventLoop();
if (ea->Object->GetType() == "component") {
string path;
- if (!ea->Object->GetProperty("path", &path))
- throw exception(/*"Missing path property"*/);
+ if (!ea->Object->GetProperty("path", &path)) {
+#ifdef _WIN32
+ path = ea->Object->GetName() + ".dll";
+#else /* _WIN32 */
+ path = "lib" + ea->Object->GetName() + ".la";
+#endif /* _WIN32 */
+
+ // TODO: try to figure out where the component is located */
+ }
LoadComponent(path, ea->Object);
}
-#ifndef I2_ICINGAAPPLICATION_H
-#define I2_ICINGAAPPLICATION_H
+#ifndef ICINGAAPPLICATION_H
+#define ICINGAAPPLICATION_H
namespace icinga
{
}
-#endif /* I2_ICINGAAPPLICATION_H */
+#endif /* ICINGAAPPLICATION_H */
-#ifndef I2_CONNECTIONMANAGER_H
-#define I2_CONNECTIONMANAGER_H
+#ifndef CONNECTIONMANAGER_H
+#define CONNECTIONMANAGER_H
namespace icinga
{
}
-#endif /* I2_CONNECTIONMANAGER_H */
+#endif /* CONNECTIONMANAGER_H */
-#ifndef I2_JSONRPC_H
-#define I2_JSONRPC_H
+#ifndef I2JSONRPC_H
+#define I2JSONRPC_H
#include <map>
#include <i2-base.h>
#include "jsonrpcserver.h"
#include "connectionmanager.h"
-#endif /* I2_JSONRPC_H */
+#endif /* I2JSONRPC_H */
-#ifndef I2_JSONRPCCLIENT_H
-#define I2_JSONRPCCLIENT_H
+#ifndef JSONRPCCLIENT_H
+#define JSONRPCCLIENT_H
namespace icinga
{
}
-#endif /* I2_JSONRPCCLIENT_H */
+#endif /* JSONRPCCLIENT_H */
-#ifndef I2_JSONRPCMESSAGE_H
-#define I2_JSONRPCMESSAGE_H
+#ifndef JSONRPCMESSAGE_H
+#define JSONRPCMESSAGE_H
namespace icinga
{
}
-#endif /* I2_JSONRPCMESSAGE_H */
+#endif /* JSONRPCMESSAGE_H */
-#ifndef I2_JSONRPCSERVER_H
-#define I2_JSONRPCSERVER_H
+#ifndef JSONRPCSERVER_H
+#define JSONRPCSERVER_H
namespace icinga
{
}
-#endif /* I2_JSONRPCSERVER_H */
\ No newline at end of file
+#endif /* JSONRPCSERVER_H */
-#ifndef I2_NETSTRING_H
-#define I2_NETSTRING_H
+#ifndef NETSTRING_H
+#define NETSTRING_H
namespace icinga
{
}
-#endif /* I2_NETSTRING_H */
+#endif /* NETSTRING_H */