1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00
VILLASnode/include/villas/plugin.h

60 lines
1.7 KiB
C
Raw Permalink Normal View History

/** 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-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-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-16 09:04:12 -03:00
#pragma once
2020-03-04 12:41:55 +01:00
#include <villas/common.hpp>
#include <villas/utils.hpp>
2018-08-06 11:22:52 +02:00
#include <villas/node_type.h>
#include <villas/format_type.h>
2019-01-07 10:28:55 +01:00
extern struct vlist plugins;
2019-06-23 16:13:23 +02:00
enum PluginType {
NODE,
FORMAT,
};
struct plugin {
2017-10-18 17:15:56 +02:00
const char *name;
const char *description;
2019-06-23 16:13:23 +02:00
enum PluginType type;
union {
struct format_type format;
2020-08-25 21:00:52 +02:00
struct vnode_type node;
};
};
/** 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)))
#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
/** 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);