Ditto 1.1.3
TransportConfig.hpp
1//
2// Created by Tom Karpiniec on 24/2/21.
3//
4
5#ifndef DITTOKIT_TRANSPORT_CONFIG_H
6#define DITTOKIT_TRANSPORT_CONFIG_H
7
8#include <set>
9
10namespace ditto {
11
16public:
20 bool enabled = false;
21
25 std::string interface_ip = "[::]";
26
30 uint16_t port = 4040;
31
32 bool operator==(const TcpListenConfig &other) const {
33 return (enabled == other.enabled && interface_ip == other.interface_ip &&
34 port == other.port);
35 }
36 bool operator!=(const TcpListenConfig &other) const {
37 return !operator==(other);
38 }
39};
40
45public:
49 bool enabled = false;
50
54 std::string interface_ip = "[::]";
55
59 uint16_t port = 8080;
60
68 bool websocket_sync = false;
69
77
84 std::string tls_key_path;
85
93
94 bool operator==(const HttpListenConfig &other) const {
95 return (enabled == other.enabled && interface_ip == other.interface_ip &&
96 port == other.port && websocket_sync == other.websocket_sync &&
98 tls_key_path == other.tls_key_path &&
100 }
101 bool operator!=(const HttpListenConfig &other) const {
102 return !operator==(other);
103 }
104};
105
109class Listen {
110public:
111 TcpListenConfig tcp;
112 HttpListenConfig http;
113};
114
120public:
124 bool enabled = false;
125
126 bool operator==(const BluetoothLeConfig &other) const {
127 return enabled == other.enabled;
128 }
129 bool operator!=(const BluetoothLeConfig &other) const {
130 return !operator==(other);
131 }
132};
133
138public:
142 bool enabled = false;
143 bool mdnsEnabled = true;
144 bool multicastEnabled = true;
145
146 bool operator==(const LanConfig &other) const {
147 return enabled == other.enabled && mdnsEnabled == other.mdnsEnabled &&
148 multicastEnabled == other.multicastEnabled;
149 }
150 bool operator!=(const LanConfig &other) const { return !operator==(other); }
151};
152
157public:
161 bool enabled = false;
162
163 bool operator==(const AwdlConfig &other) const {
164 return enabled == other.enabled;
165 }
166 bool operator!=(const AwdlConfig &other) const { return !operator==(other); }
167};
168
174public:
180
185
190};
191
195class Connect {
196public:
200 std::set<std::string> tcp_servers;
201
205 std::set<std::string> websocket_urls;
206};
207
211class Global {
212public:
230 uint32_t sync_group = 0;
231};
232
259public:
265
270
275
280
286 peer_to_peer.lan.enabled = true;
288 }
289};
290} // namespace ditto
291
292#endif // DITTOKIT_TRANSPORT_CONFIG_H
Part of the PeerToPeer config that relates to AWDL connections.
Definition: TransportConfig.hpp:156
bool enabled
Definition: TransportConfig.hpp:161
Part of the PeerToPeer config that relates to Bluetooth LE connections.
Definition: TransportConfig.hpp:119
bool enabled
Definition: TransportConfig.hpp:124
Part of the TransportConfig that relates to outgoing connections.
Definition: TransportConfig.hpp:195
std::set< std::string > tcp_servers
Definition: TransportConfig.hpp:200
std::set< std::string > websocket_urls
Definition: TransportConfig.hpp:205
Definition: TransportConfig.hpp:211
uint32_t sync_group
Definition: TransportConfig.hpp:230
Part of the Listen config that relates to incoming HTTP connections.
Definition: TransportConfig.hpp:44
std::string tls_key_path
Definition: TransportConfig.hpp:84
uint16_t port
Definition: TransportConfig.hpp:59
std::string interface_ip
Definition: TransportConfig.hpp:54
bool enabled
Definition: TransportConfig.hpp:49
std::string tls_certificate_path
Definition: TransportConfig.hpp:92
std::string static_content_path
Definition: TransportConfig.hpp:76
bool websocket_sync
Definition: TransportConfig.hpp:68
Part of the PeerToPeer config that relates to LAN connections.
Definition: TransportConfig.hpp:137
bool enabled
Definition: TransportConfig.hpp:142
Part of the TransportConfig that relates to incoming connections.
Definition: TransportConfig.hpp:109
Part of the TransportConfig that relates to peer-to-peer connections.
Definition: TransportConfig.hpp:173
LanConfig lan
Definition: TransportConfig.hpp:184
BluetoothLeConfig bluetooth_le
Definition: TransportConfig.hpp:179
AwdlConfig awdl
Definition: TransportConfig.hpp:189
Part of the Listen config that relates to incoming TCP connections.
Definition: TransportConfig.hpp:15
uint16_t port
Definition: TransportConfig.hpp:30
std::string interface_ip
Definition: TransportConfig.hpp:25
bool enabled
Definition: TransportConfig.hpp:20
A configuration object specifying which network transports Ditto should use to sync data.
Definition: TransportConfig.hpp:258
PeerToPeer peer_to_peer
Definition: TransportConfig.hpp:264
Connect connect
Definition: TransportConfig.hpp:269
Global global
Definition: TransportConfig.hpp:279
void enable_all_peer_to_peer()
Definition: TransportConfig.hpp:284
Listen listen
Definition: TransportConfig.hpp:274