diff options
author | Olliver Schinagl <oliver@schinagl.nl> | 2016-03-11 08:11:32 (GMT) |
---|---|---|
committer | Olliver Schinagl <oliver@schinagl.nl> | 2016-03-18 20:46:27 (GMT) |
commit | 32fb990072022f7668930473e07c3ae0eb3d8215 (patch) | |
tree | 79736e547aea85e597f403e24f84f06cb19c6541 /src/include | |
parent | 6cd8ff8f7101091559fa60535cb26d7c30b23fdf (diff) | |
download | engagement-32fb990072022f7668930473e07c3ae0eb3d8215.zip engagement-32fb990072022f7668930473e07c3ae0eb3d8215.tar.gz engagement-32fb990072022f7668930473e07c3ae0eb3d8215.tar.bz2 |
Add initial plugin header
This patch adds the first preliminary draft plugin description. It is
missing many things, most importantly documentation.
More importantly it is likely not yet complete.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 6 | ||||
-rw-r--r-- | src/include/engagement/plugin.h | 78 |
2 files changed, 84 insertions, 0 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am new file mode 100644 index 0000000..6a1282d --- /dev/null +++ b/src/include/Makefile.am @@ -0,0 +1,6 @@ +MAINTAINERCLEANFILES = Makefile.in + +includesdir = $(includedir)/engagement +includes_HEADERS = engagement/plugin.h + +EXTRA_DIST = gettext.h 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_ */ |