2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

PreprocessPacket hook moved after IP ban check

AUTH_IDTYPE moved to ReHLSDK
This commit is contained in:
asmodai 2015-09-29 22:56:25 +03:00
parent 8e0377617c
commit 4594ffba4a
5 changed files with 19 additions and 28 deletions

View File

@ -1251,7 +1251,7 @@ void NET_FreeMsg(net_messages_t *pmsg)
}
/* <d40a2> ../engine/net_ws.c:1391 */
qboolean NET_GetPacket_internal(netsrc_t sock)
qboolean NET_GetPacket(netsrc_t sock)
{
net_messages_t *pmsg; // 1393
qboolean bret; // 1396
@ -1300,25 +1300,6 @@ qboolean NET_GetPacket_internal(netsrc_t sock)
return bret;
}
bool EXT_FUNC NET_GetPacketPreprocessor(uint8* data, unsigned int len, const netadr_t& srcAddr) {
return true;
}
qboolean NET_GetPacket(netsrc_t sock) {
qboolean getRes = NET_GetPacket_internal(sock);
while (getRes) {
bool pass = g_RehldsHookchains.m_PreprocessPacket.callChain(NET_GetPacketPreprocessor, net_message.data, net_message.cursize, net_from);
if (pass) {
return 1;
}
//packet was consumed by 3rd party plugin, try to read another one
getRes = NET_GetPacket_internal(sock);
}
return 0;
}
/* <d41a9> ../engine/net_ws.c:1454 */
void NET_AllocateQueues(void)
{

View File

@ -91,13 +91,6 @@
#define HL_GENERIC_MAX 512
#define HL_EVENT_MAX 256
// Authentication types
#define AUTH_IDTYPE_UNKNOWN 0
#define AUTH_IDTYPE_STEAM 1
#define AUTH_IDTYPE_VALVE 2
#define AUTH_IDTYPE_LOCAL 3
/* <87d6f> ../engine/server.h:43 */
typedef enum redirect_e
{

View File

@ -3560,6 +3560,11 @@ void SV_SendBan(void)
SZ_Clear(&net_message);
}
bool EXT_FUNC NET_GetPacketPreprocessor(uint8* data, unsigned int len, const netadr_t& srcAddr)
{
return true;
}
/* <ab9af> ../engine/sv_main.c:4818 */
void SV_ReadPackets(void)
{
@ -3571,6 +3576,10 @@ void SV_ReadPackets(void)
continue;
}
bool pass = g_RehldsHookchains.m_PreprocessPacket.callChain(NET_GetPacketPreprocessor, net_message.data, net_message.cursize, net_from);
if (!pass)
continue;
if (*(uint32 *)net_message.data == 0xFFFFFFFF)
{
// Connectionless packet

View File

@ -29,6 +29,14 @@
#include "archtypes.h"
// Authentication types
enum AUTH_IDTYPE
{
AUTH_IDTYPE_UNKNOWN = 0,
AUTH_IDTYPE_STEAM = 1,
AUTH_IDTYPE_VALVE = 2,
AUTH_IDTYPE_LOCAL = 3
};
/* <2e915> ../engine/userid.h:22 */
typedef struct USERID_s

View File

@ -6,7 +6,7 @@
TEST(CRC32C_Hash, CRC32C, 1000) {
Sys_CheckCpuInstructionsSupport();
CHECK_WARNING_OUT("SSE4.1 Support", cpuinfo.sse4_1);
CHECK_WARNING_OUT("SSE4.2 Support", cpuinfo.sse4_2);
struct testdata_t {
const char* src;