OpenClonk
C4ConfigNetwork Class Reference

#include <C4Config.h>

Collaboration diagram for C4ConfigNetwork:
[legend]

Public Member Functions

void CompileFunc (StdCompiler *compiler)
 
const char * GetLeagueServerAddress ()
 
const char * GetModDatabaseServerAddress ()
 
void CheckPortsForCollisions ()
 
void SetLeagueLoginData (const char *server_name, const char *player_name, const char *account, const char *login_token)
 
bool GetLeagueLoginData (const char *server_name, const char *player_name, StdStrBuf *account, StdStrBuf *login_token) 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_CommentComment
 
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_NameAllowEmptyNick
 
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 UseAlternateModDatabaseServer
 
char AlternateModDatabaseServerAddress [CFG_MaxString+1]
 
int32_t AsyncMaxWait
 
int32_t PacketLogging
 

Detailed Description

Definition at line 136 of file C4Config.h.

Member Function Documentation

◆ CheckPortsForCollisions()

void C4ConfigNetwork::CheckPortsForCollisions ( )

Definition at line 685 of file C4Config.cpp.

686 {
687  // check for port collisions
688  if (PortTCP != -1 && PortTCP == PortRefServer)
689  {
690  LogSilentF("Network: TCP Port collision, setting defaults");
693  }
694  if (PortUDP != -1 && PortUDP == PortDiscovery)
695  {
696  LogSilentF("Network: UDP Port collision, setting defaults");
699  }
700 }
bool LogSilentF(const char *strMessage,...)
Definition: C4Log.cpp:272
const int16_t C4NetStdPortRefServer
Definition: C4Network2.h:32
const int16_t C4NetStdPortDiscovery
Definition: C4Network2.h:31
const int16_t C4NetStdPortUDP
Definition: C4Network2.h:30
const int16_t C4NetStdPortTCP
Definition: C4Network2.h:29
int32_t PortUDP
Definition: C4Config.h:153
int32_t PortRefServer
Definition: C4Config.h:153
int32_t PortDiscovery
Definition: C4Config.h:153
int32_t PortTCP
Definition: C4Config.h:153

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

Referenced by C4Network2::InitNetIO().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompileFunc()

void C4ConfigNetwork::CompileFunc ( StdCompiler compiler)

Definition at line 159 of file C4Config.cpp.

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

References AlternateModDatabaseServerAddress, 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, UseAlternateModDatabaseServer, UseAlternateServer, StdCompiler::Value(), and WorkPath.

Here is the call graph for this function:

◆ GetLeagueLoginData()

bool C4ConfigNetwork::GetLeagueLoginData ( const char *  server_name,
const char *  player_name,
StdStrBuf account,
StdStrBuf login_token 
) const

Definition at line 712 of file C4Config.cpp.

713 {
714  // check if last login matches and store if desired
715  if (LastLeagueServer == server_name && LastLeaguePlayerName == player_name)
716  {
717  account->Copy(LastLeagueAccount);
718  login_token->Copy(LastLeagueLoginToken);
719  return true;
720  }
721  return false;
722 }
void Copy()
Definition: StdBuf.h:467

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

Referenced by C4Network2::LeaguePlrAuth().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLeagueServerAddress()

const char * C4ConfigNetwork::GetLeagueServerAddress ( )

Definition at line 661 of file C4Config.cpp.

662 {
663  // Alternate (configurable) league server
664  if (UseAlternateServer)
665  {
666  return AlternateServerAddress;
667  }
668  // Standard (hardcoded) official league server
669  else
670  {
671  return "https://league.openclonk.org/league.php";
672  }
673 }

References AlternateServerAddress, and UseAlternateServer.

Referenced by C4Network2::InitLeague().

Here is the caller graph for this function:

◆ GetModDatabaseServerAddress()

const char * C4ConfigNetwork::GetModDatabaseServerAddress ( )

Definition at line 675 of file C4Config.cpp.

676 {
677  // Alternate (configurable) mod database server
680  // Standard (hardcoded) official mod database server
681  else
682  return "https://mods.openclonk.org/api/";
683 }

References AlternateModDatabaseServerAddress, and UseAlternateModDatabaseServer.

◆ SetLeagueLoginData()

void C4ConfigNetwork::SetLeagueLoginData ( const char *  server_name,
const char *  player_name,
const char *  account,
const char *  login_token 
)

Definition at line 702 of file C4Config.cpp.

703 {
704  // ideally, there would be a list to store multiple logins
705  // however, we don't really support multiplayer at one computer at the moment anyway
706  LastLeagueServer.Copy(server_name);
707  LastLeaguePlayerName.Copy(player_name);
708  LastLeagueAccount.Copy(account);
709  LastLeagueLoginToken.Copy(login_token);
710 }

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

Referenced by C4Network2::LeaguePlrAuth().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ AlternateModDatabaseServerAddress

char C4ConfigNetwork::AlternateModDatabaseServerAddress[CFG_MaxString+1]

◆ AlternateServerAddress

char C4ConfigNetwork::AlternateServerAddress[CFG_MaxString+1]

◆ AsyncMaxWait

int32_t C4ConfigNetwork::AsyncMaxWait

Definition at line 170 of file C4Config.h.

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

◆ Comment

◆ ControlMode

int32_t C4ConfigNetwork::ControlMode

Definition at line 155 of file C4Config.h.

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

◆ ControlPreSend

int32_t C4ConfigNetwork::ControlPreSend

Definition at line 140 of file C4Config.h.

Referenced by CompileFunc().

◆ ControlRate

int32_t C4ConfigNetwork::ControlRate

Definition at line 139 of file C4Config.h.

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

◆ EnableUPnP

int32_t C4ConfigNetwork::EnableUPnP

◆ LastLeagueAccount

StdCopyStrBuf C4ConfigNetwork::LastLeagueAccount

Definition at line 161 of file C4Config.h.

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

◆ LastLeagueLoginToken

StdCopyStrBuf C4ConfigNetwork::LastLeagueLoginToken

Definition at line 161 of file C4Config.h.

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

◆ LastLeaguePlayerName

StdCopyStrBuf C4ConfigNetwork::LastLeaguePlayerName

Definition at line 161 of file C4Config.h.

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

◆ LastLeagueServer

StdCopyStrBuf C4ConfigNetwork::LastLeagueServer

Definition at line 161 of file C4Config.h.

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

◆ LastPassword

char C4ConfigNetwork::LastPassword[CFG_MaxString+1]

◆ LeagueServerSignUp

◆ Lobby

int32_t C4ConfigNetwork::Lobby

Definition at line 141 of file C4Config.h.

Referenced by CompileFunc().

◆ MasterKeepPeriod

int32_t C4ConfigNetwork::MasterKeepPeriod

Definition at line 149 of file C4Config.h.

Referenced by CompileFunc().

◆ MasterReferencePeriod

int32_t C4ConfigNetwork::MasterReferencePeriod

Definition at line 150 of file C4Config.h.

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

◆ MasterServerActive

int32_t C4ConfigNetwork::MasterServerActive

Definition at line 148 of file C4Config.h.

Referenced by CompileFunc().

◆ MasterServerSignUp

◆ MaxLoadFileSize

int32_t C4ConfigNetwork::MaxLoadFileSize

Definition at line 157 of file C4Config.h.

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

◆ MaxResSearchRecursion

int32_t C4ConfigNetwork::MaxResSearchRecursion

Definition at line 144 of file C4Config.h.

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

◆ Nick

◆ NoReferenceRequest

int32_t C4ConfigNetwork::NoReferenceRequest

Definition at line 143 of file C4Config.h.

Referenced by CompileFunc().

◆ NoRuntimeJoin

int32_t C4ConfigNetwork::NoRuntimeJoin

◆ PacketLogging

int32_t C4ConfigNetwork::PacketLogging

◆ PortDiscovery

◆ PortRefServer

int32_t C4ConfigNetwork::PortRefServer

◆ PortTCP

◆ PortUDP

◆ PuncherAddress

char C4ConfigNetwork::PuncherAddress[CFG_MaxString+1]

Definition at line 160 of file C4Config.h.

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

◆ UseAlternateModDatabaseServer

int32_t C4ConfigNetwork::UseAlternateModDatabaseServer

◆ UseAlternateServer

◆ WorkPath

char C4ConfigNetwork::WorkPath[CFG_MaxString+1]

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