Emergency 20 Dokumentation  4.2.0
ProxyClient.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 em5
21 {
22  namespace multiplayer
23  {
24  namespace proxy
25  {
26  class MultiplayerProxyClient;
27  struct DataData;
28  }
29  }
30 }
31 
32 
33 //[-------------------------------------------------------]
34 //[ Namespace ]
35 //[-------------------------------------------------------]
36 namespace em5
37 {
38  namespace multiplayer
39  {
40  namespace server
41  {
42 
43 
44  //[-------------------------------------------------------]
45  //[ Classes ]
46  //[-------------------------------------------------------]
51  // TODO(sw) This causes that the same data is send multiple times via the proxy, but it makes the proxy usage for sending/receiving data via proxy transparent to the host
53  {
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public static methods ]
58  //[-------------------------------------------------------]
59  public:
60  static uint64 getIdFromProxySessionClientId(uint8 proxySessionClientId);
61  static bool isIdFromAProxyClient(uint64 clientId);
62 
63 
64  //[-------------------------------------------------------]
65  //[ Public methods ]
66  //[-------------------------------------------------------]
67  public:
75  explicit ProxyClient(proxy::MultiplayerProxyClient& serverConnection, uint8 proxySessionClientId);
76 
81  virtual ~ProxyClient();
82 
83 
84  //[-------------------------------------------------------]
85  //[ Public virtual em5::multiplayer::client::ClientBase methods ]
86  //[-------------------------------------------------------]
87  public:
88  virtual void disconnect() override;
89  virtual void disconnect(bool force) override;
90  virtual uint64 getId() const override;
91  virtual bool sendData(const qsf::Clock& simulationClock, const qsf::game::BitStream& bitStream) override;
92  virtual bool sendData(const qsf::game::BitStream& bitStream) override;
93 
94 
95  //[-------------------------------------------------------]
96  //[ Private methods ]
97  //[-------------------------------------------------------]
98  private:
99  void onServerClientPacketReceived(const proxy::DataData& data);
100 
101 
102  //[-------------------------------------------------------]
103  //[ Private data ]
104  //[-------------------------------------------------------]
105  private:
106  proxy::MultiplayerProxyClient& mServerConnection;
107  uint8 mProxySessionClientId;
108  uint64 mId;
109 
110  boost::signals2::connection mReceivedDataConnection;
111 
112 
113  };
114 
115 
116 //[-------------------------------------------------------]
117 //[ Namespace ]
118 //[-------------------------------------------------------]
119  } // server
120  } // multiplayer
121 } // em5
Definition: ActionPriority.h:13
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 multiplayer network client via proxy (server side multiplayer client instance) ...
Definition: ProxyClient.h:52
EMERGENCY 5 multiplayer client base class (represents a client on the server side) ...
Definition: ClientBase.h:52
uint64_t uint64
Definition: PlatformTypes.h:184
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
Definition: MultiplayerProxyTypes.h:110
EMERGENCY 5 multiplayer proxy client class.
Definition: MultiplayerProxyClient.h:37
unsigned char uint8
Definition: PlatformTypes.h:175