2023-04-19 01:35:31 +02:00
|
|
|
#ifndef BASE_RCON_H
|
|
|
|
#define BASE_RCON_H
|
|
|
|
|
|
|
|
#include "tier1/NetAdr.h"
|
|
|
|
#include "tier2/socketcreator.h"
|
|
|
|
#include "protobuf/message_lite.h"
|
|
|
|
|
|
|
|
class CNetConBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CNetConBase(void)
|
|
|
|
{}
|
|
|
|
|
2023-04-22 16:02:54 +02:00
|
|
|
virtual bool Encode(google::protobuf::MessageLite* pMsg, char* pMsgBuf, const size_t nMsgLen) const;
|
|
|
|
virtual bool Decode(google::protobuf::MessageLite* pMsg, const char* pMsgBuf, const size_t nMsgLen) const;
|
2023-04-19 01:35:31 +02:00
|
|
|
|
2023-04-19 01:52:05 +02:00
|
|
|
virtual bool Connect(const char* pHostAdr, const int nHostPort = SOCKET_ERROR);
|
2023-04-19 01:35:31 +02:00
|
|
|
virtual void Disconnect(const char* szReason = nullptr) { NOTE_UNUSED(szReason); };
|
|
|
|
|
2023-04-22 16:02:54 +02:00
|
|
|
virtual bool Send(const SocketHandle_t hSocket, const char* pMsgBuf, const int nMsgLen) const;
|
|
|
|
virtual void Recv(CConnectedNetConsoleData* pData, const int nMaxLen = SOCKET_ERROR);
|
2023-04-19 01:35:31 +02:00
|
|
|
|
2023-04-22 16:02:54 +02:00
|
|
|
virtual bool ProcessBuffer(CConnectedNetConsoleData* pData, const char* pRecvBuf, int nRecvLen, const int nMaxLen = SOCKET_ERROR);
|
2023-04-19 01:35:31 +02:00
|
|
|
virtual bool ProcessMessage(const char* /*pMsgBuf*/, int /*nMsgLen*/) { return true; };
|
|
|
|
|
|
|
|
CSocketCreator* GetSocketCreator(void) { return &m_Socket; }
|
|
|
|
netadr_t* GetNetAddress(void) { return &m_Address; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CSocketCreator m_Socket;
|
|
|
|
netadr_t m_Address;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BASE_RCON_H
|