summaryrefslogtreecommitdiff
path: root/engine/sv_remoteaccess.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/sv_remoteaccess.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'engine/sv_remoteaccess.h')
-rw-r--r--engine/sv_remoteaccess.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/engine/sv_remoteaccess.h b/engine/sv_remoteaccess.h
new file mode 100644
index 0000000..7ad6b5a
--- /dev/null
+++ b/engine/sv_remoteaccess.h
@@ -0,0 +1,94 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Handles all the functions for implementing remote access to the engine
+//
+//===========================================================================//
+#ifndef SV_REMOTEACCESS_H
+#define SV_REMOTEACCESS_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "igameserverdata.h"
+#include "utlbuffer.h"
+#include "utllinkedlist.h"
+
+class CRConServer;
+
+
+class CServerRemoteAccess : public IGameServerData
+{
+public:
+ CServerRemoteAccess();
+
+ // handles a request
+ virtual void WriteDataRequest( ra_listener_id listener, const void *buffer, int bufferSize );
+ void WriteDataRequest( CRConServer *pNetworkListener, ra_listener_id listener, const void *buffer, int bufferSize);
+
+ // gets return value from the server
+ // returns the number of bytes read
+ virtual int ReadDataResponse( ra_listener_id listener, void *buffer, int bufferSize);
+ int GetDataResponseSize( ra_listener_id listener );
+
+ // sends a message to all the watching admin UI's
+ void SendMessageToAdminUI( ra_listener_id listenerID, const char *message);
+
+ void SendVProfData( ra_listener_id listenerID, bool bGroupData, void *data, int len );
+
+ virtual ra_listener_id GetNextListenerID( bool authConnection, const netadr_t *adr = NULL );
+ virtual void RegisterAdminUIID( ra_listener_id listener ) { m_AdminUIID = listener; }
+
+ ra_listener_id GetAdminUIID() { return m_AdminUIID; }
+ void GetStatsString(char *buf, int bufSize); // also used by the 'stats' command
+
+ void UploadScreenshot( const char *pFileName );
+
+private:
+ void RespondString( ra_listener_id listener, int requestID, const char *pString );
+ void RequestValue( ra_listener_id listener, int requestID, const char *variable );
+ void SetValue(const char *variable, const char *value);
+ void ExecCommand(const char *cmdString);
+ bool LookupValue(const char *variable, CUtlBuffer &value);
+ const char *LookupStringValue(const char *variable);
+ bool IsAuthenticated( ra_listener_id listener );
+ void CheckPassword( CRConServer *pNetworkListener, ra_listener_id listener, int requestID, const char *password );
+ void BadPassword( CRConServer *pNetworkListener, ra_listener_id listener );
+ void LogCommand( ra_listener_id listener, const char *msg );
+ void SendResponseToClient( ra_listener_id listenerID, ServerDataResponseType_t type, void *pData, int nDataLen );
+
+ // specific value requests
+ void GetUserBanList(CUtlBuffer &value);
+ void GetPlayerList(CUtlBuffer &value);
+ void GetMapList(CUtlBuffer &value);
+
+ // list of responses waiting to be sent
+ struct DataResponse_t
+ {
+ CUtlBuffer packet;
+ ra_listener_id responderID;
+ };
+ CUtlLinkedList<DataResponse_t, int> m_ResponsePackets;
+
+ struct ListenerStore_t
+ {
+ ra_listener_id listenerID;
+ bool authenticated;
+ bool m_bHasAddress;
+ netadr_t adr;
+ };
+
+ CUtlLinkedList<ListenerStore_t, int> m_ListenerIDs;
+ ra_listener_id m_NextListenerID;
+
+ int m_nScreenshotListener;
+ int m_iBytesSent;
+ int m_iBytesReceived;
+ ra_listener_id m_AdminUIID;
+};
+
+extern CServerRemoteAccess g_ServerRemoteAccess;
+extern "C" void NotifyDedicatedServerUI(const char *message);
+
+#endif // SV_REMOTEACCESS_H
+