Ditto 1.1.7
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 = "[::]";
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 = "[::]";
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 mdnsEnabled = true;
142 bool multicastEnabled = true;
143
144 bool operator==(const LanConfig &other) const {
145 return enabled == other.enabled && mdnsEnabled == other.mdnsEnabled &&
146 multicastEnabled == other.multicastEnabled;
147 }
148 bool operator!=(const LanConfig &other) const { return !operator==(other); }
149};
150
155public:
159 bool enabled = false;
160
161 bool operator==(const AwdlConfig &other) const {
162 return enabled == other.enabled;
163 }
164 bool operator!=(const AwdlConfig &other) const { return !operator==(other); }
165};
166
172public:
178
183
188};
189
193class Connect {
194public:
198 std::set<std::string> tcp_servers;
199
203 std::set<std::string> websocket_urls;
204};
205
209class Global {
210public:
228 uint32_t sync_group = 0;
229};
230
257public:
263
268
273
278
284 peer_to_peer.lan.enabled = true;
286 }
287};
288} // namespace ditto
289
290#endif // _DITTO_TRANSPORT_CONFIG_
Part of the PeerToPeer config that relates to AWDL connections.
Definition: TransportConfig.hpp:154
bool enabled
Definition: TransportConfig.hpp:159
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:193
std::set< std::string > tcp_servers
Definition: TransportConfig.hpp:198
std::set< std::string > websocket_urls
Definition: TransportConfig.hpp:203
Definition: TransportConfig.hpp:209
uint32_t sync_group
Definition: TransportConfig.hpp:228
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:171
LanConfig lan
Definition: TransportConfig.hpp:182
BluetoothLeConfig bluetooth_le
Definition: TransportConfig.hpp:177
AwdlConfig awdl
Definition: TransportConfig.hpp:187
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:256
PeerToPeer peer_to_peer
Definition: TransportConfig.hpp:262
Connect connect
Definition: TransportConfig.hpp:267
Global global
Definition: TransportConfig.hpp:277
void enable_all_peer_to_peer()
Definition: TransportConfig.hpp:282
Listen listen
Definition: TransportConfig.hpp:272