OpenClonk
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 #include "C4Version.h"
19 #include "control/C4RoundResults.h"
20 #include "gui/C4GameLobby.h"
22 #include "network/C4Network2.h"
23 #include "network/C4Network2Res.h"
24 
25 // *** constants
26 
27 // workaround
28 template <class T> struct unpack_class
29 {
31  {
32  assert(pComp->isDeserializer());
33  T *pPkt = new T();
34  try
35  {
36  pComp->Value(*pPkt);
37  }
38  catch (...)
39  {
40  delete pPkt;
41  throw;
42  }
43  return pPkt;
44  }
45 };
46 
47 #define PKT_UNPACK(T) unpack_class<T>::unpack
48 
49 
51 {
52 
53  // C4Network2IO (network thread)
54  { PID_Conn, PC_Network, "Connection Request", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketConn) },
55  { PID_ConnRe, PC_Network, "Connection Request Reply", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketConnRe) },
56 
57  { PID_Ping, PC_Network, "Ping", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPing) },
58  { PID_Pong, PC_Network, "Pong", true, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPing) },
59 
60  { PID_FwdReq, PC_Network, "Forward Request", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketFwd) },
61  { PID_Fwd, PC_Network, "Forward", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketFwd) },
62 
63  { PID_PostMortem, PC_Network, "Post Mortem", false, true, PH_C4Network2IO, PKT_UNPACK(C4PacketPostMortem) },
64 
65  // C4Network2 (main thread)
66  { PID_Conn, PC_Network, "Connection Request", true, false, PH_C4Network2, PKT_UNPACK(C4PacketConn) },
67  { PID_ConnRe, PC_Network, "Connection Request Reply", true, false, PH_C4Network2, PKT_UNPACK(C4PacketConnRe) },
68 
69  { PID_Status, PC_Network, "Game Status", true, false, PH_C4Network2, PKT_UNPACK(C4Network2Status) },
70  { PID_StatusAck, PC_Network, "Game Status Acknowledgement",true, false, PH_C4Network2, PKT_UNPACK(C4Network2Status) },
71 
72  { PID_ClientActReq, PC_Network, "Client Activation Request", false, false, PH_C4Network2, PKT_UNPACK(C4PacketActivateReq) },
73 
74  { PID_JoinData, PC_Network, "Join Data", false, false, PH_C4Network2, PKT_UNPACK(C4PacketJoinData) },
75 
76  // C4Network2PlayerList (main thread)
77  { PID_PlayerInfoUpdReq,PC_Network, "Player info update request",true, false, PH_C4Network2Players, PKT_UNPACK(C4PacketPlayerInfoUpdRequest) },
78 
80 
81  // C4GameLobby (main thread)
84 
85  // C4Network2ClientList (main thread)
86  { PID_Addr, PC_Network, "Client Address", false, false, PH_C4Network2ClientList, PKT_UNPACK(C4PacketAddr) },
87  { PID_TCPSimOpen, PC_Network, "TCP simultaneous open req", false, false, PH_C4Network2ClientList, PKT_UNPACK(C4PacketTCPSimOpen) },
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 
146 C4PacketBase::C4PacketBase() = default;
147 
148 C4PacketBase::~C4PacketBase() = default;
149 
151 {
152  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
153 }
154 
155 C4NetIOPacket C4PacketBase::pack(uint8_t cStatus, const C4NetIO::addr_t &addr) const
156 {
157  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
158 }
159 
160 void C4PacketBase::unpack(const C4NetIOPacket &Pkt, char *pStatus)
161 {
162  if (pStatus) *pStatus = Pkt.getStatus();
163  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
164 }
165 
166 
167 // *** C4PktBuf
168 
169 C4PktBuf::C4PktBuf() = default;
170 
172 {
173  Data.Copy(rCopy.Data);
174 }
175 
176 C4PktBuf::C4PktBuf(const StdBuf &rCpyData)
177 {
178  Data.Copy(rCpyData);
179 }
180 
182 {
183  pComp->Value(mkNamingAdapt(Data, "Data"));
184 }
185 
186 // *** C4IDPacket
187 
188 C4IDPacket::C4IDPacket() = default;
189 
191  : eID(eID), pPkt(pPkt), fOwnPkt(fTakePkt), pNext(nullptr)
192 {
193 
194 }
195 
197  : C4PacketBase(Packet2)
198 {
199  // kinda hacky (note this might throw an uncaught exception)
200  C4PacketBase::unpack(Packet2.C4PacketBase::pack());
201 }
202 
204 {
205  Clear();
206 }
207 
208 const char *C4IDPacket::getPktName() const
209 {
210  // Use map
211  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
212  if (pPData->ID == eID && pPData->Name)
213  return pPData->Name;
214  return "Unknown Packet Type";
215 }
216 
218 {
219  eID = PID_None; pPkt = nullptr;
220 }
221 
223 {
224  if (fOwnPkt) delete pPkt; pPkt = nullptr;
225  eID = PID_None;
226 }
227 
229 {
230  // Packet ID
231  pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(eID), "ID", PID_None));
232  // Compiling or Decompiling?
233  if (pComp->isDeserializer())
234  {
235  if (!pComp->Name(getPktName()))
236  { pComp->excCorrupt("C4IDPacket: Data value needed! Packet data missing!"); return; }
237  // Delete old packet
238  if (fOwnPkt) delete pPkt; pPkt = nullptr;
239  if (eID == PID_None) return;
240  // Search unpacking function
241  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
242  if (pPData->ID == eID && pPData->FnUnpack)
243  {
244  pPkt = pPData->FnUnpack(pComp);
245  break;
246  }
247  if (!pPkt)
248  pComp->excCorrupt("C4IDPacket: could not unpack packet id %02x!", eID);
249  pComp->NameEnd();
250  }
251  else if (eID != PID_None)
252  // Just write
253  pComp->Value(mkNamingAdapt(*pPkt, getPktName()));
254 }
255 
256 // *** C4PacketList
257 
258 C4PacketList::C4PacketList() = default;
259 
261  : C4PacketBase(List2),
262  pFirst(nullptr), pLast(nullptr)
263 {
264  Append(List2);
265 }
266 
268 {
269  Clear();
270 }
271 
272 int32_t C4PacketList::getPktCnt() const
273 {
274  int32_t iCnt = 0;
275  for (C4IDPacket *pPkt = pFirst; pPkt; pPkt = pPkt->pNext)
276  iCnt++;
277  return iCnt;
278 }
279 
281 {
282  assert(!pPkt->pNext);
283  (pLast ? pLast->pNext : pFirst) = pPkt;
284  pLast = pPkt;
285 }
286 
288 {
289  assert(!pPkt->pNext);
290  pPkt->pNext = pFirst;
291  pFirst = pPkt;
292  if (!pLast) pLast = pPkt;
293 }
294 
296 {
297  Add(new C4IDPacket(eType, pPkt));
298 }
299 
301 {
302  AddHead(new C4IDPacket(eType, pPkt));
303 }
304 
306 {
307  pFirst = List.pFirst;
308  pLast = List.pLast;
309  List.pFirst = List.pLast = nullptr;
310 }
311 
313 {
314  for (C4IDPacket *pPkt = List.firstPkt(); pPkt; pPkt = List.nextPkt(pPkt))
315  Add(new C4IDPacket(*pPkt));
316 }
317 
319 {
320  while (pFirst)
321  Delete(pFirst);
322 }
323 
325 {
326  if (pPkt == pFirst)
327  {
328  pFirst = pPkt->pNext;
329  if (pPkt == pLast)
330  pLast = nullptr;
331  }
332  else
333  {
334  C4IDPacket *pPrev;
335  for (pPrev = pFirst; pPrev && pPrev->pNext != pPkt; pPrev = pPrev->pNext) {}
336  if (pPrev)
337  {
338  pPrev->pNext = pPkt->pNext;
339  if (pPkt == pLast)
340  pLast = pPrev;
341  }
342  }
343 }
344 
346 {
347  Remove(pPkt);
348  delete pPkt;
349 }
350 
352 {
353  // unpack packets
354  if (pComp->isDeserializer())
355  {
356  // Read until no further sections available
357  while (pComp->Name("IDPacket"))
358  {
359  // Read the packet
360  C4IDPacket *pPkt = new C4IDPacket();
361  try
362  {
363  pComp->Value(*pPkt);
364  pComp->NameEnd();
365  }
366  catch (...)
367  {
368  delete pPkt;
369  throw;
370  }
371  // Terminator?
372  if (!pPkt->getPkt()) { delete pPkt; break; }
373  // Add to list
374  Add(pPkt);
375  }
376  pComp->NameEnd();
377  }
378  else
379  {
380  // Write all packets
381  for (C4IDPacket *pPkt = pFirst; pPkt; pPkt = pPkt->pNext)
382  pComp->Value(mkNamingAdapt(*pPkt, "IDPacket"));
383  // Terminate, if no naming is available
384  if (!pComp->hasNaming())
385  {
386  C4IDPacket Pkt;
387  pComp->Value(mkNamingAdapt(Pkt, "IDPacket"));
388  }
389  }
390 }
391 
392 // *** C4PacketConn
393 
395  : iVer(C4XVER1*100 + C4XVER2)
396 {
397 }
398 
399 C4PacketConn::C4PacketConn(const C4ClientCore &nCCore, uint32_t inConnID, const char *szPassword)
400  : iVer(C4XVER1*100 + C4XVER2),
401  iConnID(inConnID),
402  CCore(nCCore),
403  Password(szPassword)
404 {
405 }
406 
408 {
409  pComp->Value(mkNamingAdapt(CCore, "CCore"));
410  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iVer), "Version", -1));
411  pComp->Value(mkNamingAdapt(Password, "Password", ""));
412  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iConnID), "ConnID", ~0u));
413 }
414 
415 // *** C4PacketConnRe
416 
418 
419 C4PacketConnRe::C4PacketConnRe(bool fnOK, bool fWrongPassword, const char *sznMsg)
420  : fOK(fnOK),
421  fWrongPassword(fWrongPassword),
422  szMsg(sznMsg, true)
423 {
424 }
425 
427 {
428  pComp->Value(mkNamingAdapt(fOK, "OK", true));
429  pComp->Value(mkNamingAdapt(szMsg, "Message", ""));
430  pComp->Value(mkNamingAdapt(fWrongPassword, "WrongPassword", false));
431 }
432 
433 // *** C4PacketFwd
434 
435 C4PacketFwd::C4PacketFwd() = default;
436 
438  : Data(Pkt)
439 {
440 }
441 
442 bool C4PacketFwd::DoFwdTo(int32_t iClient) const
443 {
444  for (int32_t i = 0; i < iClientCnt; i++)
445  if (iClients[i] == iClient)
446  return !fNegativeList;
447  return fNegativeList;
448 }
449 
450 void C4PacketFwd::SetData(const StdBuf &Pkt)
451 {
452  Data = Pkt;
453 }
454 
455 void C4PacketFwd::SetListType(bool fnNegativeList)
456 {
457  fNegativeList = fnNegativeList;
458 }
459 
460 void C4PacketFwd::AddClient(int32_t iClient)
461 {
462  if (iClientCnt + 1 > C4NetMaxClients) return;
463  // add
464  iClients[iClientCnt++] = iClient;
465 }
466 
468 {
469  pComp->Value(mkNamingAdapt(fNegativeList, "Negative", false));
470  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iClientCnt), "ClientCnt", 0));
471  pComp->Value(mkNamingAdapt(mkArrayAdaptMap(iClients, iClientCnt, mkIntPackAdapt<int32_t>), "Clients", -1));
472  pComp->Value(mkNamingAdapt(Data, "Data"));
473 }
474 
475 // *** C4PacketJoinData
476 
478 {
479  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iClientID), "ClientID", C4ClientIDUnknown));
480  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iStartCtrlTick), "CtrlTick", -1));
481  pComp->Value(mkNamingAdapt(mkParAdapt(GameStatus, true), "GameStatus"));
482  pComp->Value(mkNamingAdapt(Dynamic, "Dynamic"));
483  pComp->Value(mkNamingAdapt(ScenarioParameterDefs, "ParameterDefs"));
484  pComp->Value(Parameters);
485 }
486 
487 // *** C4PacketPing
488 
489 C4PacketPing::C4PacketPing(uint32_t iPacketCounter, uint32_t iRemotePacketCounter)
490  : tTime(C4TimeMilliseconds::Now()),
491  iPacketCounter(iPacketCounter)
492 {
493 }
494 
496 {
497  return C4TimeMilliseconds::Now() - tTime;
498 }
499 
501 {
502  uint32_t time = tTime.AsInt();
503  pComp->Value(mkNamingAdapt(time, "Time", 0U));
504  tTime = C4TimeMilliseconds(time);
505 
506  pComp->Value(mkNamingAdapt(iPacketCounter, "PacketCounter", 0U));
507 }
508 
509 // *** C4PacketResStatus
510 
512 
514  : iResID(iResID), Chunks(nChunks)
515 {
516 
517 }
518 
520 {
521  pComp->Value(mkNamingAdapt(iResID, "ResID"));
522  pComp->Value(mkNamingAdapt(Chunks, "Chunks"));
523 }
524 
525 // *** C4PacketResDiscover
526 
528 
529 bool C4PacketResDiscover::isIDPresent(int32_t iID) const
530 {
531  for (int32_t i = 0; i < iDisIDCnt; i++)
532  if (iDisIDs[i] == iID)
533  return true;
534  return false;
535 }
536 
538 {
539  if (iDisIDCnt + 1 >= int32_t(sizeof(iDisIDs) / sizeof(*iDisIDs))) return false;
540  // add
541  iDisIDs[iDisIDCnt++] = iID;
542  return true;
543 }
544 
546 {
547  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iDisIDCnt), "DiscoverCnt", 0));
548  pComp->Value(mkNamingAdapt(mkArrayAdapt(iDisIDs, iDisIDCnt), "Discovers", -1));
549 }
550 
551 // *** C4PacketResRequest
552 
553 C4PacketResRequest::C4PacketResRequest(int32_t inID, int32_t inChunk)
554  : iReqID(inID), iReqChunk(inChunk)
555 {
556 
557 }
558 
560 {
561  pComp->Value(mkNamingAdapt(iReqID, "ResID", -1));
562  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iReqChunk), "Chunk", -1));
563 }
564 
565 // *** C4PacketControlReq
566 
568  : iCtrlTick(inCtrlTick)
569 {
570 
571 }
572 
574 {
575  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCtrlTick), "CtrlTick", -1));
576 }
577 
578 // *** C4PacketActivateReq
579 
581 {
582  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iTick), "Tick", -1));
583 }
584 
585 
586 // *** C4PacketControlPkt
587 
589 {
590  pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(eDelivery), "Delivery", CDT_Queue));
591  pComp->Value(Ctrl);
592 }
C4PacketBase * pPkt
Definition: C4PacketBase.h:250
virtual bool hasNaming()
Definition: StdCompiler.h:58
StdStrBuf szMsg
Definition: C4Network2IO.h:380
Definition: StdBuf.h:29
C4IDPacket * pNext
Definition: C4PacketBase.h:254
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:181
const char * PacketNameByID(C4PacketType eID)
Definition: C4Packet2.cpp:136
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:500
void Clear()
Definition: C4Packet2.cpp:222
void Add(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:280
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:249
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:351
int32_t getPktCnt() const
Definition: C4Packet2.cpp:272
C4PacketType eID
Definition: C4PacketBase.h:249
uint8_t getStatus() const
Definition: C4NetIO.h:318
C4IDPacket * pFirst
Definition: C4PacketBase.h:277
bool AddDisID(int32_t iID)
Definition: C4Packet2.cpp:537
bool DoFwdTo(int32_t iClient) const
Definition: C4Packet2.cpp:442
C4PacketControlReq(int32_t iCtrlTick=-1)
Definition: C4Packet2.cpp:567
C4PacketType
Definition: C4PacketBase.h:76
uint32_t iPacketCounter
Definition: C4Network2IO.h:342
C4IDPacket * pLast
Definition: C4PacketBase.h:277
C4Network2ResChunkData Chunks
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77
const C4PktHandlingData PktHandlingData[]
Definition: C4Packet2.cpp:50
void Append(const C4PacketList &List)
Definition: C4Packet2.cpp:312
C4PacketType ID
Definition: C4PacketBase.h:204
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:559
void AddClient(int32_t iClient)
Definition: C4Packet2.cpp:460
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:588
void Take(C4PacketList &List)
Definition: C4Packet2.cpp:305
int32_t iClients[C4NetMaxClients]
Definition: C4Network2IO.h:398
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:477
int iCnt
Definition: TstC4NetIO.cpp:32
#define PKT_UNPACK(T)
Definition: C4Packet2.cpp:47
void Copy(size_t inSize)
Definition: StdBuf.h:225
StdArrayAdapt< T > mkArrayAdapt(T *pArray, int iSize)
Definition: StdAdaptors.h:328
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:153
void SetListType(bool fnNegativeList)
Definition: C4Packet2.cpp:455
bool isIDPresent(int32_t iID) const
Definition: C4Packet2.cpp:529
static C4PacketBase * unpack(StdCompiler *pComp)
Definition: C4Packet2.cpp:30
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:407
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:455
void Clear()
Definition: C4Packet2.cpp:318
StdCopyBuf Data
Definition: C4PacketBase.h:226
void Delete(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:345
void Value(const T &rStruct)
Definition: StdCompiler.h:161
const int32_t C4ClientIDUnknown
Definition: C4Client.h:24
StdBuf getPBuf() const
Definition: C4NetIO.h:321
C4PacketPing(uint32_t iPacketCounter=0, uint32_t iRemotePacketCounter=0)
Definition: C4Packet2.cpp:489
virtual bool isDeserializer()
Definition: StdCompiler.h:53
bool fNegativeList
Definition: C4Network2IO.h:397
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:573
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:777
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:467
C4PacketResRequest(int32_t iID=-1, int32_t iChunk=-1)
Definition: C4Packet2.cpp:553
int32_t iClientCnt
Definition: C4Network2IO.h:399
virtual ~C4PacketBase()
void AddHead(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:287
int32_t iVer
Definition: C4Network2IO.h:358
void Remove(C4IDPacket *pPkt)
Definition: C4Packet2.cpp:324
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:519
C4IDPacket * firstPkt() const
Definition: C4PacketBase.h:280
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:545
uint32_t AsInt() const
C4TimeMilliseconds tTime
Definition: C4Network2IO.h:341
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:476
void SetData(const StdBuf &Pkt)
Definition: C4Packet2.cpp:450
C4NetIOPacket getRef() const
Definition: C4NetIO.h:324
C4NetIOPacket pack(const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
Definition: C4Packet2.cpp:150
C4PacketBase * getPkt() const
Definition: C4PacketBase.h:258
C4ClientCore CCore
Definition: C4Network2IO.h:360
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
Definition: StdAdaptors.h:331
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:228
~C4IDPacket() override
Definition: C4Packet2.cpp:203
StdCopyBuf Data
Definition: C4Network2IO.h:400
uint32_t iConnID
Definition: C4Network2IO.h:359
uint32_t getTravelTime() const
Definition: C4Packet2.cpp:495
Definition: C4Network2IO.h:417
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78
void Default()
Definition: C4Packet2.cpp:217
void unpack(const C4NetIOPacket &Pkt, char *pStatus=nullptr)
Definition: C4Packet2.cpp:160
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:426
static C4TimeMilliseconds Now()
~C4PacketList() override
Definition: C4Packet2.cpp:267
C4IDPacket * nextPkt(C4IDPacket *pPkt) const
Definition: C4PacketBase.h:281
StdCopyStrBuf Password
Definition: C4Network2IO.h:361
const char * getPktName() const
Definition: C4Packet2.cpp:208
void CompileFunc(StdCompiler *pComp) override
Definition: C4Packet2.cpp:580
const int C4NetMaxClients
Definition: C4Network2IO.h:41