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.

97 lines
3.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Handles all the functions for implementing remote access to the engine
  4. //
  5. //===========================================================================//
  6. #ifndef SV_REMOTEACCESS_H
  7. #define SV_REMOTEACCESS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "igameserverdata.h"
  12. #include "utlbuffer.h"
  13. #include "utllinkedlist.h"
  14. class CRConServer;
  15. class CServerRemoteAccess : public IGameServerData
  16. {
  17. public:
  18. CServerRemoteAccess();
  19. // handles a request
  20. virtual void WriteDataRequest( ra_listener_id listener, const void *buffer, int bufferSize );
  21. void WriteDataRequest( CRConServer *pNetworkListener, ra_listener_id listener, const void *buffer, int bufferSize);
  22. // gets return value from the server
  23. // returns the number of bytes read
  24. virtual int ReadDataResponse( ra_listener_id listener, void *buffer, int bufferSize);
  25. int GetDataResponseSize( ra_listener_id listener );
  26. // sends a message to all the watching admin UI's
  27. void SendMessageToAdminUI( ra_listener_id listenerID, const char *message);
  28. void SendVProfData( ra_listener_id listenerID, bool bGroupData, void *data, int len );
  29. virtual ra_listener_id GetNextListenerID( bool authConnection, const netadr_t *adr = NULL );
  30. virtual void RegisterAdminUIID( ra_listener_id listener ) { m_AdminUIID = listener; }
  31. ra_listener_id GetAdminUIID() { return m_AdminUIID; }
  32. void GetStatsString(char *buf, int bufSize); // also used by the 'stats' command
  33. void UploadScreenshot( const char *pFileName );
  34. void RemoteBug( const char *pBugPath );
  35. private:
  36. void RespondString( ra_listener_id listener, int requestID, const char *pString );
  37. void RequestValue( ra_listener_id listener, int requestID, const char *variable );
  38. void SetValue(const char *variable, const char *value);
  39. void ExecCommand(const char *cmdString);
  40. bool LookupValue(const char *variable, CUtlBuffer &value);
  41. const char *LookupStringValue(const char *variable);
  42. bool IsAuthenticated( ra_listener_id listener );
  43. void CheckPassword( CRConServer *pNetworkListener, ra_listener_id listener, int requestID, const char *password );
  44. void BadPassword( CRConServer *pNetworkListener, ra_listener_id listener );
  45. void LogCommand( ra_listener_id listener, const char *msg );
  46. void SendResponseToClient( ra_listener_id listenerID, ServerDataResponseType_t type, void *pData, int nDataLen );
  47. // specific value requests
  48. void GetUserBanList(CUtlBuffer &value);
  49. void GetPlayerList(CUtlBuffer &value);
  50. void GetMapList(CUtlBuffer &value);
  51. // list of responses waiting to be sent
  52. struct DataResponse_t
  53. {
  54. CUtlBuffer packet;
  55. ra_listener_id responderID;
  56. };
  57. CUtlLinkedList<DataResponse_t, int> m_ResponsePackets;
  58. struct ListenerStore_t
  59. {
  60. ra_listener_id listenerID;
  61. bool authenticated;
  62. bool m_bHasAddress;
  63. netadr_t adr;
  64. };
  65. CUtlLinkedList<ListenerStore_t, int> m_ListenerIDs;
  66. ra_listener_id m_NextListenerID;
  67. int m_nScreenshotListener;
  68. int m_nBugListener;
  69. int m_iBytesSent;
  70. int m_iBytesReceived;
  71. ra_listener_id m_AdminUIID;
  72. };
  73. extern CServerRemoteAccess g_ServerRemoteAccess;
  74. extern "C" void NotifyDedicatedServerUI(const char *message);
  75. #endif // SV_REMOTEACCESS_H