2017-05-22 20:09:26 +02:00
|
|
|
/** Node type: ZeroMQ
|
|
|
|
*
|
|
|
|
* @file
|
2022-12-14 17:41:58 +01:00
|
|
|
* @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
|
2017-05-22 20:09:26 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-06-23 16:57:00 +02:00
|
|
|
#include <cstdint>
|
2017-08-14 14:42:07 +02:00
|
|
|
#include <jansson.h>
|
2017-05-23 09:58:11 +02:00
|
|
|
|
2021-05-10 00:12:30 +02:00
|
|
|
#include <villas/super_node.hpp>
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/list.hpp>
|
2021-05-10 00:12:30 +02:00
|
|
|
#include <villas/format.hpp>
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2017-11-02 13:15:31 +01:00
|
|
|
#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
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2017-08-14 14:42:07 +02:00
|
|
|
/* Forward declarations */
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
|
|
|
struct Sample;
|
2017-08-14 14:42:07 +02:00
|
|
|
|
2017-05-22 20:09:26 +02:00
|
|
|
struct zeromq {
|
2017-05-23 09:12:08 +02:00
|
|
|
int ipv6;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
Format *formatter;
|
2017-08-14 14:42:07 +02:00
|
|
|
|
2019-10-29 20:18:30 +01:00
|
|
|
struct Curve {
|
2017-05-23 09:58:11 +02:00
|
|
|
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
|
2017-05-22 20:09:26 +02:00
|
|
|
} pattern;
|
|
|
|
|
2019-10-29 20:18:30 +01:00
|
|
|
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;
|
2021-08-10 10:12:48 -04:00
|
|
|
struct List endpoints;
|
2018-08-20 18:25:42 +02:00
|
|
|
char *filter;
|
2019-10-29 20:18:30 +01:00
|
|
|
int bind, pending;
|
|
|
|
} in, out;
|
2017-05-22 20:09:26 +02:00
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
char * zeromq_print(NodeCompat *n);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int zeromq_parse(NodeCompat *n, json_t *json);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int zeromq_type_start(SuperNode *sn);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2018-07-16 08:08:17 +02:00
|
|
|
int zeromq_type_stop();
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
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[]);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int zeromq_netem_fds(NodeCompat *n, int fds[]);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int zeromq_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int zeromq_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|