Ditto 4.0.2
Loading...
Searching...
No Matches
PresenceGraph.hpp
1#ifndef _DITTO_PRESENCE_GRAPH_
2#define _DITTO_PRESENCE_GRAPH_
3
4#include "dittoffi.hpp"
5
6#include "json.hpp"
7
8#include <vector>
9
10typedef uint64_t SiteId;
11typedef std::vector<uint8_t> Pubkey;
12
13namespace ditto {
14using nlohmann::json;
19public:
20 explicit DittoAddress();
21 DittoAddress(Pubkey pubkey, SiteId site_id);
22 void update_from_json(json j);
23 bool operator==(const DittoAddress &b) const;
24
25private:
26 SiteId site_id;
27 Pubkey pubkey;
28};
29
34public:
35 explicit Connection();
36 std::string id;
37 Pubkey peer1;
38 Pubkey peer2;
39 float approximate_distance_in_meters;
40 std::string connection_type;
41};
42
46class Peer {
47public:
48 explicit Peer();
49 DittoAddress address;
50 std::vector<uint8_t> peer_key;
51 std::string device_name;
52 std::string os;
53 uint8_t query_overlap_group;
54 bool is_connected_to_ditto_cloud;
55 bool is_compatible;
56 std::string ditto_sdk_version;
57 std::vector<Connection> connections;
58};
59
64public:
69 Peer local_peer;
70 std::vector<Peer> remote_peers;
71};
72
73} // namespace ditto
74#endif
Connection between two peers.
Definition: PresenceGraph.hpp:33
Information used to identify a peer.
Definition: PresenceGraph.hpp:18
Represent a known peer in the Ditto network.
Definition: PresenceGraph.hpp:46
Represents local peer and local peers.
Definition: PresenceGraph.hpp:63
basic_json<> json
default JSON class
Definition: json.hpp:2933