// // Created by koncord on 24.04.17. // #ifndef OPENMW_QUERYCLIENT_HPP #define OPENMW_QUERYCLIENT_HPP #include #include #include #include #include #include class QueryClient { public: QueryClient(QueryClient const &) = delete; QueryClient(QueryClient &&) = delete; QueryClient &operator=(QueryClient const &) = delete; QueryClient &operator=(QueryClient &&) = delete; static QueryClient &Get(); void SetServer(const std::string &addr, unsigned short port); std::map Query(); std::pair Update(const RakNet::SystemAddress &addr); int Status(); private: RakNet::ConnectionState Connect(); MASTER_PACKETS GetAnswer(MASTER_PACKETS packet); protected: QueryClient(); ~QueryClient(); private: int status; RakNet::RakPeerInterface *peer; RakNet::SystemAddress masterAddr; mwmp::PacketMasterQuery *pmq; mwmp::PacketMasterUpdate *pmu; std::pair server; std::mutex mxServers; }; #endif //OPENMW_QUERYCLIENT_HPP