summaryrefslogtreecommitdiffstats
path: root/src/include/engagement/plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/engagement/plugin.h')
-rw-r--r--src/include/engagement/plugin.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/include/engagement/plugin.h b/src/include/engagement/plugin.h
new file mode 100644
index 0000000..7bd7fa6
--- /dev/null
+++ b/src/include/engagement/plugin.h
@@ -0,0 +1,78 @@
+/*
+ * (c) Copyright 2016 Olliver Schinagl
+ * Author: Olliver Schinagl <oliver@schinagl.nl>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+/** \file
+ * Common header to describe the generic plugin API.
+ */
+#ifndef _PLUGIN_H_
+#define _PLUGIN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/**
+ * @defgroup Plugins
+ * @ingroup engagement
+ *
+ * Generic plugin API
+ */
+
+#define PLUGIN_MAGIC 0 /* TODO pick plugin magic */
+#define PLUGIN_VERSION_MAJOR 0 /* TODO replace with version from src? @ENGAGEMENT_VERSION_MAJOR@ */
+#define PLUGIN_VERSION_MINOR 0 /* TODO replace with version from src? */
+
+#define PLUGIN_SYMBOL "calendar_plugin" /* TODO use generic name */
+
+#define PLUGIN_INIT(plugin)
+
+enum plugin_type {
+ PLUGIN_TYPE_CALENDAR,
+ PLUGIN_TYPE_DIRECTORY,
+};
+
+struct plugin_info {
+ const char *name;
+ const char *summary;
+ const char *description;
+ const char *help;
+ const char *author;
+ const char *email;
+ const char *url;
+};
+
+struct plugin_version {
+ uint8_t major;
+ uint8_t minor;
+ uint32_t micro;
+};
+
+struct plugin {
+ uint32_t magic;
+ void *_handle;
+ enum plugin_type type;
+ const char *id;
+ struct plugin_version version;
+ struct plugin_info info;
+ void *dependencies; /* Unused/reserved */
+ bool (*load)(void);
+ bool (*unload)(void);
+ void *ui; /* struct plugin_ui ui; Unused/reserved */
+ void *ops;
+ void *priv;
+};
+
+struct plugin *plugin_load(const char *path);
+int plugin_unload(struct plugin *plugin);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _PLUGIN_H_ */