mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-16 00:00:02 +01:00
84 lines
2.3 KiB
C++
84 lines
2.3 KiB
C++
/** Node type: mqtt
|
|
*
|
|
* @file
|
|
* @author Steffen Vogel <svogel2@eonerc.rwth-aachen.de>
|
|
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
|
* @license Apache 2.0
|
|
*********************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include <villas/pool.hpp>
|
|
#include <villas/format.hpp>
|
|
#include <villas/queue_signalled.h>
|
|
#include <villas/super_node.hpp>
|
|
|
|
/* Forward declarations */
|
|
struct mosquitto;
|
|
|
|
namespace villas {
|
|
namespace node {
|
|
|
|
/* Forward declarations */
|
|
class NodeCompat;
|
|
|
|
struct mqtt {
|
|
struct mosquitto *client;
|
|
struct CQueueSignalled queue;
|
|
struct Pool pool;
|
|
|
|
int keepalive; /**< Keep-alive interval in seconds. Zero for no keepalive. */
|
|
int port; /**< Hostname / IP address of the broker. */
|
|
int qos; /**< Integer value 0, 1 or 2 indicating the Quality of Service to be used for publishing messages. */
|
|
int retain; /**< Mark published messages as retained. */
|
|
char *host; /**< Hostname / IP address of the broker. */
|
|
char *username; /**< Username for authentication to the broker. */
|
|
char *password; /**< Password for authentication to the broker. */
|
|
char *publish; /**< Publish topic. */
|
|
char *subscribe; /**< Subscribe topic. */
|
|
|
|
struct {
|
|
int enabled; /**< Enable SSL encrypted connection to broker. */
|
|
int insecure; /**< Allow insecure SSL connections. */
|
|
char *cafile; /**< SSL CA file. */
|
|
char *capath; /**< SSL CA path. */
|
|
char *certfile; /**< SSL certificate. */
|
|
char *keyfile; /**< SSL private key. */
|
|
int cert_reqs; /**< SSL_VERIFY_NONE(0) or SSL_VERIFY_PEER(1) */
|
|
char *tls_version; /**< SSL tls verion */
|
|
char *ciphers; /**< SSL chipher list. */
|
|
} ssl;
|
|
|
|
Format *formatter;
|
|
};
|
|
|
|
int mqtt_reverse(NodeCompat *n);
|
|
|
|
char * mqtt_print(NodeCompat *n);
|
|
|
|
int mqtt_prepare(NodeCompat *n);
|
|
|
|
int mqtt_parse(NodeCompat *n, json_t *json);
|
|
|
|
int mqtt_check(NodeCompat *n);
|
|
|
|
int mqtt_start(NodeCompat *n);
|
|
|
|
int mqtt_init(NodeCompat *n);
|
|
|
|
int mqtt_destroy(NodeCompat *n);
|
|
|
|
int mqtt_stop(NodeCompat *n);
|
|
|
|
int mqtt_type_start(SuperNode *sn);
|
|
|
|
int mqtt_type_stop();
|
|
|
|
int mqtt_poll_fds(NodeCompat *n, int fds[]);
|
|
|
|
int mqtt_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
|
|
|
int mqtt_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
|
|
|
} /* namespace node */
|
|
} /* namespace villas */
|