summaryrefslogtreecommitdiff
path: root/include/erebos/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/erebos/network.h')
-rw-r--r--include/erebos/network.h36
1 files changed, 36 insertions, 0 deletions
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;
+};
+
+}