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, 33 insertions, 5 deletions
diff --git a/libcmix-network/server.hpp b/libcmix-network/server.hpp
index 942cb14..2e5b272 100644
--- a/libcmix-network/server.hpp
+++ b/libcmix-network/server.hpp
@@ -4,26 +4,54 @@
#include "acceptor.hpp"
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The ListenSettings struct
+ */
struct ListenSettings {
- bool enable_ipv4;
- std::string ipv4_inaddr;
- bool enable_ipv6;
- std::string ipv6_inaddr;
- uint16_t port;
+ bool enable_ipv4; ///< Should we listen on ipv4
+ 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.
};
+/*!
+ * \brief The Server class
+ */
class Server
{
public:
+ /*!
+ * \brief AcceptHandler
+ */
typedef std::function<void(boost::asio::ip::tcp::socket&& socket)> AcceptHandler;
private:
+ /*!
+ * \brief listen_settings
+ */
ListenSettings const& listen_settings;
+ /*!
+ * \brief v4_acceptor
+ */
Acceptor v4_acceptor;
+ /*!
+ * \brief v6_acceptor
+ */
Acceptor v6_acceptor;
public:
+ /*!
+ * \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 accept_handler The function to call when connections are established.
+ */
Server(boost::asio::io_service& io_service, ListenSettings const& listen_settings, AcceptHandler accept_handler);
};