From e6ed8f19771d23a2e3496eb8fd71187ce0acc615 Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Wed, 6 Jun 2018 20:06:14 +0200 Subject: Add bootstrap class (server) --- include/sibs/BootstrapNode.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/sibs/BootstrapNode.hpp (limited to 'include/sibs/BootstrapNode.hpp') 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; + }; +} -- cgit v1.2.3