#pragma once #include #include "acceptor.hpp" /*! * \file */ /*! * \brief The ListenSettings struct */ struct ListenSettings { 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 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); };