Emergency 20 Dokumentation  4.2.0
ProxyProtocolHelper.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
15 
16 
17 //[-------------------------------------------------------]
18 //[ Forward declarations ]
19 //[-------------------------------------------------------]
20 namespace qsf
21 {
22  namespace game
23  {
24  class BitStream;
25  }
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34  namespace multiplayer
35  {
36  namespace proxy
37  {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Classes ]
42  //[-------------------------------------------------------]
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public static methods ]
53  //[-------------------------------------------------------]
54  public:
55  static uint16 getProtocolVersion();
56 
70  static void writeHeader(qsf::game::BitStream& bitStream, uint32 payloadSize);
71 
90  static bool readAndCheckHeader(const qsf::game::BitStream& bitStream, uint16& protocolVersion, uint32& payloadSize);
91 
104  static bool checkPayloadDataSize(const qsf::game::BitStream& bitStream, uint32 payloadSize);
105 
118  static bool writePayloadData(qsf::game::BitStream& bitStream, const qsf::game::BitStream& payloadData);
119 
134  static bool readPayloadData(const qsf::game::BitStream& bitStream, qsf::game::BitStream& payloadData, uint32 payloadSize);
135 
150  static bool writeMessage(qsf::game::BitStream& bitStream, const MessageType& messageType, const qsf::game::BitStream& messageData);
151 
166  static bool readMessageTypeAndDataSize(const qsf::game::BitStream& bitStream, MessageType& messageType, uint32& dataSize);
167 
182  static bool readMessage(const qsf::game::BitStream& bitStream, MessageType& messageType, qsf::game::BitStream& messageData);
183 
198  static bool writeMessageAsSingleMessage(qsf::game::BitStream& bitStream, const MessageType& messageType, const qsf::game::BitStream& messagePayload);
199 
212  static bool writeMessageAsSingleMessageWithoutData(qsf::game::BitStream& bitStream, const MessageType& messageType);
213 
226  static bool writeCreateSessionMessageData(qsf::game::BitStream& bitStream, const CreateSessionData& createSessionData);
227 
240  static bool readCreateSessionMessageData(const qsf::game::BitStream& bitStream, CreateSessionData& createSessionData);
241 
254  static bool writeCreateSessionResponseMessageData(qsf::game::BitStream& bitStream, const CreateSessionResponseData& createSessionResponseData);
255 
268  static bool readCreateSessionResponseMessageData(const qsf::game::BitStream& bitStream, CreateSessionResponseData& createSessionResponseData);
269 
282  static bool writeConnectToSessionMessageData(qsf::game::BitStream& bitStream, const ConnectToSessionData& connectToSessionData);
283 
296  static bool readConnectToSessionMessageData(const qsf::game::BitStream& bitStream, ConnectToSessionData& connectToSessionData);
297 
310  static bool writeConnectToSessionResponseMessageData(qsf::game::BitStream& bitStream, const ConnectToSessionResponseData& connectToSessionResponseData);
311 
324  static bool readConnectToSessionResponseMessageData(const qsf::game::BitStream& bitStream, ConnectToSessionResponseData& connectToSessionResponseData);
325 
338  static bool writeClientConnectedToSessionMessageData(qsf::game::BitStream& bitStream, const ClientConnectedToSessionData& clientConnectedToSessionData);
339 
352  static bool readClientConnectedToSessionMessageData(const qsf::game::BitStream& bitStream, ClientConnectedToSessionData& clientConnectedToSessionData);
353 
366  static bool writeClientDisconnectFromSessionMessageData(qsf::game::BitStream& bitStream, const ClientDisconnectedFromSessionData& clientDisconnectedFromSessionData);
367 
380  static bool readClientDisconnectFromSessionMessageData(const qsf::game::BitStream& bitStream, ClientDisconnectedFromSessionData& clientDisconnectedFromSessionData);
381 
394  static bool writeDataMessageData(qsf::game::BitStream& bitStream, const DataData& data);
395 
410  static bool writeDataMessageData(qsf::game::BitStream& bitStream, const uint8 proxySessionClientId, const qsf::game::BitStream& data);
411 
424  static bool readDataMessageData(const qsf::game::BitStream& bitStream, DataData& data);
425 
438  static bool readMetaDataOfDataMessageData(const qsf::game::BitStream& bitStream, DataData& data);
439 
440  static bool updateProxySessionClientIdInDataMessageData(qsf::game::BitStream& bitStream);
441 
442 
443  };
444 
445 
446 //[-------------------------------------------------------]
447 //[ Namespace ]
448 //[-------------------------------------------------------]
449  } // proxy
450  } // multiplayer
451 } // em5
Definition: ActionPriority.h:13
Definition: MultiplayerProxyTypes.h:77
Definition: MultiplayerProxyTypes.h:105
void writeHeader(boost::property_tree::ptree &root, const std::string &type, unsigned int version)
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 multiplayer proxy protocol helper.
Definition: ProxyProtocolHelper.h:47
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
Definition: PickupPersonByParamedicAction.h:21
Definition: MultiplayerProxyTypes.h:82
MessageType
Definition: MultiplayerProxyTypes.h:32
unsigned short uint16
Definition: PlatformTypes.h:178
Definition: MultiplayerProxyTypes.h:100
Definition: MultiplayerProxyTypes.h:110
Definition: MultiplayerProxyTypes.h:88
Definition: MultiplayerProxyTypes.h:93
unsigned char uint8
Definition: PlatformTypes.h:175