OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Packet2.cpp
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 #include "C4Include.h"
17 
18 
19 #include "network/C4Network2Res.h"
20 #include "C4Version.h"
21 #include "gui/C4GameLobby.h"
22 #include "network/C4Network2.h"
23 #include "control/C4RoundResults.h"
25 
26 // *** constants
27 
28 // workaround
29 template <class T> struct unpack_class
30 {
32  {
33  assert(pComp->isDeserializer());
34  T *pPkt = new T();
35  try
36  {
37  pComp->Value(*pPkt);
38  }
39  catch (...)
40  {
41  delete pPkt;
42  throw;
43  }
44  return pPkt;
45  }
46 };
47 
48 #define PKT_UNPACK(T) unpack_class<T>::unpack
49 
50 
52 {
53 
54  // C4Network2IO (network thread)
55  { PID_Conn, PC_Network, "Connection Request", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketConn) },
56  { PID_ConnRe, PC_Network, "Connection Request Reply", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketConnRe) },
57 
58  { PID_Ping, PC_Network, "Ping", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPing) },
59  { PID_Pong, PC_Network, "Pong", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPing) },
60 
61  { PID_FwdReq, PC_Network, "Forward Request", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketFwd) },
62  { PID_Fwd, PC_Network, "Forward", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketFwd) },
63 
64  { PID_PostMortem, PC_Network, "Post Mortem", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPostMortem) },
65 
66  // C4Network2 (main thread)
67  { PID_Conn, PC_Network, "Connection Request", true, false, PH_C4Network2, PKT_UNPACK(C4PacketConn) },
68  { PID_ConnRe, PC_Network, "Connection Request Reply", true, false, PH_C4Network2, PKT_UNPACK(C4PacketConnRe) },
69 
70  { PID_Status, PC_Network, "Game Status", true, false, PH_C4Network2, PKT_UNPACK(C4Network2Status) },
71  { PID_StatusAck, PC_Network, "Game Status Acknowledgement",true, false, PH_C4Network2, PKT_UNPACK(C4Network2Status) },
72 
73  { PID_ClientActReq, PC_Network, "Client Activation Request", false, false, PH_C4Network2, PKT_UNPACK(C4PacketActivateReq) },
74 
75  { PID_JoinData, PC_Network, "Join Data", false, false, PH_C4Network2, PKT_UNPACK(C4PacketJoinData) },
76 
77  // C4Network2PlayerList (main thread)
78  { PID_PlayerInfoUpdReq,PC_Network, "Player info update request",true, false, PH_C4Network2Players, PKT_UNPACK(C4PacketPlayerInfoUpdRequest) },
79 
81 
82  // C4GameLobby (main thread)
85 
86  // C4Network2ClientList (main thread)
87  { PID_Addr, PC_Network, "Client Address", false, false, PH_C4Network2ClientList, PKT_UNPACK(C4PacketAddr) },
88 
89 
90  // C4Network2ResList (network thread)
91  { PID_NetResDis, PC_Network, "Resource Discover", true, true, PH_C4Network2ResList, PKT_UNPACK(C4PacketResDiscover) },
92  { PID_NetResStat, PC_Network, "Resource Status", false, true, PH_C4Network2ResList, PKT_UNPACK(C4PacketResStatus) },
93  { PID_NetResDerive, PC_Network, "Resource Derive", false, true, PH_C4Network2ResList, PKT_UNPACK(C4Network2ResCore) },
94  { PID_NetResReq, PC_Network, "Resource Request", false, true, PH_C4Network2ResList, PKT_UNPACK(C4PacketResRequest) },
95  { PID_NetResData, PC_Network, "Resource Data", false, true, PH_C4Network2ResList, PKT_UNPACK(C4Network2ResChunk) },
96 
97  // C4GameControlNetwork (network thread)
99  { PID_ControlReq, PC_Network, "Control Request", false, true, PH_C4GameControlNetwork, PKT_UNPACK(C4PacketControlReq) },
100  // main thread
101  { PID_ControlPkt, PC_Network, "Control Paket", false, false, PH_C4GameControlNetwork, PKT_UNPACK(C4PacketControlPkt) },
102  { PID_ExecSyncCtrl, PC_Network, "Execute Sync Control", false, false, PH_C4GameControlNetwork, PKT_UNPACK(C4PacketExecSyncCtrl)},
103 
104  // Control (Isn't send over network, handled only as part of a control list)
105  { CID_ClientJoin, PC_Control, "Client Join", false, true, 0, PKT_UNPACK(C4ControlClientJoin) },
106  { CID_ClientUpdate, PC_Control, "Client Update", false, true, 0, PKT_UNPACK(C4ControlClientUpdate)},
107  { CID_ClientRemove, PC_Control, "Client Remove", false, true, 0, PKT_UNPACK(C4ControlClientRemove)},
108  { CID_Vote, PC_Control, "Voting", false, true, 0, PKT_UNPACK(C4ControlVote) },
109  { CID_VoteEnd, PC_Control, "Voting End", false, true, 0, PKT_UNPACK(C4ControlVoteEnd) },
110  { CID_SyncCheck, PC_Control, "Sync Check", false, true, 0, PKT_UNPACK(C4ControlSyncCheck) },
111  { CID_Synchronize, PC_Control, "Synchronize", false, true, 0, PKT_UNPACK(C4ControlSynchronize)},
112  { CID_Set, PC_Control, "Set", false, true, 0, PKT_UNPACK(C4ControlSet) },
113  { CID_Script, PC_Control, "Script", false, true, 0, PKT_UNPACK(C4ControlScript) },
114  { CID_MsgBoardReply,PC_Control, "Message Board Reply", false, true, 0, PKT_UNPACK(C4ControlMsgBoardReply)},
115  { CID_MsgBoardCmd ,PC_Control, "Message Board Command", false, true, 0, PKT_UNPACK(C4ControlMsgBoardCmd)},
116  { CID_PlrInfo, PC_Control, "Player Info", false, true, 0, PKT_UNPACK(C4ControlPlayerInfo) },
117  { CID_JoinPlr, PC_Control, "Join Player", false, true, 0, PKT_UNPACK(C4ControlJoinPlayer) },
118  { CID_RemovePlr, PC_Control, "Remove Player", false, true, 0, PKT_UNPACK(C4ControlRemovePlr) },
119  { CID_PlrSelect, PC_Control, "Player Select", false, true, 0, PKT_UNPACK(C4ControlPlayerSelect)},
120  { CID_PlrControl, PC_Control, "Player Control", false, true, 0, PKT_UNPACK(C4ControlPlayerControl)},
121  { CID_PlrAction, PC_Control, "Player Self-Mgmt Action", false, true, 0, PKT_UNPACK(C4ControlPlayerAction)},
122  { CID_PlrMouseMove, PC_Control, "Player Mouse Movement", false, true, 0, PKT_UNPACK(C4ControlPlayerMouse)},
123  { CID_Message, PC_Control, "Message", false, true, 0, PKT_UNPACK(C4ControlMessage) },
124  { CID_MenuCommand, PC_Control, "Menu Command", false, true, 0, PKT_UNPACK(C4ControlMenuCommand)},
125  { CID_EMMoveObj, PC_Control, "EM Move Obj", false, true, 0, PKT_UNPACK(C4ControlEMMoveObject)},
126  { CID_EMDrawTool, PC_Control, "EM Draw Tool", false, true, 0, PKT_UNPACK(C4ControlEMDrawTool) },
127  { CID_ReInitScenario,PC_Control, "Reinit Scenario", false, true, 0, PKT_UNPACK(C4ControlReInitScenario) },
128  { CID_EditGraph, PC_Control, "Edit Graph", false, true, 0, PKT_UNPACK(C4ControlEditGraph) },
129 
130  { CID_DebugRec, PC_Control, "Debug Rec", false, true, 0, PKT_UNPACK(C4ControlDebugRec) },
131 
132  // EOL
133  { PID_None, PC_Network, nullptr, false, true, 0, nullptr }
134 };
135 
136 const char *PacketNameByID(C4PacketType eID)
137 {
138  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
139  if (pPData->ID == eID)
140  return pPData->Name;
141  return "?!?";
142 }
143 
144 // *** C4PacketBase
145 
147 {
148 
149 }
150 
152 {
153 
154 }
155 
157 {
158  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
159 }
160 
161 C4NetIOPacket C4PacketBase::pack(uint8_t cStatus, const C4NetIO::addr_t &addr) const
162 {
163  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
164 }
165 
166 void C4PacketBase::unpack(const C4NetIOPacket &Pkt, char *pStatus)
167 {
168  if (pStatus) *pStatus = Pkt.getStatus();
169  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
170 }
171 
172 
173 // *** C4PktBuf
174 
176 {
177 }
178 
180 {
181  Data.Copy(rCopy.Data);
182 }
183 
184 C4PktBuf::C4PktBuf(const StdBuf &rCpyData)
185 {
186  Data.Copy(rCpyData);
187 }
188 
190 {
191  pComp->Value(mkNamingAdapt(Data, "Data"));
192 }
193 
194 // *** C4IDPacket
195 
197  : eID(PID_None), pPkt(nullptr), fOwnPkt(true), pNext(nullptr)
198 {
199 
200 }
201 
203  : eID(eID), pPkt(pPkt), fOwnPkt(fTakePkt), pNext(nullptr)
204 {
205 
206 }
207 
209  : C4PacketBase(Packet2),
210  eID(PID_None), pPkt(nullptr), fOwnPkt(true), pNext(nullptr)
211 {
212  // kinda hacky (note this might throw an uncaught exception)
213  C4PacketBase::unpack(Packet2.C4PacketBase::pack());
214 }
215 
217 {
218  Clear();
219 }
220 
221 const char *C4IDPacket::getPktName() const
222 {
223  // Use map
224  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
225  if (pPData->ID == eID && pPData->Name)
226  return pPData->Name;
227  return "Unknown Packet Type";
228 }
229 
231 {
232  eID = PID_None; pPkt = nullptr;
233 }
234 
236 {
237  if (fOwnPkt) delete pPkt; pPkt = nullptr;
238  eID = PID_None;
239 }
240 
242 {
243  // Packet ID
244  pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(eID), "ID", PID_None));
245  // Compiling or Decompiling?
246  if (pComp->isDeserializer())
247  {
248  if (!pComp->Name(getPktName()))
249  { pComp->excCorrupt("C4IDPacket: Data value needed! Packet data missing!"); return; }
250  // Delete old packet
251  if (fOwnPkt) delete pPkt; pPkt = nullptr;
252  if (eID == PID_None) return;
253  // Search unpacking function
254  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
255  if (pPData->ID == eID && pPData->FnUnpack)
256  {
257  pPkt = pPData->FnUnpack(pComp);
258  break;
259  }
260  if (!pPkt)
261  pComp->excCorrupt("C4IDPacket: could not unpack packet id %02x!", eID);
262  pComp->NameEnd();
263  }
264  else if (eID != PID_None)
265  // Just write
266  pComp->Value(mkNamingAdapt(*pPkt, getPktName()));
267 }
268 
269 // *** C4PacketList
270 
272  : pFirst(nullptr), pLast(nullptr)
273 {
274 
275 }
276 
278  : C4PacketBase(List2),
279  pFirst(nullptr), pLast(nullptr)
280 {
281  Append(List2);
282 }
283 
285 {
286  Clear();
287 }
288 
289 int32_t C4PacketList::getPktCnt() const
290 {
291  int32_t iCnt = 0;
292  for (C4IDPacket *pPkt = pFirst; pPkt; pPkt = pPkt->pNext)
293  iCnt++;
294  return iCnt;
295 }
296 
298 {
299  assert(!pPkt->pNext);
300  (pLast ? pLast->pNext : pFirst) = pPkt;
301  pLast = pPkt;
302 }
303 
305 {
306  assert(!pPkt->pNext);
307  pPkt->pNext = pFirst;
308  pFirst = pPkt;
309  if (!pLast) pLast = pPkt;
310 }
311 
313 {
314  Add(new C4IDPacket(eType, pPkt));
315 }
316 
318 {
319  AddHead(new C4IDPacket(eType, pPkt));
320 }
321 
323 {
324  pFirst = List.pFirst;
325  pLast = List.pLast;
326  List.pFirst = List.pLast = nullptr;
327 }
328 
330 {
331  for (C4IDPacket *pPkt = List.firstPkt(); pPkt; pPkt = List.nextPkt(pPkt))
332  Add(new C4IDPacket(*pPkt));
333 }
334 
336 {
337  while (pFirst)
338  Delete(pFirst);
339 }
340 
342 {
343  if (pPkt == pFirst)
344  {
345  pFirst = pPkt->pNext;
346  if (pPkt == pLast)
347  pLast = nullptr;
348  }
349  else
350  {
351  C4IDPacket *pPrev;
352  for (pPrev = pFirst; pPrev && pPrev->pNext != pPkt; pPrev = pPrev->pNext) {}
353  if (pPrev)
354  {
355  pPrev->pNext = pPkt->pNext;
356  if (pPkt == pLast)
357  pLast = pPrev;
358  }
359  }
360 }
361 
363 {
364  Remove(pPkt);
365  delete pPkt;
366 }
367 
369 {
370  // unpack packets
371  if (pComp->isDeserializer())
372  {
373  // Read until no further sections available
374  while (pComp->Name("IDPacket"))
375  {
376  // Read the packet
377  C4IDPacket *pPkt = new C4IDPacket();
378  try
379  {
380  pComp->Value(*pPkt);
381  pComp->NameEnd();
382  }
383  catch (...)
384  {
385  delete pPkt;
386  throw;
387  }
388  // Terminator?
389  if (!pPkt->getPkt()) { delete pPkt; break; }
390  // Add to list
391  Add(pPkt);
392  }
393  pComp->NameEnd();
394  }
395  else
396  {
397  // Write all packets
398  for (C4IDPacket *pPkt = pFirst; pPkt; pPkt = pPkt->pNext)
399  pComp->Value(mkNamingAdapt(*pPkt, "IDPacket"));
400  // Terminate, if no naming is available
401  if (!pComp->hasNaming())
402  {
403  C4IDPacket Pkt;
404  pComp->Value(mkNamingAdapt(Pkt, "IDPacket"));
405  }
406  }
407 }
408 
409 // *** C4PacketConn
410 
412  : iVer(C4XVER1*100 + C4XVER2)
413 {
414 }
415 
416 C4PacketConn::C4PacketConn(const C4ClientCore &nCCore, uint32_t inConnID, const char *szPassword)
417  : iVer(C4XVER1*100 + C4XVER2),
418  iConnID(inConnID),
419  CCore(nCCore),
420  Password(szPassword)
421 {
422 }
423 
425 {
426  pComp->Value(mkNamingAdapt(CCore, "CCore"));
427  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iVer), "Version", -1));
428  pComp->Value(mkNamingAdapt(Password, "Password", ""));
429  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iConnID), "ConnID", ~0u));
430 }
431 
432 // *** C4PacketConnRe
433 
435 {
436 }
437 
438 C4PacketConnRe::C4PacketConnRe(bool fnOK, bool fWrongPassword, const char *sznMsg)
439  : fOK(fnOK),
440  fWrongPassword(fWrongPassword),
441  szMsg(sznMsg, true)
442 {
443 }
444 
446 {
447  pComp->Value(mkNamingAdapt(fOK, "OK", true));
448  pComp->Value(mkNamingAdapt(szMsg, "Message", ""));
449  pComp->Value(mkNamingAdapt(fWrongPassword, "WrongPassword", false));
450 }
451 
452 // *** C4PacketFwd
453 
455  : fNegativeList(false),
456  iClientCnt(0)
457 {
458 }
459 
461  : fNegativeList(false), iClientCnt(0),
462  Data(Pkt)
463 {
464 }
465 
466 bool C4PacketFwd::DoFwdTo(int32_t iClient) const
467 {
468  for (int32_t i = 0; i < iClientCnt; i++)
469  if (iClients[i] == iClient)
470  return !fNegativeList;
471  return fNegativeList;
472 }
473 
474 void C4PacketFwd::SetData(const StdBuf &Pkt)
475 {
476  Data = Pkt;
477 }
478 
479 void C4PacketFwd::SetListType(bool fnNegativeList)
480 {
481  fNegativeList = fnNegativeList;
482 }
483 
484 void C4PacketFwd::AddClient(int32_t iClient)
485 {
486  if (iClientCnt + 1 > C4NetMaxClients) return;
487  // add
488  iClients[iClientCnt++] = iClient;
489 }
490 
492 {
493  pComp->Value(mkNamingAdapt(fNegativeList, "Negative", false));
494  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iClientCnt), "ClientCnt", 0));
495  pComp->Value(mkNamingAdapt(mkArrayAdaptMap(iClients, iClientCnt, mkIntPackAdapt<int32_t>), "Clients", -1));
496  pComp->Value(mkNamingAdapt(Data, "Data"));
497 }
498 
499 // *** C4PacketJoinData
500 
502 {
504  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iStartCtrlTick), "CtrlTick", -1));
505  pComp->Value(mkNamingAdapt(mkParAdapt(GameStatus, true), "GameStatus"));
506  pComp->Value(mkNamingAdapt(Dynamic, "Dynamic"));
507  pComp->Value(mkNamingAdapt(ScenarioParameterDefs, "ParameterDefs"));
508  pComp->Value(Parameters);
509 }
510 
511 // *** C4PacketPing
512 
513 C4PacketPing::C4PacketPing(uint32_t iPacketCounter, uint32_t iRemotePacketCounter)
514  : tTime(C4TimeMilliseconds::Now()),
515  iPacketCounter(iPacketCounter)
516 {
517 }
518 
520 {
521  return C4TimeMilliseconds::Now() - tTime;
522 }
523 
525 {
526  uint32_t time = tTime.AsInt();
527  pComp->Value(mkNamingAdapt(time, "Time", 0U));
528  tTime = C4TimeMilliseconds(time);
529 
530  pComp->Value(mkNamingAdapt(iPacketCounter, "PacketCounter", 0U));
531 }
532 
533 // *** C4PacketResStatus
534 
536 {
537 
538 }
539 
541  : iResID(iResID), Chunks(nChunks)
542 {
543 
544 }
545 
547 {
548  pComp->Value(mkNamingAdapt(iResID, "ResID"));
549  pComp->Value(mkNamingAdapt(Chunks, "Chunks"));
550 }
551 
552 // *** C4PacketResDiscover
553 
555  : iDisIDCnt(0)
556 {
557 
558 }
559 
560 bool C4PacketResDiscover::isIDPresent(int32_t iID) const
561 {
562  for (int32_t i = 0; i < iDisIDCnt; i++)
563  if (iDisIDs[i] == iID)
564  return true;
565  return false;
566 }
567 
569 {
570  if (iDisIDCnt + 1 >= int32_t(sizeof(iDisIDs) / sizeof(*iDisIDs))) return false;
571  // add
572  iDisIDs[iDisIDCnt++] = iID;
573  return true;
574 }
575 
577 {
578  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iDisIDCnt), "DiscoverCnt", 0));
579  pComp->Value(mkNamingAdapt(mkArrayAdapt(iDisIDs, iDisIDCnt), "Discovers", -1));
580 }
581 
582 // *** C4PacketResRequest
583 
584 C4PacketResRequest::C4PacketResRequest(int32_t inID, int32_t inChunk)
585  : iReqID(inID), iReqChunk(inChunk)
586 {
587 
588 }
589 
591 {
592  pComp->Value(mkNamingAdapt(iReqID, "ResID", -1));
593  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iReqChunk), "Chunk", -1));
594 }
595 
596 // *** C4PacketControlReq
597 
599  : iCtrlTick(inCtrlTick)
600 {
601 
602 }
603 
605 {
606  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCtrlTick), "CtrlTick", -1));
607 }
608 
609 // *** C4PacketActivateReq
610 
612 {
613  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iTick), "Tick", -1));
614 }
615 
616 
617 // *** C4PacketControlPkt
618 
620 {
621  pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(eDelivery), "Delivery", CDT_Queue));
622  pComp->Value(Ctrl);
623 }
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:445
C4PacketBase * pPkt
Definition: C4PacketBase.h:247
virtual bool hasNaming()
Definition: StdCompiler.h:68
StdStrBuf szMsg
Definition: C4Network2IO.h:377
Definition: StdBuf.h:37
C4IDPacket * pNext
Definition: C4PacketBase.h:251
const char * PacketNameByID(C4PacketType eID)
Definition: C4Packet2.cpp:136
void Clear()
Definition: C4Packet2.cpp:235
void Add(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:297
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:501
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:259
C4Network2Status GameStatus
Definition: C4Network2.h:429
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:590
C4PacketType eID
Definition: C4PacketBase.h:246
uint32_t getTravelTime() const
Definition: C4Packet2.cpp:519
C4IDPacket * pFirst
Definition: C4PacketBase.h:274
StdBuf getPBuf() const
Definition: C4NetIO.h:321
bool AddDisID(int32_t iID)
Definition: C4Packet2.cpp:568
C4PacketControlReq(int32_t iCtrlTick=-1)
Definition: C4Packet2.cpp:598
C4PacketType
Definition: C4PacketBase.h:76
C4Network2ResCore Dynamic
Definition: C4Network2.h:426
C4ScenarioParameterDefs ScenarioParameterDefs
Definition: C4Network2.h:437
uint32_t iPacketCounter
Definition: C4Network2IO.h:339
C4IDPacket * pLast
Definition: C4PacketBase.h:274
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:576
C4NetIOPacket getRef() const
Definition: C4NetIO.h:324
C4Network2ResChunkData Chunks
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:491
virtual bool Name(const char *szName)
Definition: StdCompiler.h:87
int32_t iStartCtrlTick
Definition: C4Network2.h:432
enum C4ControlDeliveryType eDelivery
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:424
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:241
const C4PktHandlingData PktHandlingData[]
Definition: C4Packet2.cpp:51
void Append(const C4PacketList &List)
Definition: C4Packet2.cpp:329
C4PacketType ID
Definition: C4PacketBase.h:201
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
void AddClient(int32_t iClient)
Definition: C4Packet2.cpp:484
const char * getPktName() const
Definition: C4Packet2.cpp:221
void Take(C4PacketList &List)
Definition: C4Packet2.cpp:322
int32_t iClients[C4NetMaxClients]
Definition: C4Network2IO.h:395
int iCnt
Definition: TstC4NetIO.cpp:35
#define PKT_UNPACK(T)
Definition: C4Packet2.cpp:48
void Copy(size_t inSize)
Definition: StdBuf.h:233
StdArrayAdapt< T > mkArrayAdapt(T *pArray, int iSize)
Definition: StdAdaptors.h:308
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:154
C4IDPacket * nextPkt(C4IDPacket *pPkt) const
Definition: C4PacketBase.h:278
void SetListType(bool fnNegativeList)
Definition: C4Packet2.cpp:479
static C4PacketBase * unpack(StdCompiler *pComp)
Definition: C4Packet2.cpp:31
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:435
void Clear()
Definition: C4Packet2.cpp:335
StdCopyBuf Data
Definition: C4PacketBase.h:223
void Delete(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:362
void Value(const T &rStruct)
Definition: StdCompiler.h:171
const int32_t C4ClientIDUnknown
Definition: C4Client.h:24
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:524
C4PacketPing(uint32_t iPacketCounter=0, uint32_t iRemotePacketCounter=0)
Definition: C4Packet2.cpp:513
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:189
virtual bool isDeserializer()
Definition: StdCompiler.h:63
bool fNegativeList
Definition: C4Network2IO.h:394
virtual ~C4PacketList()
Definition: C4Packet2.cpp:284
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:757
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:368
C4PacketResRequest(int32_t iID=-1, int32_t iChunk=-1)
Definition: C4Packet2.cpp:584
int32_t iClientCnt
Definition: C4Network2IO.h:396
virtual ~C4PacketBase()
Definition: C4Packet2.cpp:151
void AddHead(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:304
uint8_t getStatus() const
Definition: C4NetIO.h:318
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:546
int32_t iVer
Definition: C4Network2IO.h:355
void Remove(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:341
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:611
int32_t iClientID
Definition: C4Network2.h:423
bool DoFwdTo(int32_t iClient) const
Definition: C4Packet2.cpp:466
bool isIDPresent(int32_t iID) const
Definition: C4Packet2.cpp:560
C4TimeMilliseconds tTime
Definition: C4Network2IO.h:338
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
void SetData(const StdBuf &Pkt)
Definition: C4Packet2.cpp:474
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:619
C4ClientCore CCore
Definition: C4Network2IO.h:357
C4NetIOPacket pack(const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
Definition: C4Packet2.cpp:156
uint32_t AsInt() const
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
Definition: StdAdaptors.h:311
C4PacketBase * getPkt() const
Definition: C4PacketBase.h:255
StdCopyBuf Data
Definition: C4Network2IO.h:397
int32_t getPktCnt() const
Definition: C4Packet2.cpp:289
uint32_t iConnID
Definition: C4Network2IO.h:356
Definition: C4Network2IO.h:414
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:88
void Default()
Definition: C4Packet2.cpp:230
void unpack(const C4NetIOPacket &Pkt, char *pStatus=nullptr)
Definition: C4Packet2.cpp:166
static C4TimeMilliseconds Now()
C4GameParameters Parameters
Definition: C4Network2.h:440
C4IDPacket * firstPkt() const
Definition: C4PacketBase.h:277
virtual void CompileFunc(StdCompiler *pComp)
Definition: C4Packet2.cpp:604
StdCopyStrBuf Password
Definition: C4Network2IO.h:358
const int C4NetMaxClients
Definition: C4Network2IO.h:41