Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
cRCONServer::cConnection Class Reference

#include <RCONServer.h>

Inheritance diagram for cRCONServer::cConnection:
Inheritance graph
[legend]
Collaboration diagram for cRCONServer::cConnection:
Collaboration graph
[legend]

Public Member Functions

 cConnection (cRCONServer &a_RCONServer, const AString &a_IPAddress)
 
- Public Member Functions inherited from cTCPLink::cCallbacks
virtual void OnTlsHandshakeCompleted (void)
 Called when the TLS handshake has been completed and communication can continue regularly. More...
 
virtual ~cCallbacks ()
 

Protected Member Functions

virtual void OnError (int a_ErrorCode, const AString &a_ErrorMsg) override
 Called when an error is detected on the connection. More...
 
virtual void OnLinkCreated (cTCPLinkPtr a_Link) override
 Called when the cTCPLink for the connection is created. More...
 
virtual void OnReceivedData (const char *a_Data, size_t a_Length) override
 Called when there's data incoming from the remote peer. More...
 
virtual void OnRemoteClosed (void) override
 Called when the remote end closes the connection. More...
 
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 connection is to be dropped. More...
 
void SendResponse (UInt32 a_RequestID, UInt32 a_PacketType, UInt32 a_PayloadLength, const char *a_Payload)
 Sends a RCON packet back to the client. More...
 
UInt32 UIntFromBuffer (const char *a_Buffer)
 Reads 4 bytes from a_Buffer and returns the LE UInt32 they represent. More...
 
void UIntToBuffer (UInt32 a_Value, char *a_Buffer)
 Puts 4 bytes representing the int into the buffer. More...
 

Protected Attributes

AString m_Buffer
 Buffer for the incoming data. More...
 
AString m_IPAddress
 Address of the client. More...
 
bool m_IsAuthenticated
 Set to true if the client has successfully authenticated. More...
 
cTCPLinkPtr m_Link
 The TCP link to the client. More...
 
cRCONServerm_RCONServer
 Server that owns this connection and processes requests. More...
 

Friends

class cRCONCommandOutput
 

Detailed Description

Definition at line 38 of file RCONServer.h.

Constructor & Destructor Documentation

◆ cConnection()

cRCONServer::cConnection::cConnection ( cRCONServer a_RCONServer,
const AString a_IPAddress 
)

Definition at line 184 of file RCONServer.cpp.

Member Function Documentation

◆ OnError()

void cRCONServer::cConnection::OnError ( int  a_ErrorCode,
const AString a_ErrorMsg 
)
overrideprotectedvirtual

Called when an error is detected on the connection.

Implements cTCPLink::cCallbacks.

Definition at line 256 of file RCONServer.cpp.

◆ OnLinkCreated()

void cRCONServer::cConnection::OnLinkCreated ( cTCPLinkPtr  a_Link)
overrideprotectedvirtual

Called when the cTCPLink for the connection is created.

The callback may store the cTCPLink instance for later use, but it should remove it in OnError(), OnRemoteClosed() or right after Close().

Implements cTCPLink::cCallbacks.

Definition at line 195 of file RCONServer.cpp.

◆ OnReceivedData()

void cRCONServer::cConnection::OnReceivedData ( const char *  a_Data,
size_t  a_Length 
)
overrideprotectedvirtual

Called when there's data incoming from the remote peer.

Implements cTCPLink::cCallbacks.

Definition at line 204 of file RCONServer.cpp.

◆ OnRemoteClosed()

void cRCONServer::cConnection::OnRemoteClosed ( void  )
overrideprotectedvirtual

Called when the remote end closes the connection.

The link is still available for connection information query (IP / port). Sending data on the link is not an error, but the data won't be delivered.

Implements cTCPLink::cCallbacks.

Definition at line 247 of file RCONServer.cpp.

◆ ProcessPacket()

bool cRCONServer::cConnection::ProcessPacket ( UInt32  a_RequestID,
UInt32  a_PacketType,
UInt32  a_PayloadLength,
const char *  a_Payload 
)
protected

Processes the given packet and sends the response; returns true if successful, false if the connection is to be dropped.

Definition at line 266 of file RCONServer.cpp.

◆ SendResponse()

void cRCONServer::cConnection::SendResponse ( UInt32  a_RequestID,
UInt32  a_PacketType,
UInt32  a_PayloadLength,
const char *  a_Payload 
)
protected

Sends a RCON packet back to the client.

Definition at line 339 of file RCONServer.cpp.

◆ UIntFromBuffer()

UInt32 cRCONServer::cConnection::UIntFromBuffer ( const char *  a_Buffer)
protected

Reads 4 bytes from a_Buffer and returns the LE UInt32 they represent.

Definition at line 317 of file RCONServer.cpp.

◆ UIntToBuffer()

void cRCONServer::cConnection::UIntToBuffer ( UInt32  a_Value,
char *  a_Buffer 
)
protected

Puts 4 bytes representing the int into the buffer.

Definition at line 327 of file RCONServer.cpp.

Friends And Related Function Documentation

◆ cRCONCommandOutput

friend class cRCONCommandOutput
friend

Definition at line 45 of file RCONServer.h.

Member Data Documentation

◆ m_Buffer

AString cRCONServer::cConnection::m_Buffer
protected

Buffer for the incoming data.

Definition at line 51 of file RCONServer.h.

◆ m_IPAddress

AString cRCONServer::cConnection::m_IPAddress
protected

Address of the client.

Definition at line 60 of file RCONServer.h.

◆ m_IsAuthenticated

bool cRCONServer::cConnection::m_IsAuthenticated
protected

Set to true if the client has successfully authenticated.

Definition at line 48 of file RCONServer.h.

◆ m_Link

cTCPLinkPtr cRCONServer::cConnection::m_Link
protected

The TCP link to the client.

Definition at line 57 of file RCONServer.h.

◆ m_RCONServer

cRCONServer& cRCONServer::cConnection::m_RCONServer
protected

Server that owns this connection and processes requests.

Definition at line 54 of file RCONServer.h.


The documentation for this class was generated from the following files: