Ditto 3.0.3-alpha2
TransportConfig.hpp
1#ifndef _DITTO_TRANSPORT_CONFIG_
2#define _DITTO_TRANSPORT_CONFIG_
3
4#include <set>
5#include <string>
6
7namespace ditto {
8
13public:
17 bool enabled = false;
18
22 std::string interface_ip = "0.0.0.0";
23
27 uint16_t port = 4040;
28
29 bool operator==(const TcpListenConfig &other) const {
30 return (enabled == other.enabled && interface_ip == other.interface_ip &&
31 port == other.port);
32 }
33 bool operator!=(const TcpListenConfig &other) const {
34 return !operator==(other);
35 }
36};
37
42public:
46 bool enabled = false;
47
51 std::string interface_ip = "0.0.0.0";
52
56 uint16_t port = 8080;
57
65 bool websocket_sync = false;
66
74
81 std::string tls_key_path;
82
90
91 bool operator==(const HttpListenConfig &other) const {
92 return (enabled == other.enabled && interface_ip == other.interface_ip &&
93 port == other.port && websocket_sync == other.websocket_sync &&
95 tls_key_path == other.tls_key_path &&
97 }
98 bool operator!=(const HttpListenConfig &other) const {
99 return !operator==(other);
100 }
101};
102
106class Listen {
107public:
108 TcpListenConfig tcp;
109 HttpListenConfig http;
110};
111
117public:
121 bool enabled = false;
122
123 bool operator==(const BluetoothLeConfig &other) const {
124 return enabled == other.enabled;
125 }
126 bool operator!=(const BluetoothLeConfig &other) const {
127 return !operator==(other);
128 }
129};
130
135public:
139 bool enabled = false;
140 // TODO: Rename these to `mdns_enabled` and `multicast_enabled`
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};
236
237const uint32_t NO_PREFERRED_ROUTE_HINT = 0;
238
242class Global {
243public:
261 uint32_t sync_group = 0;
262
280 uint32_t routing_hint = NO_PREFERRED_ROUTE_HINT;
281};
282
309public:
315
320
325
330
336 peer_to_peer.lan.enabled = true;
339 }
340};
341} // namespace ditto
342
343#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:116
bool enabled
Definition: TransportConfig.hpp:121
Part of the TransportConfig that relates to outgoing connections.
Definition: TransportConfig.hpp:224
std::set< std::string > tcp_servers
Definition: TransportConfig.hpp:229
std::set< std::string > websocket_urls
Definition: TransportConfig.hpp:234
Definition: TransportConfig.hpp:242
uint32_t sync_group
Definition: TransportConfig.hpp:261
uint32_t routing_hint
Definition: TransportConfig.hpp:280
Part of the Listen config that relates to incoming HTTP connections.
Definition: TransportConfig.hpp:41
std::string tls_key_path
Definition: TransportConfig.hpp:81
uint16_t port
Definition: TransportConfig.hpp:56
std::string interface_ip
Definition: TransportConfig.hpp:51
bool enabled
Definition: TransportConfig.hpp:46
std::string tls_certificate_path
Definition: TransportConfig.hpp:89
std::string static_content_path
Definition: TransportConfig.hpp:73
bool websocket_sync
Definition: TransportConfig.hpp:65
Part of the PeerToPeer config that relates to LAN connections.
Definition: TransportConfig.hpp:134
bool enabled
Definition: TransportConfig.hpp:139
Part of the TransportConfig that relates to incoming connections.
Definition: TransportConfig.hpp:106
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:12
uint16_t port
Definition: TransportConfig.hpp:27
std::string interface_ip
Definition: TransportConfig.hpp:22
bool enabled
Definition: TransportConfig.hpp:17
A configuration object specifying which network transports Ditto should use to sync data.
Definition: TransportConfig.hpp:308
PeerToPeer peer_to_peer
Definition: TransportConfig.hpp:314
Connect connect
Definition: TransportConfig.hpp:319
Global global
Definition: TransportConfig.hpp:329
void enable_all_peer_to_peer()
Definition: TransportConfig.hpp:334
Listen listen
Definition: TransportConfig.hpp:324
Part of the PeerToPeer transport config that applies to WiFi Aware connections.
Definition: TransportConfig.hpp:174
bool enabled
Definition: TransportConfig.hpp:182