r5sdk/r5dev/netconsole/netconsole.h
Kawe Mazidjatari 5aea2f4261 RCON system upgrade
RCON upgrade with additional logging system improvements:
* Netconsole's can now log received messages in color, even when the RCON server has ANSI colors disabled; logs are fully composed locally.
* RCON server now also sends the log type over the wire, along with the (already existing) context.
* SDK logging code is now shared with the standalone netconsole application.
* Improved logging readability for the standalone netconsole application.
2023-03-27 02:01:48 +02:00

57 lines
1.4 KiB
C++

//===========================================================================//
//
// Purpose:
//
//===========================================================================//
#pragma once
#include "protoc/cl_rcon.pb.h"
#include "protoc/sv_rcon.pb.h"
constexpr const char* NETCON_VERSION = "2.0.0.1";
class CNetCon
{
public:
CNetCon(void);
~CNetCon(void);
bool Init(void);
bool Shutdown(void);
void TermSetup(void);
void UserInput(void);
void ClearInput(void);
void RunFrame(void);
bool ShouldQuit(void) const;
bool Connect(const std::string& svInAdr, const std::string& svInPort);
void Disconnect(void);
void Send(const std::string& svMessage) const;
void Recv(void);
void ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNetConsoleData* pData);
void ProcessMessage(const sv_rcon::response& sv_response) const;
std::string Serialize(const std::string& svReqBuf, const std::string& svReqVal, const cl_rcon::request_t request_t) const;
sv_rcon::response Deserialize(const std::string& svBuf) const;
private:
bool m_bInitialized;
bool m_bQuitApplication;
bool m_bPromptConnect;
bool m_bConnEstablished;
CNetAdr m_Address;
CSocketCreator m_Socket;
std::string m_Input;
mutable std::mutex m_Mutex;
};
//-----------------------------------------------------------------------------
// singleton
//-----------------------------------------------------------------------------
extern CNetCon* NetConsole();