1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/nodes/zeromq.hpp

88 lines
1.7 KiB
C++
Raw Normal View History

/** Node type: ZeroMQ
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
*********************************************************************************/
#pragma once
#include <cstdint>
#include <jansson.h>
2021-05-10 00:12:30 +02:00
#include <villas/super_node.hpp>
#include <villas/list.hpp>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
#if ZMQ_BUILD_DRAFT_API && (ZMQ_VERSION_MAJOR > 4 || (ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR >= 2))
2018-06-29 08:37:14 +02:00
#define ZMQ_BUILD_DISH 1
2017-06-15 13:59:09 +02:00
#endif
namespace villas {
namespace node {
/* Forward declarations */
class NodeCompat;
struct Sample;
struct zeromq {
2017-05-23 09:12:08 +02:00
int ipv6;
2017-07-24 19:33:35 +02:00
Format *formatter;
struct Curve {
int enabled;
struct {
char public_key[41];
char secret_key[41];
} server, client;
} curve;
2017-07-24 19:33:35 +02:00
2019-06-23 16:13:23 +02:00
enum class Pattern {
2019-04-22 23:43:46 +02:00
PUBSUB,
2017-06-15 13:59:09 +02:00
#ifdef ZMQ_BUILD_DISH
2019-04-22 23:43:46 +02:00
RADIODISH
2017-06-15 13:59:09 +02:00
#endif
} pattern;
struct Dir {
2018-06-29 08:37:14 +02:00
void *socket; /**< ZeroMQ socket. */
2017-05-23 11:13:41 +02:00
void *mon_socket;
struct List endpoints;
char *filter;
int bind, pending;
} in, out;
};
char * zeromq_print(NodeCompat *n);
int zeromq_parse(NodeCompat *n, json_t *json);
int zeromq_type_start(SuperNode *sn);
int zeromq_type_stop();
int zeromq_init(NodeCompat *n);
int zeromq_destroy(NodeCompat *n);
int zeromq_check(NodeCompat *n);
int zeromq_start(NodeCompat *n);
int zeromq_stop(NodeCompat *n);
int zeromq_reverse(NodeCompat *n);
int zeromq_poll_fds(NodeCompat *n, int fds[]);
int zeromq_netem_fds(NodeCompat *n, int fds[]);
int zeromq_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
int zeromq_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
} // namespace node
} // namespace villas