65 virtual void OnReceivedData(
const char * a_Data,
size_t a_Length)
override;
67 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg)
override;
std::shared_ptr< cTCPLink > cTCPLinkPtr
std::vector< cServerHandlePtr > cServerHandlePtrs
cServerHandlePtrs m_ListenServers
The sockets for accepting RCON connections (one socket per port).
AString m_Password
Password for authentication.
void Initialize(cSettingsRepositoryInterface &a_Settings)
cRCONServer(cServer &a_Server)
cServer & m_Server
The server object that will process the commands received.
virtual void OnLinkCreated(cTCPLinkPtr a_Link) override
Called when the cTCPLink for the connection is created.
AString m_IPAddress
Address of the client.
virtual void OnReceivedData(const char *a_Data, size_t a_Length) override
Called when there's data incoming from the remote peer.
bool ProcessPacket(UInt32 a_RequestID, UInt32 a_PacketType, UInt32 a_PayloadLength, const char *a_Payload)
Processes the given packet and sends the response; returns true if successful, false if the connectio...
cRCONServer & m_RCONServer
Server that owns this connection and processes requests.
void SendResponse(UInt32 a_RequestID, UInt32 a_PacketType, UInt32 a_PayloadLength, const char *a_Payload)
Sends a RCON packet back to the client.
void UIntToBuffer(UInt32 a_Value, char *a_Buffer)
Puts 4 bytes representing the int into the buffer.
bool m_IsAuthenticated
Set to true if the client has successfully authenticated.
cConnection(cRCONServer &a_RCONServer, const AString &a_IPAddress)
cTCPLinkPtr m_Link
The TCP link to the client.
virtual void OnError(int a_ErrorCode, const AString &a_ErrorMsg) override
Called when an error is detected on the connection.
virtual void OnRemoteClosed(void) override
Called when the remote end closes the connection.
AString m_Buffer
Buffer for the incoming data.
UInt32 UIntFromBuffer(const char *a_Buffer)
Reads 4 bytes from a_Buffer and returns the LE UInt32 they represent.