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 /utils/vmpi/ichannel.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/vmpi/ichannel.h')
| -rw-r--r-- | utils/vmpi/ichannel.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/utils/vmpi/ichannel.h b/utils/vmpi/ichannel.h new file mode 100644 index 0000000..a26f034 --- /dev/null +++ b/utils/vmpi/ichannel.h @@ -0,0 +1,49 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef ICHANNEL_H +#define ICHANNEL_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "tier1/utlvector.h" + + +class IChannel +{ +public: + // Note: this also releases any channels contained inside. So if you make a reliable + // channel that contains an unreliable channel and release the reliable one, + // it will automatically release the unreliable one it contains. + virtual void Release() = 0; + + // Send data to the destination. + virtual bool Send( const void *pData, int len ) = 0; + + // This version puts all the chunks into one packet and ships it off. + virtual bool SendChunks( void const * const *pChunks, const int *pChunkLengths, int nChunks ) = 0; + + // Check for any packets coming in from the destination. + // Returns false if no packet was received. + // + // flTimeout can be used to make it wait for data. + // + // Note: this is most efficient if you keep the buffer around between calls so it only + // reallocates it when it needs more space. + virtual bool Recv( CUtlVector<unsigned char> &data, double flTimeout=0 ) = 0; + + // Returns false if the connection has been broken. + virtual bool IsConnected() = 0; + + // If IsConnected returns false, you can call this to find out why the socket got disconnected. + virtual void GetDisconnectReason( CUtlVector<char> &reason ) = 0; +}; + + +#endif // ICHANNEL_H |