Reversed CIPRateLimit

Minor refactoring
This commit is contained in:
s1lent 2017-12-19 21:34:15 +07:00
parent 5e2bd82b00
commit f5784be364
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
14 changed files with 198 additions and 394 deletions

View File

@ -81,7 +81,7 @@ extern unsigned short *host_basepal;
NOXREF void Host_EndGame(const char *message, ...);
void NORETURN Host_Error(const char *error, ...);
void Host_InitLocal(void);
NOBODY void Info_WriteVars(FileHandle_t fp);
NOXREF void Info_WriteVars(FileHandle_t fp);
void Host_WriteConfiguration(void);
void Host_WriteCustomConfig(void);
void SV_ClientPrintf(const char *fmt, ...);

View File

@ -28,51 +28,123 @@
#include "precompiled.h"
//bool (__fastcall *pCIPRateLimit__CheckIP)(CIPRateLimit *obj, int none, netadr_t adr);
CIPRateLimit rateChecker;
NOBODY bool CIPRateLimit::CheckIP(netadr_t adr)
cvar_t max_queries_sec = { "max_queries_sec", "3.0", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, nullptr };
cvar_t max_queries_sec_global = { "max_queries_sec_global", "30", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, nullptr };
cvar_t max_queries_window = { "max_queries_window", "60", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, nullptr };
cvar_t sv_logblocks = { "sv_logblocks", "0", FCVAR_SERVER, 0.0f, nullptr };
CIPRateLimit::CIPRateLimit() : m_IPTree(0, START_TREE_SIZE, LessIP)
{
// TODO: Reverse me
//{
// long curTime; // 29
// ip_t clientIP; // 32
// class iprate_s findEntry; // 56
// ip_t entry; // 57
// {
// ip_t tmp; // 37
// int i; // 38
// LastInorder(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this); /* size=169106148, low_pc=0 */ // 37
// IsValidIndex(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=524288, low_pc=0 */ // 41
// operator[](class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=169107280, low_pc=0 */ // 42
// {
// ip_t removeIPT; // 45
// PrevInorder(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=0, low_pc=0 */ // 46
// }
// PrevInorder(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=2019913216, low_pc=0 */ // 51
// }
// Find(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// const class iprate_s &const search); /* size=1967350639, low_pc=0 */ // 57
// IsValidIndex(const class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=7626612, low_pc=0 */ // 59
// operator[](class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=1936875856, low_pc=0 */ // 61
// operator[](class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// int i); /* size=1869898597, low_pc=0 */ // 63
// {
// float query_rate; // 70
// }
// {
// class iprate_s newEntry; // 80
// Insert(class CUtlRBTree<CIPRateLimit::iprate_s, int> *const this,
// const class iprate_s &const insert); /* size=1399744112, low_pc=0 */ // 84
// }
// {
// float query_rate; // 97
// }
//}
m_iGlobalCount = 0;
m_lLastTime = -1;
}
CIPRateLimit::~CIPRateLimit()
{
}
// Sort func for rb tree
bool CIPRateLimit::LessIP(const iprate_t &lhs, const iprate_t &rhs)
{
return (lhs.ip < rhs.ip);
}
// Return false if this IP has exceeded limits
bool CIPRateLimit::CheckIP(netadr_t adr)
{
time_t curTime = CRehldsPlatformHolder::get()->time(nullptr);
// check the per ip rate (do this first, so one person dosing doesn't add to the global max rate
ip_t clientIP;
Q_memcpy(&clientIP, adr.ip, sizeof(ip_t));
// if we have stored too many items
if (m_IPTree.Count() > MAX_TREE_SIZE)
{
ip_t tmp = m_IPTree.LastInorder(); // we step BACKWARD's through the tree
int i = m_IPTree.FirstInorder();
// trim 1/3 the entries from the tree and only traverse the max nodes
while ((m_IPTree.Count() > (2 * MAX_TREE_SIZE) / 3) && i < m_IPTree.MaxElement())
{
if (m_IPTree.IsValidIndex(tmp) &&
(curTime - m_IPTree[tmp].lastTime) > FLUSH_TIMEOUT &&
m_IPTree[tmp].ip != clientIP)
{
ip_t removeIPT = tmp;
tmp = m_IPTree.PrevInorder(tmp);
m_IPTree.RemoveAt(removeIPT);
continue;
}
i++;
tmp = m_IPTree.PrevInorder(tmp);
}
}
// now find the entry and check if its within our rate limits
iprate_t findEntry;
findEntry.ip = clientIP;
ip_t entry = m_IPTree.Find(findEntry);
if (m_IPTree.IsValidIndex(entry))
{
m_IPTree[entry].count++; // a new hit
if ((curTime - m_IPTree[entry].lastTime) > max_queries_window.value)
{
m_IPTree[entry].lastTime = curTime;
m_IPTree[entry].count = 1;
}
else
{
float query_rate = static_cast<float>(m_IPTree[entry].count) / max_queries_window.value; // add one so the bottom is never zero
if (query_rate > max_queries_sec.value)
{
return false;
}
}
}
else
{
// not found, insert this new guy
iprate_t newEntry;
newEntry.count = 1;
newEntry.lastTime = curTime;
newEntry.ip = clientIP;
m_IPTree.Insert(newEntry);
}
// now check the global rate
m_iGlobalCount++;
if ((curTime - m_lLastTime) > max_queries_window.value)
{
m_lLastTime = curTime;
m_iGlobalCount = 1;
}
else
{
float query_rate = static_cast<float>(m_iGlobalCount) / max_queries_window.value; // add one so the bottom is never zero
if (query_rate > max_queries_sec_global.value)
{
return false;
}
}
return true;
}
// Return false if this IP exceeds rate limits
bool SV_CheckConnectionLessRateLimits(netadr_t &adr)
{
bool ret = rateChecker.CheckIP(adr);
if (!ret && sv_logblocks.value)
{
Log_Printf("Traffic from %s was blocked for exceeding rate limits\n", NET_AdrToString(adr));
}
return ret;
}

View File

@ -35,9 +35,10 @@
class CIPRateLimit
{
public:
CIPRateLimit() {}
~CIPRateLimit() {}
CIPRateLimit();
~CIPRateLimit();
// updates an ip entry, return true if the ip is allowed, false otherwise
bool CheckIP(netadr_t adr);
private:
@ -48,21 +49,25 @@ private:
FLUSH_TIMEOUT = 120,
};
typedef struct iprate_s
using ip_t = int;
struct iprate_t
{
typedef int ip_t;
ip_t ip;
long lastTime;
int count;
} iprate_t;
};
private:
class CUtlRBTree<CIPRateLimit::iprate_s, int> m_IPTree;
CUtlRBTree<iprate_t, int> m_IPTree;
int m_iGlobalCount;
long m_lLastTime;
bool LessIP(const struct iprate_s &, const struct iprate_s &);
static bool LessIP(const iprate_t &lhs, const iprate_t &rhs);
};
//extern bool (__fastcall *pCIPRateLimit__CheckIP)(CIPRateLimit *obj, int none, netadr_t adr);
extern cvar_t max_queries_sec;
extern cvar_t max_queries_sec_global;
extern cvar_t max_queries_window;
extern cvar_t sv_logblocks;
bool SV_CheckConnectionLessRateLimits(netadr_t &adr);

View File

@ -1,37 +0,0 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "precompiled.h"
class CIPRateLimit rateChecker;
int CheckIP(netadr_t adr)
{
CRehldsPlatformHolder::get()->time(NULL); // time() is called inside IpRateLimiter
return 1;
}

View File

@ -1,37 +0,0 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "maintypes.h"
#include "net.h"
#include "ipratelimit.h"
extern class CIPRateLimit rateChecker;
int CheckIP(netadr_t adr);

View File

@ -362,10 +362,6 @@ extern cvar_t sv_allow_upload;
extern cvar_t sv_max_upload;
extern cvar_t hpk_maxsize;
extern cvar_t sv_visiblemaxplayers;
extern cvar_t max_queries_sec;
extern cvar_t max_queries_sec_global;
extern cvar_t max_queries_window;
extern cvar_t sv_logblocks;
extern cvar_t sv_downloadurl;
extern cvar_t sv_allow_dlfile;
extern cvar_t sv_version;
@ -535,8 +531,6 @@ void SV_ProcessFile(client_t *cl, char *filename);
qboolean SV_FilterPacket(void);
void SV_SendBan(void);
void SV_ReadPackets(void);
//NOBODY int ntohl(void);
//NOBODY int htons(void);
void SV_CheckTimeouts(void);
int SV_CalcPing(client_t *cl);
void SV_SendFullClientUpdateForAll(client_t *client);

View File

@ -174,10 +174,6 @@ cvar_t sv_max_upload = { "sv_uploadmax", "0.5", FCVAR_SERVER, 0.0f, NULL };
cvar_t hpk_maxsize = { "hpk_maxsize", "4", FCVAR_ARCHIVE, 0.0f, NULL };
cvar_t sv_visiblemaxplayers = { "sv_visiblemaxplayers", "-1", 0, 0.0f, NULL };
cvar_t max_queries_sec = { "max_queries_sec", "3.0", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, NULL };
cvar_t max_queries_sec_global = { "max_queries_sec_global", "30", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, NULL };
cvar_t max_queries_window = { "max_queries_window", "60", FCVAR_SERVER | FCVAR_PROTECTED, 0.0f, NULL };
cvar_t sv_logblocks = { "sv_logblocks", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t sv_downloadurl = { "sv_downloadurl", "", FCVAR_PROTECTED, 0.0f, NULL };
cvar_t sv_allow_dlfile = { "sv_allow_dlfile", "1", 0, 0.0f, NULL };
#ifdef REHLDS_FIXES
@ -3571,15 +3567,12 @@ void SV_ReadPackets(void)
if (*(uint32 *)net_message.data == 0xFFFFFFFF)
{
// Connectionless packet
if (CheckIP(net_from))
if (SV_CheckConnectionLessRateLimits(net_from))
{
Steam_HandleIncomingPacket(net_message.data, net_message.cursize, ntohl(*(u_long *)&net_from.ip[0]), htons(net_from.port));
SV_ConnectionlessPacket();
}
else if (sv_logblocks.value != 0.0f)
{
Log_Printf("Traffic from %s was blocked for exceeding rate limits\n", NET_AdrToString(net_from));
}
continue;
}

View File

@ -172,7 +172,6 @@ void CSteam3Server::OnGSClientApprove(GSClientApprove_t *pGSClientSteam2Accept)
if (!cl)
return;
if (SV_FilterUser(&cl->network_userid))
{
char msg[256];
@ -519,7 +518,6 @@ void CSteam3Server::SendUpdatedServerDetails()
CRehldsPlatformHolder::get()->SteamGameServer()->SetMapName(g_psv.name);
}
void CSteam3Client::Shutdown()
{
if (m_bLoggedOn)

View File

@ -50,7 +50,7 @@ protected:
virtual ~CSteam3() {}
virtual void Shutdown() = 0;
void GSSendUserStatusResponse(CSteamID &, int, int);
void GSSendUserStatusResponse(CSteamID &steamID, int nSecondsConnected, int nSecondsSinceLast);
bool InitModule();
};
@ -75,11 +75,11 @@ public:
NOBODY void SetServerType();
NOBODY void SetSpawnCount(int count);
NOBODY bool BSecure();
NOBODY bool BLanOnly();
bool BWantsSecure() { return m_bWantToBeSecure; }
bool BLoggedOn() { return m_bLoggedOn; }
bool BSecure() const { return m_bWantToBeSecure; }
bool BLanOnly() const { return m_bLanOnly; };
bool BWantsSecure() const { return m_bWantToBeSecure; }
bool BLoggedOn() const { return m_bLoggedOn; }
uint64 GetSteamID();

View File

@ -28,22 +28,15 @@
#include "precompiled.h"
#ifndef Z_Functions_region
/*
==============================================================================
ZONE MEMORY ALLOCATION
There is never any space between memblocks, and there will never be two
contiguous free memblocks.
The rover can be left pointing at a non-empty block
The zone calls are pretty much only used for small strings and structures,
all big things are allocated on the hunk.
==============================================================================
*/
// ZONE MEMORY ALLOCATION
//
// There is never any space between memblocks, and there will never be two
// contiguous free memblocks.
//
// The rover can be left pointing at a non-empty block
//
// The zone calls are pretty much only used for small strings and structures,
// all big things are allocated on the hunk.
#define ZONEID 0x001d4a11
const int MINFRAGMENT = 64;
@ -242,7 +235,7 @@ NOXREF void Z_Print(memzone_t *zone)
}
}
void Z_CheckHeap(void)
void Z_CheckHeap()
{
memblock_t *block;
@ -270,10 +263,6 @@ void Z_CheckHeap(void)
}
}
#endif // Z_Functions_region
#ifndef Hunk_Functions_region
const int HUNK_NAME_LEN = 64;
#define HUNK_SENTINEL 0x1df001ed
@ -293,15 +282,8 @@ int hunk_high_used;
qboolean hunk_tempactive;
int hunk_tempmark;
/*
==============
Hunk_Check
Run consistency and sentinel trashing checks
==============
*/
void Hunk_Check(void)
// Run consistency and sentinel trashing checks
void Hunk_Check()
{
hunk_t *h;
@ -319,15 +301,8 @@ void Hunk_Check(void)
}
}
/*
==============
Hunk_Print
If "all" is specified, every single allocation is printed.
Otherwise, allocations with the same name will be totaled up before printing.
==============
*/
// If "all" is specified, every single allocation is printed.
// Otherwise, allocations with the same name will be totaled up before printing.
NOXREF void Hunk_Print(qboolean all)
{
NOXREFCHECK;
@ -352,9 +327,7 @@ NOXREF void Hunk_Print(qboolean all)
while (true)
{
//
// skip to the high hunk if done with low hunk
//
if (h == endlow)
{
Con_Printf("-------------------------\n");
@ -363,15 +336,11 @@ NOXREF void Hunk_Print(qboolean all)
h = starthigh;
}
//
// if totally done, break
//
if (h == endhigh)
break;
//
// run consistancy checks
//
if (h->sentinel != HUNK_SENTINEL)
Sys_Error("%s: trahsed sentinal", __func__);
if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size)
@ -382,16 +351,12 @@ NOXREF void Hunk_Print(qboolean all)
totalblocks++;
sum += h->size;
//
// print the single block
//
Q_memcpy(name, h->name, HUNK_NAME_LEN);
if (all)
Con_Printf("%8p :%8i %8s\n", h, h->size, name);
//
// print the total
//
if (next == endlow || next == endhigh ||
Q_strncmp(h->name, next->name, HUNK_NAME_LEN))
{
@ -408,12 +373,6 @@ NOXREF void Hunk_Print(qboolean all)
Con_Printf("%8i total blocks\n", totalblocks);
}
/*
===================
Hunk_AllocName
===================
*/
void *Hunk_AllocName(int size, const char *name)
{
if (size < 0)
@ -447,7 +406,7 @@ void *Hunk_Alloc(int size)
return Hunk_AllocName(size, "unknown");
}
int Hunk_LowMark(void)
int Hunk_LowMark()
{
return hunk_low_used;
}
@ -462,7 +421,7 @@ void Hunk_FreeToLowMark(int mark)
hunk_low_used = mark;
}
int Hunk_HighMark(void)
int Hunk_HighMark()
{
if (hunk_tempactive)
{
@ -489,12 +448,6 @@ void Hunk_FreeToHighMark(int mark)
hunk_high_used = mark;
}
/*
===================
Hunk_HighAllocName
===================
*/
void *Hunk_HighAllocName(int size, const char *name)
{
hunk_t *h;
@ -531,14 +484,7 @@ void *Hunk_HighAllocName(int size, const char *name)
return (void *)(h + 1);
}
/*
=================
Hunk_TempAlloc
Return space from the top of the hunk
=================
*/
// Return space from the top of the hunk
void *Hunk_TempAlloc(int size)
{
void *buf;
@ -556,18 +502,7 @@ void *Hunk_TempAlloc(int size)
return buf;
}
#endif // Hunk_Functions_region
#ifndef Cache_Functions_region
/*
===============================================================================
CACHE MEMORY
===============================================================================
*/
// CACHE MEMORY
const int CACHE_NAME_LEN = 64;
typedef struct cache_system_s
@ -583,12 +518,6 @@ typedef struct cache_system_s
cache_system_t cache_head;
/*
===========
Cache_Move
===========
*/
void Cache_Move(cache_system_t *c)
{
cache_system_t *newmem = Cache_TryAlloc(c->size, 1);
@ -607,14 +536,7 @@ void Cache_Move(cache_system_t *c)
}
}
/*
============
Cache_FreeLow
Throw things out until the hunk can be expanded to the given point
============
*/
// Throw things out until the hunk can be expanded to the given point
void Cache_FreeLow(int new_low_hunk)
{
cache_system_t *c;
@ -630,14 +552,7 @@ void Cache_FreeLow(int new_low_hunk)
}
}
/*
============
Cache_FreeHigh
Throw things out until the hunk can be expanded to the given point
============
*/
// Throw things out until the hunk can be expanded to the given point
void Cache_FreeHigh(int new_high_hunk)
{
cache_system_t *c, *prev;
@ -685,15 +600,8 @@ void Cache_MakeLRU(cache_system_t *cs)
cache_head.lru_next = cs;
}
/*
============
Cache_TryAlloc
Looks for a free block of memory between the high and low hunk marks
Size should already include the header and padding
============
*/
// Looks for a free block of memory between the high and low hunk marks
// Size should already include the header and padding
cache_system_t *Cache_TryAlloc(int size, qboolean nobottom)
{
cache_system_t *cs;
@ -758,15 +666,8 @@ cache_system_t *Cache_TryAlloc(int size, qboolean nobottom)
return newmem;
}
/*
============
Cache_Flush
Throw everything out, so new data will be demand cached
============
*/
void Cache_Force_Flush(void)
// Throw everything out, so new data will be demand cached
void Cache_Force_Flush()
{
cache_system_t *i;
@ -776,7 +677,7 @@ void Cache_Force_Flush(void)
}
}
void Cache_Flush(void)
void Cache_Flush()
{
if (g_pcl.maxclients <= 1 || allow_cheats)
{
@ -788,15 +689,8 @@ void Cache_Flush(void)
}
}
/*
============
CacheSystemCompare
Compares the names of two cache_system_t structs.
Used with qsort()
============
*/
// Compares the names of two cache_system_t structs.
// Used with qsort()
NOXREF int CacheSystemCompare(const void *ppcs1, const void *ppcs2)
{
NOXREFCHECK;
@ -807,14 +701,7 @@ NOXREF int CacheSystemCompare(const void *ppcs1, const void *ppcs2)
return Q_stricmp(pcs1->name, pcs2->name);
}
/*
============
Cache_Print
============
*/
NOXREF void Cache_Print(void)
NOXREF void Cache_Print()
{
NOXREFCHECK;
@ -826,15 +713,8 @@ NOXREF void Cache_Print(void)
}
}
/*
============
ComparePath1
compares the first directory of two paths...
(so "foo/bar" will match "foo/fred"
============
*/
// compares the first directory of two paths...
// (so "foo/bar" will match "foo/fred"
NOXREF int ComparePath1(char *path1, char *path2)
{
NOXREFCHECK;
@ -851,18 +731,11 @@ NOXREF int ComparePath1(char *path1, char *path2)
return 1;
}
/*
============
CommatizeNumber
takes a number, and creates a string of that with commas in the
appropriate places.
============
*/
// Takes a number, and creates a string of that with commas in the appropriate places.
NOXREF char *CommatizeNumber(int num, char *pout)
{
NOXREFCHECK;
// this is probably more complex than it needs to be.
int len = 0;
int i;
@ -892,39 +765,18 @@ NOXREF char *CommatizeNumber(int num, char *pout)
return pout;
}
/*
============
Cache_Report
============
*/
NOXREF void Cache_Report(void)
NOXREF void Cache_Report()
{
NOXREFCHECK;
Con_DPrintf("%4.1f megabyte data cache\n", (hunk_size - hunk_low_used - hunk_high_used) / (float)(1024 * 1024));
}
/*
============
Cache_Compact
============
*/
NOXREF void Cache_Compact(void)
NOXREF void Cache_Compact()
{
NOXREFCHECK;
}
/*
============
Cache_Init
============
*/
void Cache_Init(void)
void Cache_Init()
{
cache_head.next = cache_head.prev = &cache_head;
cache_head.lru_next = cache_head.lru_prev = &cache_head;
@ -932,14 +784,7 @@ void Cache_Init(void)
Cmd_AddCommand("flush", Cache_Flush);
}
/*
==============
Cache_Free
Frees the memory and removes it from the LRU list
==============
*/
// Frees the memory and removes it from the LRU list
void Cache_Free(cache_user_t *c)
{
if (!c->data)
@ -956,7 +801,7 @@ void Cache_Free(cache_user_t *c)
Cache_UnlinkLRU(cs);
}
NOXREF int Cache_TotalUsed(void)
NOXREF int Cache_TotalUsed()
{
NOXREFCHECK;
@ -968,12 +813,6 @@ NOXREF int Cache_TotalUsed(void)
return Total;
}
/*
==============
Cache_Check
==============
*/
void* EXT_FUNC Cache_Check(cache_user_t *c)
{
cache_system_t *cs;
@ -989,12 +828,6 @@ void* EXT_FUNC Cache_Check(cache_user_t *c)
return c->data;
}
/*
==============
Cache_Alloc
==============
*/
void *Cache_Alloc(cache_user_t *c, int size, char *name)
{
cache_system_t *cs;
@ -1034,12 +867,6 @@ void *Cache_Alloc(cache_user_t *c, int size, char *name)
return Cache_Check(c);
}
/*
========================
Memory_Init
========================
*/
void Memory_Init(void *buf, int size)
{
int zonesize = ZONE_DYNAMIC_SIZE;
@ -1069,7 +896,7 @@ void Memory_Init(void *buf, int size)
Z_ClearZone(mainzone, zonesize);
}
NOXREF void Cache_Print_Models_And_Totals(void)
NOXREF void Cache_Print_Models_And_Totals()
{
NOXREFCHECK;
char buf[50];
@ -1109,7 +936,7 @@ NOXREF void Cache_Print_Models_And_Totals(void)
const int MAX_SFX = 1024;
NOXREF void Cache_Print_Sounds_And_Totals(void)
NOXREF void Cache_Print_Sounds_And_Totals()
{
NOXREFCHECK;
char buf[50];
@ -1154,5 +981,3 @@ NOXREF void Cache_Print_Sounds_And_Totals(void)
FS_FPrintf(file, "Total bytes in cache used by sound: %s\n", CommatizeNumber(totalsndbytes, buf));
FS_Close(file);
}
#endif // Cache_Functions_region

View File

@ -53,15 +53,15 @@ void Z_Free(void *ptr);
void *Z_Malloc(int size);
void *Z_TagMalloc(int size, int tag);
NOXREF void Z_Print(memzone_t *zone);
void Z_CheckHeap(void);
void Z_CheckHeap();
void Hunk_Check(void);
void Hunk_Check();
NOXREF void Hunk_Print(qboolean all);
void *Hunk_AllocName(int size, const char *name);
void *Hunk_Alloc(int size);
int Hunk_LowMark(void);
int Hunk_LowMark();
void Hunk_FreeToLowMark(int mark);
int Hunk_HighMark(void);
int Hunk_HighMark();
void Hunk_FreeToHighMark(int mark);
void *Hunk_HighAllocName(int size, const char *name);
void *Hunk_TempAlloc(int size);
@ -72,19 +72,19 @@ void Cache_FreeHigh(int new_high_hunk);
void Cache_UnlinkLRU(cache_system_t *cs);
void Cache_MakeLRU(cache_system_t *cs);
cache_system_t *Cache_TryAlloc(int size, qboolean nobottom);
void Cache_Force_Flush(void);
void Cache_Flush(void);
void Cache_Force_Flush();
void Cache_Flush();
NOXREF int CacheSystemCompare(const void *ppcs1, const void *ppcs2);
NOXREF void Cache_Print(void);
NOXREF void Cache_Print();
NOXREF int ComparePath1(char *path1, char *path2);
NOXREF char *CommatizeNumber(int num, char *pout);
NOXREF void Cache_Report(void);
NOXREF void Cache_Compact(void);
void Cache_Init(void);
NOXREF void Cache_Report();
NOXREF void Cache_Compact();
void Cache_Init();
void Cache_Free(cache_user_t *c);
NOXREF int Cache_TotalUsed(void);
NOXREF int Cache_TotalUsed();
void *Cache_Check(cache_user_t *c);
void *Cache_Alloc(cache_user_t *c, int size, char *name);
void Memory_Init(void *buf, int size);
NOXREF NOBODY void Cache_Print_Models_And_Totals(void);
NOXREF NOBODY void Cache_Print_Sounds_And_Totals(void);
NOXREF void Cache_Print_Models_And_Totals();
NOXREF void Cache_Print_Sounds_And_Totals();

View File

@ -49,7 +49,6 @@
<ClCompile Include="..\engine\host_cmd.cpp" />
<ClCompile Include="..\engine\info.cpp" />
<ClCompile Include="..\engine\ipratelimit.cpp" />
<ClCompile Include="..\engine\ipratelimitWrapper.cpp" />
<ClCompile Include="..\engine\l_studio.cpp" />
<ClCompile Include="..\engine\mathlib.cpp" />
<ClCompile Include="..\engine\mathlib_sse.cpp" />
@ -316,7 +315,6 @@
<ClInclude Include="..\engine\info.h" />
<ClInclude Include="..\engine\inst_baseline.h" />
<ClInclude Include="..\engine\ipratelimit.h" />
<ClInclude Include="..\engine\ipratelimitWrapper.h" />
<ClInclude Include="..\engine\keys.h" />
<ClInclude Include="..\engine\l_studio.h" />
<ClInclude Include="..\engine\mathlib_e.h" />

View File

@ -242,9 +242,6 @@
<ClCompile Include="..\engine\ipratelimit.cpp">
<Filter>engine\server</Filter>
</ClCompile>
<ClCompile Include="..\engine\ipratelimitWrapper.cpp">
<Filter>engine\server</Filter>
</ClCompile>
<ClCompile Include="..\engine\decals.cpp">
<Filter>engine\common</Filter>
</ClCompile>
@ -784,9 +781,6 @@
<ClInclude Include="..\engine\ipratelimit.h">
<Filter>engine\server</Filter>
</ClInclude>
<ClInclude Include="..\engine\ipratelimitWrapper.h">
<Filter>engine\server</Filter>
</ClInclude>
<ClInclude Include="..\public\savegame_version.h">
<Filter>public</Filter>
</ClInclude>

View File

@ -78,7 +78,6 @@
#include "com_custom.h"
#include "hashpak.h"
#include "ipratelimit.h"
#include "ipratelimitWrapper.h"
#include "savegame_version.h"
#include "sys_linuxwnd.h"
#include "SystemWrapper.h"