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.

94 lines
2.7 KiB

  1. //===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef NET_SUPPORT_H
  7. #define NET_SUPPORT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/dbg.h"
  12. #include "tier0/icommandline.h"
  13. #include "tier1/strtools.h"
  14. #include "tier1/checksum_crc.h"
  15. #include "tier1/keyvalues.h"
  16. #include "tier1/utlbuffer.h"
  17. #include "mathlib/mathlib.h"
  18. #include "appframework/IAppSystemGroup.h"
  19. #include "matchmaking/imatchframework.h"
  20. #include "engine/inetsupport.h"
  21. #include "tier2/tier2.h"
  22. class CNetSupportImpl : public CTier2AppSystem< INetSupport >
  23. {
  24. typedef CTier2AppSystem< INetSupport > BaseClass;
  25. // Methods of IAppSystem
  26. public:
  27. virtual bool Connect( CreateInterfaceFn factory );
  28. virtual void Disconnect();
  29. virtual void *QueryInterface( const char *pInterfaceName );
  30. virtual InitReturnVal_t Init();
  31. virtual void Shutdown();
  32. // Methods of INetSupport
  33. public:
  34. // Get engine build number
  35. virtual int GetEngineBuildNumber();
  36. // Get server info
  37. virtual void GetServerInfo( ServerInfo_t *pServerInfo );
  38. // Get client info
  39. virtual void GetClientInfo( ClientInfo_t *pClientInfo );
  40. // Update a local server reservation
  41. virtual void UpdateServerReservation( uint64 uiReservation );
  42. // Update a client reservation
  43. virtual void UpdateClientReservation( uint64 uiReservation, uint64 uiMachineIdHost );
  44. // Submit a server reservation packet
  45. virtual void ReserveServer(
  46. const ns_address &netAdrPublic, const ns_address &netAdrPrivate,
  47. uint64 nServerReservationCookie, KeyValues *pKVGameSettings,
  48. IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) OVERRIDE;
  49. // Check server reservation cookie matches cookie held by client
  50. virtual bool CheckServerReservation(
  51. const ns_address &netAdrPublic, uint64 nServerReservationCookie, uint32 uiReservationStage,
  52. IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) OVERRIDE;
  53. virtual bool ServerPing( const ns_address &netAdrPublic,
  54. IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) OVERRIDE;
  55. // When client event is fired
  56. virtual void OnMatchEvent( KeyValues *pEvent );
  57. // Process incoming net packets on the socket
  58. virtual void ProcessSocket( int sock, IConnectionlessPacketHandler * pHandler );
  59. // Send a network packet
  60. virtual int SendPacket (
  61. INetChannel *chan, int sock, const netadr_t &to,
  62. const void *data, int length,
  63. bf_write *pVoicePayload = NULL,
  64. bool bUseCompression = false );
  65. virtual ISteamNetworkingUtils *GetSteamNetworkingUtils() OVERRIDE;
  66. public:
  67. CNetSupportImpl();
  68. ~CNetSupportImpl();
  69. };
  70. #endif // NET_SUPPORT_H