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;
251
254
257
259
261
263 std::vector<std::string> m_vAnnouncements;
264
265 std::shared_ptr<ILogger> m_pFileLogger = nullptr;
266 std::shared_ptr<ILogger> m_pStdoutLogger = nullptr;
267
268 CServer();
269 ~CServer();
270
271 bool IsClientNameAvailable(int ClientId, const char *pNameRequest);
272 bool SetClientNameImpl(int ClientId, const char *pNameRequest, bool Set);
273 bool SetClientClanImpl(int ClientId, const char *pClanRequest, bool Set);
274
275 bool WouldClientNameChange(int ClientId, const char *pNameRequest) override;
276 bool WouldClientClanChange(int ClientId, const char *pClanRequest) override;
277 void SetClientName(int ClientId, const char *pName) override;
278 void SetClientClan(int ClientId, const char *pClan) override;
279 void SetClientCountry(int ClientId, int Country) override;
280 void SetClientScore(int ClientId, std::optional<int> Score) override;
281 void SetClientFlags(int ClientId, int Flags) override;
282
283 void Kick(int ClientId, const char *pReason) override;
284 void Ban(int ClientId, int Seconds, const char *pReason, bool VerbatimReason) override;
285 void RedirectClient(int ClientId, int Port, bool Verbose = false) override;
286
287 void DemoRecorder_HandleAutoStart() override;
288
289 //int Tick()
290 int64_t TickStartTime(int Tick);
291 //int TickSpeed()
292
293 int Init();
294
295 void SendLogLine(const CLogMessage *pMessage);
296 void SetRconCid(int ClientId) override;
297 int GetAuthedState(int ClientId) const override;
298 const char *GetAuthName(int ClientId) const override;
299 void GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_DIGEST *pMapSha256, int *pMapCrc) override;
300 bool GetClientInfo(int ClientId, CClientInfo *pInfo) const override;
301 void SetClientDDNetVersion(int ClientId, int DDNetVersion) override;
302 void GetClientAddr(int ClientId, char *pAddrStr, int Size) const override;
303 const char *ClientName(int ClientId) const override;
304 const char *ClientClan(int ClientId) const override;
305 int ClientCountry(int ClientId) const override;
306 bool ClientSlotEmpty(int ClientId) const override;
307 bool ClientIngame(int ClientId) const override;
308 int Port() const override;
309 int MaxClients() const override;
310 int ClientCount() const override;
311 int DistinctClientCount() const override;
312
313 int GetClientVersion(int ClientId) const override;
314 int SendMsg(CMsgPacker *pMsg, int Flags, int ClientId) override;
315
316 void DoSnapshot();
317
318 static int NewClientCallback(int ClientId, void *pUser, bool Sixup);
319 static int NewClientNoAuthCallback(int ClientId, void *pUser);
320 static int DelClientCallback(int ClientId, const char *pReason, void *pUser);
321
322 static int ClientRejoinCallback(int ClientId, void *pUser);
323
324 void SendRconType(int ClientId, bool UsernameReq);
325 void SendCapabilities(int ClientId);
326 void SendMap(int ClientId);
327 void SendMapData(int ClientId, int Chunk);
328 void SendMapReload(int ClientId);
329 void SendConnectionReady(int ClientId);
330 void SendRconLine(int ClientId, const char *pLine);
331 // Accepts -1 as ClientId to mean "all clients with at least auth level admin"
332 void SendRconLogLine(int ClientId, const CLogMessage *pMessage);
333
334 void SendRconCmdAdd(const IConsole::CCommandInfo *pCommandInfo, int ClientId);
335 void SendRconCmdRem(const IConsole::CCommandInfo *pCommandInfo, int ClientId);
336 int GetConsoleAccessLevel(int ClientId);
337 int NumRconCommands(int ClientId);
339
340 bool CheckReservedSlotAuth(int ClientId, const char *pPassword);
341 void ProcessClientPacket(CNetChunk *pPacket);
342
343 class CCache
344 {
345 public:
347 {
348 public:
349 CCacheChunk(const void *pData, int Size);
350 CCacheChunk(const CCacheChunk &) = delete;
352
353 std::vector<uint8_t> m_vData;
354 };
355
356 std::vector<CCacheChunk> m_vCache;
357
358 CCache();
359 ~CCache();
360
361 void AddChunk(const void *pData, int Size);
362 void Clear();
363 };
367
368 void FillAntibot(CAntibotRoundData *pData) override;
369
370 void ExpireServerInfo() override;
371 void CacheServerInfo(CCache *pCache, int Type, bool SendClients);
372 void CacheServerInfoSixup(CCache *pCache, bool SendClients);
373 void SendServerInfo(const NETADDR *pAddr, int Token, int Type, bool SendClients);
374 void GetServerInfoSixup(CPacker *pPacker, int Token, bool SendClients);
376 void SendServerInfoConnless(const NETADDR *pAddr, int Token, int Type);
378 void UpdateServerInfo(bool Resend = false);
379
380 void PumpNetwork(bool PacketWaiting);
381
382 void ChangeMap(const char *pMap) override;
383 const char *GetMapName() const override;
384 void ReloadMap() override;
385 int LoadMap(const char *pMapName);
386
387 void SaveDemo(int ClientId, float Time) override;
388 void StartRecord(int ClientId) override;
389 void StopRecord(int ClientId) override;
390 bool IsRecording(int ClientId) override;
391 void StopDemos() override;
392
393 int Run();
394
395 static void ConKick(IConsole::IResult *pResult, void *pUser);
396 static void ConStatus(IConsole::IResult *pResult, void *pUser);
397 static void ConShutdown(IConsole::IResult *pResult, void *pUser);
398 static void ConRecord(IConsole::IResult *pResult, void *pUser);
399 static void ConStopRecord(IConsole::IResult *pResult, void *pUser);
400 static void ConMapReload(IConsole::IResult *pResult, void *pUser);
401 static void ConLogout(IConsole::IResult *pResult, void *pUser);
402 static void ConShowIps(IConsole::IResult *pResult, void *pUser);
403
404 static void ConAuthAdd(IConsole::IResult *pResult, void *pUser);
405 static void ConAuthAddHashed(IConsole::IResult *pResult, void *pUser);
406 static void ConAuthUpdate(IConsole::IResult *pResult, void *pUser);
407 static void ConAuthUpdateHashed(IConsole::IResult *pResult, void *pUser);
408 static void ConAuthRemove(IConsole::IResult *pResult, void *pUser);
409 static void ConAuthList(IConsole::IResult *pResult, void *pUser);
410
411 // console commands for sqlmasters
412 static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData);
413 static void ConDumpSqlServers(IConsole::IResult *pResult, void *pUserData);
414
415 static void ConReloadAnnouncement(IConsole::IResult *pResult, void *pUserData);
416
417 static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
418 static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
419 static void ConchainCommandAccessUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
420
421 void LogoutClient(int ClientId, const char *pReason);
422 void LogoutKey(int Key, const char *pReason);
423
424 void ConchainRconPasswordChangeGeneric(int Level, const char *pCurrent, IConsole::IResult *pResult);
425 static void ConchainRconPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
426 static void ConchainRconModPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
427 static void ConchainRconHelperPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
428 static void ConchainMapUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
429 static void ConchainSixupUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
430 static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
431 static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
432 static void ConchainAnnouncementFileName(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
433
434#if defined(CONF_FAMILY_UNIX)
435 static void ConchainConnLoggingServerChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
436#endif
437
438 void RegisterCommands();
439
440 int SnapNewId() override;
441 void SnapFreeId(int Id) override;
442 void *SnapNewItem(int Type, int Id, int Size) override;
443 void SnapSetStaticsize(int ItemType, int Size) override;
444
445 // DDRace
446
447 void GetClientAddr(int ClientId, NETADDR *pAddr) const override;
449 const char *GetAnnouncementLine() override;
451
452 int *GetIdMap(int ClientId) override;
453
454 void InitDnsbl(int ClientId);
455 bool DnsblWhite(int ClientId) override
456 {
459 }
460 bool DnsblPending(int ClientId) override
461 {
463 }
464 bool DnsblBlack(int ClientId) override
465 {
467 }
468
469 void AuthRemoveKey(int KeySlot);
470 bool ClientPrevIngame(int ClientId) override { return m_aPrevStates[ClientId] == CClient::STATE_INGAME; }
471 const char *GetNetErrorString(int ClientId) override { return m_NetServer.ErrorString(ClientId); }
472 void ResetNetErrorString(int ClientId) override { m_NetServer.ResetErrorString(ClientId); }
473 bool SetTimedOut(int ClientId, int OrigId) override;
474 void SetTimeoutProtected(int ClientId) override { m_NetServer.SetTimeoutProtected(ClientId); }
475
476 void SendMsgRaw(int ClientId, const void *pData, int Size, int Flags) override;
477
478 bool ErrorShutdown() const { return m_aErrorShutdownReason[0] != 0; }
479 void SetErrorShutdown(const char *pReason) override;
480
481 bool IsSixup(int ClientId) const override { return ClientId != SERVER_DEMO_CLIENT && m_aClients[ClientId].m_Sixup; }
482
483 void SetLoggers(std::shared_ptr<ILogger> &&pFileLogger, std::shared_ptr<ILogger> &&pStdoutLogger);
484
485#ifdef CONF_FAMILY_UNIX
487 {
490 };
491
492 void SendConnLoggingCommand(CONN_LOGGING_CMD Cmd, const NETADDR *pAddr);
493#endif
494};
495
496extern CServer *CreateServer();
497#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:273
Definition: logger.h:19
Definition: message.h:10
Definition: name_ban.h:29
Definition: netban.h:27
Definition: netban.h:13
Definition: network.h:385
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:38
Definition: server.h:45
static void ConBanRegionRange(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:174
static void ConBanRegion(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:164
void InitServerBan(class IConsole *pConsole, class IStorage *pStorage, class CServer *pServer)
Definition: server.cpp:55
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:68
class CServer * Server() const
Definition: server.h:52
static void ConBanExt(class IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:144
int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason, bool VerbatimReason) override
Definition: server.cpp:130
int BanRange(const CNetRange *pRange, int Seconds, const char *pReason) override
Definition: server.cpp:135
Definition: server_logger.h:10
Definition: server.h:347
std::vector< uint8_t > m_vData
Definition: server.h:353
CCacheChunk(CCacheChunk &&)=default
CCacheChunk(const CCacheChunk &)=delete
CCacheChunk(const void *pData, int Size)
Definition: server.cpp:1940
Definition: server.h:344
void Clear()
Definition: server.cpp:1950
void AddChunk(const void *pData, int Size)
Definition: server.cpp:1945
CCache()
Definition: server.cpp:1930
std::vector< CCacheChunk > m_vCache
Definition: server.h:356
~CCache()
Definition: server.cpp:1935
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:210
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
@ 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_DDNetVersion
Definition: server.h:178
char m_aDDNetVersionStr[64]
Definition: server.h:179
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:865
UNIXSOCKET m_ConnLoggingSocket
Definition: server.h:83
void SetClientName(int ClientId, const char *pName) override
Definition: server.cpp:426
static void ConchainSixupUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3814
bool CheckReservedSlotAuth(int ClientId, const char *pPassword)
Definition: server.cpp:1415
void ExpireServerInfo() override
Definition: server.cpp:2313
void GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_DIGEST *pMapSha256, int *pMapCrc) override
Definition: server.cpp:1194
void SetClientCountry(int ClientId, int Country) override
Definition: server.cpp:436
void SetClientFlags(int ClientId, int Flags) override
Definition: server.cpp:455
int GetAuthedState(int ClientId) const override
Definition: server.cpp:569
static void ConDumpSqlServers(IConsole::IResult *pResult, void *pUserData)
Definition: server.cpp:3632
void DoSnapshot()
Definition: server.cpp:884
void RedirectClient(int ClientId, int Port, bool Verbose=false) override
Definition: server.cpp:491
static void ConchainCommandAccessUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3676
int64_t TickStartTime(int Tick)
Definition: server.cpp:520
char m_aErrorShutdownReason[128]
Definition: server.h:258
void CacheServerInfo(CCache *pCache, int Type, bool SendClients)
Definition: server.cpp:1955
void Ban(int ClientId, int Seconds, const char *pReason, bool VerbatimReason) override
Definition: server.cpp:484
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:4000
void SetClientClan(int ClientId, const char *pClan) override
Definition: server.cpp:431
static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData)
Definition: server.cpp:3583
bool DnsblPending(int ClientId) override
Definition: server.h:460
void ReadAnnouncementsFile()
Definition: server.cpp:3977
CServerBan m_ServerBan
Definition: server.h:204
CSnapshotDelta m_SnapshotDelta
Definition: server.h:198
bool IsSixup(int ClientId) const override
Definition: server.h:481
void SetRconCid(int ClientId) override
Definition: server.cpp:564
class CDbConnectionPool * m_pConnectionPool
Definition: server.h:86
bool IsRecording(int ClientId) override
Definition: server.cpp:3489
const char * ClientClan(int ClientId) const override
Definition: server.cpp:639
int * GetIdMap(int ClientId) override
Definition: server.cpp:4029
void GetServerInfoSixup(CPacker *pPacker, int Token, bool SendClients)
Definition: server.cpp:2285
void SetClientScore(int ClientId, std::optional< int > Score) override
Definition: server.cpp:444
const char * GetMapName() const override
Definition: server.cpp:2552
void StopDemos() override
Definition: server.cpp:3494
void AuthRemoveKey(int KeySlot)
Definition: server.cpp:3202
void SendCapabilities(int ClientId)
Definition: server.cpp:1202
class IConsole * m_pConsole
Definition: server.h:70
bool SetTimedOut(int ClientId, int OrigId) override
Definition: server.cpp:4034
void RegisterCommands()
Definition: server.cpp:3881
bool IsClientNameAvailable(int ClientId, const char *pNameRequest)
Definition: server.cpp:295
int Port() const override
Definition: server.cpp:669
bool SetClientNameImpl(int ClientId, const char *pNameRequest, bool Set)
Definition: server.cpp:319
SHA256_DIGEST m_aCurrentMapSha256[NUM_MAP_TYPES]
Definition: server.h:246
void SendConnectionReady(int ClientId)
Definition: server.cpp:1288
static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3832
void SnapSetStaticsize(int ItemType, int Size) override
Definition: server.cpp:3961
int Run()
Definition: server.cpp:2692
std::shared_ptr< ILogger > m_pFileLogger
Definition: server.h:265
bool m_ConnLoggingSocketCreated
Definition: server.h:82
static void ConchainAnnouncementFileName(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3842
bool DnsblWhite(int ClientId) override
Definition: server.h:455
void CacheServerInfoSixup(CCache *pCache, bool SendClients)
Definition: server.cpp:2169
class IStorage * m_pStorage
Definition: server.h:71
static void ConchainRconHelperPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3797
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:1017
void InitDnsbl(int ClientId)
Definition: server.cpp:1104
CNetServer m_NetServer
Definition: server.h:201
void PumpNetwork(bool PacketWaiting)
Definition: server.cpp:2447
void SendLogLine(const CLogMessage *pMessage)
Definition: server.cpp:552
std::shared_ptr< ILogger > m_pStdoutLogger
Definition: server.h:266
int m_ServerInfoNumRequests
Definition: server.h:256
static void ConRecord(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3505
int m_RunServer
Definition: server.h:219
static void ConchainMapUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3804
int SnapNewId() override
Definition: server.cpp:3945
bool ClientSlotEmpty(int ClientId) const override
Definition: server.cpp:659
static void ConAuthAddHashed(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3248
void SendMapReload(int ClientId)
Definition: server.cpp:1282
IEngineMap * m_pMap
Definition: server.h:207
bool m_ReloadedWhenEmpty
Definition: server.h:223
const char * ClientName(int ClientId) const override
Definition: server.cpp:629
CDemoRecorder m_aDemoRecorder[NUM_RECORDERS]
Definition: server.h:252
bool DnsblBlack(int ClientId) override
Definition: server.h:464
bool m_MapReload
Definition: server.h:221
void * SnapNewItem(int Type, int Id, int Size) override
Definition: server.cpp:3955
void UpdateClientRconCommands()
Definition: server.cpp:1378
static int NewClientCallback(int ClientId, void *pUser, bool Sixup)
Definition: server.cpp:1071
CUPnP m_UPnP
Definition: server.h:77
bool WouldClientClanChange(int ClientId, const char *pClanRequest) override
Definition: server.cpp:421
unsigned m_aCurrentMapCrc[NUM_MAP_TYPES]
Definition: server.h:247
int MaxClients() const override
Definition: server.cpp:674
class IStorage * Storage()
Definition: server.h:98
static void ConShutdown(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3403
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:1361
static void ConchainRconModPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3790
void UpdateRegisterServerInfo()
Definition: server.cpp:2318
void SendRconType(int ClientId, bool UsernameReq)
Definition: server.cpp:1187
static void ConAuthList(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3395
const char * GetAuthName(int ClientId) const override
Definition: server.cpp:576
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:263
int64_t m_GameStartTime
Definition: server.h:209
static void ConReloadAnnouncement(IConsole::IResult *pResult, void *pUserData)
Definition: server.cpp:3652
void LogoutClient(int ClientId, const char *pReason)
Definition: server.cpp:3707
bool SetClientClanImpl(int ClientId, const char *pClanRequest, bool Set)
Definition: server.cpp:375
static void ConAuthAdd(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3221
const char * GetNetErrorString(int ClientId) override
Definition: server.h:471
void SendServerInfoConnless(const NETADDR *pAddr, int Token, int Type)
Definition: server.cpp:1915
static void ConAuthUpdateHashed(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3320
CCache m_aServerInfoCache[3 *2]
Definition: server.h:364
void FillAntibot(CAntibotRoundData *pData) override
Definition: server.cpp:2300
void SendMap(int ClientId)
Definition: server.cpp:1210
void SendRconLogLine(int ClientId, const CLogMessage *pMessage)
Definition: server.cpp:1301
void DemoRecorder_HandleAutoStart() override
Definition: server.cpp:3414
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:622
static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3822
int DistinctClientCount() const override
Definition: server.cpp:693
class IRegister * m_pRegister
Definition: server.h:73
CNameBans m_NameBans
Definition: server.h:260
int ClientCountry(int ClientId) const override
Definition: server.cpp:649
static void ConStatus(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3132
bool RateLimitServerInfoConnless()
Definition: server.cpp:1893
int SendMsg(CMsgPacker *pMsg, int Flags, int ClientId) override
Definition: server.cpp:788
static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3669
int m_PrintCBIndex
Definition: server.h:226
CSnapIdPool m_IdPool
Definition: server.h:200
CCache m_aSixupServerInfoCache[2]
Definition: server.h:365
static int DelClientCallback(int ClientId, const char *pReason, void *pUser)
Definition: server.cpp:1147
void UpdateServerInfo(bool Resend=false)
Definition: server.cpp:2412
void SendRconLine(int ClientId, const char *pLine)
Definition: server.cpp:1294
CServer()
Definition: server.cpp:228
int GetClientVersion(int ClientId) const override
Definition: server.cpp:725
void LogoutKey(int Key, const char *pReason)
Definition: server.cpp:3746
void ProcessClientPacket(CNetChunk *pPacket)
Definition: server.cpp:1447
void ResetNetErrorString(int ClientId) override
Definition: server.h:472
bool WouldClientNameChange(int ClientId, const char *pNameRequest) override
Definition: server.cpp:416
void * m_pPersistentData
Definition: server.h:228
void StopRecord(int ClientId) override
Definition: server.cpp:3481
bool ClientPrevIngame(int ClientId) override
Definition: server.h:470
char m_aMapDownloadUrl[256]
Definition: server.h:250
static void ConAuthRemove(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3364
@ MAX_RCONCMD_SEND
Definition: server.h:105
bool m_ServerInfoNeedsUpdate
Definition: server.h:366
void ReloadMap() override
Definition: server.cpp:2563
static void ConAuthUpdate(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3291
IEngine * m_pEngine
Definition: server.h:74
CONN_LOGGING_CMD
Definition: server.h:487
@ OPEN_SESSION
Definition: server.h:488
@ CLOSE_SESSION
Definition: server.h:489
void SendConnLoggingCommand(CONN_LOGGING_CMD Cmd, const NETADDR *pAddr)
Definition: server.cpp:1131
bool GetClientInfo(int ClientId, CClientInfo *pInfo) const override
Definition: server.cpp:585
void SendServerInfo(const NETADDR *pAddr, int Token, int Type, bool SendClients)
Definition: server.cpp:2231
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:3563
class IEngineAntibot * Antibot()
Definition: server.h:99
static int NewClientNoAuthCallback(int ClientId, void *pUser)
Definition: server.cpp:1039
IEngine * Engine()
Definition: server.h:101
static void ConchainRconPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3783
static void ConStopRecord(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3542
CEcon m_Econ
Definition: server.h:202
int NumRconCommands(int ClientId)
Definition: server.cpp:1366
class CDbConnectionPool * DbPool()
Definition: server.h:100
class CConfig * Config()
Definition: server.h:95
int Init()
Definition: server.cpp:525
int ClientCount() const override
Definition: server.cpp:679
CFifo m_Fifo
Definition: server.h:203
void ChangeMap(const char *pMap) override
Definition: server.cpp:2557
bool ClientIngame(int ClientId) const override
Definition: server.cpp:664
size_t m_AnnouncementLastLine
Definition: server.h:262
void StartRecord(int ClientId) override
Definition: server.cpp:3458
int LoadMap(const char *pMapName)
Definition: server.cpp:2568
int m_aPrevStates[MAX_CLIENTS]
Definition: server.h:448
int m_RconAuthLevel
Definition: server.h:225
bool ErrorShutdown() const
Definition: server.h:478
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:3854
void SendRconCmdRem(const IConsole::CCommandInfo *pCommandInfo, int ClientId)
Definition: server.cpp:1354
int64_t m_ServerInfoFirstRequest
Definition: server.h:255
char m_aShutdownReason[128]
Definition: server.h:227
static void ConLogout(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3552
static void ConKick(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3120
void SaveDemo(int ClientId, float Time) override
Definition: server.cpp:3448
void SendRconCmdAdd(const IConsole::CCommandInfo *pCommandInfo, int ClientId)
Definition: server.cpp:1345
void SetClientDDNetVersion(int ClientId, int DDNetVersion) override
Definition: server.cpp:611
void ConchainRconPasswordChangeGeneric(int Level, const char *pCurrent, IConsole::IResult *pResult)
Definition: server.cpp:3753
void SetLoggers(std::shared_ptr< ILogger > &&pFileLogger, std::shared_ptr< ILogger > &&pStdoutLogger)
Definition: server.cpp:4060
void SetErrorShutdown(const char *pReason) override
Definition: server.cpp:4055
class IConsole * Console()
Definition: server.h:97
static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: server.cpp:3658
void Kick(int ClientId, const char *pReason) override
Definition: server.cpp:463
void SendMapData(int ClientId, int Chunk)
Definition: server.cpp:1246
const char * m_pCurrentMapName
Definition: server.h:245
~CServer()
Definition: server.cpp:275
CAuthManager m_AuthManager
Definition: server.h:253
bool m_SameMapReload
Definition: server.h:222
void SetTimeoutProtected(int ClientId) override
Definition: server.h:474
void SnapFreeId(int Id) override
Definition: server.cpp:3950
static void ConMapReload(IConsole::IResult *pResult, void *pUser)
Definition: server.cpp:3547
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:76
Definition: console.h:47
Definition: console.h:18
void(* FCommandCallback)(IResult *pResult, void *pUserData)
Definition: console.h:94
Definition: antibot.h:31
Definition: map.h:35
Definition: engine.h:15
Definition: server.h:295
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:806
struct sockaddr_un UNIXSOCKETADDR
Definition: system.h:810
CServer * CreateServer()
Definition: server.cpp:3966
@ SERVER_DEMO_CLIENT
Definition: server.h:26
Definition: antibot_data.h:98
Definition: network.h:139
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