1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 05:19:55 +00:00
openmw-tes3mp/apps/openmw-mp/MasterClient.hpp

53 lines
1.3 KiB
C++
Raw Normal View History

2016-08-14 23:48:25 +00:00
//
// Created by koncord on 14.08.16.
//
#ifndef OPENMW_MASTERCLIENT_HPP
#define OPENMW_MASTERCLIENT_HPP
#include <string>
2016-08-15 13:15:36 +00:00
#include <HTTPConnection2.h>
#include <TCPInterface.h>
2016-08-14 23:48:25 +00:00
#include <mutex>
#include <thread>
2016-08-14 23:48:25 +00:00
class MasterClient
{
public:
static const unsigned int step_rate = 1000;
static const unsigned int min_rate = 1000;
static const unsigned int max_rate = 30000;
public:
MasterClient(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort);
void SetPlayers(unsigned pl);
void SetMaxPlayers(unsigned pl);
void SetHostname(std::string hostname);
void SetModname(std::string hostname);
2016-08-14 23:48:25 +00:00
void Update();
void Start();
2016-08-14 23:48:25 +00:00
void Stop();
void SetUpdateRate(unsigned int rate);
private:
RakNet::RakString
Send(std::string hostname, std::string modname, unsigned maxPlayers, bool update, unsigned players);
2016-08-14 23:48:25 +00:00
private:
std::string queryAddr;
unsigned short queryPort;
std::string serverAddr;
unsigned short serverPort;
std::string hostname;
std::string modname;
2016-08-14 23:48:25 +00:00
unsigned players, maxPlayers;
RakNet::HTTPConnection2 *httpConnection;
RakNet::TCPInterface tcpInterface;
unsigned int timeout;
static bool sRun;
std::mutex mutexData;
std::thread thrQuery;
2016-08-14 23:48:25 +00:00
};
#endif //OPENMW_MASTERCLIENT_HPP