OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PacketBase.h File Reference
#include "network/C4NetIO.h"
Include dependency graph for C4PacketBase.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  C4PacketBase
 
struct  C4NetFilenameAdapt
 
struct  C4PktHandlingData
 
class  C4PktBuf
 
class  C4IDPacket
 
class  C4PacketList
 

Enumerations

enum  C4PacketType {
  PID_None = 0xFF, PID_Ping = 0x00, PID_Pong = 0x01, PID_Conn = 0x02,
  PID_ConnRe = 0x03, PID_FwdReq = 0x04, PID_Fwd = 0x05, PID_PostMortem = 0x06,
  PID_PacketLogStart = 0x04, PID_Status = 0x10, PID_StatusAck = 0x11, PID_Addr = 0x12,
  PID_ClientActReq = 0x13, PID_JoinData = 0x15, PID_PlayerInfoUpdReq = 0x16, PID_LeagueRoundResults = 0x17,
  PID_LobbyCountdown = 0x20, PID_SetScenarioParameter = 0x21, PID_NetResDis = 0x30, PID_NetResStat = 0x31,
  PID_NetResDerive = 0x32, PID_NetResReq = 0x33, PID_NetResData = 0x34, PID_Control = 0x40,
  PID_ControlReq = 0x41, PID_ControlPkt = 0x42, PID_ExecSyncCtrl = 0x43, CID_First = 0x80,
  CID_ClientJoin = CID_First | 0x00, CID_ClientUpdate = CID_First | 0x01, CID_ClientRemove = CID_First | 0x02, CID_Vote = CID_First | 0x03,
  CID_VoteEnd = CID_First | 0x04, CID_SyncCheck = CID_First | 0x05, CID_Synchronize = CID_First | 0x06, CID_Set = CID_First | 0x07,
  CID_Script = CID_First | 0x08, CID_MsgBoardReply = CID_First | 0x09, CID_MsgBoardCmd = CID_First | 0x0A, CID_PlrInfo = CID_First | 0x10,
  CID_JoinPlr = CID_First | 0x11, CID_RemovePlr = CID_First | 0x12, CID_PlrSelect = CID_First | 0x20, CID_PlrControl = CID_First | 0x21,
  CID_Message = CID_First | 0x23, CID_PlrAction = CID_First | 0x24, CID_PlrMouseMove = CID_First | 0x25, CID_EMMoveObj = CID_First | 0x30,
  CID_EMDrawTool = CID_First | 0x31, CID_ReInitScenario = CID_First | 0x32, CID_EditGraph = CID_First | 0x33, CID_DebugRec = CID_First | 0x40,
  CID_MenuCommand = CID_First | 0x41
}
 
enum  C4PacketClass { PC_Network, PC_Control }
 
enum  C4PacketHandlerID {
  PH_C4Network2IO = 1 << 0, PH_C4Network2 = 1 << 1, PH_C4GUIMainDlg = 1 << 2, PH_C4Network2ClientList = 1 << 3,
  PH_C4Network2Players = 1 << 4, PH_C4Network2ResList = 1 << 5, PH_C4GameControlNetwork = 1 << 6
}
 

Functions

C4NetIOPacket MkC4NetIOPacket (char cStatus, const class C4PacketBase &Pkt, const C4NetIO::addr_t &addr=C4NetIO::addr_t())
 
C4NetFilenameAdapt mkNetFilenameAdapt (StdStrBuf &FileName)
 
const char * PacketNameByID (C4PacketType eID)
 

Variables

const C4PktHandlingData PktHandlingData []
 

Enumeration Type Documentation

Enumerator
PC_Network 
PC_Control 

Definition at line 179 of file C4PacketBase.h.

180 {
181  PC_Network, // network packet - internal stuff
182  PC_Control // control packet - game data (saved in records)
183 };
Enumerator
PH_C4Network2IO 
PH_C4Network2 
PH_C4GUIMainDlg 
PH_C4Network2ClientList 
PH_C4Network2Players 
PH_C4Network2ResList 
PH_C4GameControlNetwork 

Definition at line 186 of file C4PacketBase.h.

187 {
188  PH_C4Network2IO = 1 << 0, // network i/o class
189  PH_C4Network2 = 1 << 1, // main network class
190  PH_C4GUIMainDlg = 1 << 2, // network lobby class
191  PH_C4Network2ClientList = 1 << 3, // client list class
192  PH_C4Network2Players = 1 << 4, // player list class
193  PH_C4Network2ResList = 1 << 5, // resource list class
194  PH_C4GameControlNetwork = 1 << 6, // network control class
195 };
Enumerator
PID_None 
PID_Ping 
PID_Pong 
PID_Conn 
PID_ConnRe 
PID_FwdReq 
PID_Fwd 
PID_PostMortem 
PID_PacketLogStart 
PID_Status 
PID_StatusAck 
PID_Addr 
PID_ClientActReq 
PID_JoinData 
PID_PlayerInfoUpdReq 
PID_LeagueRoundResults 
PID_LobbyCountdown 
PID_SetScenarioParameter 
PID_NetResDis 
PID_NetResStat 
PID_NetResDerive 
PID_NetResReq 
PID_NetResData 
PID_Control 
PID_ControlReq 
PID_ControlPkt 
PID_ExecSyncCtrl 
CID_First 
CID_ClientJoin 
CID_ClientUpdate 
CID_ClientRemove 
CID_Vote 
CID_VoteEnd 
CID_SyncCheck 
CID_Synchronize 
CID_Set 
CID_Script 
CID_MsgBoardReply 
CID_MsgBoardCmd 
CID_PlrInfo 
CID_JoinPlr 
CID_RemovePlr 
CID_PlrSelect 
CID_PlrControl 
CID_Message 
CID_PlrAction 
CID_PlrMouseMove 
CID_EMMoveObj 
CID_EMDrawTool 
CID_ReInitScenario 
CID_EditGraph 
CID_DebugRec 
CID_MenuCommand 

Definition at line 76 of file C4PacketBase.h.

77 {
78  PID_None = 0xFF,
79 
80  // *** network
81 
82  // * base packets
83  // ping
84  PID_Ping = 0x00,
85  PID_Pong = 0x01,
86 
87  // connecting
88  PID_Conn = 0x02,
89  PID_ConnRe = 0x03,
90 
91  // msg forwarding
92  PID_FwdReq = 0x04,
93  PID_Fwd = 0x05,
94 
95  // post mortem
96  PID_PostMortem = 0x06,
97 
98  // (packets before this ID won't be recovered post-mortem)
99  PID_PacketLogStart = 0x04,
100 
101  // * game
102  // game status
103  PID_Status = 0x10,
104  PID_StatusAck = 0x11,
105 
106  // client address propagation
107  PID_Addr = 0x12,
108 
109  // activation request
110  PID_ClientActReq = 0x13,
111 
112  // all data a client needs to get started
113  PID_JoinData = 0x15,
114 
115  // player info
116  PID_PlayerInfoUpdReq = 0x16,
117 
118  // round results league info
119  PID_LeagueRoundResults = 0x17,
120 
121  // * lobby
122  PID_LobbyCountdown = 0x20,
123  PID_SetScenarioParameter = 0x21, // scenario parameter update
124 
125  // * resources
126  PID_NetResDis = 0x30,
127  PID_NetResStat = 0x31,
128  PID_NetResDerive = 0x32,
129  PID_NetResReq = 0x33,
130  PID_NetResData = 0x34,
131 
132  // * control
133  PID_Control = 0x40,
134  PID_ControlReq = 0x41,
135  PID_ControlPkt = 0x42,
136  PID_ExecSyncCtrl = 0x43,
137 
138  // *** control
139  CID_First = 0x80,
140 
141  CID_ClientJoin = CID_First | 0x00,
142  CID_ClientUpdate = CID_First | 0x01,
143  CID_ClientRemove = CID_First | 0x02,
144 
145  CID_Vote = CID_First | 0x03,
146  CID_VoteEnd = CID_First | 0x04,
147 
148  CID_SyncCheck = CID_First | 0x05,
149  CID_Synchronize = CID_First | 0x06,
150  CID_Set = CID_First | 0x07,
151  CID_Script = CID_First | 0x08,
152  CID_MsgBoardReply = CID_First | 0x09,
153  CID_MsgBoardCmd = CID_First | 0x0A,
154 
155  CID_PlrInfo = CID_First | 0x10,
156  CID_JoinPlr = CID_First | 0x11,
157  CID_RemovePlr = CID_First | 0x12,
158 
159  CID_PlrSelect = CID_First | 0x20,
160  CID_PlrControl = CID_First | 0x21,
161 
162  CID_Message = CID_First | 0x23,
163  CID_PlrAction = CID_First | 0x24,
164  CID_PlrMouseMove = CID_First | 0x25,
165 
166  CID_EMMoveObj = CID_First | 0x30,
167  CID_EMDrawTool = CID_First | 0x31,
169  CID_EditGraph = CID_First | 0x33,
170 
171  CID_DebugRec = CID_First | 0x40,
172  CID_MenuCommand = CID_First | 0x41,
173 
174  // Note: There are some more packet types in src/netpuncher/C4PuncherPacket.h
175  // They have been picked to be distinct from these for safety, not for necessary.
176 };

Function Documentation

C4NetIOPacket MkC4NetIOPacket ( char  cStatus,
const class C4PacketBase Pkt,
const C4NetIO::addr_t addr = C4NetIO::addr_t() 
)
inline

Definition at line 40 of file C4PacketBase.h.

References C4PacketBase::pack().

Referenced by C4GameLobby::Countdown::Abort(), C4Network2Client::AddAddr(), C4Network2ClientList::BroadcastMsgToClients(), C4Network2::ChangeGameStatus(), C4GameControlNetwork::CheckCompleteCtrl(), C4Network2::CheckStatusAck(), C4Network2::CheckStatusReached(), C4Network2Client::CloseConns(), C4GameLobby::Countdown::Countdown(), C4GameControlNetwork::DoInput(), C4GameControlNetwork::ExecSyncControl(), C4Network2Res::FinishDerive(), C4Network2::HandleConn(), C4GameControlNetwork::HandleControlReq(), C4Network2IO::HandleFwdReq(), C4Network2IO::HandlePacket(), C4Network2::HandleStatusAck(), C4GameControlNetwork::Init(), C4Network2Players::JoinLocalPlayer(), C4Network2::LeagueEnd(), C4Network2::OnDisconn(), C4GameLobby::Countdown::OnSec1Timer(), C4GameControlNetwork::PackCompleteCtrl(), C4Network2IO::Ping(), C4Network2IO::Punch(), C4Network2::RequestActivate(), C4Network2Players::RequestPlayerInfoUpdate(), C4Network2Client::SendAddresses(), C4Network2Res::SendChunk(), C4Network2IO::SendConnPackets(), C4Network2ResList::SendDiscover(), C4Network2::SendJoinData(), C4Network2ClientList::SendMsgToClient(), C4Network2Res::SendStatus(), C4GameControlNetwork::SetCtrlMode(), C4Network2Res::StartLoad(), and C4Network2::UpdateChaseTarget().

41 {
42  return Pkt.pack(cStatus, addr);
43 }

Here is the call graph for this function:

Here is the caller graph for this function:

C4NetFilenameAdapt mkNetFilenameAdapt ( StdStrBuf FileName)
inline

Definition at line 73 of file C4PacketBase.h.

Referenced by C4Network2ResCore::CompileFunc().

73 { return C4NetFilenameAdapt(FileName); }

Here is the caller graph for this function:

const char* PacketNameByID ( C4PacketType  eID)

Definition at line 136 of file C4Packet2.cpp.

References C4PktHandlingData::ID, and PID_None.

137 {
138  for (const C4PktHandlingData *pPData = PktHandlingData; pPData->ID != PID_None; pPData++)
139  if (pPData->ID == eID)
140  return pPData->Name;
141  return "?!?";
142 }
const C4PktHandlingData PktHandlingData[]
Definition: C4Packet2.cpp:51
C4PacketType ID
Definition: C4PacketBase.h:201

Variable Documentation

const C4PktHandlingData PktHandlingData[]

Definition at line 51 of file C4Packet2.cpp.

Referenced by C4Network2IO::HandlePacket().