Emergency 20 Dokumentation  4.2.0
MatchmakingClient.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 
17 
18 #include <boost/signals2/signal.hpp>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26  class MatchmakingProtocol;
27  namespace packet
28  {
29  class ProxyServerPropertiesResponse;
30  class TestOpenPortResponse;
31  }
32 }
33 
34 
35 //[-------------------------------------------------------]
36 //[ Namespace ]
37 //[-------------------------------------------------------]
38 namespace em5
39 {
40 
41 
42  //[-------------------------------------------------------]
43  //[ Classes ]
44  //[-------------------------------------------------------]
50  {
51 
52 
53  //[-------------------------------------------------------]
54  //[ Friends ]
55  //[-------------------------------------------------------]
56  friend class MatchmakingProtocol; // The matchmaking protocol needs to tell the matchmaking client about itself
57 
58 
59  //[-------------------------------------------------------]
60  //[ Public boost signals ]
61  //[-------------------------------------------------------]
62  public:
67  //void connected();
68  boost::signals2::signal<void()> connected;
69 
74  //void disconnected();
75  boost::signals2::signal<void()> disconnected;
76 
81  //void connectionLost();
82  boost::signals2::signal<void()> connectionLost;
83 
88  //void connectFailed();
89  boost::signals2::signal<void()> connectFailed;
90 
95  //void registerHostResponse(RegisterHostStatus status);
96  boost::signals2::signal<void(multiplayer::RegisterHostStatus)> registerHostResponse;
97 
102  //void hostList(const std::vector<HostEntry>& hosts);
103  boost::signals2::signal<void(const std::vector<multiplayer::HostEntry>&)> hostList;
104 
109  //void testOpenPortResponse(const em5::packet::TestOpenPortResponse& response);
110  boost::signals2::signal<void(const em5::packet::TestOpenPortResponse&)> testOpenPortResponse;
111 
116  //void proxyServerPropertiesResponse(const em5::packet::ProxyServerPropertiesResponse& response);
117  boost::signals2::signal<void(const em5::packet::ProxyServerPropertiesResponse&)> proxyServerPropertiesResponse;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Public methods ]
122  //[-------------------------------------------------------]
123  public:
129 
134  virtual ~MatchmakingClient();
135 
143  bool requestRegisterHost(const multiplayer::HostEntry& hostEntry, const std::string& gameModificationString) const;
144 
152  bool updateHost(const multiplayer::HostEntry& hostEntry) const;
153 
154  bool unregisterHost() const;
155 
163  bool requestTestOpenPort() const;
164 
172  bool requestHostList(const std::string& gameModificationString) const;
173 
181  bool requestProxyServerProperties() const;
182 
183 
184  //[-------------------------------------------------------]
185  //[ Public virtual qsf::Client methods ]
186  //[-------------------------------------------------------]
187  public:
188  virtual void onConnected() override;
189  virtual void onUnexpectedDisconnected() override;
190  virtual void onConnectFailed() override;
191 
192 
193  //[-------------------------------------------------------]
194  //[ Public virtual qsf::QsfClient methods ]
195  //[-------------------------------------------------------]
196  public:
197  virtual const qsf::QsfProtocolList& getProtocols() const override;
198 
199 
200  //[-------------------------------------------------------]
201  //[ Private methods ]
202  //[-------------------------------------------------------]
203  private:
204  void setMatchmakingProtocol(MatchmakingProtocol* matchmakingProtocol);
205 
206 
207  //[-------------------------------------------------------]
208  //[ Private data ]
209  //[-------------------------------------------------------]
210  private:
211  qsf::QsfProtocolList mProtocols;
212  MatchmakingProtocol* mMatchmakingProtocol;
213 
214 
215  };
216 
217 
218 //[-------------------------------------------------------]
219 //[ Namespace ]
220 //[-------------------------------------------------------]
221 } // em5
Definition: ActionPriority.h:13
boost::signals2::signal< void()> connected
Signal emitted after the connection has been established.
Definition: MatchmakingClient.h:68
EM5 matchmaking network client class.
Definition: MatchmakingClient.h:49
#define EM5_API_EXPORT
Definition: Export.h:28
boost::signals2::signal< void()> disconnected
Signal emitted after the connection has been closed.
Definition: MatchmakingClient.h:75
boost::signals2::signal< void()> connectFailed
Signal emitted after the connection attempt failed.
Definition: MatchmakingClient.h:89
boost::signals2::signal< void(multiplayer::RegisterHostStatus)> registerHostResponse
Signal emitted after the register host response is available.
Definition: MatchmakingClient.h:96
std::vector< std::pair< QsfProtocolId, boost::function< QsfProtocolGenerator > > > QsfProtocolList
Definition: QsfProtocol.h:44
boost::signals2::signal< void(const em5::packet::TestOpenPortResponse &)> testOpenPortResponse
Signal emitted after the test open port response is available.
Definition: MatchmakingClient.h:110
Matchmaking protocol class.
Definition: MatchmakingProtocol.h:40
Abstract network client class.
Definition: QsfClient.h:31
boost::signals2::signal< void()> connectionLost
Signal emitted after the connection has been lost.
Definition: MatchmakingClient.h:82
boost::signals2::signal< void(const em5::packet::ProxyServerPropertiesResponse &)> proxyServerPropertiesResponse
Signal emitted after the proxy server properties response is available.
Definition: MatchmakingClient.h:117
Definition: MatchmakingTypes.h:47