/* * (c) Copyright 2016 Olliver Schinagl * Author: Olliver Schinagl * * 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 #include /** * @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_ */