DDraceNetwork Docs
server.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef ENGINE_SERVER_SERVER_H
4#define ENGINE_SERVER_SERVER_H
5
6#include <base/hash.h>
7
8#include <engine/console.h>
9#include <engine/server.h>
10
11#include <engine/shared/demo.h>
12#include <engine/shared/econ.h>
13#include <engine/shared/fifo.h>
14#include <engine/shared/http.h>
20
21#include <list>
22#include <memory>
23#include <optional>
24#include <vector>
25
26#include "antibot.h"
27#include "authmanager.h"
28#include "name_ban.h"
29#include "snap_id_pool.h"
30
31#if defined(CONF_UPNP)
32#include "upnp.h"
33#endif
34
35class CConfig;
36class CHostLookup;
37class CLogMessage;
38class CMsgPacker;
39class CPacker;
40class IEngine;
41class IEngineMap;
42class ILogger;
43
44class CServerBan : public CNetBan
45{
47
48 template<class T>
49 int BanExt(T *pBanPool, const typename T::CDataType *pData, int Seconds, const char *pReason, bool VerbatimReason);
50
51public:
52 class CServer *Server() const { return m_pServer; }
53
54 void InitServerBan(class IConsole *pConsole, class IStorage *pStorage, class CServer *pServer);
55
56 int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason, bool VerbatimReason) override;
57 int BanRange(const CNetRange *pRange, int Seconds, const char *pReason) override;
58
59 static void ConBanExt(class IConsole::IResult *pResult, void *pUser);
60 static void ConBanRegion(class IConsole::IResult *pResult, void *pUser);
61 static void ConBanRegionRange(class IConsole::IResult *pResult, void *pUser);
62};
63
64class CServer : public IServer
65{
66 friend class CServerLogger;
67
75
76#if defined(CONF_UPNP)
78#endif
79
80#if defined(CONF_FAMILY_UNIX)
84#endif
85
87
88#ifdef CONF_DEBUG
89 int m_PreviousDebugDummies = 0;
90 void UpdateDebugDummies(bool ForceDisconnect);
91#endif
92
93public:
95 class CConfig *Config() { return m_pConfig; }
96 const CConfig *Config() const { return m_pConfig; }
97 class IConsole *Console() { return m_pConsole; }
98 class IStorage *Storage() { return m_pStorage; }
99 class IEngineAntibot *Antibot() { return m_pAntibot; }
101 IEngine *Engine() { return m_pEngine; }
102
103 enum
104 {
106 };
107
109 {
110 public:
111 enum
112 {
120
124
129 };
130
131 class CInput
132 {
133 public:
135 int m_GameTick; // the tick that was chosen for the input
136 };
137
138 // connection state info
142
143 double m_Traffic;
145
149
151 CInput m_aInputs[200]; // TODO: handle input better
153
157 std::optional<int> m_Score;
165
167
170
171 void Reset();
172
173 // DDRace
174
182
183 // DNSBL
185 std::shared_ptr<CHostLookup> m_pDnsblLookup;
186
188
190 {
191 return m_State != STATE_EMPTY && !m_DebugDummy;
192 }
193 };
194
197
206
208
210 //int m_CurrentGameTick;
211
212 enum
213 {
216 STOPPING = 2
217 };
218
220
229
230 enum
231 {
235 };
236
237 enum
238 {
242 };
243
245 const char *m_pCurrentMapName;
250
253
256
258
260
262 std::vector<std::string> m_vAnnouncements;
263
264 std::shared_ptr<ILogger> m_pFileLogger = nullptr;
265 std::shared_ptr<ILogger> m_pStdoutLogger = nullptr;
266
267 CServer();
268 ~CServer();
269
270 bool IsClientNameAvailable(int ClientId, const char *pNameRequest);
271 bool SetClientNameImpl(int ClientId, const char *pNameRequest, bool Set);
272 bool SetClientClanImpl(int ClientId, const char *pClanRequest, bool Set);
273
274 bool WouldClientNameChange(int ClientId, const char *pNameRequest) override;
275 bool WouldClientClanChange(int ClientId, const char *pClanRequest) override;
276 void SetClientName(int ClientId, const char *pName) override;
277 void SetClientClan(int ClientId, const char *pClan) override;
278 void SetClientCountry(int ClientId, int Country) override;
279 void SetClientScore(int ClientId, std::optional<int> Score) override;
280 void SetClientFlags(int ClientId, int Flags) override;
281
282 void Kick(int ClientId, const char *pReason) override;
283 void Ban(int ClientId, int Seconds, const char *pReason, bool VerbatimReason) override;
284 void RedirectClient(int ClientId, int Port, bool Verbose = false) override;
285
286 void DemoRecorder_HandleAutoStart() override;
287
288 //int Tick()
289 int64_t TickStartTime(int Tick);
290 //int TickSpeed()
291
292 int Init();
293
294 void SendLogLine(const CLogMessage *pMessage);
295 void SetRconCid(int ClientId) override;
296 int GetAuthedState(int ClientId) const override;
297 const char *GetAuthName(int ClientId) const override;
298 void GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_DIGEST *pMapSha256, int *pMapCrc) override;
299 bool GetClientInfo(int ClientId, CClientInfo *pInfo) const override;
300 void SetClientDDNetVersion(int ClientId, int DDNetVersion) override;
301 void GetClientAddr(int ClientId, char *pAddrStr, int Size) const override;
302 const char *ClientName(int ClientId) const override;
303 const char *ClientClan(int ClientId) const override;
304 int ClientCountry(int ClientId) const override;
305 bool ClientSlotEmpty(int ClientId) const override;
306 bool ClientIngame(int ClientId) const override;
307 int Port() const override;
308 int MaxClients() const override;
309 int ClientCount() const override;
310 int DistinctClientCount() const override;
311
312 int GetClientVersion(int ClientId) const override;
313 int SendMsg(CMsgPacker *pMsg, int Flags, int ClientId) override;
314
315 void DoSnapshot();
316
317 static int NewClientCallback(int ClientId, void *pUser, bool Sixup);
318 static int NewClientNoAuthCallback(int ClientId, void *pUser);
319 static int DelClientCallback(int ClientId, const char *pReason, void *pUser);
320
321 static int ClientRejoinCallback(int ClientId, void *pUser);
322
323 void SendRconType(int ClientId, bool UsernameReq);
324 void SendCapabilities(int ClientId);
325 void SendMap(int ClientId);
326 void SendMapData(int ClientId, int Chunk);
327 void SendMapReload(int ClientId);
328 void SendConnectionReady(int ClientId);
329 void SendRconLine(int ClientId, const char *pLine);
330 // Accepts -1 as ClientId to mean "all clients with at least auth level admin"
331 void SendRconLogLine(int ClientId, const CLogMessage *pMessage);
332
333 void SendRconCmdAdd(const IConsole::CCommandInfo *pCommandInfo, int ClientId);
334 void SendRconCmdRem(const IConsole::CCommandInfo *pCommandInfo, int ClientId);
335 int GetConsoleAccessLevel(int ClientId);
336 int NumRconCommands(int ClientId);
338
339 bool CheckReservedSlotAuth(int ClientId, const char *pPassword);
340 void ProcessClientPacket(CNetChunk *pPacket);
341
342 class CCache
343 {
344 public:
346 {
347 public:
348 CCacheChunk(const void *pData, int Size);
349 CCacheChunk(const CCacheChunk &) = delete;
351
352 std::vector<uint8_t> m_vData;
353 };
354
355 std::vector<CCacheChunk> m_vCache;
356
357 CCache();
358 ~CCache();
359
360 void AddChunk(const void *pData, int Size);
361 void Clear();
362 };
366
367 void FillAntibot(CAntibotRoundData *pData) override;
368
369 void ExpireServerInfo() override;
370 void CacheServerInfo(CCache *pCache, int Type, bool SendClients);
371 void CacheServerInfoSixup(CCache *pCache, bool SendClients);
372 void SendServerInfo(const NETADDR *pAddr, int Token, int Type, bool SendClients);
373 void GetServerInfoSixup(CPacker *pPacker, int Token, bool SendClients);
375 void SendServerInfoConnless(const NETADDR *pAddr, int Token, int Type);
377 void UpdateServerInfo(bool Resend = false);
378
379 void PumpNetwork(bool PacketWaiting);
380
381 void ChangeMap(const char *pMap) override;
382 const char *GetMapName() const override;
383 void ReloadMap() override;
384 int LoadMap(const char *pMapName);
385
386 void SaveDemo(int ClientId, float Time) override;
387 void StartRecord(int ClientId) override;
388 void StopRecord(int ClientId) override;
389 bool IsRecording(int ClientId) override;
390 void StopDemos() override;
391
392 int Run();
393
394 static void ConKick(IConsole::IResult *pResult, void *pUser);
395 static void ConStatus(IConsole::IResult *pResult, void *pUser);
396 static void ConShutdown(IConsole::IResult *pResult, void *pUser);
397 static void ConRecord(IConsole::IResult *pResult, void *pUser);
398 static void ConStopRecord(IConsole::IResult *pResult, void *pUser);
399 static void ConMapReload(IConsole::IResult *pResult, void *pUser);
400 static void ConLogout(IConsole::IResult *pResult, void *pUser);
401 static void ConShowIps(IConsole::IResult *pResult, void *pUser);
402
403 static void ConAuthAdd(IConsole::IResult *pResult, void *pUser);
404 static void ConAuthAddHashed(IConsole::IResult *pResult, void *pUser);
405 static void ConAuthUpdate(IConsole::IResult *pResult, void *pUser);
406 static void ConAuthUpdateHashed(IConsole::IResult *pResult, void *pUser);
407 static void ConAuthRemove(IConsole::IResult *pResult, void *pUser);
408 static void ConAuthList(IConsole::IResult *pResult, void *pUser);
409
410 // console commands for sqlmasters
411 static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData);
412 static void ConDumpSqlServers(IConsole::IResult *pResult, void *pUserData);
413
414 static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
415 static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
416 static void ConchainCommandAccessUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
417
418 void LogoutClient(int ClientId, const char *pReason);
419 void LogoutKey(int Key, const char *pReason);
420
421 void ConchainRconPasswordChangeGeneric(int Level, const char *pCurrent, IConsole::IResult *pResult);
422 static void ConchainRconPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
423 static void ConchainRconModPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
424 static void ConchainRconHelperPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
425 static void ConchainMapUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
426 static void ConchainSixupUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
427 static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
428 static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
429 static void ConchainAnnouncementFileName(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
430
431#if defined(CONF_FAMILY_UNIX)
432 static void ConchainConnLoggingServerChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
433#endif
434
435 void RegisterCommands();
436
437 int SnapNewId() override;
438 void SnapFreeId(int Id) override;
439 void *SnapNewItem(int Type, int Id, int Size) override;
440 void SnapSetStaticsize(int ItemType, int Size) override;
441
442 // DDRace
443
444 void GetClientAddr(int ClientId, NETADDR *pAddr) const override;
446 const char *GetAnnouncementLine() override;
447 void ReadAnnouncementsFile(const char *pFileName) override;
448
449 int *GetIdMap(int ClientId) override;
450
451 void InitDnsbl(int ClientId);
452 bool DnsblWhite(int ClientId) override
453 {
456 }
457 bool DnsblPending(int ClientId) override
458 {
460 }
461 bool DnsblBlack(int ClientId) override
462 {
464 }
465
466 void AuthRemoveKey(int KeySlot);
467 bool ClientPrevIngame(int ClientId) override { return m_aPrevStates[ClientId] == CClient::STATE_INGAME; }
468 const char *GetNetErrorString(int ClientId) override { return m_NetServer.ErrorString(ClientId); }
469 void ResetNetErrorString(int ClientId) override { m_NetServer.ResetErrorString(ClientId); }
470 bool SetTimedOut(int ClientId, int OrigId) override;
471 void SetTimeoutProtected(int ClientId) override { m_NetServer.SetTimeoutProtected(ClientId); }
472
473 void SendMsgRaw(int ClientId, const void *pData, int Size, int Flags) override;
474
475 bool ErrorShutdown() const { return m_aErrorShutdownReason[0] != 0; }
476 void SetErrorShutdown(const char *pReason) override;
477
478 bool IsSixup(int ClientId) const override { return ClientId != SERVER_DEMO_CLIENT && m_aClients[ClientId].m_Sixup; }
479
480 void SetLoggers(std::shared_ptr<ILogger> &&pFileLogger, std::shared_ptr<ILogger> &&pStdoutLogger);
481
482#ifdef CONF_FAMILY_UNIX
484 {
487 };
488
489 void SendConnLoggingCommand(CONN_LOGGING_CMD Cmd, const NETADDR *pAddr);
490#endif
491};
492
493extern CServer *CreateServer();
494#endif
Definition: authmanager.h:11
Definition: config.h:23
Definition: connection_pool.h:61
Definition: demo.h:19
Definition: econ.h:13
Definition: fifo.h:8
Definition: host_lookup.h:11
Definition: http.h:266
Definition: logger.h:19
Definition: message.h:10
Definition: name_ban.h:29
Definition: netban.h:27
Definition: netban.h:13
Definition: network.h:375
int ResetErrorString(int ClientId)
Definition: network_server.cpp:807
void SetTimeoutProtected(int ClientId)
Definition: network_server.cpp:802
const char * ErrorString(int ClientId)
Definition: network_server.cpp:813
Definition: packer.h:7
Definition: server.h:45
static void ConBanRegionRange(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:170
static void ConBanRegion(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:160
void InitServerBan(class IConsole *pConsole, class IStorage *pStorage, class CServer *pServer)
Definition: server.cpp:51
class CServer * m_pServer
Definition: server.h:46
int BanExt(T *pBanPool, const typename T::CDataType *pData, int Seconds, const char *pReason, bool VerbatimReason)
Definition: server.cpp:64
class CServer * Server() const
Definition: server.h:52
static void ConBanExt(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:140
int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason, bool VerbatimReason) override
Definition: server.cpp:126
int BanRange(const CNetRange *pRange, int Seconds, const char *pReason) override
Definition: server.cpp:131
Definition: server_logger.h:10
Definition: server.h:346
std::vector< uint8_t > m_vData
Definition: server.h:352
CCacheChunk(CCacheChunk &&)=default
CCacheChunk(const CCacheChunk &)=delete
CCacheChunk(const void *pData, int Size)
Definition: server.cpp:1927
Definition: server.h:343
void Clear()
Definition: server.cpp:1937
void AddChunk(const void *pData, int Size)
Definition: server.cpp:1932
CCache()
Definition: server.cpp:1917
std::vector< CCacheChunk > m_vCache
Definition: server.h:355
~CCache()
Definition: server.cpp:1922
Definition: server.h:132
int m_aData[MAX_INPUT_SIZE]
Definition: server.h:134
int m_GameTick
Definition: server.h:135
Definition: server.h:109
double m_Traffic
Definition: server.h:143
NETADDR m_Addr
Definition: server.h:175
int64_t m_RedirectDropTime
Definition: server.h:181
int m_CurrentInput
Definition: server.h:152
void Reset()
Definition: server.cpp:206
int m_NextMapChunk
Definition: server.h:161
CSnapshotStorage m_Snapshots
Definition: server.h:148
bool m_DebugDummy
Definition: server.h:164
bool m_ShowIps
Definition: server.h:163
int m_LastAckedSnapshot
Definition: server.h:146
CInput m_aInputs[200]
Definition: server.h:151
int m_DDNetVersion
Definition: server.h:178
char m_aDDNetVersionStr[64]
Definition: server.h:179
@ STATE_REDIRECTED
Definition: server.h:119
@ SNAPRATE_FULL
Definition: server.h:122
@ DNSBL_STATE_BLACKLISTED
Definition: server.h:127
@ STATE_INGAME
Definition: server.h:118
@ STATE_EMPTY
Definition: server.h:113
@ STATE_CONNECTING
Definition: server.h:116
@ SNAPRATE_RECOVER
Definition: server.h:123
@ DNSBL_STATE_PENDING
Definition: server.h:126
@ SNAPRATE_INIT
Definition: server.h:121
@ STATE_AUTH
Definition: server.h:115
@ STATE_READY
Definition: server.h:117
@ STATE_PREAUTH
Definition: server.h:114
@ DNSBL_STATE_NONE
Definition: server.h:125
@ DNSBL_STATE_WHITELISTED
Definition: server.h:128
int m_AuthTries
Definition: server.h:160
void * m_pPersistentData
Definition: server.h:169
int m_Latency
Definition: server.h:140
int m_Authed
Definition: server.h:158
int m_State
Definition: server.h:139
int m_AuthKey
Definition: server.h:159
char m_aClan[MAX_CLAN_LENGTH]
Definition: server.h:155
const IConsole::CCommandInfo * m_pRconCmdToSend
Definition: server.h:166
bool m_HasPersistentData
Definition: server.h:168
CUuid m_ConnectionId
Definition: server.h:180
bool m_Sixup
Definition: server.h:187
bool IncludedInServerInfo() const
Definition: server.h:189
int m_Flags
Definition: server.h:162
int m_LastInputTick
Definition: server.h:147
char m_aName[MAX_NAME_LENGTH]
Definition: server.h:154
bool m_DDNetVersionSettled
Definition: server.h:177
int m_Country
Definition: server.h:156
int m_DnsblState
Definition: server.h:184
int m_SnapRate
Definition: server.h:141
std::optional< int > m_Score
Definition: server.h:157
bool m_GotDDNetVersionPacket
Definition: server.h:176
CInput m_LatestInput
Definition: server.h:150
int64_t m_TrafficSince
Definition: server.h:144
std::shared_ptr< CHostLookup > m_pDnsblLookup
Definition: server.h:185
Definition: server.h:65
CSnapshotBuilder m_SnapshotBuilder
Definition: server.h:199
void SendMsgRaw(int ClientId, const void *pData, int Size, int Flags) override
Definition: server.cpp:859
UNIXSOCKET m_ConnLoggingSocket
Definition: server.h:83
void SetClientName(int ClientId, const char *pName) override
Definition: server.cpp:421
static void ConchainSixupUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3777
bool CheckReservedSlotAuth(int ClientId, const char *pPassword)
Definition: server.cpp:1402
void ExpireServerInfo() override
Definition: server.cpp:2300
void GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_DIGEST *pMapSha256, int *pMapCrc) override
Definition: server.cpp:1188
void SetClientCountry(int ClientId, int Country) override
Definition: server.cpp:431
void SetClientFlags(int ClientId, int Flags) override
Definition: server.cpp:450
int GetAuthedState(int ClientId) const override
Definition: server.cpp:564
static void ConDumpSqlServers(IConsole::IResult *pResult, void *pUserData)
Definition: server.cpp:3601
void DoSnapshot()
Definition: server.cpp:878
void RedirectClient(int ClientId, int Port, bool Verbose=false) override
Definition: server.cpp:486
static void ConchainCommandAccessUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3639
int64_t TickStartTime(int Tick)
Definition: server.cpp:515
char m_aErrorShutdownReason[128]
Definition: server.h:257
void CacheServerInfo(CCache *pCache, int Type, bool SendClients)
Definition: server.cpp:1942
void Ban(int ClientId, int Seconds, const char *pReason, bool VerbatimReason) override
Definition: server.cpp:479
int m_aIdMap[MAX_CLIENTS *VANILLA_MAX_CLIENTS]
Definition: server.h:196
@ RUNNING
Definition: server.h:215
@ STOPPING
Definition: server.h:216
@ UNINITIALIZED
Definition: server.h:214
const char * GetAnnouncementLine() override
Definition: server.cpp:3961
void SetClientClan(int ClientId, const char *pClan) override
Definition: server.cpp:426
static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData)
Definition: server.cpp:3552
bool DnsblPending(int ClientId) override
Definition: server.h:457
CServerBan m_ServerBan
Definition: server.h:204
CSnapshotDelta m_SnapshotDelta
Definition: server.h:198
bool IsSixup(int ClientId) const override
Definition: server.h:478
void SetRconCid(int ClientId) override
Definition: server.cpp:559
class CDbConnectionPool * m_pConnectionPool
Definition: server.h:86
bool IsRecording(int ClientId) override
Definition: server.cpp:3458
const char * ClientClan(int ClientId) const override
Definition: server.cpp:633
int * GetIdMap(int ClientId) override
Definition: server.cpp:3990
void GetServerInfoSixup(CPacker *pPacker, int Token, bool SendClients)
Definition: server.cpp:2272
void SetClientScore(int ClientId, std::optional< int > Score) override
Definition: server.cpp:439
const char * GetMapName() const override
Definition: server.cpp:2539
void StopDemos() override
Definition: server.cpp:3463
void AuthRemoveKey(int KeySlot)
Definition: server.cpp:3171
void SendCapabilities(int ClientId)
Definition: server.cpp:1196
class IConsole * m_pConsole
Definition: server.h:70
bool SetTimedOut(int ClientId, int OrigId) override
Definition: server.cpp:3995
void RegisterCommands()
Definition: server.cpp:3844
bool IsClientNameAvailable(int ClientId, const char *pNameRequest)
Definition: server.cpp:290
int Port() const override
Definition: server.cpp:663
bool SetClientNameImpl(int ClientId, const char *pNameRequest, bool Set)
Definition: server.cpp:314
SHA256_DIGEST m_aCurrentMapSha256[NUM_MAP_TYPES]
Definition: server.h:246
void SendConnectionReady(int ClientId)
Definition: server.cpp:1275
static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3795
void SnapSetStaticsize(int ItemType, int Size) override
Definition: server.cpp:3922
int Run()
Definition: server.cpp:2669
std::shared_ptr< ILogger > m_pFileLogger
Definition: server.h:264
bool m_ConnLoggingSocketCreated
Definition: server.h:82
static void ConchainAnnouncementFileName(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3805
bool DnsblWhite(int ClientId) override
Definition: server.h:452
void CacheServerInfoSixup(CCache *pCache, bool SendClients)
Definition: server.cpp:2156
class IStorage * m_pStorage
Definition: server.h:71
static void ConchainRconHelperPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3760
class IEngineAntibot * m_pAntibot
Definition: server.h:72
CHttp m_Http
Definition: server.h:205
static int ClientRejoinCallback(int ClientId, void *pUser)
Definition: server.cpp:1011
void InitDnsbl(int ClientId)
Definition: server.cpp:1098
CNetServer m_NetServer
Definition: server.h:201
void PumpNetwork(bool PacketWaiting)
Definition: server.cpp:2434
void SendLogLine(const CLogMessage *pMessage)
Definition: server.cpp:547
std::shared_ptr< ILogger > m_pStdoutLogger
Definition: server.h:265
int m_ServerInfoNumRequests
Definition: server.h:255
static void ConRecord(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3474
int m_RunServer
Definition: server.h:219
static void ConchainMapUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3767
int SnapNewId() override
Definition: server.cpp:3906
bool ClientSlotEmpty(int ClientId) const override
Definition: server.cpp:653
static void ConAuthAddHashed(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3217
void SendMapReload(int ClientId)
Definition: server.cpp:1269
IEngineMap * m_pMap
Definition: server.h:207
bool m_ReloadedWhenEmpty
Definition: server.h:223
const char * ClientName(int ClientId) const override
Definition: server.cpp:623
CDemoRecorder m_aDemoRecorder[NUM_RECORDERS]
Definition: server.h:251
bool DnsblBlack(int ClientId) override
Definition: server.h:461
bool m_MapReload
Definition: server.h:221
void * SnapNewItem(int Type, int Id, int Size) override
Definition: server.cpp:3916
void UpdateClientRconCommands()
Definition: server.cpp:1365
static int NewClientCallback(int ClientId, void *pUser, bool Sixup)
Definition: server.cpp:1065
CUPnP m_UPnP
Definition: server.h:77
bool WouldClientClanChange(int ClientId, const char *pClanRequest) override
Definition: server.cpp:416
unsigned m_aCurrentMapCrc[NUM_MAP_TYPES]
Definition: server.h:247
int MaxClients() const override
Definition: server.cpp:668
class IStorage * Storage()
Definition: server.h:98
static void ConShutdown(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3372
const CConfig * Config() const
Definition: server.h:96
class IGameServer * GameServer()
Definition: server.h:94
@ RECORDER_AUTO
Definition: server.h:240
@ NUM_RECORDERS
Definition: server.h:241
@ RECORDER_MANUAL
Definition: server.h:239
int GetConsoleAccessLevel(int ClientId)
Definition: server.cpp:1348
static void ConchainRconModPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3753
void UpdateRegisterServerInfo()
Definition: server.cpp:2305
void SendRconType(int ClientId, bool UsernameReq)
Definition: server.cpp:1181
static void ConAuthList(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3364
const char * GetAuthName(int ClientId) const override
Definition: server.cpp:571
class IGameServer * m_pGameServer
Definition: server.h:68
char m_aCurrentMap[IO_MAX_PATH_LENGTH]
Definition: server.h:244
class CConfig * m_pConfig
Definition: server.h:69
std::vector< std::string > m_vAnnouncements
Definition: server.h:262
int64_t m_GameStartTime
Definition: server.h:209
void LogoutClient(int ClientId, const char *pReason)
Definition: server.cpp:3670
bool SetClientClanImpl(int ClientId, const char *pClanRequest, bool Set)
Definition: server.cpp:370
static void ConAuthAdd(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3190
const char * GetNetErrorString(int ClientId) override
Definition: server.h:468
void SendServerInfoConnless(const NETADDR *pAddr, int Token, int Type)
Definition: server.cpp:1902
static void ConAuthUpdateHashed(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3289
CCache m_aServerInfoCache[3 *2]
Definition: server.h:363
void FillAntibot(CAntibotRoundData *pData) override
Definition: server.cpp:2287
void SendMap(int ClientId)
Definition: server.cpp:1204
void SendRconLogLine(int ClientId, const CLogMessage *pMessage)
Definition: server.cpp:1288
void DemoRecorder_HandleAutoStart() override
Definition: server.cpp:3383
int m_RconClientId
Definition: server.h:224
@ MAP_TYPE_SIX
Definition: server.h:232
@ NUM_MAP_TYPES
Definition: server.h:234
@ MAP_TYPE_SIXUP
Definition: server.h:233
void GetClientAddr(int ClientId, char *pAddrStr, int Size) const override
Definition: server.cpp:617
static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3785
int DistinctClientCount() const override
Definition: server.cpp:687
class IRegister * m_pRegister
Definition: server.h:73
CNameBans m_NameBans
Definition: server.h:259
int ClientCountry(int ClientId) const override
Definition: server.cpp:643
static void ConStatus(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3101
bool RateLimitServerInfoConnless()
Definition: server.cpp:1880
int SendMsg(CMsgPacker *pMsg, int Flags, int ClientId) override
Definition: server.cpp:782
static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3632
int m_PrintCBIndex
Definition: server.h:226
CSnapIdPool m_IdPool
Definition: server.h:200
CCache m_aSixupServerInfoCache[2]
Definition: server.h:364
static int DelClientCallback(int ClientId, const char *pReason, void *pUser)
Definition: server.cpp:1141
void ReadAnnouncementsFile(const char *pFileName) override
Definition: server.cpp:3939
void UpdateServerInfo(bool Resend=false)
Definition: server.cpp:2399
void SendRconLine(int ClientId, const char *pLine)
Definition: server.cpp:1281
CServer()
Definition: server.cpp:224
int GetClientVersion(int ClientId) const override
Definition: server.cpp:719
void LogoutKey(int Key, const char *pReason)
Definition: server.cpp:3709
void ProcessClientPacket(CNetChunk *pPacket)
Definition: server.cpp:1434
void ResetNetErrorString(int ClientId) override
Definition: server.h:469
bool WouldClientNameChange(int ClientId, const char *pNameRequest) override
Definition: server.cpp:411
void * m_pPersistentData
Definition: server.h:228
void StopRecord(int ClientId) override
Definition: server.cpp:3450
bool ClientPrevIngame(int ClientId) override
Definition: server.h:467
static void ConAuthRemove(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3333
@ MAX_RCONCMD_SEND
Definition: server.h:105
bool m_ServerInfoNeedsUpdate
Definition: server.h:365
void ReloadMap() override
Definition: server.cpp:2550
static void ConAuthUpdate(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3260
IEngine * m_pEngine
Definition: server.h:74
CONN_LOGGING_CMD
Definition: server.h:484
@ OPEN_SESSION
Definition: server.h:485
@ CLOSE_SESSION
Definition: server.h:486
void SendConnLoggingCommand(CONN_LOGGING_CMD Cmd, const NETADDR *pAddr)
Definition: server.cpp:1125
bool GetClientInfo(int ClientId, CClientInfo *pInfo) const override
Definition: server.cpp:580
void SendServerInfo(const NETADDR *pAddr, int Token, int Type, bool SendClients)
Definition: server.cpp:2218
CClient m_aClients[MAX_CLIENTS]
Definition: server.h:195
UNIXSOCKETADDR m_ConnLoggingDestAddr
Definition: server.h:81
unsigned char * m_apCurrentMapData[NUM_MAP_TYPES]
Definition: server.h:248
static void ConShowIps(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3532
class IEngineAntibot * Antibot()
Definition: server.h:99
static int NewClientNoAuthCallback(int ClientId, void *pUser)
Definition: server.cpp:1033
IEngine * Engine()
Definition: server.h:101
static void ConchainRconPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3746
static void ConStopRecord(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3511
CEcon m_Econ
Definition: server.h:202
int NumRconCommands(int ClientId)
Definition: server.cpp:1353
class CDbConnectionPool * DbPool()
Definition: server.h:100
class CConfig * Config()
Definition: server.h:95
int Init()
Definition: server.cpp:520
int ClientCount() const override
Definition: server.cpp:673
CFifo m_Fifo
Definition: server.h:203
void ChangeMap(const char *pMap) override
Definition: server.cpp:2544
bool ClientIngame(int ClientId) const override
Definition: server.cpp:658
size_t m_AnnouncementLastLine
Definition: server.h:261
void StartRecord(int ClientId) override
Definition: server.cpp:3427
int LoadMap(const char *pMapName)
Definition: server.cpp:2555
int m_aPrevStates[MAX_CLIENTS]
Definition: server.h:445
int m_RconAuthLevel
Definition: server.h:225
bool ErrorShutdown() const
Definition: server.h:475
unsigned int m_aCurrentMapSize[NUM_MAP_TYPES]
Definition: server.h:249
static void ConchainConnLoggingServerChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3817
void SendRconCmdRem(const IConsole::CCommandInfo *pCommandInfo, int ClientId)
Definition: server.cpp:1341
int64_t m_ServerInfoFirstRequest
Definition: server.h:254
char m_aShutdownReason[128]
Definition: server.h:227
static void ConLogout(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3521
static void ConKick(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3089
void SaveDemo(int ClientId, float Time) override
Definition: server.cpp:3417
void SendRconCmdAdd(const IConsole::CCommandInfo *pCommandInfo, int ClientId)
Definition: server.cpp:1332
void SetClientDDNetVersion(int ClientId, int DDNetVersion) override
Definition: server.cpp:606
void ConchainRconPasswordChangeGeneric(int Level, const char *pCurrent, IConsole::IResult *pResult)
Definition: server.cpp:3716
void SetLoggers(std::shared_ptr< ILogger > &&pFileLogger, std::shared_ptr< ILogger > &&pStdoutLogger)
Definition: server.cpp:4021
void SetErrorShutdown(const char *pReason) override
Definition: server.cpp:4016
class IConsole * Console()
Definition: server.h:97
static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3621
void Kick(int ClientId, const char *pReason) override
Definition: server.cpp:458
void SendMapData(int ClientId, int Chunk)
Definition: server.cpp:1233
const char * m_pCurrentMapName
Definition: server.h:245
~CServer()
Definition: server.cpp:270
CAuthManager m_AuthManager
Definition: server.h:252
bool m_SameMapReload
Definition: server.h:222
void SetTimeoutProtected(int ClientId) override
Definition: server.h:471
void SnapFreeId(int Id) override
Definition: server.cpp:3911
static void ConMapReload(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3516
Definition: snap_id_pool.h:8
Definition: snapshot.h:146
Definition: snapshot.h:74
Definition: snapshot.h:115
Definition: upnp.h:6
Definition: console.h:74
Definition: console.h:45
Definition: console.h:18
void(* FCommandCallback)(IResult *pResult, void *pUserData)
Definition: console.h:92
Definition: antibot.h:31
Definition: map.h:35
Definition: engine.h:15
Definition: server.h:296
Definition: logger.h:67
Definition: register.h:11
Definition: server.h:30
int Tick() const
Definition: server.h:49
Definition: storage.h:20
@ MAX_CLAN_LENGTH
Definition: protocol.h:98
@ MAX_INPUT_SIZE
Definition: protocol.h:94
@ MAX_CLIENTS
Definition: protocol.h:88
@ VANILLA_MAX_CLIENTS
Definition: protocol.h:89
@ MAX_NAME_LENGTH
Definition: protocol.h:97
int UNIXSOCKET
Definition: system.h:794
struct sockaddr_un UNIXSOCKETADDR
Definition: system.h:798
CServer * CreateServer()
Definition: server.cpp:3927
@ SERVER_DEMO_CLIENT
Definition: server.h:26
Definition: antibot_data.h:98
Definition: network.h:129
Definition: uuid_manager.h:17
Definition: server.h:40
Definition: types.h:67
Definition: hash.h:15
Definition: score.cpp:40
@ IO_MAX_PATH_LENGTH
Definition: types.h:43