2019-02-24 11:07:07 +01:00
|
|
|
/** Node direction
|
|
|
|
*
|
|
|
|
* @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
|
2019-02-24 11:07:07 +01: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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup node Node
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <jansson.h>
|
|
|
|
|
2020-03-04 12:41:55 +01:00
|
|
|
#include <villas/common.hpp>
|
2019-02-24 11:07:07 +01:00
|
|
|
#include <villas/list.h>
|
|
|
|
|
|
|
|
/* Forward declarations */
|
2020-08-25 21:00:52 +02:00
|
|
|
struct vnode;
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2019-06-23 16:13:23 +02:00
|
|
|
enum class NodeDir {
|
|
|
|
IN, /**< VILLASnode is receiving/reading */
|
|
|
|
OUT /**< VILLASnode is sending/writing */
|
2019-02-24 11:07:07 +01:00
|
|
|
};
|
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
struct vnode_direction {
|
2019-06-23 16:13:23 +02:00
|
|
|
enum State state;
|
|
|
|
enum NodeDir direction;
|
2019-02-24 11:07:07 +01:00
|
|
|
|
|
|
|
int enabled;
|
|
|
|
int builtin; /**< This node should use built-in hooks by default. */
|
2019-04-07 15:13:40 +02:00
|
|
|
unsigned vectorize; /**< Number of messages to send / recv at once (scatter / gather) */
|
2019-02-24 11:07:07 +01:00
|
|
|
|
|
|
|
struct vlist hooks; /**< List of read / write hooks (struct hook). */
|
|
|
|
struct vlist signals; /**< Signal description. */
|
|
|
|
|
|
|
|
json_t *cfg; /**< A JSON object containing the configuration of the node. */
|
|
|
|
};
|
|
|
|
|
2020-09-10 11:11:42 +02:00
|
|
|
int node_direction_init(struct vnode_direction *nd, enum NodeDir dir, struct vnode *n) __attribute__ ((warn_unused_result));
|
|
|
|
|
|
|
|
int node_direction_destroy(struct vnode_direction *nd, struct vnode *n) __attribute__ ((warn_unused_result));
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int node_direction_parse(struct vnode_direction *nd, struct vnode *n, json_t *cfg);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int node_direction_check(struct vnode_direction *nd, struct vnode *n);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int node_direction_prepare(struct vnode_direction *nd, struct vnode *n);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int node_direction_start(struct vnode_direction *nd, struct vnode *n);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int node_direction_stop(struct vnode_direction *nd, struct vnode *n);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
struct vlist * node_direction_get_signals(struct vnode_direction *nd);
|
2019-02-24 11:07:07 +01:00
|
|
|
|
|
|
|
/** @} */
|