2022-02-06 16:48:52 +01:00
|
|
|
//===========================================================================//
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
2022-02-13 15:10:38 +01:00
|
|
|
#include "protoc/cl_rcon.pb.h"
|
|
|
|
#include "protoc/sv_rcon.pb.h"
|
2023-04-19 01:35:31 +02:00
|
|
|
#include "engine/shared/base_rcon.h"
|
2022-02-06 16:48:52 +01:00
|
|
|
|
2022-02-08 16:32:00 +01:00
|
|
|
constexpr const char* NETCON_VERSION = "2.0.0.1";
|
|
|
|
|
2023-04-19 01:35:31 +02:00
|
|
|
class CNetCon : public CNetConBase
|
2022-02-06 16:48:52 +01:00
|
|
|
{
|
|
|
|
public:
|
2022-08-02 23:58:43 +02:00
|
|
|
CNetCon(void);
|
|
|
|
~CNetCon(void);
|
2022-05-28 23:05:10 +02:00
|
|
|
|
2022-02-06 16:48:52 +01:00
|
|
|
bool Init(void);
|
|
|
|
bool Shutdown(void);
|
|
|
|
|
2022-02-08 16:32:00 +01:00
|
|
|
void TermSetup(void);
|
|
|
|
void UserInput(void);
|
2023-03-27 02:01:48 +02:00
|
|
|
void ClearInput(void);
|
2022-02-08 16:32:00 +01:00
|
|
|
|
|
|
|
void RunFrame(void);
|
2022-02-13 15:10:38 +01:00
|
|
|
bool ShouldQuit(void) const;
|
2022-02-08 16:32:00 +01:00
|
|
|
|
2023-04-19 01:35:31 +02:00
|
|
|
virtual void Disconnect(const char* szReason = nullptr);
|
2023-04-22 16:02:54 +02:00
|
|
|
virtual bool ProcessMessage(const char* pMsgBuf, const int nMsgLen) override;
|
2022-02-13 15:10:38 +01:00
|
|
|
|
2023-04-19 01:35:31 +02:00
|
|
|
bool Serialize(vector<char>& vecBuf, const char* szReqBuf,
|
|
|
|
const char* szReqVal, const cl_rcon::request_t requestType) const;
|
2022-02-06 16:48:52 +01:00
|
|
|
|
2023-04-19 01:35:31 +02:00
|
|
|
SocketHandle_t GetSocket(void);
|
|
|
|
bool IsInitialized(void) const;
|
|
|
|
bool IsConnected(void);
|
2022-02-13 15:10:38 +01:00
|
|
|
|
2022-02-09 21:29:34 +01:00
|
|
|
private:
|
2022-08-02 23:58:43 +02:00
|
|
|
bool m_bInitialized;
|
|
|
|
bool m_bQuitApplication;
|
2023-03-27 02:01:48 +02:00
|
|
|
bool m_bPromptConnect;
|
2023-04-16 15:49:07 +02:00
|
|
|
float m_flTickInterval;
|
2022-08-27 18:57:56 +02:00
|
|
|
|
2023-03-27 02:01:48 +02:00
|
|
|
std::string m_Input;
|
2022-08-27 18:57:56 +02:00
|
|
|
mutable std::mutex m_Mutex;
|
2022-11-14 21:00:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// singleton
|
|
|
|
//-----------------------------------------------------------------------------
|
2023-03-27 02:01:48 +02:00
|
|
|
extern CNetCon* NetConsole();
|