aboutsummaryrefslogtreecommitdiff
path: root/include/sibs/BootstrapNode.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-06-06 20:06:14 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-18 22:56:48 +0200
commited71e8adf36e3d0c3f6f2b54794fe069091d3376 (patch)
treee42eb457ea930a67d4e7352672e5d68082f3a2b4 /include/sibs/BootstrapNode.hpp
parentc10dbcb7b59a5187061b1dcd162e8120c89a5973 (diff)
Add bootstrap class (server)
Diffstat (limited to 'include/sibs/BootstrapNode.hpp')
-rw-r--r--include/sibs/BootstrapNode.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/sibs/BootstrapNode.hpp b/include/sibs/BootstrapNode.hpp
new file mode 100644
index 0000000..eaf48eb
--- /dev/null
+++ b/include/sibs/BootstrapNode.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "DirectConnection.hpp"
+#include "IpAddress.hpp"
+
+namespace sibs
+{
+ class BootstrapException : public std::runtime_error
+ {
+ public:
+ BootstrapException(const std::string &errMsg) : std::runtime_error(errMsg) {}
+ };
+
+ class BootstrapNode
+ {
+ DISABLE_COPY(BootstrapNode)
+ public:
+ // Throws BootstrapException on error
+ BootstrapNode(const Ipv4 &address);
+ ~BootstrapNode();
+ private:
+ void acceptConnections();
+ private:
+ DirectConnections connections;
+ int socket;
+ std::thread acceptConnectionsThread;
+ };
+}