r5sdk/r5dev/engine/shared/base_rcon.h
Kawe Mazidjatari ddfe027677 Pass by reference
CConnectedNetConsoleData was allocated and deallocated manually, but std::vector is able to do it on its own. The vector type has been swapped out with CUtlVector as this removed the need of having to cast size types to a 32bit int to make it more compatible with the other sdk/engine types without throwing compiler warnings.
2023-08-04 10:48:22 +02:00

35 lines
1.1 KiB
C++

#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)
{}
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;
virtual bool Connect(const char* pHostAdr, const int nHostPort = SOCKET_ERROR);
virtual void Disconnect(const char* szReason = nullptr) { NOTE_UNUSED(szReason); };
virtual bool Send(const SocketHandle_t hSocket, const char* pMsgBuf, const int nMsgLen) const;
virtual void Recv(CConnectedNetConsoleData& pData, const int nMaxLen = SOCKET_ERROR);
virtual bool ProcessBuffer(CConnectedNetConsoleData& pData, const char* pRecvBuf, int nRecvLen, const int nMaxLen = SOCKET_ERROR);
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