2017-05-23 14:54:25 +02:00
|
|
|
/** Node type: nanomsg
|
|
|
|
*
|
|
|
|
* @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-23 14:54:25 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
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-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 {
|
|
|
|
struct {
|
|
|
|
int socket;
|
2021-08-10 10:12:48 -04:00
|
|
|
struct List endpoints;
|
2018-08-20 18:25:25 +02:00
|
|
|
} in, out;
|
2017-08-14 14:42:07 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
Format *formatter;
|
2017-05-23 14:54:25 +02:00
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
char * nanomsg_print(NodeCompat *n);
|
|
|
|
|
|
|
|
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
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int nanomsg_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2017-05-23 14:54:25 +02:00
|
|
|
|
2021-08-10 10:12:48 -04: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
|