#ifndef LIBREPOMGR_SERVER_H #define LIBREPOMGR_SERVER_H #include "./routeid.h" #include "../global.h" #include #include #include #include #include class WebAPITests; namespace LibRepoMgr { struct ServiceSetup; namespace WebAPI { class LIBREPOMGR_EXPORT Server : public std::enable_shared_from_this { friend WebAPITests; public: Server(ServiceSetup &setup); static void serve(ServiceSetup &setup); static void stop(); static const Router &router(); static boost::asio::io_context *context(); void run(); void accept(); void handleAccepted(boost::system::error_code ec, boost::asio::ip::tcp::socket); private: boost::asio::ip::tcp::acceptor m_acceptor; ServiceSetup &m_setup; static std::shared_ptr s_instance; static const Router s_router; }; inline const Router &Server::router() { return s_router; } } // namespace WebAPI } // namespace LibRepoMgr #endif // LIBREPOMGR_SERVER_H