diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /networksystem/networkclient.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'networksystem/networkclient.h')
| -rw-r--r-- | networksystem/networkclient.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/networksystem/networkclient.h b/networksystem/networkclient.h new file mode 100644 index 0000000..40f3467 --- /dev/null +++ b/networksystem/networkclient.h @@ -0,0 +1,54 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//===========================================================================// + +#ifndef CLIENT_H +#define CLIENT_H +#ifdef _WIN32 +#pragma once +#endif + +#include "NetChannel.h" + +class CNetworkClient : public IConnectionlessPacketHandler, public INetworkMessageHandler, public ILookupChannel +{ +public: + CNetworkClient(); + virtual ~CNetworkClient(); + + bool Init( int nListenPort ); + void Shutdown(); + + bool Connect( const char *server, int port ); + void Disconnect(); + + // IConnectionlessPacketHandler + virtual bool ProcessConnectionlessPacket( CNetPacket *packet ); // process a connectionless packet + + // INetworkMessageHandler + virtual void OnConnectionClosing( INetChannel *channel, char const *reason ); + virtual void OnConnectionStarted( INetChannel *channel ); + + virtual void OnPacketStarted( int inseq, int outseq ); + virtual void OnPacketFinished(); + + // ILookupChannel + virtual INetChannel *FindNetChannel( const netadr_t& from ) ; + + INetChannel *GetNetChannel() + { + return &m_NetChan; + } + + void ReadPackets(); + void SendUpdate(); + + CUDPSocket *m_pSocket; + + CNetChannel m_NetChan; + bool m_bConnected; +}; + +#endif // CLIENT_H |