diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-29 14:26:07 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-29 14:26:07 +0200 |
| commit | 8507aec59b92e16ed6a05c92fea6ced5dba3f753 (patch) | |
| tree | b8ae5904f74c9896ccc6662837e628400d47b829 /libcmix-network/server.hpp | |
| parent | 3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375 (diff) | |
| download | cmix-8507aec59b92e16ed6a05c92fea6ced5dba3f753.tar.gz cmix-8507aec59b92e16ed6a05c92fea6ced5dba3f753.tar.bz2 cmix-8507aec59b92e16ed6a05c92fea6ced5dba3f753.zip | |
Added some boilerplate to enable ssl connections.
Diffstat (limited to 'libcmix-network/server.hpp')
| -rw-r--r-- | libcmix-network/server.hpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/libcmix-network/server.hpp b/libcmix-network/server.hpp index 2e5b272..fad7c71 100644 --- a/libcmix-network/server.hpp +++ b/libcmix-network/server.hpp @@ -1,6 +1,7 @@ #pragma once #include <boost/asio/io_service.hpp> +#include <boost/asio/ssl.hpp> #include "acceptor.hpp" @@ -13,10 +14,11 @@ */ struct ListenSettings { bool enable_ipv4; ///< Should we listen on ipv4 - std::string ipv4_inaddr; ///< listen on this ipv4 address + std::string ipv4_inaddr; ///< Listen on this ipv4 address bool enable_ipv6; ///< Should we listen on ipv6 - std::string ipv6_inaddr; ///< listen on this ipv6 address - uint16_t port; ///< listen on this port. + std::string ipv6_inaddr; ///< Listen on this ipv6 address + uint16_t port; ///< Listen on this port. + bool use_ssl; ///< Should we use ssl }; /*! @@ -24,27 +26,12 @@ struct ListenSettings { */ class Server { -public: - /*! - * \brief AcceptHandler - */ - typedef std::function<void(boost::asio::ip::tcp::socket&& socket)> AcceptHandler; + Server(boost::asio::io_service& io_service, ListenSettings const& listen_settings); -private: - /*! - * \brief listen_settings - */ - ListenSettings const& listen_settings; - - /*! - * \brief v4_acceptor - */ + ListenSettings const& listen_settings; Acceptor v4_acceptor; - /*! - * \brief v6_acceptor - */ Acceptor v6_acceptor; - + public: /*! * \brief Server @@ -54,4 +41,13 @@ public: */ Server(boost::asio::io_service& io_service, ListenSettings const& listen_settings, AcceptHandler accept_handler); + /*! + * \brief Server + * \param io_service The io_service this server will use for all its connections. + * \param listen_settings The parameters used for determining on what endpoints to listen. + * \param ctx The SSL context. + * \param accept_handler The function to call when SSL connections are established. + */ + Server(boost::asio::io_service& io_service, ListenSettings const& listen_settings, std::shared_ptr<boost::asio::ssl::context> ctx, SSLAcceptHandler accept_handler); + }; |
