summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/erebos/network.h6
-rw-r--r--include/erebos/service.h31
2 files changed, 36 insertions, 1 deletions
diff --git a/include/erebos/network.h b/include/erebos/network.h
index 90c85a6..d730fb5 100644
--- a/include/erebos/network.h
+++ b/include/erebos/network.h
@@ -1,6 +1,7 @@
#pragma once
#include <erebos/identity.h>
+#include <erebos/service.h>
#include <functional>
@@ -9,7 +10,7 @@ namespace erebos {
class Server
{
public:
- Server(const Identity &);
+ Server(const Identity &, std::vector<std::unique_ptr<Service>> &&);
~Server();
class PeerList & peerList() const;
@@ -30,6 +31,9 @@ public:
std::string name() const;
std::optional<Identity> identity() const;
+ bool hasChannel() const;
+ bool send(UUID, const Ref &) const;
+
private:
std::shared_ptr<Priv> p;
};
diff --git a/include/erebos/service.h b/include/erebos/service.h
new file mode 100644
index 0000000..7a6f646
--- /dev/null
+++ b/include/erebos/service.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <erebos/storage.h>
+
+namespace erebos {
+
+class Service
+{
+public:
+ Service();
+ virtual ~Service();
+
+ class Context
+ {
+ public:
+ struct Priv;
+ Context(Priv *);
+ Priv & priv();
+
+ const Ref & ref() const;
+ const class Peer & peer() const;
+
+ private:
+ std::unique_ptr<Priv> p;
+ };
+
+ virtual UUID uuid() const = 0;
+ virtual void handle(Context &) const = 0;
+};
+
+}