2023-09-04 12:21:37 +02:00
|
|
|
/* Node type: nanomsg.
|
2017-05-23 14:54:25 +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-23 14:54:25 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-05-10 00:12:30 +02:00
|
|
|
#include <villas/format.hpp>
|
2023-09-07 11:46:39 +02:00
|
|
|
#include <villas/list.hpp>
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2021-06-21 16:11:42 -04:00
|
|
|
// Forward declarations
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
2021-06-21 16:11:42 -04:00
|
|
|
|
2017-08-14 14:42:07 +02:00
|
|
|
// The maximum length of a packet which contains stuct msg.
|
|
|
|
#define NANOMSG_MAX_PACKET_LEN 1500
|
|
|
|
|
2017-05-23 14:54:25 +02:00
|
|
|
struct nanomsg {
|
2023-09-07 11:46:39 +02:00
|
|
|
struct {
|
|
|
|
int socket;
|
|
|
|
struct List endpoints;
|
|
|
|
} in, out;
|
2017-08-14 14:42:07 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
Format *formatter;
|
2017-05-23 14:54:25 +02:00
|
|
|
};
|
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
char *nanomsg_print(NodeCompat *n);
|
2021-08-10 10:12:48 -04:00
|
|
|
|
|
|
|
int nanomsg_init(NodeCompat *n);
|
|
|
|
|
|
|
|
int nanomsg_destroy(NodeCompat *n);
|
|
|
|
|
|
|
|
int nanomsg_parse(NodeCompat *n, json_t *json);
|
|
|
|
|
|
|
|
int nanomsg_start(NodeCompat *n);
|
|
|
|
|
|
|
|
int nanomsg_stop(NodeCompat *n);
|
|
|
|
|
|
|
|
int nanomsg_type_stop();
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int nanomsg_reverse(NodeCompat *n);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int nanomsg_poll_fds(NodeCompat *n, int fds[]);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int nanomsg_netem_fds(NodeCompat *n, int fds[]);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int nanomsg_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int nanomsg_write(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|