aboutsummaryrefslogtreecommitdiff
path: root/libcmix-network/server.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-network/server.hpp')
-rw-r--r--libcmix-network/server.hpp38
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);
+
};