1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/nodes/mqtt.hpp

85 lines
2.3 KiB
C++
Raw Normal View History

/** Node type: mqtt
*
* @file
* @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
*********************************************************************************/
#pragma once
#include <villas/pool.hpp>
2021-05-10 00:12:30 +02:00
#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 {
2021-11-09 17:11:51 +01:00
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);
2021-01-08 15:22:28 +01:00
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