Cuberite
A lightweight, fast and extensible game server for Minecraft
ForgeHandshake.h
Go to the documentation of this file.
1 
2 // ForgeHandshake.h
3 
4 // Implements Forge protocol handshaking
5 
6 #pragma once
7 
8 #include <stddef.h>
9 #include "../UUID.h"
10 #include "json/json.h"
11 
12 
13 
14 
15 
16 // fwd:
17 class cClientHandle;
18 
19 
20 
21 
22 
24 {
25 public:
26 
29 
31 
33  void AugmentServerListPing(cClientHandle & a_Client, Json::Value & ResponseValue);
34 
36  void BeginForgeHandshake(cClientHandle & a_Client);
37 
39  void SendServerHello(cClientHandle & a_Client);
40 
42  void DataReceived(cClientHandle & a_Client, ContiguousByteBufferView a_Data);
43 
44 private:
45 
47  bool m_Errored;
48 
50  void HandleModList(cClientHandle & a_Client, ContiguousByteBufferView a_Data);
52 
54  void SetError(const AString & message);
55 
58 };
std::basic_string_view< std::byte > ContiguousByteBufferView
Definition: Globals.h:376
std::string AString
Definition: StringUtils.h:11
std::map< AString, AString > AStringMap
A string dictionary, used for key-value pairs.
Definition: StringUtils.h:16
bool m_Errored
True if the Forge handshake is in an errored state.
void AugmentServerListPing(cClientHandle &a_Client, Json::Value &ResponseValue)
Add the registered Forge mods to the server ping list packet.
void HandleClientHello(cClientHandle &a_Client, ContiguousByteBufferView a_Data)
void SendServerHello(cClientHandle &a_Client)
Send the ServerHello packet in the Forge handshake.
AStringMap ParseModList(ContiguousByteBufferView a_Data)
Parse the client ModList packet of installed Forge mods and versions.
void SetError(const AString &message)
Set errored state to prevent further handshake message processing.
void BeginForgeHandshake(cClientHandle &a_Client)
Begin the Forge Modloader Handshake (FML|HS) sequence.
void HandleModList(cClientHandle &a_Client, ContiguousByteBufferView a_Data)
bool IsForgeClient
True if the client advertised itself as a Forge client.
void HandleHandshakeAck(cClientHandle &a_Client, ContiguousByteBufferView a_Data)
void DataReceived(cClientHandle &a_Client, ContiguousByteBufferView a_Data)
Process received data from the client advancing the Forge handshake.