Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ICHANNEL_H
  8. #define ICHANNEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier1/utlvector.h"
  13. class IChannel
  14. {
  15. public:
  16. // Note: this also releases any channels contained inside. So if you make a reliable
  17. // channel that contains an unreliable channel and release the reliable one,
  18. // it will automatically release the unreliable one it contains.
  19. virtual void Release() = 0;
  20. // Send data to the destination.
  21. virtual bool Send( const void *pData, int len ) = 0;
  22. // This version puts all the chunks into one packet and ships it off.
  23. virtual bool SendChunks( void const * const *pChunks, const int *pChunkLengths, int nChunks ) = 0;
  24. // Check for any packets coming in from the destination.
  25. // Returns false if no packet was received.
  26. //
  27. // flTimeout can be used to make it wait for data.
  28. //
  29. // Note: this is most efficient if you keep the buffer around between calls so it only
  30. // reallocates it when it needs more space.
  31. virtual bool Recv( CUtlVector<unsigned char> &data, double flTimeout=0 ) = 0;
  32. // Returns false if the connection has been broken.
  33. virtual bool IsConnected() = 0;
  34. // If IsConnected returns false, you can call this to find out why the socket got disconnected.
  35. virtual void GetDisconnectReason( CUtlVector<char> &reason ) = 0;
  36. };
  37. #endif // ICHANNEL_H