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/kafka.hpp
Steffen Vogel 02a2aa4f94 Apply clang-format changes
Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
2023-09-08 11:37:42 +02:00

83 lines
1.7 KiB
C++

/* Node type: kafka.
*
* Author: Juan Pablo Noreña <jpnorenam@unal.edu.co>
* SPDX-FileCopyrightText: 2021 Universidad Nacional de Colombia
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <librdkafka/rdkafka.h>
#include <villas/format.hpp>
#include <villas/pool.hpp>
#include <villas/queue_signalled.h>
namespace villas {
namespace node {
// Forward declarations
class NodeCompat;
struct kafka {
struct CQueueSignalled queue;
struct Pool pool;
double timeout; // Timeout in seconds.
char *server; // Hostname/IP:Port address of the bootstrap server.
char *protocol; // Security protocol.
char *produce; // Producer topic.
char *consume; // Consumer topic.
char *client_id; // Client ID.
struct {
rd_kafka_t *client;
rd_kafka_topic_t *topic;
} producer;
struct {
rd_kafka_t *client;
char *group_id; // Group id.
} consumer;
struct {
char *ca; // SSL CA file.
} ssl;
struct {
char *mechanisms; // SASL mechanisms.
char *username; // SSL CA path.
char *password; // SSL certificate.
} sasl;
Format *formatter;
};
int kafka_reverse(NodeCompat *n);
char *kafka_print(NodeCompat *n);
int kafka_init(NodeCompat *n);
int kafka_prepare(NodeCompat *n);
int kafka_parse(NodeCompat *n, json_t *json);
int kafka_start(NodeCompat *n);
int kafka_destroy(NodeCompat *n);
int kafka_stop(NodeCompat *n);
int kafka_type_start(SuperNode *sn);
int kafka_type_stop();
int kafka_poll_fds(NodeCompat *n, int fds[]);
int kafka_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
int kafka_write(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
} // namespace node
} // namespace villas