diff options
Diffstat (limited to 'libcmix-network/acceptor.hpp')
| -rw-r--r-- | libcmix-network/acceptor.hpp | 32 |
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); }; |
