Ditto 4.1.0
TransportConfig.hpp
1#ifndef _DITTO_TRANSPORT_CONFIG_
2#define _DITTO_TRANSPORT_CONFIG_
3
4#include <chrono>
5#include <set>
6#include <string>
7
8namespace ditto {
9
14public:
18 bool enabled = false;
19
23 std::string interface_ip = "0.0.0.0";
24
28 uint16_t port = 4040;
29
30 bool operator==(const TcpListenConfig &other) const {
31 return (enabled == other.enabled && interface_ip == other.interface_ip &&
32 port == other.port);
33 }
34 bool operator!=(const TcpListenConfig &other) const {
35 return !operator==(other);
36 }
37};
38
43public:
47 bool enabled = false;
48
52 std::string interface_ip = "0.0.0.0";
53
57 uint16_t port = 8080;
58
66 bool websocket_sync = false;
67
75
82 std::string tls_key_path;
83
91
92 bool operator==(const HttpListenConfig &other) const {
93 return (enabled == other.enabled && interface_ip == other.interface_ip &&
94 port == other.port && websocket_sync == other.websocket_sync &&
96 tls_key_path == other.tls_key_path &&
98 }
99 bool operator!=(const HttpListenConfig &other) const {
100 return !operator==(other);
101 }
102};
103
107class Listen {
108public:
109 TcpListenConfig tcp;
110 HttpListenConfig http;
111};
112
118public:
122 bool enabled = false;
123
124 bool operator==(const BluetoothLeConfig &other) const {
125 return enabled == other.enabled;
126 }
127 bool operator!=(const BluetoothLeConfig &other) const {
128 return !operator==(other);
129 }
130};
131
136public:
140 bool enabled = false;
141 bool mdns_enabled = true;
142 bool multicast_enabled = true;
143
144 bool operator==(const LanConfig &other) const {
145 return enabled == other.enabled && mdns_enabled == other.mdns_enabled &&
146 multicast_enabled == other.multicast_enabled;
147 }
148 bool operator!=(const LanConfig &other) const { return !operator==(other); }
149};
150
155public:
162 bool enabled = false;
163
164 bool operator==(const AwdlConfig &other) const {
165 return enabled == other.enabled;
166 }
167 bool operator!=(const AwdlConfig &other) const { return !operator==(other); }
168};
169
175public:
182 bool enabled = false;
183
184 bool operator==(const WiFiAwareConfig &other) const {
185 return enabled == other.enabled;
186 }
187 bool operator!=(const WiFiAwareConfig &other) const {
188 return !operator==(other);
189 }
190};
191
197public:
203
208
213
219};
220
224class Connect {
225public:
229 std::set<std::string> tcp_servers;
230
234 std::set<std::string> websocket_urls;
235
239 std::chrono::duration<uint32_t, std::milli> retry_interval{5000};
240};
241
242const uint32_t NO_PREFERRED_ROUTE_HINT = 0;
243
248class Global {
249public:
267 uint32_t sync_group = 0;
268
286 uint32_t routing_hint = NO_PREFERRED_ROUTE_HINT;
287};
288
318public:
324
329
334
339
345 peer_to_peer.lan.enabled = true;
348 }
349};
350} // namespace ditto
351
352#endif // _DITTO_TRANSPORT_CONFIG_
Part of the PeerToPeer config that relates to AWDL connections.
Definition: TransportConfig.hpp:154
bool enabled
Definition: TransportConfig.hpp:162
Part of the PeerToPeer config that relates to Bluetooth LE connections.
Definition: TransportConfig.hpp:117
bool enabled
Definition: TransportConfig.hpp:122
Part of the TransportConfig that relates to outgoing connections.
Definition: TransportConfig.hpp:224
std::set< std::string > tcp_servers
Definition: TransportConfig.hpp:229
std::chrono::duration< uint32_t, std::milli > retry_interval
Definition: TransportConfig.hpp:239
std::set< std::string > websocket_urls
Definition: TransportConfig.hpp:234
Definition: TransportConfig.hpp:248
uint32_t sync_group
Definition: TransportConfig.hpp:267
uint32_t routing_hint
Definition: TransportConfig.hpp:286
Part of the Listen config that relates to incoming HTTP connections.
Definition: TransportConfig.hpp:42
std::string tls_key_path
Definition: TransportConfig.hpp:82
uint16_t port
Definition: TransportConfig.hpp:57
std::string interface_ip
Definition: TransportConfig.hpp:52
bool enabled
Definition: TransportConfig.hpp:47
std::string tls_certificate_path
Definition: TransportConfig.hpp:90
std::string static_content_path
Definition: TransportConfig.hpp:74
bool websocket_sync
Definition: TransportConfig.hpp:66
Part of the PeerToPeer config that relates to LAN connections.
Definition: TransportConfig.hpp:135
bool enabled
Definition: TransportConfig.hpp:140
Part of the TransportConfig that relates to incoming connections.
Definition: TransportConfig.hpp:107
Part of the TransportConfig that relates to peer-to-peer connections.
Definition: TransportConfig.hpp:196
LanConfig lan
Definition: TransportConfig.hpp:207
BluetoothLeConfig bluetooth_le
Definition: TransportConfig.hpp:202
AwdlConfig awdl
Definition: TransportConfig.hpp:212
WiFiAwareConfig wifi_aware
Definition: TransportConfig.hpp:218
Part of the Listen config that relates to incoming TCP connections.
Definition: TransportConfig.hpp:13
uint16_t port
Definition: TransportConfig.hpp:28
std::string interface_ip
Definition: TransportConfig.hpp:23
bool enabled
Definition: TransportConfig.hpp:18
A configuration object specifying which network transports Ditto should use to sync data.
Definition: TransportConfig.hpp:317
PeerToPeer peer_to_peer
Definition: TransportConfig.hpp:323
Connect connect
Definition: TransportConfig.hpp:328
Global global
Definition: TransportConfig.hpp:338
void enable_all_peer_to_peer()
Definition: TransportConfig.hpp:343
Listen listen
Definition: TransportConfig.hpp:333
Part of the PeerToPeer transport config that applies to WiFi Aware connections.
Definition: TransportConfig.hpp:174
bool enabled
Definition: TransportConfig.hpp:182