2023-09-04 12:21:37 +02:00
|
|
|
/* Node type: ZeroMQ.
|
2017-05-22 20:09:26 +02:00
|
|
|
*
|
2022-03-15 09:18:01 -04:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2022-07-04 18:20:03 +02:00
|
|
|
* SPDX-License-Identifier: 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/format.hpp>
|
2023-09-07 11:46:39 +02:00
|
|
|
#include <villas/list.hpp>
|
|
|
|
#include <villas/super_node.hpp>
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
#if ZMQ_BUILD_DRAFT_API && \
|
|
|
|
(ZMQ_VERSION_MAJOR > 4 || \
|
|
|
|
(ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR >= 2))
|
|
|
|
#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 {
|
2023-09-07 11:46:39 +02:00
|
|
|
int ipv6;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
Format *formatter;
|
2017-08-14 14:42:07 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
struct Curve {
|
|
|
|
int enabled;
|
|
|
|
struct {
|
|
|
|
char public_key[41];
|
|
|
|
char secret_key[41];
|
|
|
|
} server, client;
|
|
|
|
} curve;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
enum class Pattern {
|
|
|
|
PUBSUB,
|
2017-06-15 13:59:09 +02:00
|
|
|
#ifdef ZMQ_BUILD_DISH
|
2023-09-07 11:46:39 +02:00
|
|
|
RADIODISH
|
2017-06-15 13:59:09 +02:00
|
|
|
#endif
|
2023-09-07 11:46:39 +02:00
|
|
|
} pattern;
|
|
|
|
|
|
|
|
struct Dir {
|
|
|
|
void *socket; // ZeroMQ socket.
|
|
|
|
void *mon_socket;
|
|
|
|
struct List endpoints;
|
|
|
|
char *filter;
|
|
|
|
int bind, pending;
|
|
|
|
} in, out;
|
2017-05-22 20:09:26 +02:00
|
|
|
};
|
|
|
|
|
2023-09-07 11:46:39 +02: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
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int zeromq_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
2023-09-07 11:46:39 +02: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
|