summaryrefslogtreecommitdiff
path: root/src/common/HPM.h
diff options
context:
space:
mode:
authorjaBote <j@bot.e>2013-05-03 01:45:50 +0200
committerjaBote <j@bot.e>2013-05-03 01:45:50 +0200
commit1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b (patch)
treec8825cc2dc141d91fe1fcc52739a0e79a89c80e9 /src/common/HPM.h
parentf41dea469a52213acfde4f4ea5e8d7bbbd869bed (diff)
parent274bfc3b06616ea03c467d8eed23fae61c72fe18 (diff)
downloadhercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.gz
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.bz2
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.tar.xz
hercules-1e5e8f5f42abb2cd42ad7ecf8e07439b8a1c570b.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'src/common/HPM.h')
-rw-r--r--src/common/HPM.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/common/HPM.h b/src/common/HPM.h
new file mode 100644
index 000000000..ac2c4050f
--- /dev/null
+++ b/src/common/HPM.h
@@ -0,0 +1,83 @@
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+
+#ifndef _HPM_H_
+#define _HPM_H_
+
+#include "../common/cbasetypes.h"
+#include "../common/HPMi.h"
+
+#ifdef WIN32
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+ #include <windows.h>
+ #define plugin_open(x) LoadLibraryA(x)
+ #define plugin_import(x,y,z) (z)GetProcAddress(x,y)
+ #define plugin_close(x) FreeLibrary(x)
+
+ #define DLL_EXT ".dll"
+ #define DLL HINSTANCE
+#else
+ #include <dlfcn.h>
+ #define plugin_open(x) dlopen(x,RTLD_NOW)
+ #define plugin_import(x,y,z) (z)dlsym(x,y)
+ #define plugin_close(x) dlclose(x)
+
+ #ifdef CYGWIN
+ #define DLL_EXT ".dll"
+ #else
+ #define DLL_EXT ".so"
+ #endif
+
+ #define DLL void *
+
+ #include <string.h> // size_t
+
+#endif
+
+struct hplugin {
+ DLL dll;
+ unsigned int idx;
+ char *filename;
+ struct hplugin_info *info;
+ struct HPMi_interface *hpi;
+};
+
+struct hpm_symbol {
+ char *name;
+ void *ptr;
+};
+
+/* Hercules Plugin Manager Interface */
+struct HPM_interface {
+ /* vars */
+ unsigned int version[2];
+ bool off;
+ /* data */
+ struct hplugin **plugins;
+ unsigned int plugin_count;
+ struct hpm_symbol **symbols;
+ unsigned int symbol_count;
+ /* funcs */
+ void (*init) (void);
+ void (*final) (void);
+ struct hplugin * (*create) (void);
+ void (*load) (const char* filename);
+ void (*unload) (struct hplugin* plugin);
+ bool (*exists) (const char *filename);
+ bool (*iscompatible) (char* version);
+ void (*event) (enum hp_event_types type);
+ void *(*import_symbol) (char *);
+ void (*share) (void *, char *);
+ void (*symbol_defaults) (void);
+ void (*config_read) (void);
+ bool (*showmsg_pop) (struct hplugin *plugin,const char *filename);
+ void (*symbol_defaults_sub) (void);
+} HPM_s;
+
+struct HPM_interface *HPM;
+
+void hpm_defaults(void);
+
+#endif /* _HPM_H_ */ \ No newline at end of file