diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-08-30 16:06:04 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-08-30 16:07:44 +0200 |
| commit | 5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc (patch) | |
| tree | 25fc89fc4074d469ab0110a39b8f1419c2690068 /network-handler/server.hpp | |
| parent | 825fc3d44eb6a3837bb922815c4351aa011a213c (diff) | |
| download | cmix-5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc.tar.gz cmix-5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc.tar.bz2 cmix-5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc.zip | |
Split NetworkHandler in a server component and a to reuse Server.
Also switched from an inheritance system to composition based system for
the server based classes.
Diffstat (limited to 'network-handler/server.hpp')
| -rw-r--r-- | network-handler/server.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/network-handler/server.hpp b/network-handler/server.hpp new file mode 100644 index 0000000..942cb14 --- /dev/null +++ b/network-handler/server.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include <boost/asio/io_service.hpp> + +#include "acceptor.hpp" + +struct ListenSettings { + bool enable_ipv4; + std::string ipv4_inaddr; + bool enable_ipv6; + std::string ipv6_inaddr; + uint16_t port; +}; + +class Server +{ +public: + typedef std::function<void(boost::asio::ip::tcp::socket&& socket)> AcceptHandler; + +private: + ListenSettings const& listen_settings; + + Acceptor v4_acceptor; + Acceptor v6_acceptor; + +public: + Server(boost::asio::io_service& io_service, ListenSettings const& listen_settings, AcceptHandler accept_handler); + +}; |
