mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Adapt codebase to new class to reduce rune-like code. * Fixed several bugs where the global CClient pointer was used instead of the instance in question to issue bans and display information about a certain client in CBanSystem and Pylon. * Upgraded CBanSystem and Pylon to use IPv6 instead (including IPv4 mapped IPv6 addresses). This breaks all existing banlist files! All bans have to be re-issued or the existing file has to be updated to use IPv4 mapped IPv6 addresses and renamed to 'banlist.json', and moved to the root of the 'platform' folder.
168 lines
5.0 KiB
C++
168 lines
5.0 KiB
C++
//=============================================================================//
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================//
|
|
|
|
#ifndef NET_CHAN_H
|
|
#define NET_CHAN_H
|
|
|
|
#include "tier1/bitbuf.h"
|
|
#include "tier1/NetAdr2.h"
|
|
#include "tier1/utlmemory.h"
|
|
#include "common/netmessages.h"
|
|
#include "common/protocol.h"
|
|
#include "public/include/inetchannel.h"
|
|
|
|
#define NET_FRAMES_BACKUP 128
|
|
#define NET_LEN_CHANNELNAME 32
|
|
#define NET_FRAMES_MASK (NET_FRAMES_BACKUP-1)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: forward declarations
|
|
//-----------------------------------------------------------------------------
|
|
class CBaseClient;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
struct netframe_t
|
|
{
|
|
float one;
|
|
float two;
|
|
float three;
|
|
float four;
|
|
float five;
|
|
float six;
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
struct __declspec(align(8)) netflow_t
|
|
{
|
|
float nextcompute;
|
|
float avgbytespersec;
|
|
float avgpacketspersec;
|
|
float avgloss;
|
|
float avgchoke;
|
|
float avglatency;
|
|
float latency;
|
|
int64_t totalpackets;
|
|
int64_t totalbytes;
|
|
netframe_t frames[NET_FRAMES_BACKUP];
|
|
netframe_t current_frame;
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
struct __declspec(align(4)) dataFragments_t
|
|
{
|
|
char* data;
|
|
int64_t block_size;
|
|
bool m_bIsCompressed;
|
|
uint8_t gap11[7];
|
|
int64_t m_nRawSize;
|
|
bool m_bFirstFragment;
|
|
bool m_bLastFragment;
|
|
bool m_bIsOutbound;
|
|
int transferID;
|
|
int m_nTransferSize;
|
|
int m_nCurrentOffset;
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
enum EBufType
|
|
{
|
|
BUF_RELIABLE = 0,
|
|
BUF_UNRELIABLE,
|
|
BUF_VOICE
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
class __declspec(align(8)) CNetChan
|
|
{
|
|
public:
|
|
const char* GetName(void) const;
|
|
const char* GetAddress(void) const;
|
|
int GetDataRate(void) const;
|
|
int GetBufferSize(void) const;
|
|
|
|
float GetLatency(int flow) const;
|
|
float GetAvgChoke(int flow) const;
|
|
float GetAvgLatency(int flow) const;
|
|
float GetAvgLoss(int flow) const;
|
|
float GetAvgPackets(int flow) const;
|
|
float GetAvgData(int flow) const;
|
|
|
|
int GetTotalData(int flow) const;
|
|
int GetTotalPackets(int flow) const;
|
|
int GetSequenceNr(int flow) const;
|
|
|
|
float GetTimeoutSeconds(void) const;
|
|
double GetConnectTime(void) const;
|
|
int GetSocket(void) const;
|
|
|
|
bool IsOverflowed(void) const;
|
|
//-----------------------------------------------------------------------------
|
|
private:
|
|
bool m_bProcessingMessages;
|
|
bool m_bShouldDelete;
|
|
bool m_bStopProcessing;
|
|
bool shutting_down;
|
|
int m_nOutSequenceNr;
|
|
int m_nInSequenceNr;
|
|
int m_nOutSequenceNrAck;
|
|
int m_nChokedPackets;
|
|
int unknown_challenge_var;
|
|
int m_nLastRecvFlags;
|
|
RTL_SRWLOCK LOCK;
|
|
bf_write m_StreamReliable;
|
|
CUtlMemory m_ReliableDataBuffer;
|
|
bf_write m_StreamUnreliable;
|
|
CUtlMemory m_UnreliableDataBuffer;
|
|
bf_write m_StreamVoice;
|
|
CUtlMemory m_VoiceDataBuffer;
|
|
int m_Socket;
|
|
int m_MaxReliablePayloadSize;
|
|
double last_received;
|
|
double connect_time;
|
|
uint32_t m_Rate;
|
|
int padding_maybe;
|
|
double m_fClearTime;
|
|
VecNetDataFragments m_WaitingList;
|
|
dataFragments_t m_ReceiveList;
|
|
int m_nSubOutFragmentsAck;
|
|
int m_nSubInFragments;
|
|
int m_nNonceHost;
|
|
uint32_t m_nNonceRemote;
|
|
bool m_bReceivedRemoteNonce;
|
|
bool m_bInReliableState;
|
|
bool m_bPendingRemoteNonceAck;
|
|
uint32_t m_nSubOutSequenceNr;
|
|
int m_nLastRecvNonce;
|
|
bool m_bUseCompression;
|
|
uint32_t dword168;
|
|
float m_Timeout;
|
|
INetChannelHandler* m_MessageHandler;
|
|
VecNetMessages m_NetMessages;
|
|
uint64_t qword198;
|
|
int m_nQueuedPackets;
|
|
float m_flRemoteFrameTime;
|
|
float m_flRemoteFrameTimeStdDeviation;
|
|
uint8_t m_bUnkTickBool;
|
|
int m_nMaxRoutablePayloadSize;
|
|
int m_nSplitPacketSequence;
|
|
int64_t m_StreamSendBuffer;
|
|
bf_write m_StreamSend;
|
|
uint8_t m_bInMatch_maybe;
|
|
netflow_t m_DataFlow[2];
|
|
int m_nLifetimePacketsDropped;
|
|
int m_nSessionPacketsDropped;
|
|
int m_nSequencesSkipped_MAYBE;
|
|
int m_nSessionRecvs;
|
|
uint32_t m_nLiftimeRecvs;
|
|
char m_Name[NET_LEN_CHANNELNAME];
|
|
uint8_t m_bRetrySendLong;
|
|
v_netadr_t remote_address;
|
|
};
|
|
|
|
static_assert(sizeof(CNetChan) == 0x1AC8);
|
|
|
|
#endif // NET_CHAN_H
|