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

103 lines
3 KiB
C++
Raw Permalink Normal View History

/** Node type: mqtt
*
* @file
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
2020-01-20 17:17:00 +01:00
* @copyright 2014-2020, 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 mqtt mqtt node type
* @ingroup node
* @{
*/
#pragma once
#include <villas/node.h>
#include <villas/pool.h>
2018-05-12 15:25:29 +02:00
#include <villas/io.h>
#include <villas/queue_signalled.h>
/* Forward declarations */
2018-05-12 13:56:12 +02:00
struct format_type;
struct mosquitto;
struct mqtt {
struct mosquitto *client;
struct queue_signalled 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. */
} ssl;
2018-05-12 13:56:12 +02:00
struct format_type *format;
2018-05-12 15:25:29 +02:00
struct io io;
};
/** @see node_type::reverse */
2020-08-25 21:00:52 +02:00
int mqtt_reverse(struct vnode *n);
/** @see node_type::print */
2020-08-25 21:00:52 +02:00
char * mqtt_print(struct vnode *n);
2021-01-08 15:22:28 +01:00
/** @see node_type::prepare */
int mqtt_prepare(struct vnode *n);
/** @see node_type::parse */
2020-08-25 21:00:52 +02:00
int mqtt_parse(struct vnode *n, json_t *cfg);
2020-01-21 14:27:28 +01:00
/** @see node_type::start */
2020-08-25 21:00:52 +02:00
int mqtt_start(struct vnode *n);
/** @see node_type::destroy */
2020-08-25 21:00:52 +02:00
int mqtt_destroy(struct vnode *n);
2020-01-21 14:27:28 +01:00
/** @see node_type::stop */
2020-08-25 21:00:52 +02:00
int mqtt_stop(struct vnode *n);
/** @see node_type::type_start */
2019-04-23 13:14:47 +02:00
int mqtt_type_start(villas::node::SuperNode *sn);
/** @see node_type::type_stop */
int mqtt_type_stop();
/** @see node_type::read */
2020-08-25 21:00:52 +02:00
int mqtt_read(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
/** @see node_type::write */
2020-08-25 21:00:52 +02:00
int mqtt_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
/** @} */