Team Fortress 2 Source Code as on 22/4/2020
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.

76 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #if !defined( INETCHANNELINFO_H )
  14. #define INETCHANNELINFO_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #define FLOW_OUTGOING 0
  19. #define FLOW_INCOMING 1
  20. #define MAX_FLOWS 2 // in & out
  21. class INetChannelInfo
  22. {
  23. public:
  24. enum {
  25. GENERIC = 0, // must be first and is default group
  26. LOCALPLAYER, // bytes for local player entity update
  27. OTHERPLAYERS, // bytes for other players update
  28. ENTITIES, // all other entity bytes
  29. SOUNDS, // game sounds
  30. EVENTS, // event messages
  31. USERMESSAGES, // user messages
  32. ENTMESSAGES, // entity messages
  33. VOICE, // voice data
  34. STRINGTABLE, // a stringtable update
  35. MOVE, // client move cmds
  36. STRINGCMD, // string command
  37. SIGNON, // various signondata
  38. TOTAL, // must be last and is not a real group
  39. };
  40. virtual const char *GetName( void ) const = 0; // get channel name
  41. virtual const char *GetAddress( void ) const = 0; // get channel IP address as string
  42. virtual float GetTime( void ) const = 0; // current net time
  43. virtual float GetTimeConnected( void ) const = 0; // get connection time in seconds
  44. virtual int GetBufferSize( void ) const = 0; // netchannel packet history size
  45. virtual int GetDataRate( void ) const = 0; // send data rate in byte/sec
  46. virtual bool IsLoopback( void ) const = 0; // true if loopback channel
  47. virtual bool IsTimingOut( void ) const = 0; // true if timing out
  48. virtual bool IsPlayback( void ) const = 0; // true if demo playback
  49. virtual float GetLatency( int flow ) const = 0; // current latency (RTT), more accurate but jittering
  50. virtual float GetAvgLatency( int flow ) const = 0; // average packet latency in seconds
  51. virtual float GetAvgLoss( int flow ) const = 0; // avg packet loss[0..1]
  52. virtual float GetAvgChoke( int flow ) const = 0; // avg packet choke[0..1]
  53. virtual float GetAvgData( int flow ) const = 0; // data flow in bytes/sec
  54. virtual float GetAvgPackets( int flow ) const = 0; // avg packets/sec
  55. virtual int GetTotalData( int flow ) const = 0; // total flow in/out in bytes
  56. virtual int GetSequenceNr( int flow ) const = 0; // last send seq number
  57. virtual bool IsValidPacket( int flow, int frame_number ) const = 0; // true if packet was not lost/dropped/chocked/flushed
  58. virtual float GetPacketTime( int flow, int frame_number ) const = 0; // time when packet was send
  59. virtual int GetPacketBytes( int flow, int frame_number, int group ) const = 0; // group size of this packet
  60. virtual bool GetStreamProgress( int flow, int *received, int *total ) const = 0; // TCP progress if transmitting
  61. virtual float GetTimeSinceLastReceived( void ) const = 0; // get time since last recieved packet in seconds
  62. virtual float GetCommandInterpolationAmount( int flow, int frame_number ) const = 0;
  63. virtual void GetPacketResponseLatency( int flow, int frame_number, int *pnLatencyMsecs, int *pnChoke ) const = 0;
  64. virtual void GetRemoteFramerate( float *pflFrameTime, float *pflFrameTimeStdDeviation ) const = 0;
  65. virtual float GetTimeoutSeconds() const = 0;
  66. };
  67. #endif // INETCHANNELINFO_H