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 // fwd:
13 class cClientHandle;
14 
15 
16 
17 
18 
20 {
21 public:
24 
26 
28  void AugmentServerListPing(Json::Value & ResponseValue);
29 
31  void BeginForgeHandshake(const AString & a_Name, const cUUID & a_UUID, const Json::Value & a_Properties);
32 
34  void SendServerHello();
35 
37  void DataReceived(cClientHandle * a_Client, const char * a_Data, size_t a_Size);
38 
39 private:
41  bool m_Errored;
42 
45 
49  Json::Value m_Properties;
50 
51  void HandleClientHello(cClientHandle * a_Client, const char * a_Data, size_t a_Size);
52  void HandleModList(cClientHandle * a_Client, const char * a_Data, size_t a_Size);
53  void HandleHandshakeAck(cClientHandle * a_Client, const char * a_Data, size_t a_Size);
54 
56  void SetError(const AString & message);
57 
59  AStringMap ParseModList(const char * a_Data, size_t a_Size);
60 };
void AugmentServerListPing(Json::Value &ResponseValue)
Add the registered Forge mods to the server ping list packet.
void HandleHandshakeAck(cClientHandle *a_Client, const char *a_Data, size_t a_Size)
AStringMap ParseModList(const char *a_Data, size_t a_Size)
Parse the client ModList packet of installed Forge mods and versions.
void DataReceived(cClientHandle *a_Client, const char *a_Data, size_t a_Size)
Process received data from the client advancing the Forge handshake.
void HandleModList(cClientHandle *a_Client, const char *a_Data, size_t a_Size)
Json::Value m_Properties
Definition: UUID.h:10
cClientHandle * m_Client
The client handle undergoing this Forge handshake.
void SendServerHello()
Send the ServerHello packet in the Forge handshake.
bool m_Errored
True if the Forge handshake is in an errored state.
void HandleClientHello(cClientHandle *a_Client, const char *a_Data, size_t a_Size)
std::map< AString, AString > AStringMap
A string dictionary, used for key-value pairs.
Definition: StringUtils.h:18
std::string AString
Definition: StringUtils.h:13
bool m_IsForgeClient
True if the client advertised itself as a Forge client.
cForgeHandshake(cClientHandle *client)
AString m_Name
Values saved from BeginForgeHandshake() for continuing the normal handshake after Forge completes...
void SetError(const AString &message)
Set errored state to prevent further handshake message processing.
void BeginForgeHandshake(const AString &a_Name, const cUUID &a_UUID, const Json::Value &a_Properties)
Begin the Forge Modloader Handshake (FML|HS) sequence.