aboutsummaryrefslogtreecommitdiff
path: root/libcmix-network/acceptor.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-08-31 11:57:15 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-08-31 11:57:15 +0200
commit2f1c3293d2c5776c4ecd9b2f1dce66492b15dbdd (patch)
tree1c582e4c5715a93c493582b1e01e51bc960d56c0 /libcmix-network/acceptor.hpp
parent1525c5defe3db08c765477003be73c68bb2c3cb7 (diff)
downloadcmix-2f1c3293d2c5776c4ecd9b2f1dce66492b15dbdd.tar.gz
cmix-2f1c3293d2c5776c4ecd9b2f1dce66492b15dbdd.tar.bz2
cmix-2f1c3293d2c5776c4ecd9b2f1dce66492b15dbdd.zip
Split up the client and server parts in a separate network library
Diffstat (limited to 'libcmix-network/acceptor.hpp')
-rw-r--r--libcmix-network/acceptor.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libcmix-network/acceptor.hpp b/libcmix-network/acceptor.hpp
new file mode 100644
index 0000000..7d8e0a2
--- /dev/null
+++ b/libcmix-network/acceptor.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <boost/asio/ip/tcp.hpp>
+
+#include <functional>
+
+class Acceptor{
+ boost::asio::ip::tcp::acceptor acceptor;
+ boost::asio::ip::tcp::endpoint endpoint;
+
+public:
+ Acceptor(boost::asio::io_service& io_service, boost::asio::ip::address address, uint16_t port);
+
+ boost::asio::ip::address get_address() { return endpoint.address(); }
+
+ void bind_v6_and_v4_any(std::function<void(boost::asio::ip::tcp::socket&&)> accept_handler);
+ void setup_listen_socket(std::function<void(boost::asio::ip::tcp::socket&&)> accept_handler);
+};