Ditto 4.7.1
Loading...
Searching...
No Matches
PresenceGraph.hpp
1#ifndef _DITTO_PRESENCE_GRAPH_
2#define _DITTO_PRESENCE_GRAPH_
3
4#include "Helpers.hpp"
5#include "any.hpp"
6
7#include "json.hpp"
8
9#include <vector>
10
11typedef uint64_t SiteId;
12typedef std::vector<uint8_t> Pubkey;
13
14namespace ditto {
15using nlohmann::json;
16
21public:
22 explicit DittoAddress();
23 DittoAddress(Pubkey pubkey, SiteId site_id);
24 void update_from_json(json j);
25 bool operator==(const DittoAddress &b) const;
26
27private:
28 SiteId site_id;
29 Pubkey pubkey;
30};
31
36public:
37 explicit Connection();
38 std::string id;
39 Pubkey peer1;
40 Pubkey peer2;
41 float approximate_distance_in_meters;
42 std::string connection_type;
43};
44
48class Peer {
49public:
50 explicit Peer();
51
56
61 DITTO_DEPRECATED std::vector<uint8_t> peer_key;
62
70 std::string peer_key_string;
71
77 std::string device_name;
78
82 std::string os;
83
92
97
102
106 std::string ditto_sdk_version;
107
111 std::vector<Connection> connections;
112
125
134};
135
142public:
147
155
160 std::vector<Peer> remote_peers;
161};
162
163} // namespace ditto
164#endif
Connection between two peers.
Definition PresenceGraph.hpp:35
Information used to identify a peer.
Definition PresenceGraph.hpp:20
Represent a known peer in the Ditto network.
Definition PresenceGraph.hpp:48
DITTO_DEPRECATED std::vector< uint8_t > peer_key
Definition PresenceGraph.hpp:61
nlohmann::json identity_service_metadata
Metadata associated with the peer by the identity service.
Definition PresenceGraph.hpp:133
std::string peer_key_string
The peer key is a unique identifier for a given peer, equal to or derived from the cryptographic publ...
Definition PresenceGraph.hpp:70
nlohmann::json peer_metadata
Metadata associated with the peer, or empty map by default.
Definition PresenceGraph.hpp:124
std::string os
Operating system of the remote peer.
Definition PresenceGraph.hpp:82
bool is_compatible
Indicates whether the peer is compatible with the current peer.
Definition PresenceGraph.hpp:101
std::string ditto_sdk_version
The Ditto SDK version the peer is running with.
Definition PresenceGraph.hpp:106
std::string device_name
The human-readable device name of the remote peer. This defaults to the hostname but can be manually ...
Definition PresenceGraph.hpp:77
std::vector< Connection > connections
Currently active connections of the peer.
Definition PresenceGraph.hpp:111
bool is_connected_to_ditto_cloud
Indicates whether the peer is connected to Ditto Cloud.
Definition PresenceGraph.hpp:96
uint8_t query_overlap_group
An optional Query Overlap Group which can be assigned to group certain types of peers together and co...
Definition PresenceGraph.hpp:91
DittoAddress address
Address to contact this peer via Ditto Bus.
Definition PresenceGraph.hpp:55
Represents the Ditto mesh network of peers and their connections between each other....
Definition PresenceGraph.hpp:141
Peer local_peer
Returns the local peer (usually the peer that is represented by the currently running Ditto instance)...
Definition PresenceGraph.hpp:154
std::vector< Peer > remote_peers
Returns all remote peers known by the local_peer, either directly or via other remote peers.
Definition PresenceGraph.hpp:160
PresenceGraph(nlohmann::json)
Construct a new Presence Graph object.
Definition PresenceGraph.cpp:65
basic_json<> json
default JSON class
Definition json.hpp:2933
Definition Arc.hpp:11