summaryrefslogtreecommitdiff
path: root/include/erebos
diff options
context:
space:
mode:
Diffstat (limited to 'include/erebos')
-rw-r--r--include/erebos/identity.h1
-rw-r--r--include/erebos/network.h36
2 files changed, 37 insertions, 0 deletions
diff --git a/include/erebos/identity.h b/include/erebos/identity.h
index 9ed170a..dce6093 100644
--- a/include/erebos/identity.h
+++ b/include/erebos/identity.h
@@ -12,6 +12,7 @@ public:
std::optional<std::string> name() const;
std::optional<Identity> owner() const;
+ const Identity & finalOwner() const;
Stored<class PublicKey> keyMessage() const;
diff --git a/include/erebos/network.h b/include/erebos/network.h
index 47c7e7a..90c85a6 100644
--- a/include/erebos/network.h
+++ b/include/erebos/network.h
@@ -2,6 +2,8 @@
#include <erebos/identity.h>
+#include <functional>
+
namespace erebos {
class Server
@@ -10,10 +12,44 @@ public:
Server(const Identity &);
~Server();
+ class PeerList & peerList() const;
+
struct Peer;
private:
struct Priv;
const std::shared_ptr<Priv> p;
};
+class Peer
+{
+public:
+ struct Priv;
+ Peer(const std::shared_ptr<Priv> & p);
+ ~Peer();
+
+ std::string name() const;
+ std::optional<Identity> identity() const;
+
+private:
+ std::shared_ptr<Priv> p;
};
+
+class PeerList
+{
+public:
+ struct Priv;
+ PeerList();
+ PeerList(const std::shared_ptr<Priv> & p);
+ ~PeerList();
+
+ size_t size() const;
+ Peer at(size_t n) const;
+
+ void onUpdate(std::function<void(size_t, const Peer *)>);
+
+private:
+ friend Server;
+ const std::shared_ptr<Priv> p;
+};
+
+}