aboutsummaryrefslogtreecommitdiff
path: root/libcmix-network/acceptor.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-09-28 13:18:18 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-09-28 13:18:18 +0200
commit3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375 (patch)
tree345583aaf457ce5076d0d5f7c158628dfd971360 /libcmix-network/acceptor.hpp
parent85d25eebd38bb278ad598a291a007938854945a4 (diff)
downloadcmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.gz
cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.bz2
cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.zip
Finally made a initial doxygen documentation pass over all files.
Diffstat (limited to 'libcmix-network/acceptor.hpp')
-rw-r--r--libcmix-network/acceptor.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libcmix-network/acceptor.hpp b/libcmix-network/acceptor.hpp
index 7d8e0a2..06b709d 100644
--- a/libcmix-network/acceptor.hpp
+++ b/libcmix-network/acceptor.hpp
@@ -4,15 +4,47 @@
#include <functional>
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The Acceptor class
+ *
+ * Encapsulates an endpoint and an acceptor.
+ * Otherwise they would be side to side in the Server class.
+ */
class Acceptor{
boost::asio::ip::tcp::acceptor acceptor;
boost::asio::ip::tcp::endpoint endpoint;
public:
+ /*!
+ * \brief Acceptor
+ * \param io_service The io_service to associate with
+ * \param address The listen address
+ * \param port The listen port
+ */
Acceptor(boost::asio::io_service& io_service, boost::asio::ip::address address, uint16_t port);
+ /*!
+ * \brief get_address
+ * \return The listening address
+ */
boost::asio::ip::address get_address() { return endpoint.address(); }
+ /*!
+ * \brief bind_v6_and_v4_any
+ * \param accept_handler Function to call when accepting an incoming connection.
+ *
+ * If you want to accept on both ipv6 and ipv any you have to do some special setup.
+ * This function handles that and starts listening.
+ */
void bind_v6_and_v4_any(std::function<void(boost::asio::ip::tcp::socket&&)> accept_handler);
+
+ /*!
+ * \brief setup_listen_socket
+ * \param accept_handler Function to call when accepting an incoming connection.
+ */
void setup_listen_socket(std::function<void(boost::asio::ip::tcp::socket&&)> accept_handler);
};