-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathgateway.hpp
More file actions
59 lines (42 loc) · 1.11 KB
/
gateway.hpp
File metadata and controls
59 lines (42 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Node type for API gateway.
*
* Author: Jitpanu Maneeratpongsuk <jitpanu.maneeratpongsuk@rwth-aachen.de>
* SPDX-FileCopyrightText: 2025 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <pthread.h>
#include <villas/format.hpp>
#include <villas/node.hpp>
namespace villas {
namespace node {
// Forward declarations
struct Sample;
class GatewayNode : public Node {
protected:
int parse(json_t *json) override;
int _read(struct Sample *smps[], unsigned cnt) override;
int _write(struct Sample *smps[], unsigned cnt) override;
public:
GatewayNode(const uuid_t &id = {}, const std::string &name = "");
enum ApiType { gRPC };
struct Direction {
Sample *sample;
pthread_cond_t cv;
pthread_mutex_t mutex;
char *buf;
size_t buflen;
size_t wbytes;
};
Direction read, write;
std::string address;
ApiType type;
Format::Ptr formatter;
int prepare() override;
int check() override;
int start() override;
int stop() override;
~GatewayNode();
};
} // namespace node
} // namespace villas