* implemented (experimental!) remote controlling interface as requested by Coma. you can send any text to a specific port (via PHP or anything else), which will be interpreted & parsed DefScript-like.
* please report any bugs with this!
This commit is contained in:
parent
7ffc21bec5
commit
2b40be9e01
@ -102,3 +102,9 @@ defaultlang=0
|
||||
// the GUI is enabled and activated. (if its in background - way less CPU load.)
|
||||
enablegui=0
|
||||
|
||||
// options for remote control:
|
||||
// port beeing listened on. set to 0 do disable.
|
||||
rmcontrolport=8101
|
||||
// IP or hostname that is allowed to connect. leave blank to allow connections from everywhere (dangerous!)
|
||||
rmcontrolhost=localhost
|
||||
|
||||
|
||||
@ -812,3 +812,5 @@ void DefScriptPackage::My_Run(std::string line, std::string username)
|
||||
|
||||
Interpret(curSet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "WorldSession.h"
|
||||
#include "CacheHandler.h"
|
||||
#include "GUI/PseuGUI.h"
|
||||
|
||||
#include "RemoteController.h"
|
||||
#include "Cli.h"
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ PseuInstance::PseuInstance(PseuInstanceRunnable *run)
|
||||
_scp=NULL;
|
||||
_conf=NULL;
|
||||
_cli=NULL;
|
||||
_rmcontrol=NULL;
|
||||
_stop=false;
|
||||
_fastquit=false;
|
||||
_startrealm=true;
|
||||
@ -70,6 +71,8 @@ PseuInstance::~PseuInstance()
|
||||
_cli->stop();
|
||||
}
|
||||
|
||||
if(_rmcontrol)
|
||||
delete _rmcontrol;
|
||||
if(_rsession)
|
||||
delete _rsession;
|
||||
if(_wsession)
|
||||
@ -166,6 +169,11 @@ bool PseuInstance::Init(void) {
|
||||
logerror("GUI: incorrect settings!");
|
||||
}
|
||||
|
||||
if(GetConf()->rmcontrolport)
|
||||
{
|
||||
_rmcontrol = new RemoteController(this,GetConf()->rmcontrolport);
|
||||
}
|
||||
|
||||
if(GetConf()->enablecli)
|
||||
{
|
||||
log("Starting CLI...");
|
||||
@ -286,6 +294,16 @@ void PseuInstance::Update()
|
||||
}
|
||||
|
||||
|
||||
if(_rmcontrol)
|
||||
{
|
||||
_rmcontrol->Update();
|
||||
if(_rmcontrol->MustDie())
|
||||
{
|
||||
delete _rmcontrol;
|
||||
_rmcontrol = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
GetScripts()->GetEventMgr()->Update();
|
||||
|
||||
this->Sleep(GetConf()->networksleeptime);
|
||||
@ -338,6 +356,8 @@ void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
|
||||
showmyopcodes=(bool)atoi(v.Get("SHOWMYOPCODES").c_str());
|
||||
disablespellcheck=(bool)atoi(v.Get("DISABLESPELLCHECK").c_str());
|
||||
enablegui=(bool)atoi(v.Get("ENABLEGUI").c_str());
|
||||
rmcontrolport=atoi(v.Get("RMCONTROLPORT").c_str());
|
||||
rmcontrolhost=v.Get("RMCONTROLHOST");
|
||||
|
||||
// clientversion is a bit more complicated to add
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ class WorldSession;
|
||||
class Sockethandler;
|
||||
class PseuInstanceRunnable;
|
||||
class CliRunnable;
|
||||
class RemoteController;
|
||||
|
||||
class PseuInstanceConf
|
||||
{
|
||||
@ -49,6 +50,8 @@ class PseuInstanceConf
|
||||
bool notifyping;
|
||||
bool showmyopcodes;
|
||||
bool disablespellcheck;
|
||||
uint32 rmcontrolport;
|
||||
std::string rmcontrolhost;
|
||||
|
||||
// gui related
|
||||
bool enablegui;
|
||||
@ -109,6 +112,7 @@ class PseuInstance
|
||||
SocketHandler _sh;
|
||||
CliRunnable *_cli;
|
||||
ZThread::Thread _clithread;
|
||||
RemoteController *_rmcontrol;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -243,6 +243,11 @@ void RealmSession::_HandleRealmList(ByteBuffer& pkt)
|
||||
|
||||
void RealmSession::SendLogonChallenge(void)
|
||||
{
|
||||
if(!_socket)
|
||||
{
|
||||
logerror("Can't send logon challenge, socket doesn't exist");
|
||||
return;
|
||||
}
|
||||
if( GetInstance()->GetConf()->accname.empty() || GetInstance()->GetConf()->clientversion_string.empty()
|
||||
|| GetInstance()->GetConf()->clientbuild==0 || GetInstance()->GetConf()->clientlang.empty() )
|
||||
{
|
||||
@ -264,7 +269,7 @@ void RealmSession::SendLogonChallenge(void)
|
||||
for(uint8 i=0;i<4;i++)
|
||||
packet << (uint8)(GetInstance()->GetConf()->clientlang[3-i]); // "enUS" -> "SUne" : reversed and NOT zero terminated
|
||||
packet << (uint32)0x3c; // timezone
|
||||
packet << (uint32)_socket->GetClientRemoteAddr(); // my IP address
|
||||
packet << (uint32)_socket->GetMyIP(); // my IP address
|
||||
packet << (uint8)acc.length(); // length of acc name without \0
|
||||
packet.append(acc.c_str(),acc.length()); // append accname, skip \0
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "ByteBuffer.h"
|
||||
#include "RealmSession.h"
|
||||
#include "RealmSocket.h"
|
||||
#include "Network/Utility.h"
|
||||
|
||||
|
||||
|
||||
@ -88,4 +89,8 @@ void RealmSocket::OnDelete(void)
|
||||
_session->SetMustDie();
|
||||
}
|
||||
|
||||
uint32 RealmSocket::GetMyIP(void)
|
||||
{
|
||||
return GetRemoteIP4();
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ public:
|
||||
RealmSession *GetSession(void);
|
||||
bool IsOk(void);
|
||||
void SetSession(RealmSession*);
|
||||
uint32 GetMyIP(void);
|
||||
|
||||
void Update(void);
|
||||
void SendLogonChallenge(void);
|
||||
@ -27,6 +28,7 @@ public:
|
||||
int Close(void);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
bool _ok;
|
||||
RealmSession *_session;
|
||||
|
||||
@ -162,6 +162,12 @@
|
||||
<File
|
||||
RelativePath=".\Client\Cli.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\ControlSocket.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\ControlSocket.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\DefScriptInterface.cpp">
|
||||
</File>
|
||||
@ -189,6 +195,12 @@
|
||||
<File
|
||||
RelativePath=".\Client\PseuWoW.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\RemoteController.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\RemoteController.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Client\SCPDatabase.cpp">
|
||||
</File>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="FALSE"
|
||||
PrecompiledHeaderFile=".\Debug/PseuWoW_Controller.pch"
|
||||
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||
@ -84,6 +85,7 @@
|
||||
BufferSecurityCheck="FALSE"
|
||||
EnableFunctionLevelLinking="FALSE"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="FALSE"
|
||||
PrecompiledHeaderFile=".\Release/PseuWoW_Controller.pch"
|
||||
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||
@ -160,18 +162,6 @@
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shared\Network\CircularBuffer.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shared\Network\CircularBuffer.h">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user