2017-05-22 20:09:26 +02:00
|
|
|
/** Node type: ZeroMQ
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
|
|
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
|
|
|
* @license GNU General Public License (version 3)
|
|
|
|
*
|
|
|
|
* VILLASnode
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup zeromq ZeroMQ node type
|
|
|
|
* @ingroup node
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-05-23 09:58:11 +02:00
|
|
|
#include <stdint.h>
|
2017-08-14 14:42:07 +02:00
|
|
|
#include <jansson.h>
|
2017-05-23 09:58:11 +02:00
|
|
|
|
2017-05-22 20:09:26 +02:00
|
|
|
#include "list.h"
|
|
|
|
|
2017-06-29 21:10:33 +02:00
|
|
|
#if ZMQ_VERSION_MAJOR > 4 || (ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR >= 2)
|
2017-06-15 13:59:09 +02:00
|
|
|
#define ZMQ_BUILD_DISH 1
|
|
|
|
#endif
|
|
|
|
|
2017-08-14 14:42:07 +02:00
|
|
|
/* Forward declarations */
|
|
|
|
struct io_format;
|
|
|
|
struct node;
|
|
|
|
struct sample;
|
|
|
|
|
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
|
|
|
|
2017-05-23 09:34:53 +02:00
|
|
|
char *filter;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2017-08-14 14:42:07 +02:00
|
|
|
struct io_format *format;
|
|
|
|
|
2017-05-23 09:58:11 +02:00
|
|
|
struct {
|
|
|
|
int enabled;
|
|
|
|
struct {
|
|
|
|
char public_key[41];
|
|
|
|
char secret_key[41];
|
|
|
|
} server, client;
|
|
|
|
} curve;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2017-05-22 20:09:26 +02:00
|
|
|
enum {
|
|
|
|
ZEROMQ_PATTERN_PUBSUB,
|
2017-06-15 13:59:09 +02:00
|
|
|
#ifdef ZMQ_BUILD_DISH
|
2017-05-22 20:09:26 +02:00
|
|
|
ZEROMQ_PATTERN_RADIODISH
|
2017-06-15 13:59:09 +02:00
|
|
|
#endif
|
2017-05-22 20:09:26 +02:00
|
|
|
} pattern;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
void *socket; /**< ZeroMQ socket. */
|
2017-05-23 11:13:41 +02:00
|
|
|
void *mon_socket;
|
2017-05-22 20:09:26 +02:00
|
|
|
char *endpoint;
|
|
|
|
} subscriber;
|
2017-07-24 19:33:35 +02:00
|
|
|
|
2017-05-22 20:09:26 +02:00
|
|
|
struct {
|
|
|
|
void *socket; /**< ZeroMQ socket. */
|
|
|
|
struct list endpoints;
|
|
|
|
} publisher;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @see node_type::print */
|
|
|
|
char * zeromq_print(struct node *n);
|
|
|
|
|
|
|
|
/** @see node_type::parse */
|
2017-08-03 00:19:27 +02:00
|
|
|
int zeromq_parse(struct node *n, json_t *cfg);
|
2017-05-22 20:09:26 +02:00
|
|
|
|
|
|
|
/** @see node_type::init */
|
|
|
|
int zeromq_init();
|
|
|
|
|
|
|
|
/** @see node_type::deinit */
|
|
|
|
int zeromq_deinit();
|
|
|
|
|
|
|
|
/** @see node_type::open */
|
|
|
|
int zeromq_start(struct node *n);
|
|
|
|
|
|
|
|
/** @see node_type::close */
|
|
|
|
int zeromq_stop(struct node *n);
|
|
|
|
|
|
|
|
/** @see node_type::read */
|
|
|
|
int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt);
|
|
|
|
|
|
|
|
/** @see node_type::write */
|
|
|
|
int zeromq_write(struct node *n, struct sample *smps[], unsigned cnt);
|
|
|
|
|
|
|
|
/** @} */
|