1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Update INetworkSystem and some other related things.

This commit is contained in:
Nicholas Hastings 2015-10-14 21:38:48 -04:00
parent 4dd7a85b57
commit f56fcd4fca
4 changed files with 57 additions and 16 deletions

View File

@ -8,6 +8,7 @@
#include <eiface.h>
#include <tier1/utldelegate.h>
#include <inetchannel.h>
class IRecipientFilter;
class CUtlSlot;
@ -18,10 +19,6 @@ namespace google {
}
}
enum NetChannelBufType_t
{
};
struct GameEventHandle_t__
{
void *m_pUnknown;

View File

@ -39,7 +39,7 @@ typedef struct netpacket_s
} netpacket_t;
#endif // NET_PACKET_ST_DEFINED
enum ENetChannelBufType
enum NetChannelBufType_t
{
BUF_RELIABLE = 0,
BUF_UNRELIABLE,

View File

@ -182,7 +182,7 @@ class IConnectionlessPacketHandler
public:
virtual ~IConnectionlessPacketHandler( void ) {};
virtual bool ProcessConnectionlessPacket( netpacket_t *packet ) = 0; // process a connectionless packet
virtual bool ProcessConnectionlessPacket( const ns_address *addr, bf_read *bf ) = 0; // process a connectionless packet
};

View File

@ -17,12 +17,40 @@
class IConnectionlessPacketHandler;
class INetworkConfigChanged;
class INetworkPacketFilter;
class INetworkFileDownloadFilter;
class INetworkFileSendCompleted;
class INetworkPrepareStartupParams;
class IPeerToPeerCallbacks;
class ISteamP2PAllowConnection;
class INetworkChannelNotify;
class NetScratchBuffer_t;
class CMsgSteamDatagramGameServerAuthTicket;
class CUtlStringToken;
class CPeerToPeerAddress;
struct ns_address;
class ns_address
{
public:
inline uint32 IP() const { return m_IP; }
inline uint16 Port() const { return m_Port; }
private:
int iUnknown;
uint32 m_IP;
uint16 m_Port;
};
enum
{
NS_CLIENT = 0, // client socket
NS_SERVER, // server socket
NS_HLTV,
NS_P2P,
MAX_SOCKETS
};
enum ESteamP2PConnectionOwner {};
// Reverse engineered interface: return types may be wrong
@ -31,7 +59,6 @@ abstract_class INetworkSystem : public IAppSystem
public:
virtual void InitGameServer() = 0;
virtual void ShutdownGameServer() = 0;
virtual void SetDedicated( bool enable ) = 0;
virtual int CreateSocket( int, int, int, int, int, const char * ) = 0;
virtual void OpenSocket( int sock ) = 0;
virtual bool IsOpen ( int sock ) = 0;
@ -40,28 +67,37 @@ public:
virtual void SetRemoteStreamChannel( int, int ) = 0;
virtual void AddExtraSocket( int, const char * ) = 0;
virtual void RemoveAllExtraSockets() = 0;
virtual int InitPeerToPeerNetworking( IPeerToPeerCallbacks * ) = 0;
virtual void ShutdownPeerToPeerNetworking( int sock ) = 0;
virtual void TerminatePeerToPeerSockets( int sock ) = 0;
virtual void P2PAcceptableConnectionsChanged( ESteamP2PConnectionOwner owner ) = 0;
virtual void EnableLoopbackBetweenSockets( int, int ) = 0;
virtual void SetDefaultBroadcastPort( int port ) = 0;
virtual void RunFrame( double ) = 0;
virtual void SendQueuedPackets() = 0;
virtual void FlushPeerToPeerChannels( int sock ) = 0;
virtual void SleepUntilMessages( int, int ) = 0;
virtual void InitPostFork() = 0;
virtual void SetSubProcess( bool ) = 0;
virtual void SendPacket( INetChannel *netchan, int, const netadr_t &adr, const unsigned char *, int, bf_write *, bool, unsigned int ) = 0;
virtual void SendPacket( INetChannel *netchan, int, const ns_address &adr, const unsigned char *, int, bf_write *, bool, unsigned int ) = 0;
virtual void ProcessSocket( int sock, IConnectionlessPacketHandler *handler ) = 0;
virtual INetChannel *CreateNetChannel( int, netadr_t *adr ,char const *, INetChannelHandler *handler, bool ) = 0;
virtual void ProcessIncomingP2PRequests( ESteamP2PConnectionOwner, ISteamP2PAllowConnection * ) = 0;
virtual void PollSocket( int, IConnectionlessPacketHandler * ) = 0;
virtual void ProcessSocketMessages( int ) = 0;
virtual INetChannel *CreateNetChannel( int, const ns_address *adr, const char *, uint32, uint32 ) = 0;
virtual INetChannel *CreateNetChannel( int, const CPeerToPeerAddress &, const char * ) = 0;
virtual void RemoveNetChannel( INetChannel *netchan, bool ) = 0;
virtual void RemoveNetChannelByAddress(int, const CPeerToPeerAddress &) = 0;
virtual void ListenSocket( int sock, bool ) = 0;
virtual void ConnectSocket( int sock , const netadr_t &adr ) = 0;
virtual void CloseNetworkSocket( int sock, int ) = 0;
virtual void OutOfBandPrintf( int sock, const netadr_t &adr, const char *format, ...) = 0;
virtual void OutOfBandDelayedPrintf( int sock, const netadr_t &adr, unsigned int delay, const char *format, ...) = 0;
virtual void OutOfBandPrintf( int sock, const ns_address &adr, const char *format, ...) = 0;
virtual void OutOfBandDelayedPrintf( int sock, const ns_address &adr, unsigned int delay, const char *format, ...) = 0;
virtual void SetTime( double time ) = 0;
virtual void SetTimeScale( float timeScale ) = 0;
virtual double GetNetTime() const = 0;
virtual bool IsDedicated() = 0;
virtual bool IsDedicatedForXbox() = 0;
virtual void LogBadPacket( netpacket_t * ) = 0;
virtual void DescribeSocket( int sock ) = 0;
virtual void BufferToBufferCompress( char *, unsigned int *, const char *, unsigned int ) = 0;
virtual void BufferToBufferDecompress( char *, unsigned int *, char const *, unsigned int ) = 0;
@ -72,6 +108,8 @@ public:
virtual bool IsSafeFileToDownload( const char *file ) = 0;
virtual bool IsValidFileTransferExtension( const char *extension ) = 0;
virtual bool CanRedownloadFile( const char *file ) = 0;
virtual void AddNetworkConfigChangedCallback( INetworkConfigChanged *callback ) = 0;
virtual void RemoveNetworkConfigChangedCallback( INetworkConfigChanged *callback ) = 0;
virtual void AddNetworkPacketFilterCallback( INetworkPacketFilter *callback ) = 0;
virtual void RemoveNetworkPacketFilterCallback( INetworkPacketFilter *callback ) = 0;
virtual void AddNetworkFileDownloadFilter( INetworkFileDownloadFilter *callback ) = 0;
@ -80,8 +118,14 @@ public:
virtual void RemoveNetworkFileSendCompletedCallback( INetworkFileSendCompleted *callback ) = 0;
virtual void AddNetworkPrepareStartupParamsCallback( INetworkPrepareStartupParams *callback ) = 0;
virtual void RemoveNetworkPrepareStartupParamsCallback( INetworkPrepareStartupParams *callback ) = 0;
virtual void AddNetworkChannelNotifyCallback( INetworkChannelNotify *callback ) = 0;
virtual void RemoveNetworkChannelNotifyCallback( INetworkChannelNotify *callback ) = 0;
virtual void CloseAllSockets() = 0;
virtual bool CheckConnectionLessRateLimits(const ns_address &) = 0;
virtual int FindSocket( const CUtlStringToken & ) = 0;
virtual NetScratchBuffer_t *GetScratchBuffer( void ) = 0;
virtual void PutScratchBuffer( NetScratchBuffer_t * ) = 0;
virtual void ReceivedSteamDatagramTicket( const CMsgSteamDatagramGameServerAuthTicket & ) = 0;
virtual void *GetSteamDatagramClient( void ) = 0;
};
DECLARE_TIER2_INTERFACE( INetworkSystem, g_pNetworkSystem );