Ditto 4.0.2
Loading...
Searching...
No Matches
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 // TODO: Rename these to `mdns_enabled` and `multicast_enabled`
142 bool mdns_enabled = true;
143 bool multicast_enabled = true;
144
145 bool operator==(const LanConfig &other) const {
146 return enabled == other.enabled && mdns_enabled == other.mdns_enabled &&
147 multicast_enabled == other.multicast_enabled;
148 }
149 bool operator!=(const LanConfig &other) const { return !operator==(other); }
150};
151
156public:
163 bool enabled = false;
164
165 bool operator==(const AwdlConfig &other) const {
166 return enabled == other.enabled;
167 }
168 bool operator!=(const AwdlConfig &other) const { return !operator==(other); }
169};
170
176public:
183 bool enabled = false;
184
185 bool operator==(const WiFiAwareConfig &other) const {
186 return enabled == other.enabled;
187 }
188 bool operator!=(const WiFiAwareConfig &other) const {
189 return !operator==(other);
190 }
191};
192
198public:
204
209
214
220};
221
225class Connect {
226public:
230 std::set<std::string> tcp_servers;
231
235 std::set<std::string> websocket_urls;
236
240 std::chrono::duration<uint32_t, std::milli> retry_interval{5000};
241};
242
243const uint32_t NO_PREFERRED_ROUTE_HINT = 0;
244
249class Global {
250public:
268 uint32_t sync_group = 0;
269
287 uint32_t routing_hint = NO_PREFERRED_ROUTE_HINT;
288};
289
319public:
325
330
335
340
346 peer_to_peer.lan.enabled = true;
349 }
350};
351} // namespace ditto
352
353#endif // _DITTO_TRANSPORT_CONFIG_
Part of the PeerToPeer config that relates to AWDL connections.
Definition: TransportConfig.hpp:155
bool enabled
Definition: TransportConfig.hpp:163
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:225
std::set< std::string > tcp_servers
Definition: TransportConfig.hpp:230
std::chrono::duration< uint32_t, std::milli > retry_interval
Definition: TransportConfig.hpp:240
std::set< std::string > websocket_urls
Definition: TransportConfig.hpp:235
Definition: TransportConfig.hpp:249
uint32_t sync_group
Definition: TransportConfig.hpp:268
uint32_t routing_hint
Definition: TransportConfig.hpp:287
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:197
LanConfig lan
Definition: TransportConfig.hpp:208
BluetoothLeConfig bluetooth_le
Definition: TransportConfig.hpp:203
AwdlConfig awdl
Definition: TransportConfig.hpp:213
WiFiAwareConfig wifi_aware
Definition: TransportConfig.hpp:219
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:318
PeerToPeer peer_to_peer
Definition: TransportConfig.hpp:324
Connect connect
Definition: TransportConfig.hpp:329
Global global
Definition: TransportConfig.hpp:339
void enable_all_peer_to_peer()
Definition: TransportConfig.hpp:344
Listen listen
Definition: TransportConfig.hpp:334
Part of the PeerToPeer transport config that applies to WiFi Aware connections.
Definition: TransportConfig.hpp:175
bool enabled
Definition: TransportConfig.hpp:183