10 #define MCS_CLIENT_VERSIONS "1.8.x-1.14.4"
11 #define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 477, 480, 485, 490, 498"
12 #define MCS_LATEST_PROTOCOL_VERSION 498
std::basic_string_view< std::byte > ContiguousByteBufferView
std::basic_string< std::byte > ContiguousByteBuffer
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
ePacketType
Logical types of outgoing packets.
Version
The protocol version number, received from the client in the Handshake packet.
Meta-protocol that recognizes multiple protocol versions, creates the specific protocol version insta...
bool TryHandleHTTPRequest(cClientHandle &a_Client, ContiguousByteBuffer &a_Data)
cByteBuffer m_Buffer
Buffer for received protocol data.
void HandlePacketStatusPing(cClientHandle &a_Client)
void HandleOutgoingData(ContiguousByteBuffer &a_Data)
Allows the protocol (if any) to do a final pass on outgiong data, possibly modifying the provided buf...
void HandleIncomingData(cClientHandle &a_Client, ContiguousByteBuffer &a_Data)
Directs incoming protocol data along the correct pathway, depending on the state of the version recog...
bool m_WaitingForData
If we're still waiting for data required for version recognition to arrive.
void HandleIncomingDataInOldPingResponseStage(cClientHandle &a_Client, ContiguousByteBufferView a_Data)
Handles and responds to unsupported clients sending pings.
static UInt32 GetPacketID(cProtocol::ePacketType a_PacketType)
Returns the protocol-specific packet ID given the protocol-agnostic packet enum.
static void SendPacket(cClientHandle &a_Client, cByteBuffer &a_OutPacketBuffer)
Sends one packet inside a cByteBuffer.
void SendDisconnect(cClientHandle &a_Client, const AString &a_Reason)
Sends a disconnect to the client as a result of a recognition error.
auto & operator->()
Convenience overload to enable redirecting sends to the underlying implementation.
void HandlePacketStatusRequest(cClientHandle &a_Client)
bool VersionRecognitionSuccessful()
Returns if we contain a concrete protocol corresponding to the client's protocol version.
static AString GetVersionTextFromInt(cProtocol::Version a_ProtocolVersion)
Translates protocol version number into protocol version text: 49 -> "1.4.4".
std::unique_ptr< cProtocol > m_Protocol
The actual protocol implementation.
std::unique_ptr< cProtocol > TryRecognizeLengthedProtocol(cClientHandle &a_Client)
Tries to recognize a protocol in the lengthed family (1.7+), based on m_Buffer.
void HandleIncomingDataInRecognitionStage(cClientHandle &a_Client, ContiguousByteBuffer &a_Data)
Handles data reception in a newly-created client handle that doesn't yet have a known protocol.