string path = componentConfig->GetProperty("path", name);
-#ifdef _WIN32
HMODULE hModule = LoadLibrary(path.c_str());
if (hModule == INVALID_HANDLE_VALUE)
if (pCreateComponent == NULL)
throw exception(/*"Module does not contain CreateComponent function"*/);
-#else /* _WIN32 */
- // TODO: implement
-#endif /* _WIN32 */
-
component = Component::RefType(pCreateComponent());
component->SetApplication(static_pointer_cast<Application>(shared_from_this()));
component->SetConfig(componentConfig);
#ifndef I2_UNIX_H
#define I2_UNIX_H
+#include <ltdl.h>
#include <execinfo.h>
#include <unistd.h>
#include <sys/types.h>
#define I2_EXPORT
#define I2_IMPORT
+typedef lt_dlhandle HMODULE;
+
+#define INVALID_HANDLE_VALUE NULL
+
+inline HMODULE LoadLibrary(const char *filename)
+{
+ lt_dlhandle handle = 0;
+ lt_dladvise advise;
+
+ if (!lt_dladvise_init(&advise) && !lt_dladvise_global(&advise)) {
+ handle = lt_dlopenadvise(filename, advise);
+ }
+
+ lt_dladvise_destroy(&advise);
+
+ return handle;
+}
+
+inline void FreeLibrary(HMODULE module)
+{
+ if (module)
+ lt_dlclose(module);
+}
+
+inline void *GetProcAddress(HMODULE module, const char *function)
+{
+ return lt_dlsym(module, function);
+}
+
#endif /* I2_UNIX_H */
\ No newline at end of file
int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
{
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
- connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectCreated", true));
+ connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectCreated", true));
return 0;
}
int ConfigRpcComponent::LocalObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
{
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
- connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectRemoved", false));
+ connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false));
return 0;
}
int ConfigRpcComponent::LocalPropertyChangedHandler(ConfigHiveEventArgs::RefType ea)
{
- JsonRpcMessage::RefType msg = MakeObjectMessage(ea->Object, "config::ObjectRemoved", false);
+ JsonRpcMessage::RefType msg = MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false);
cJSON *params = msg->GetParams();
cJSON_AddStringToObject(params, "property", ea->Property.c_str());
- string value = ea->Object->GetProperty(ea->Property);
+ string value = ea->ConfigObject->GetProperty(ea->Property);
cJSON_AddStringToObject(params, "value", value.c_str());
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();