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 136 of file C4Config.h.

Member Function Documentation

void C4ConfigNetwork::CheckPortsForCollisions ( )

Definition at line 600 of file C4Config.cpp.

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

Referenced by C4Network2::InitNetIO().

601 {
602  // check for port collisions
603  if (PortTCP != -1 && PortTCP == PortRefServer)
604  {
605  LogSilentF("Network: TCP Port collision, setting defaults");
608  }
609  if (PortUDP != -1 && PortUDP == PortDiscovery)
610  {
611  LogSilentF("Network: UDP Port collision, setting defaults");
614  }
615 }
int32_t PortDiscovery
Definition: C4Config.h:153
const int16_t C4NetStdPortUDP
Definition: C4Network2.h:30
int32_t PortRefServer
Definition: C4Config.h:153
const int16_t C4NetStdPortTCP
Definition: C4Network2.h:29
bool LogSilentF(const char *strMessage,...)
Definition: C4Log.cpp:270
const int16_t C4NetStdPortRefServer
Definition: C4Network2.h:32
const int16_t C4NetStdPortDiscovery
Definition: C4Network2.h:31
int32_t PortTCP
Definition: C4Config.h:153
int32_t PortUDP
Definition: C4Config.h:153

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ConfigNetwork::CompileFunc ( StdCompiler pComp)

Definition at line 150 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.

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

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 627 of file C4Config.cpp.

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

Referenced by C4Network2::LeaguePlrAuth().

628 {
629  // check if last login matches and store if desired
630  if (LastLeagueServer == szServer && LastLeaguePlayerName == szPlayerName)
631  {
632  pAccount->Copy(LastLeagueAccount);
633  pLoginToken->Copy(LastLeagueLoginToken);
634  return true;
635  }
636  return false;
637 }
StdCopyStrBuf LastLeagueLoginToken
Definition: C4Config.h:161
StdCopyStrBuf LastLeaguePlayerName
Definition: C4Config.h:161
StdCopyStrBuf LastLeagueAccount
Definition: C4Config.h:161
void Copy()
Definition: StdBuf.h:467
StdCopyStrBuf LastLeagueServer
Definition: C4Config.h:161

Here is the call graph for this function:

Here is the caller graph for this function:

const char * C4ConfigNetwork::GetLeagueServerAddress ( )

Definition at line 590 of file C4Config.cpp.

References AlternateServerAddress, and UseAlternateServer.

Referenced by C4Network2::InitLeague().

591 {
592  // Alternate (configurable) league server
593  if (UseAlternateServer)
594  return AlternateServerAddress;
595  // Standard (hardcoded) official league server
596  else
597  return "league.openclonk.org:80/league.php";
598 }
char AlternateServerAddress[CFG_MaxString+1]
Definition: C4Config.h:159
int32_t UseAlternateServer
Definition: C4Config.h:152

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 617 of file C4Config.cpp.

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

Referenced by C4Network2::LeaguePlrAuth().

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

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 167 of file C4Config.h.

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

int32_t C4ConfigNetwork::ControlMode

Definition at line 155 of file C4Config.h.

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

int32_t C4ConfigNetwork::ControlPreSend

Definition at line 140 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::ControlRate

Definition at line 139 of file C4Config.h.

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

int32_t C4ConfigNetwork::EnableUPnP
StdCopyStrBuf C4ConfigNetwork::LastLeagueAccount

Definition at line 161 of file C4Config.h.

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

StdCopyStrBuf C4ConfigNetwork::LastLeagueLoginToken

Definition at line 161 of file C4Config.h.

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

StdCopyStrBuf C4ConfigNetwork::LastLeaguePlayerName

Definition at line 161 of file C4Config.h.

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

StdCopyStrBuf C4ConfigNetwork::LastLeagueServer

Definition at line 161 of file C4Config.h.

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

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

Definition at line 141 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MasterKeepPeriod

Definition at line 149 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MasterReferencePeriod

Definition at line 150 of file C4Config.h.

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

int32_t C4ConfigNetwork::MasterServerActive

Definition at line 148 of file C4Config.h.

Referenced by CompileFunc().

int32_t C4ConfigNetwork::MaxLoadFileSize

Definition at line 157 of file C4Config.h.

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

int32_t C4ConfigNetwork::MaxResSearchRecursion

Definition at line 144 of file C4Config.h.

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

int32_t C4ConfigNetwork::NoReferenceRequest

Definition at line 143 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 160 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: