2022-02-06 16:48:52 +01:00
|
|
|
#pragma once
|
2023-01-29 15:24:24 +01:00
|
|
|
#include "tier1/NetAdr.h"
|
2022-02-14 23:16:24 +01:00
|
|
|
#include "tier2/SocketCreator.h"
|
|
|
|
#include "protoc/sv_rcon.pb.h"
|
|
|
|
#include "protoc/cl_rcon.pb.h"
|
2022-02-06 16:48:52 +01:00
|
|
|
|
|
|
|
class CRConClient
|
|
|
|
{
|
2022-02-14 23:16:24 +01:00
|
|
|
public:
|
2022-08-02 23:58:43 +02:00
|
|
|
CRConClient(void);
|
|
|
|
~CRConClient(void);
|
2022-02-06 16:48:52 +01:00
|
|
|
|
2022-02-14 23:16:24 +01:00
|
|
|
void Init(void);
|
|
|
|
void Shutdown(void);
|
|
|
|
|
|
|
|
void RunFrame(void);
|
|
|
|
|
|
|
|
bool Connect(void);
|
2023-01-29 15:24:24 +01:00
|
|
|
bool Connect(const char* szInAdr);
|
2022-02-14 23:16:24 +01:00
|
|
|
void Disconnect(void);
|
|
|
|
|
2023-01-29 17:12:33 +01:00
|
|
|
void Send(const string& svMessage) const;
|
2022-02-14 23:16:24 +01:00
|
|
|
void Recv(void);
|
|
|
|
|
2022-08-02 23:58:43 +02:00
|
|
|
void ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNetConsoleData* pData);
|
2022-02-14 23:16:24 +01:00
|
|
|
void ProcessMessage(const sv_rcon::response& sv_response) const;
|
|
|
|
|
2023-01-29 17:12:33 +01:00
|
|
|
string Serialize(const string& svReqBuf, const string& svReqVal, const cl_rcon::request_t request_t) const;
|
|
|
|
sv_rcon::response Deserialize(const string& svBuf) const;
|
2022-02-14 23:16:24 +01:00
|
|
|
|
|
|
|
bool IsInitialized(void) const;
|
|
|
|
bool IsConnected(void) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_bInitialized = false;
|
|
|
|
bool m_bConnEstablished = false;
|
2022-11-14 21:00:41 +01:00
|
|
|
|
2023-01-29 15:24:24 +01:00
|
|
|
netadr_t m_Address;
|
2022-11-14 21:00:41 +01:00
|
|
|
CSocketCreator m_Socket;
|
2022-02-14 23:16:24 +01:00
|
|
|
};
|
2022-11-14 21:00:41 +01:00
|
|
|
|
2022-07-25 19:35:08 +02:00
|
|
|
CRConClient* RCONClient();
|