OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ConfigNetwork Class Reference

#include <C4Config.h>

Collaboration diagram for C4ConfigNetwork:
[legend]

Public Member Functions

void CompileFunc (StdCompiler *pComp)
 
const char * GetLeagueServerAddress ()
 
void CheckPortsForCollisions ()
 
void SetLeagueLoginData (const char *szServer, const char *szPlayerName, const char *szAccount, const char *szLoginToken)
 
bool GetLeagueLoginData (const char *szServer, const char *szPlayerName, StdStrBuf *pAccount, StdStrBuf *pLoginToken) const
 

Public Attributes

int32_t ControlRate
 
int32_t ControlPreSend
 
int32_t Lobby
 
int32_t NoRuntimeJoin
 
int32_t NoReferenceRequest
 
int32_t MaxResSearchRecursion
 
char WorkPath [CFG_MaxString+1]
 
ValidatedStdCopyStrBuf
< C4InVal::VAL_Comment
Comment
 
int32_t MasterServerSignUp
 
int32_t MasterServerActive
 
int32_t MasterKeepPeriod
 
int32_t MasterReferencePeriod
 
int32_t LeagueServerSignUp
 
int32_t UseAlternateServer
 
int32_t PortTCP
 
int32_t PortUDP
 
int32_t PortDiscovery
 
int32_t PortRefServer
 
int32_t EnableUPnP
 
int32_t ControlMode
 
ValidatedStdCopyStrBuf
< C4InVal::VAL_NameAllowEmpty
Nick
 
int32_t MaxLoadFileSize
 
char LastPassword [CFG_MaxString+1]
 
char AlternateServerAddress [CFG_MaxString+1]
 
char PuncherAddress [CFG_MaxString+1]
 
StdCopyStrBuf LastLeagueServer
 
StdCopyStrBuf LastLeaguePlayerName
 
StdCopyStrBuf LastLeagueAccount
 
StdCopyStrBuf LastLeagueLoginToken
 
int32_t AsyncMaxWait
 
int32_t PacketLogging
 

Detailed Description

Definition at line 137 of file C4Config.h.

Member Function Documentation

void C4ConfigNetwork::CheckPortsForCollisions ( )

Definition at line 604 of file C4Config.cpp.

References C4NetStdPortDiscovery, C4NetStdPortRefServer, C4NetStdPortTCP, C4NetStdPortUDP, LogSilentF(), PortDiscovery, PortRefServer, PortTCP, and PortUDP.

Referenced by C4Network2::InitNetIO().

605 {
606  // check for port collisions
607  if (PortTCP != -1 && PortTCP == PortRefServer)
608  {
609  LogSilentF("Network: TCP Port collision, setting defaults");
612  }
613  if (PortUDP != -1 && PortUDP == PortDiscovery)
614  {
615  LogSilentF("Network: UDP Port collision, setting defaults");
618  }
619 }
int32_t PortDiscovery
Definition: C4Config.h:154
const int16_t C4NetStdPortUDP
Definition: C4Network2.h:30
int32_t PortRefServer
Definition: C4Config.h:154
const int16_t C4NetStdPortTCP
Definition: C4Network2.h:29
bool LogSilentF(const char *strMessage,...)
Definition: C4Log.cpp:263
const int16_t C4NetStdPortRefServer
Definition: C4Network2.h:32
const int16_t C4NetStdPortDiscovery
Definition: C4Network2.h:31
int32_t PortTCP
Definition: C4Config.h:154
int32_t PortUDP
Definition: C4Config.h:154

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ConfigNetwork::CompileFunc ( StdCompiler pComp)

Definition at line 154 of file C4Config.cpp.

References AlternateServerAddress, AsyncMaxWait, C4NetStdPortDiscovery, C4NetStdPortRefServer, C4NetStdPortTCP, C4NetStdPortUDP, Comment, ControlMode, ControlPreSend, ControlRate, EnableUPnP, LastLeagueAccount, LastLeagueLoginToken, LastLeaguePlayerName, LastLeagueServer, LastPassword, LeagueServerSignUp, Lobby, MasterKeepPeriod, MasterReferencePeriod, MasterServerActive, MasterServerSignUp, MaxLoadFileSize, MaxResSearchRecursion, mkNamingAdapt(), mkParAdapt(), Nick, NoReferenceRequest, NoRuntimeJoin, PacketLogging, PortDiscovery, PortRefServer, PortTCP, PortUDP, PuncherAddress, StdCompiler::RCT_All, s, UseAlternateServer, StdCompiler::Value(), and WorkPath.

155 {
156  pComp->Value(mkNamingAdapt(ControlRate, "ControlRate", 3 ,false, true));
157  pComp->Value(mkNamingAdapt(ControlPreSend, "ControlPreSend", -1 ));
158  pComp->Value(mkNamingAdapt(s(WorkPath), "WorkPath", "Network" ,false, true));
159  pComp->Value(mkNamingAdapt(Lobby, "Lobby", 0 ));
160  pComp->Value(mkNamingAdapt(NoRuntimeJoin, "NoRuntimeJoin", 1 ,false, true));
161  pComp->Value(mkNamingAdapt(NoReferenceRequest, "NoReferenceRequest", 0 ));
162  pComp->Value(mkNamingAdapt(MaxResSearchRecursion, "MaxResSearchRecursion",1 ,false, true));
163  pComp->Value(mkNamingAdapt(Comment, "Comment", "" ,false, true));
164  pComp->Value(mkNamingAdapt(PortTCP, "PortTCP", C4NetStdPortTCP ,false, true));
165  pComp->Value(mkNamingAdapt(PortUDP, "PortUDP", C4NetStdPortUDP ,false, true));
166  pComp->Value(mkNamingAdapt(EnableUPnP, "EnableUPnP", 1 , false, true));
167  pComp->Value(mkNamingAdapt(PortDiscovery, "PortDiscovery", C4NetStdPortDiscovery ,false, true));
168  pComp->Value(mkNamingAdapt(PortRefServer, "PortRefServer", C4NetStdPortRefServer ,false, true));
169  pComp->Value(mkNamingAdapt(ControlMode, "ControlMode", 0 ));
170  pComp->Value(mkNamingAdapt(Nick, "Nick", "" ,false, true));
171  pComp->Value(mkNamingAdapt(MaxLoadFileSize, "MaxLoadFileSize", 5*1024*1024 ,false, true));
172 
173  pComp->Value(mkNamingAdapt(MasterServerSignUp, "MasterServerSignUp", 1 ));
174  pComp->Value(mkNamingAdapt(MasterServerActive, "MasterServerActive", 0 ));
175  pComp->Value(mkNamingAdapt(MasterKeepPeriod, "MasterKeepPeriod", 60 ));
176  pComp->Value(mkNamingAdapt(MasterReferencePeriod, "MasterReferencePeriod",120 ));
177  pComp->Value(mkNamingAdapt(LeagueServerSignUp, "LeagueServerSignUp", 0 ));
178  pComp->Value(mkNamingAdapt(UseAlternateServer, "UseAlternateServer", 0 ));
179  pComp->Value(mkNamingAdapt(s(AlternateServerAddress),"AlternateServerAddress", "league.openclonk.org:80/league.php"));
180  pComp->Value(mkNamingAdapt(s(LastPassword), "LastPassword", "Wipf" ));
181 #ifdef WITH_AUTOMATIC_UPDATE
182  pComp->Value(mkNamingAdapt(s(UpdateServerAddress), "UpdateServerAddress", "www.openclonk.org:80/update/"));
183  pComp->Value(mkNamingAdapt(AutomaticUpdate, "AutomaticUpdate", 0 ,false, true));
184  pComp->Value(mkNamingAdapt(LastUpdateTime, "LastUpdateTime", 0 ));
185 #endif
186  pComp->Value(mkNamingAdapt(AsyncMaxWait, "AsyncMaxWait", 2 ));
187  pComp->Value(mkNamingAdapt(PacketLogging, "PacketLogging", 0 ));
188 
189 
190  pComp->Value(mkNamingAdapt(s(PuncherAddress), "PuncherAddress", "netpuncher.openclonk.org:11115"));
191  pComp->Value(mkNamingAdapt(mkParAdapt(LastLeagueServer, StdCompiler::RCT_All), "LastLeagueServer", "" ));
192  pComp->Value(mkNamingAdapt(mkParAdapt(LastLeaguePlayerName, StdCompiler::RCT_All), "LastLeaguePlayerName", "" ));
193  pComp->Value(mkNamingAdapt(mkParAdapt(LastLeagueAccount, StdCompiler::RCT_All), "LastLeagueAccount", "" ));
194  pComp->Value(mkNamingAdapt(mkParAdapt(LastLeagueLoginToken, StdCompiler::RCT_All), "LastLeagueLoginToken", "" ));
195 }
int32_t MaxResSearchRecursion
Definition: C4Config.h:145
int32_t PortDiscovery
Definition: C4Config.h:154
const int16_t C4NetStdPortUDP
Definition: C4Network2.h:30
StdCopyStrBuf LastLeagueLoginToken
Definition: C4Config.h:162
int32_t PacketLogging
Definition: C4Config.h:169
int32_t PortRefServer
Definition: C4Config.h:154
int32_t MaxLoadFileSize
Definition: C4Config.h:158
ValidatedStdCopyStrBuf< C4InVal::VAL_Comment > Comment
Definition: C4Config.h:147
char PuncherAddress[CFG_MaxString+1]
Definition: C4Config.h:161
int32_t ControlRate
Definition: C4Config.h:140
ValidatedStdCopyStrBuf< C4InVal::VAL_NameAllowEmpty > Nick
Definition: C4Config.h:157
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
const int16_t C4NetStdPortTCP
Definition: C4Network2.h:29
int32_t NoReferenceRequest
Definition: C4Config.h:144
const int16_t C4NetStdPortRefServer
Definition: C4Network2.h:32
const int16_t C4NetStdPortDiscovery
Definition: C4Network2.h:31
char LastPassword[CFG_MaxString+1]
Definition: C4Config.h:159
char AlternateServerAddress[CFG_MaxString+1]
Definition: C4Config.h:160
StdCopyStrBuf LastLeaguePlayerName
Definition: C4Config.h:162
void Value(const T &rStruct)
Definition: StdCompiler.h:171
char WorkPath[CFG_MaxString+1]
Definition: C4Config.h:146
int32_t MasterKeepPeriod
Definition: C4Config.h:150
int32_t ControlPreSend
Definition: C4Config.h:141
int32_t LeagueServerSignUp
Definition: C4Config.h:152
int32_t MasterServerSignUp
Definition: C4Config.h:148
int32_t MasterReferencePeriod
Definition: C4Config.h:151
StdCopyStrBuf LastLeagueAccount
Definition: C4Config.h:162
int32_t ControlMode
Definition: C4Config.h:156
int32_t NoRuntimeJoin
Definition: C4Config.h:143
int32_t AsyncMaxWait
Definition: C4Config.h:168
int32_t MasterServerActive
Definition: C4Config.h:149
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:459
int32_t Lobby
Definition: C4Config.h:142
int32_t EnableUPnP
Definition: C4Config.h:155
int32_t UseAlternateServer
Definition: C4Config.h:153
int32_t PortTCP
Definition: C4Config.h:154
#define s
StdCopyStrBuf LastLeagueServer
Definition: C4Config.h:162
int32_t PortUDP
Definition: C4Config.h:154

Here is the call graph for this function:

bool C4ConfigNetwork::GetLeagueLoginData ( const char *  szServer,
const char *  szPlayerName,
StdStrBuf pAccount,
StdStrBuf pLoginToken 
) const

Definition at line 631 of file C4Config.cpp.

References StdStrBuf::Copy(), LastLeagueAccount, LastLeagueLoginToken, LastLeaguePlayerName, and LastLeagueServer.

Referenced by C4Network2::LeaguePlrAuth().

632 {
633  // check if last login matches and store if desired
634  if (LastLeagueServer == szServer && LastLeaguePlayerName == szPlayerName)
635  {
636  pAccount->Copy(LastLeagueAccount);
637  pLoginToken->Copy(LastLeagueLoginToken);
638  return true;
639  }
640  return false;
641 }
StdCopyStrBuf LastLeagueLoginToken
Definition: C4Config.h:162
StdCopyStrBuf LastLeaguePlayerName
Definition: C4Config.h:162
StdCopyStrBuf LastLeagueAccount
Definition: C4Config.h:162
void Copy()
Definition: StdBuf.h:475
StdCopyStrBuf LastLeagueServer
Definition: C4Config.h:162

Here is the call graph for this function:

Here is the caller graph for this function:

const char * C4ConfigNetwork::GetLeagueServerAddress ( )

Definition at line 594 of file C4Config.cpp.

References AlternateServerAddress, and UseAlternateServer.

Referenced by C4Network2::InitLeague().

595 {
596  // Alternate (configurable) league server
597  if (UseAlternateServer)
598  return AlternateServerAddress;
599  // Standard (hardcoded) official league server
600  else
601  return "league.openclonk.org:80/league.php";
602 }
char AlternateServerAddress[CFG_MaxString+1]
Definition: C4Config.h:160
int32_t UseAlternateServer
Definition: C4Config.h:153

Here is the caller graph for this function:

void C4ConfigNetwork::SetLeagueLoginData ( const char *  szServer,
const char *  szPlayerName,
const char *  szAccount,
const char *  szLoginToken 
)

Definition at line 621 of file C4Config.cpp.

References StdStrBuf::Copy(), LastLeagueAccount, LastLeagueLoginToken, LastLeaguePlayerName, and LastLeagueServer.

Referenced by C4Network2::LeaguePlrAuth().

622 {
623  // ideally, there would be a list to store multiple logins
624  // however, we don't really support multiplayer at one computer at the moment anyway
625  LastLeagueServer.Copy(szServer);
626  LastLeaguePlayerName.Copy(szPlayerName);
627  LastLeagueAccount.Copy(szAccount);
628  LastLeagueLoginToken.Copy(szLoginToken);
629 }
StdCopyStrBuf LastLeagueLoginToken
Definition: C4Config.h:162
StdCopyStrBuf LastLeaguePlayerName
Definition: C4Config.h:162
StdCopyStrBuf LastLeagueAccount
Definition: C4Config.h:162
void Copy()
Definition: StdBuf.h:475
StdCopyStrBuf LastLeagueServer
Definition: C4Config.h:162

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

char C4ConfigNetwork::AlternateServerAddress[CFG_MaxString+1]
int32_t C4ConfigNetwork::AsyncMaxWait

Definition at line 168 of file C4Config.h.

Referenced by CompileFunc(), and C4GameControlNetwork::PackCompleteCtrl().

int32_t C4ConfigNetwork::ControlMode

Definition at line 156 of file C4Config.h.

Referenced by CompileFunc(), and C4Network2::InitHost().

int32_t C4ConfigNetwork::ControlPreSend

Definition at line 141 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::ControlRate

Definition at line 140 of file C4Config.h.

Referenced by CompileFunc(), C4GameControl::Default(), and C4GameParameters::Load().

int32_t C4ConfigNetwork::EnableUPnP
StdCopyStrBuf C4ConfigNetwork::LastLeagueAccount

Definition at line 162 of file C4Config.h.

Referenced by CompileFunc(), GetLeagueLoginData(), and SetLeagueLoginData().

StdCopyStrBuf C4ConfigNetwork::LastLeagueLoginToken

Definition at line 162 of file C4Config.h.

Referenced by CompileFunc(), GetLeagueLoginData(), and SetLeagueLoginData().

StdCopyStrBuf C4ConfigNetwork::LastLeaguePlayerName

Definition at line 162 of file C4Config.h.

Referenced by CompileFunc(), GetLeagueLoginData(), and SetLeagueLoginData().

StdCopyStrBuf C4ConfigNetwork::LastLeagueServer

Definition at line 162 of file C4Config.h.

Referenced by CompileFunc(), GetLeagueLoginData(), and SetLeagueLoginData().

char C4ConfigNetwork::LastPassword[CFG_MaxString+1]
int32_t C4ConfigNetwork::Lobby

Definition at line 142 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MasterKeepPeriod

Definition at line 150 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MasterReferencePeriod

Definition at line 151 of file C4Config.h.

Referenced by CompileFunc(), and C4Network2::LeagueUpdate().

int32_t C4ConfigNetwork::MasterServerActive

Definition at line 149 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MaxLoadFileSize

Definition at line 158 of file C4Config.h.

Referenced by CompileFunc(), and C4Network2Res::GetStandalone().

int32_t C4ConfigNetwork::MaxResSearchRecursion

Definition at line 145 of file C4Config.h.

Referenced by CompileFunc(), and C4Network2Res::SetByCore().

int32_t C4ConfigNetwork::NoReferenceRequest

Definition at line 144 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::NoRuntimeJoin
int32_t C4ConfigNetwork::PacketLogging
int32_t C4ConfigNetwork::PortRefServer
char C4ConfigNetwork::PuncherAddress[CFG_MaxString+1]

Definition at line 161 of file C4Config.h.

Referenced by CompileFunc(), and C4Network2::InitHost().

char C4ConfigNetwork::WorkPath[CFG_MaxString+1]

The documentation for this class was generated from the following files: