2017-02-12 14:35:05 -03:00
|
|
|
/** Loadable / plugin support.
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2020-01-20 17:17:00 +01:00
|
|
|
* @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
|
2017-04-27 12:56:43 +02:00
|
|
|
* @license GNU General Public License (version 3)
|
|
|
|
*
|
|
|
|
* VILLASnode
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 12:56:43 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 12:56:43 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-02-12 14:35:05 -03:00
|
|
|
*********************************************************************************/
|
|
|
|
|
2017-02-16 09:04:12 -03:00
|
|
|
#pragma once
|
2017-02-12 14:35:05 -03:00
|
|
|
|
2020-03-04 12:41:55 +01:00
|
|
|
#include <villas/common.hpp>
|
2019-04-23 13:09:50 +02:00
|
|
|
#include <villas/utils.hpp>
|
2018-08-06 11:22:52 +02:00
|
|
|
#include <villas/node_type.h>
|
|
|
|
#include <villas/format_type.h>
|
2017-02-18 10:51:43 -05:00
|
|
|
|
2019-01-07 10:28:55 +01:00
|
|
|
extern struct vlist plugins;
|
2017-02-12 14:35:05 -03:00
|
|
|
|
2019-06-23 16:13:23 +02:00
|
|
|
enum PluginType {
|
|
|
|
NODE,
|
|
|
|
FORMAT,
|
2017-02-12 14:35:05 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct plugin {
|
2017-10-18 17:15:56 +02:00
|
|
|
const char *name;
|
|
|
|
const char *description;
|
2017-05-05 19:24:16 +00:00
|
|
|
|
2019-06-23 16:13:23 +02:00
|
|
|
enum PluginType type;
|
2017-05-05 19:24:16 +00:00
|
|
|
|
2017-02-12 14:35:05 -03:00
|
|
|
union {
|
2018-05-13 13:51:28 +02:00
|
|
|
struct format_type format;
|
2020-08-25 21:00:52 +02:00
|
|
|
struct vnode_type node;
|
2017-02-12 14:35:05 -03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-03-07 07:12:24 -04:00
|
|
|
/** Return a pointer to the plugin structure */
|
2018-10-20 14:20:06 +02:00
|
|
|
#define plugin(vt) ((struct plugin *) ((char *) (vt) - offsetof(struct plugin, format)))
|
2017-03-07 07:12:24 -04:00
|
|
|
|
|
|
|
#define plugin_name(vt) plugin(vt)->name
|
|
|
|
#define plugin_description(vt) plugin(vt)->description
|
|
|
|
|
2019-06-23 16:13:23 +02:00
|
|
|
void plugin_dump(enum PluginType type);
|
2017-03-03 20:21:33 -04:00
|
|
|
|
2017-02-18 10:51:43 -05:00
|
|
|
/** Find registered and loaded plugin with given name and type. */
|
2019-06-23 16:13:23 +02:00
|
|
|
struct plugin * plugin_lookup(enum PluginType type, const char *name);
|