diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/utils/vmpi/ichannel.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/utils/vmpi/ichannel.h')
| -rw-r--r-- | mp/src/utils/vmpi/ichannel.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/mp/src/utils/vmpi/ichannel.h b/mp/src/utils/vmpi/ichannel.h new file mode 100644 index 00000000..42466cfc --- /dev/null +++ b/mp/src/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
|