OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Network2.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 #ifndef INC_C4Network2
17 #define INC_C4Network2
18 
19 #include "control/C4Control.h"
21 #include "gui/C4Gui.h"
22 #include "network/C4NetIO.h"
24 #include "network/C4Network2IO.h"
26 #include "network/C4Network2Res.h"
27 
28 // standard ports
29 const int16_t C4NetStdPortTCP = 11112,
30  C4NetStdPortUDP = 11113,
35 
36 // resource retrieve wait timeout
37 const int C4NetResRetrieveTimeout = 100000; // (ms)
38 
39 // client (de)activation
40 const int C4NetActivationReqInterval = 5000, // (ms)
41  C4NetMaxBehind4Activation = 20, // (ticks)
42  C4NetDeactivationDelay = 500; // (ticks)
43 
44 // client chase
45 const unsigned int C4NetChaseTargetUpdateInterval = 5; // (s)
46 
47 // reference
48 const unsigned int C4NetReferenceUpdateInterval = 120; // (s)
49 const unsigned int C4NetMinLeagueUpdateInterval = 1; // (s)
50 
51 // voting
52 const unsigned int C4NetVotingTimeout = 10; // (s)
53 const unsigned int C4NetMinVotingInterval = 120; // (s)
54 
55 // streaming
56 const size_t C4NetStreamingMinBlockSize = 10 * 1024;
57 const size_t C4NetStreamingMaxBlockSize = 20 * 1024;
58 const int C4NetStreamingInterval = 30; // (s)
59 
61 {
62  GS_None, // network not active
63  GS_Init, // connecting to host, waiting for join data
64  GS_Lobby, // lobby mode
65  GS_Pause, // game paused
66  GS_Go // game running
67 };
68 
70 {
71 public:
73 
74 protected:
76  int32_t iCtrlMode;
77  int32_t iTargetCtrlTick{-1};
78 
79 public:
80  C4NetGameState getState() const { return eState; }
81  int32_t getCtrlMode() const { return iCtrlMode; }
82  int32_t getTargetCtrlTick() const { return iTargetCtrlTick; }
83  const char *getStateName() const;
84  const char *getDescription() const;
85 
86  bool isEnabled() const { return eState != GS_None; }
87  bool isLobbyActive() const { return eState == GS_Lobby; }
88  bool isPastLobby() const { return eState > GS_Lobby; }
89  bool isPaused() const { return eState == GS_Pause; }
90  bool isRunning() const { return eState == GS_Go; }
91 
93  void SetCtrlMode(int32_t iCtrlMode);
94  void SetTargetTick(int32_t iTargetCtrlTick);
95  void Clear();
96 
97  void CompileFunc(StdCompiler *pComp, bool fReference);
98  void CompileFunc(StdCompiler *pComp) override;
99 };
100 
102 {
103  friend class C4Network2IO;
104 public:
105  C4Network2();
106  ~C4Network2() override;
107 
108 public:
109  // network i/o class
111 
112  // resource list
114 
115  // client list
117 
118  // player list
120 
121  // game status
123 
124 protected:
125 
126  // role
127  bool fHost;
128 
129  // options
130  bool fAllowJoin{false}, fAllowObserve;
131 
132  // join resource
134 
135  // resources
136  int32_t iDynamicTick{-1};
137  bool fDynamicNeeded{false};
138 
139  // game status flags
140  bool fStatusAck{false}, fStatusReached{false};
141  bool fChasing{false};
142 
143  // control
145 
146  // lobby
148  bool fLobbyRunning{false};
150 
151  // master server used
153 
154  // clients
155  int32_t iNextClientID{0};
156 
157  // chase
159 
160  // time of last activation request.
162 
163  // reference
164  uint32_t iLastReferenceUpdate{0};
167 
168  // league
169  class C4LeagueClient *pLeagueClient{nullptr};
170 
171  // game password
173 
174  // connection failed because password needed?
176 
177  // delayed activation request?
178  bool fDelayedActivateReq{false};
179 
180  // voting
182  class C4VoteDialog *pVoteDialog{nullptr};
183  bool fPausedForVote{false};
185 
186  // streaming
187  bool fStreaming{false};
192 
195 
196  // puncher
199 
200 public:
201 
202  // data access
203  bool isEnabled() const { return Status.isEnabled(); }
204  bool isLobbyActive()const { return Status.isLobbyActive(); }
205  bool isPastLobby() const { return Status.isPastLobby(); }
206  bool isRunning() const { return Status.isRunning() && isStatusAck(); }
207  bool isPaused() const { return Status.isPaused() && isStatusAck(); }
208  bool isPausing() const { return Status.isPaused() && !fStatusAck; }
209  bool isHost() const { return fHost; }
210  bool isStatusAck() const { return fStatusAck; }
211  bool isFrozen() const;
212 
213  bool isJoinAllowed() const { return fAllowJoin; }
214  bool isObservingAllowed() const { return fAllowObserve; }
215 
216  class C4GameLobby::MainDlg *GetLobby() const { return pLobby; } // lobby publication
217  const char *GetPassword() const { return sPassword.getData(); } // Oh noez, now the password is public!
218  bool isPassworded() const { return !sPassword.isNull(); }
219 
220  // initialization result type
222  {
224  };
225 
226  // initialization
227  bool InitHost(bool fLobby);
228  InitResult InitClient(const class C4Network2Reference &Ref, bool fObserver);
229  InitResult InitClient(const std::vector<class C4Network2Address>& Addrs, const class C4ClientCore &HostCore, const char *szPassword = nullptr);
230  bool DoLobby();
231  bool Start();
232  bool Pause();
233  bool Sync();
234  bool FinalInit();
235 
236  bool RetrieveScenario(char *szScenario);
237  C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore = false);
238 
239  // idle processes
240  void OnSec1Timer() override;
241  void Execute();
242 
243  // termination
244  void Clear();
245 
246  // some options
247  bool ToggleAllowJoin();
248  bool ToggleClientListDlg();
249  void AllowJoin(bool fAllow);
250  void SetAllowObserve(bool fAllow);
251  void SetCtrlMode(int32_t iCtrlMode);
252  void SetPassword(const char *szToPassword);
253  StdStrBuf QueryClientPassword(); // ask client for a password; empty if user canceled
254 
255  // interface for C4Network2IO
256  void OnConn(C4Network2IOConnection *pConn);
257  void OnDisconn(C4Network2IOConnection *pConn);
258  void HandlePacket(char cStatus, const C4PacketBase *pBasePkt, C4Network2IOConnection *pConn);
259  void HandleLobbyPacket(char cStatus, const C4PacketBase *pBasePkt, C4Network2IOConnection *pConn);
262 
263  // runtime join stuff
264  void OnGameSynchronized();
265 
266  // status
267  void DrawStatus(C4TargetFacet &cgo);
268 
269  // client activation
270  void RequestActivate();
271  void DeactivateInactiveClients(); // host
272 
273  // league
274  void LeagueGameEvaluate(const char *szRecordName = nullptr, const BYTE *pRecordSHA = nullptr);
275  void LeagueSignupDisable(); // if "internet game" button is switched off in lobby: Remove from league server
276  bool LeagueSignupEnable(); // if "internet game" button is switched on in lobby: (re)Add to league server
277  void InvalidateReference(); // forces a recreation and re-send of the game reference in the next execution cycle
278  bool LeaguePlrAuth(C4PlayerInfo *pInfo); // client: get authentication for a player from the league server
279  bool LeaguePlrAuthCheck(C4PlayerInfo *pInfo); // host: check AUID of player info with league server
280  void LeagueNotifyDisconnect(int32_t iClientID, enum C4LeagueDisconnectReason eReason); //
281  void LeagueWaitNotBusy(); // block until league serveris no longer busy. Process update reply if last message was an update
282  void LeagueSurrender(); // forfeit in league - just fake a disconnect
283  void LeagueShowError(const char *szMsg); // show league error msg box in fullscreen; just log in console
284 
285  // voting
286  void Vote(C4ControlVoteType eType, bool fApprove = true, int32_t iData = 0);
287  void AddVote(const C4ControlVote &Vote);
288  C4IDPacket *GetVote(int32_t iClientID, C4ControlVoteType eType, int32_t iData);
289  void EndVote(C4ControlVoteType eType, bool fApprove, int32_t iData);
290  void OpenVoteDialog();
291  void OpenSurrenderDialog(C4ControlVoteType eType, int32_t iData);
292  void OnVoteDialogClosed();
293 
294  // lobby countdown
295  void StartLobbyCountdown(int32_t iCountdownTime);
296  void AbortLobbyCountdown();
297  bool isLobbyCountDown() { return pLobbyCountdown != nullptr; }
298 
299  // streaming
300  size_t getPendingStreamData() const { return StreamingBuf.getSize() - StreamCompressor.avail_out; }
301  bool isStreaming() const;
302  bool StartStreaming(C4Record *pRecord);
303  bool FinishStreaming();
304  bool StopStreaming();
305 
306  // netpuncher
310 
311 protected:
312 
313  using C4ApplicationSec1Timer::Execute; // to avoid "virtual ... is hidden" warning
314 
315  // net i/o initialization
316  bool InitNetIO(bool fNoClientID, bool fHost);
317 
318  // handling of own packets
319  void HandleConn(const class C4PacketConn &Pkt, C4Network2IOConnection *pConn, C4Network2Client *pClient);
320  bool CheckConn(const C4ClientCore &CCore, C4Network2IOConnection *pConn, C4Network2Client *pClient, StdStrBuf * szReply);
321  bool HostConnect(const C4ClientCore &CCore, C4Network2IOConnection *pConn, StdStrBuf *szReply);
322  bool Join(C4ClientCore &CCore, C4Network2IOConnection *pConn, StdStrBuf *szReply);
323  void HandleConnRe(const class C4PacketConnRe &Pkt, C4Network2IOConnection *pConn, C4Network2Client *pClient);
324  void HandleStatus(const C4Network2Status &nStatus);
325  void HandleStatusAck(const C4Network2Status &nStatus, C4Network2Client *pClient);
326  void HandleActivateReq(int32_t iTick, C4Network2Client *pClient);
327  void HandleJoinData(const class C4PacketJoinData &rPkt);
328 
329  // events
330  void OnConnect(C4Network2Client *pClient, C4Network2IOConnection *pConn, const char *szMsg, bool fFirstConnection);
334  void OnClientDisconnect(C4Network2Client *pClient);
335 
336  void SendJoinData(C4Network2Client *pClient);
337 
338  // resource list
339  bool CreateDynamic(bool fInit);
340  void RemoveDynamic();
341 
342  // status changes
343  bool PauseGame(bool fAutoContinue);
344  bool ChangeGameStatus(C4NetGameState enState, int32_t iTargetCtrlTick, int32_t iCtrlMode = -1);
345  void CheckStatusReached(bool fFromFinalInit = false);
346  void CheckStatusAck();
347  void OnStatusReached();
348  void OnStatusAck();
349 
350  // chase
351  void UpdateChaseTarget();
352 
353  // league
354  bool InitLeague(bool *pCancel);
355  void DeinitLeague();
356  bool LeagueStart(bool *pCancel);
357  bool LeagueUpdate();
359  bool LeagueEnd(const char *szRecordName = nullptr, const BYTE *pRecordSHA = nullptr);
360 
361  // streaming
362  bool StreamIn(bool fFinish);
363  bool StreamOut();
364 
365  // puncher
366  void InitPuncher();
367 
368  // Manages delayed initial connection attempts.
369  class InitialConnect : protected CStdTimerProc
370  {
371  static const uint32_t DELAY = 100; // ms to wait for each batch
372  static const int ADDR_PER_TRY = 4; // how many connection attempts to start each time
373 
374  const std::vector<C4Network2Address>& Addrs;
375  std::vector<C4Network2Address>::const_iterator CurrentAddr;
376  const C4ClientCore& HostCore;
377  const char *Password;
378 
379  void TryNext();
380  void Done();
381 
382  public:
383  InitialConnect(const std::vector<C4Network2Address>& Addrs, const C4ClientCore& HostCore, const char *Password);
384  ~InitialConnect() override;
385  bool Execute(int, pollfd *) override;
386  };
387 };
388 
389 extern C4Network2 Network;
390 
392 {
393 public:
394  C4VoteDialog(const char *szText, C4ControlVoteType eVoteType, int32_t iVoteData, bool fSurrender);
395 
396 private:
397  C4ControlVoteType eVoteType;
398  int32_t iVoteData;
399  bool fSurrender;
400 
401 public:
402  C4ControlVoteType getVoteType() const { return eVoteType; }
403  int32_t getVoteData() const { return iVoteData; }
404 
405 private:
406  bool OnEnter() override { UserClose(false); return true; } // the vote dialog defaults to "No" [MarkFra]
407  void OnClosed(bool fOK) override;
408 
409  // true for dialogs that receive full keyboard and mouse input even in shared mode
410  bool IsExclusiveDialog() override { return true; }
411 };
412 
413 // * Packets *
414 
416 {
417 public:
418  C4PacketJoinData() = default;
419 
420 protected:
421 
422  // the client ID
423  int32_t iClientID;
424 
425  // Dynamic data to boot
427 
428  // network status
430 
431  // control tick
432  int32_t iStartCtrlTick;
433 
434 public:
435 
436  // scenario parameter definitions (so the client can see them in the lobby)
438 
439  // the game parameters
441 
442 public:
443  const int32_t &getClientID() const { return iClientID; }
444  const C4Network2ResCore&getDynamicCore() const { return Dynamic; }
445  const C4Network2Status &getStatus() const { return GameStatus; }
446  int32_t getStartCtrlTick() const { return iStartCtrlTick; }
447 
448  void SetClientID(int32_t inClientID) { iClientID = inClientID; }
449  void SetGameStatus(const C4Network2Status &Status) { GameStatus = Status; }
450  void SetDynamicCore(const C4Network2ResCore &Core) { Dynamic = Core; }
451  void SetStartCtrlTick(int32_t iTick) { iStartCtrlTick = iTick; }
452 
453  void CompileFunc(StdCompiler *pComp) override;
454 };
455 
457 {
458 public:
459  C4PacketActivateReq(int32_t iTick = -1) : iTick(iTick) { }
460 
461 protected:
462  int32_t iTick;
463 
464 public:
465  int32_t getTick() const { return iTick; }
466 
467  void CompileFunc(StdCompiler *pComp) override;
468 };
469 
470 #endif
const char * getData() const
Definition: StdBuf.h:442
const char * GetPassword() const
Definition: C4Network2.h:217
void CheckStatusAck()
void RemoveDynamic()
class C4Network2HTTPClient * pStreamer
Definition: C4Network2.h:193
class C4GameLobby::MainDlg * GetLobby() const
Definition: C4Network2.h:216
const unsigned int C4NetReferenceUpdateInterval
Definition: C4Network2.h:48
bool fStatusAck
Definition: C4Network2.h:140
void SetPassword(const char *szToPassword)
Definition: C4Network2.cpp:771
int32_t getTargetCtrlTick() const
Definition: C4Network2.h:82
bool CheckConn(const C4ClientCore &CCore, C4Network2IOConnection *pConn, C4Network2Client *pClient, StdStrBuf *szReply)
unsigned int iCurrentStreamPosition
Definition: C4Network2.h:194
bool Start()
Definition: C4Network2.cpp:505
void OnClientDisconnect(C4Network2Client *pClient)
StdBuf StreamingBuf
Definition: C4Network2.h:190
void HandleConnRe(const class C4PacketConnRe &Pkt, C4Network2IOConnection *pConn, C4Network2Client *pClient)
bool Execute(int, pollfd *) override
Definition: StdScheduler.h:131
time_t iVoteStartTime
Definition: C4Network2.h:184
Definition: StdBuf.h:29
bool InitNetIO(bool fNoClientID, bool fHost)
uint32_t iLastLeagueUpdate
Definition: C4Network2.h:165
void SetCtrlMode(int32_t iCtrlMode)
Definition: C4Network2.cpp:818
bool fStatusReached
Definition: C4Network2.h:140
void LeagueWaitNotBusy()
void AddVote(const C4ControlVote &Vote)
bool isHost() const
Definition: C4Network2.h:209
bool isPaused() const
Definition: C4Network2.h:207
void SetGameStatus(const C4Network2Status &Status)
Definition: C4Network2.h:449
bool isRunning() const
Definition: C4Network2.h:206
C4Network2IO NetIO
Definition: C4Network2.h:110
void AbortLobbyCountdown()
bool LeaguePlrAuthCheck(C4PlayerInfo *pInfo)
const int16_t C4NetStdPortUDP
Definition: C4Network2.h:30
void SetAllowObserve(bool fAllow)
Definition: C4Network2.cpp:812
const C4Network2Status & getStatus() const
Definition: C4Network2.h:445
void SetClientID(int32_t inClientID)
Definition: C4Network2.h:448
void OnDisconn(C4Network2IOConnection *pConn)
Definition: C4Network2.cpp:835
C4Network2Status GameStatus
Definition: C4Network2.h:429
uint32_t iLeagueUpdateDelay
Definition: C4Network2.h:165
int32_t getTick() const
Definition: C4Network2.h:465
bool FinalInit()
Definition: C4Network2.cpp:537
bool fLobbyRunning
Definition: C4Network2.h:148
bool isLobbyActive() const
Definition: C4Network2.h:204
C4NetGameState
Definition: C4Network2.h:60
int32_t iNextClientID
Definition: C4Network2.h:155
void OpenSurrenderDialog(C4ControlVoteType eType, int32_t iData)
const int C4NetStreamingInterval
Definition: C4Network2.h:58
const int C4NetDeactivationDelay
Definition: C4Network2.h:42
bool isStatusAck() const
Definition: C4Network2.h:210
bool isStreaming() const
bool ToggleAllowJoin()
Definition: C4Network2.cpp:758
void Set(C4NetGameState eState, int32_t iTargetCtrlTick)
Definition: C4Network2.cpp:81
void OnStatusAck()
void OnPuncherConnect(C4NetIO::addr_t addr)
C4ControlVoteType
Definition: C4Control.h:559
C4Network2ResCore Dynamic
Definition: C4Network2.h:426
bool CreateDynamic(bool fInit)
C4NetpuncherID getNetpuncherGameID() const
Definition: C4Network2.h:308
C4ScenarioParameterDefs ScenarioParameterDefs
Definition: C4Network2.h:437
void Vote(C4ControlVoteType eType, bool fApprove=true, int32_t iData=0)
void SetDynamicCore(const C4Network2ResCore &Core)
Definition: C4Network2.h:450
StdStrBuf getNetpuncherAddr() const
Definition: C4Network2.h:309
uint8_t BYTE
class C4VoteDialog * pVoteDialog
Definition: C4Network2.h:182
void HandleStatus(const C4Network2Status &nStatus)
C4Network2 Network
Definition: C4Globals.cpp:53
bool fAllowJoin
Definition: C4Network2.h:130
unsigned int iCurrentStreamAmount
Definition: C4Network2.h:194
StdCopyStrBuf MasterServerAddress
Definition: C4Network2.h:152
int32_t iStartCtrlTick
Definition: C4Network2.h:432
bool StreamIn(bool fFinish)
void SetCtrlMode(int32_t iCtrlMode)
Definition: C4Network2.cpp:86
C4Record * pStreamedRecord
Definition: C4Network2.h:189
void Execute()
Definition: C4Network2.cpp:648
void OnStatusReached()
bool isJoinAllowed() const
Definition: C4Network2.h:213
bool isObservingAllowed() const
Definition: C4Network2.h:214
int32_t iDynamicTick
Definition: C4Network2.h:136
const size_t C4NetStreamingMinBlockSize
Definition: C4Network2.h:56
class C4LeagueClient * pLeagueClient
Definition: C4Network2.h:169
size_t getSize() const
Definition: StdBuf.h:101
bool PauseGame(bool fAutoContinue)
void HandleConn(const class C4PacketConn &Pkt, C4Network2IOConnection *pConn, C4Network2Client *pClient)
bool fOK
Definition: C4Gui.h:2082
void StartLobbyCountdown(int32_t iCountdownTime)
const C4Network2ResCore & getDynamicCore() const
Definition: C4Network2.h:444
C4LeagueDisconnectReason
Definition: C4Constants.h:142
bool InitHost(bool fLobby)
Definition: C4Network2.cpp:138
void OnSec1Timer() override
Definition: C4Network2.cpp:643
void AllowJoin(bool fAllow)
Definition: C4Network2.cpp:801
~C4Network2() override
Definition: C4Network2.cpp:133
void OnDisconnect(C4Network2Client *pClient, C4Network2IOConnection *pConn)
void HandleLobbyPacket(char cStatus, const C4PacketBase *pBasePkt, C4Network2IOConnection *pConn)
Definition: C4Network2.cpp:962
void LeagueNotifyDisconnect(int32_t iClientID, enum C4LeagueDisconnectReason eReason)
void DeactivateInactiveClients()
bool isPausing() const
Definition: C4Network2.h:208
bool ToggleClientListDlg()
Definition: C4Network2.cpp:765
C4PacketActivateReq(int32_t iTick=-1)
Definition: C4Network2.h:459
void OpenVoteDialog()
const int16_t C4NetStdPortTCP
Definition: C4Network2.h:29
InitialConnect(const std::vector< C4Network2Address > &Addrs, const C4ClientCore &HostCore, const char *Password)
Definition: C4Network2.cpp:313
void HandleJoinData(const class C4PacketJoinData &rPkt)
bool Pause()
Definition: C4Network2.cpp:513
time_t iLastStreamAttempt
Definition: C4Network2.h:188
void LeagueShowError(const char *szMsg)
void OnConnectFail(C4Network2IOConnection *pConn)
const int16_t C4NetStdPortRefServer
Definition: C4Network2.h:32
bool fDelayedActivateReq
Definition: C4Network2.h:178
bool LeagueUpdate()
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:476
const int16_t C4NetStdPortDiscovery
Definition: C4Network2.h:31
int32_t iCtrlMode
Definition: C4Network2.h:76
C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore=false)
bool isLobbyCountDown()
Definition: C4Network2.h:297
bool InitLeague(bool *pCancel)
bool isPastLobby() const
Definition: C4Network2.h:88
void InvalidateReference()
bool LeagueStart(bool *pCancel)
bool isEnabled() const
Definition: C4Network2.h:86
bool isFrozen() const
void SetStartCtrlTick(int32_t iTick)
Definition: C4Network2.h:451
const unsigned int C4NetMinVotingInterval
Definition: C4Network2.h:53
uint32_t iLastReferenceUpdate
Definition: C4Network2.h:164
size_t getPendingStreamData() const
Definition: C4Network2.h:300
bool LeagueSignupEnable()
const char * getStateName() const
Definition: C4Network2.cpp:55
void OnClientConnect(C4Network2Client *pClient, C4Network2IOConnection *pConn)
C4PacketJoinData()=default
bool StartStreaming(C4Record *pRecord)
bool LeaguePlrAuth(C4PlayerInfo *pInfo)
C4Network2ResCore ResDynamic
Definition: C4Network2.h:133
void HandleActivateReq(int32_t iTick, C4Network2Client *pClient)
const int C4NetActivationReqInterval
Definition: C4Network2.h:40
C4Network2Status Status
Definition: C4Network2.h:122
void Clear()
Definition: C4Network2.cpp:711
bool fDynamicNeeded
Definition: C4Network2.h:137
void HandleStatusAck(const C4Network2Status &nStatus, C4Network2Client *pClient)
const unsigned int C4NetChaseTargetUpdateInterval
Definition: C4Network2.h:45
bool fWrongPassword
Definition: C4Network2.h:175
void SendJoinData(C4Network2Client *pClient)
InitResult InitClient(const class C4Network2Reference &Ref, bool fObserver)
C4GameLobby::MainDlg * pLobby
Definition: C4Network2.h:147
const int32_t & getClientID() const
Definition: C4Network2.h:443
bool isEnabled() const
Definition: C4Network2.h:203
void OnConn(C4Network2IOConnection *pConn)
Definition: C4Network2.cpp:827
StdCopyStrBuf NetpuncherAddr
Definition: C4Network2.h:198
const int16_t C4NetStdPortHTTP
Definition: C4Network2.h:34
bool fPausedForVote
Definition: C4Network2.h:183
C4TimeMilliseconds tLastActivateRequest
Definition: C4Network2.h:161
C4Network2ResList ResList
Definition: C4Network2.h:113
C4NetGameState getState() const
Definition: C4Network2.h:80
void EndVote(C4ControlVoteType eType, bool fApprove, int32_t iData)
void LeagueSurrender()
int32_t getCtrlMode() const
Definition: C4Network2.h:81
void CompileFunc(StdCompiler *pComp, bool fReference)
Definition: C4Network2.cpp:106
int32_t iTargetCtrlTick
Definition: C4Network2.h:77
const unsigned int C4NetMinLeagueUpdateInterval
Definition: C4Network2.h:49
bool ChangeGameStatus(C4NetGameState enState, int32_t iTargetCtrlTick, int32_t iCtrlMode=-1)
bool fLeagueEndSent
Definition: C4Network2.h:166
C4Network2ClientList Clients
Definition: C4Network2.h:116
const int C4NetResRetrieveTimeout
Definition: C4Network2.h:37
void SetTargetTick(int32_t iTargetCtrlTick)
Definition: C4Network2.cpp:91
void DrawStatus(C4TargetFacet &cgo)
bool StreamOut()
int32_t getVoteData() const
Definition: C4Network2.h:403
bool isLobbyActive() const
Definition: C4Network2.h:87
std::unique_ptr< C4NetpuncherPacket > uptr
C4NetpuncherID NetpuncherGameID
Definition: C4Network2.h:197
bool LeagueUpdateProcessReply()
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2206
bool isNull() const
Definition: StdBuf.h:441
bool RetrieveScenario(char *szScenario)
Definition: C4Network2.cpp:589
bool fAllowObserve
Definition: C4Network2.h:130
time_t iLastOwnVoting
Definition: C4Network2.h:184
C4Network2Players Players
Definition: C4Network2.h:119
void OnGameSynchronized()
z_stream StreamCompressor
Definition: C4Network2.h:191
void UpdateChaseTarget()
bool DoLobby()
Definition: C4Network2.cpp:432
bool isPassworded() const
Definition: C4Network2.h:218
int32_t iClientID
Definition: C4Network2.h:423
bool fHost
Definition: C4Network2.h:127
C4IDPacket * GetVote(int32_t iClientID, C4ControlVoteType eType, int32_t iData)
void InitPuncher()
const size_t C4NetStreamingMaxBlockSize
Definition: C4Network2.h:57
const int C4NetMaxBehind4Activation
Definition: C4Network2.h:41
C4Control Votes
Definition: C4Network2.h:181
void OnConnect(C4Network2Client *pClient, C4Network2IOConnection *pConn, const char *szMsg, bool fFirstConnection)
bool HostConnect(const C4ClientCore &CCore, C4Network2IOConnection *pConn, StdStrBuf *szReply)
bool FinishStreaming()
StdStrBuf sPassword
Definition: C4Network2.h:172
void LeagueGameEvaluate(const char *szRecordName=nullptr, const BYTE *pRecordSHA=nullptr)
bool isRunning() const
Definition: C4Network2.h:90
bool Execute(int, pollfd *) override
Definition: C4Network2.cpp:325
bool fStreaming
Definition: C4Network2.h:187
bool Sync()
Definition: C4Network2.cpp:520
C4ControlVoteType getVoteType() const
Definition: C4Network2.h:402
bool StopStreaming()
uint32_t iLastChaseTargetUpdate
Definition: C4Network2.h:158
bool HandlePuncherPacket(C4NetpuncherPacket::uptr, C4NetIO::HostAddress::AddressFamily family)
Definition: C4Network2.cpp:971
const unsigned int C4NetVotingTimeout
Definition: C4Network2.h:52
bool isPaused() const
Definition: C4Network2.h:89
void RequestActivate()
C4NetGameState eState
Definition: C4Network2.h:75
bool LeagueEnd(const char *szRecordName=nullptr, const BYTE *pRecordSHA=nullptr)
void OnVoteDialogClosed()
void LeagueSignupDisable()
const char * getDescription() const
Definition: C4Network2.cpp:68
int32_t getStartCtrlTick() const
Definition: C4Network2.h:446
void CheckStatusReached(bool fFromFinalInit=false)
StdStrBuf QueryClientPassword()
Definition: C4Network2.cpp:784
void DeinitLeague()
bool isPastLobby() const
Definition: C4Network2.h:205
const int16_t C4NetStdPortPuncher
Definition: C4Network2.h:33
C4GameParameters Parameters
Definition: C4Network2.h:440
void HandlePacket(char cStatus, const C4PacketBase *pBasePkt, C4Network2IOConnection *pConn)
Definition: C4Network2.cpp:878
bool Join(C4ClientCore &CCore, C4Network2IOConnection *pConn, StdStrBuf *szReply)
class C4GameControlNetwork * pControl
Definition: C4Network2.h:144
C4VoteDialog(const char *szText, C4ControlVoteType eVoteType, int32_t iVoteData, bool fSurrender)
C4GameLobby::Countdown * pLobbyCountdown
Definition: C4Network2.h:149
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:579
bool fChasing
Definition: C4Network2.h:141