[9466] Implemented SOAP in MaNGOS

- removed deprecated code from RASocket
- allow more than one login at a time on the RA console
- added gsoap library for handling SOAP requests
- removed deprecated mangos_string entry

Thanks to:
- Derex for reporting a bug which occured if more than 1024
    players were connected  [poll() vs select()]
- caeruleaus for adding windowsbuild support
- vladimir for suggesting a different thread starting order
- fdb_ for suggesting SOAP in the first place
This commit is contained in:
arrai 2010-02-26 20:15:46 +01:00
parent 844f032458
commit e520d8409e
33 changed files with 20337 additions and 96 deletions

View file

@ -266,6 +266,16 @@ AC_SUBST(MANGOS_LIBS)
## Set output files.
AC_CONFIG_HEADERS([config.h])
AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])])
AH_TOP([
#ifndef AC_CONFIG_H
#define AC_CONFIG_H
])
AH_BOTTOM([#endif /* !AC_CONFIG_H */])
AC_CONFIG_FILES([
dep/include/Makefile
dep/lib/Makefile
@ -273,6 +283,7 @@ AC_CONFIG_FILES([
dep/src/g3dlite/Makefile
dep/src/sockets/Makefile
dep/src/zlib/Makefile
dep/src/gsoap/Makefile
dep/Makefile
dep/tbb/Makefile
doc/Doxyfile

34
contrib/soap/example.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/*
* MaNGOSsoap client example
*
* a simple example how to invoke commands using SOAP
*/
$username = 'ADMINISTRATOR';
$password = 'ADMINISTRATOR';
$host = "localhost";
$soapport = 7878;
$command = "server info";
$client = new SoapClient(NULL,
array(
"location" => "http://$host:$soapport/",
"uri" => "urn:MaNGOS",
"style" => SOAP_RPC,
'login' => $username,
'password' => $password
));
try {
$result = $client->executeCommand(new SoapParam($command, "command"));
echo "Command succeeded! Output:<br />\n";
echo $result;
}
catch (Exception $e)
{
echo "Command failed! Reason:<br />\n";
echo $e->getMessage();
}
?>

View file

@ -207,3 +207,8 @@ EXTRA_DIST += \
utf8cpp/utf8/checked.h \
utf8cpp/utf8/core.h \
utf8cpp/utf8/unchecked.h
# gsoap header file
EXTRA_DIST += \
gsoap/stdsoap2.h

2360
dep/include/gsoap/stdsoap2.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,7 @@
## Process this file with automake to produce Makefile.in
## Sub-directories to parse
SUBDIRS = g3dlite sockets zlib
SUBDIRS = g3dlite sockets gsoap zlib
## Additional files to include when running 'make dist'
# Nothing yet.

30
dep/src/gsoap/Makefile.am Normal file
View file

@ -0,0 +1,30 @@
# Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
## Process this file with automake to produce Makefile.in
## Sub-directories to parse
## CPP flags for includes, defines, etc.
AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../../include/gsoap
## Build MaNGOS shared library and its parts as convenience library.
# All libraries will be convenience libraries. Might be changed to shared
# later.
noinst_LIBRARIES = libgsoap.a
libgsoap_a_SOURCES = \
stdsoap2.cpp

15198
dep/src/gsoap/stdsoap2.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_9464_01_mangos_spell_proc_event` bit(1) default NULL
`required_9466_01_mangos_mangos_string` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_9464_01_mangos_spell_proc_event required_9466_01_mangos_mangos_string bit;
DELETE FROM mangos_string WHERE entry=60;

View file

@ -79,6 +79,7 @@ pkgdata_DATA = \
9460_01_mangos_spell_bonus_data.sql \
9460_02_mangos_spell_chain.sql \
9464_01_mangos_spell_proc_event.sql \
9466_01_mangos_mangos_string.sql \
README
## Additional files to include when running 'make dist'
@ -138,4 +139,5 @@ EXTRA_DIST = \
9460_01_mangos_spell_bonus_data.sql \
9460_02_mangos_spell_chain.sql \
9464_01_mangos_spell_proc_event.sql \
9466_01_mangos_mangos_string.sql \
README

View file

@ -873,6 +873,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co
SendSysMessage(LANG_CMD_SYNTAX);
ShowHelpForCommand(table[i].ChildCommands,text);
SetSentErrorMessage(true);
}
return true;
@ -900,12 +901,13 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co
}
}
// some commands have custom error messages. Don't send the default one in these cases.
else if(!sentErrorMessage)
else if(!HasSentErrorMessage())
{
if(!table[i].Help.empty())
SendSysMessage(table[i].Help.c_str());
else
SendSysMessage(LANG_CMD_SYNTAX);
SetSentErrorMessage(true);
}
return true;
@ -999,7 +1001,10 @@ int ChatHandler::ParseCommands(const char* text)
std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing.
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
SendSysMessage(LANG_NO_CMD);
SetSentErrorMessage(true);
}
return 1;
}
@ -2256,8 +2261,8 @@ bool CliHandler::isAvailable(ChatCommand const& cmd) const
void CliHandler::SendSysMessage(const char *str)
{
m_print(str);
m_print("\r\n");
m_print(m_callbackArg, str);
m_print(m_callbackArg, "\r\n");
}
std::string CliHandler::GetNameLink() const

View file

@ -71,6 +71,7 @@ class ChatHandler
int ParseCommands(const char* text);
bool isValidChatMessage(const char* msg);
bool HasSentErrorMessage() { return sentErrorMessage;}
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
@ -552,8 +553,8 @@ class ChatHandler
class CliHandler : public ChatHandler
{
public:
typedef void Print(char const*);
explicit CliHandler(Print* zprint) : m_print(zprint) {}
typedef void Print(void*, char const*);
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
// overwrite functions
const char *GetMangosString(int32 entry) const;
@ -565,6 +566,7 @@ class CliHandler : public ChatHandler
int GetSessionDbLocaleIndex() const;
private:
void* m_callbackArg;
Print* m_print;
};

View file

@ -83,7 +83,7 @@ enum MangosStrings
LANG_USING_WORLD_DB = 57,
LANG_USING_SCRIPT_LIB = 58,
LANG_USING_EVENT_AI = 59,
LANG_RA_BUSY = 60,
//LANG_RA_BUSY = 60, not used
LANG_RA_USER = 61,
LANG_RA_PASS = 62,
// Room for more level 0 63-99 not used

View file

@ -1823,19 +1823,21 @@ void World::UpdateSessions( uint32 diff )
void World::ProcessCliCommands()
{
CliCommandHolder::Print* zprint = NULL;
void* callbackArg = NULL;
CliCommandHolder* command;
while (cliCmdQueue.next(command))
{
sLog.outDebug("CLI command under processing...");
zprint = command->m_print;
CliHandler(zprint).ParseCommands(command->m_command);
callbackArg = command->m_callbackArg;
CliHandler handler(callbackArg, zprint);
handler.ParseCommands(command->m_command);
if(command->m_commandFinished)
command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
delete command;
}
// print the console message here so it looks right
if (zprint)
zprint("mangos>");
}
void World::InitResultQueue()

View file

@ -372,13 +372,16 @@ enum RealmZone
/// Storage class for commands issued for delayed execution
struct CliCommandHolder
{
typedef void Print(const char*);
typedef void Print(void*, const char*);
typedef void CommandFinished(void*, bool success);
void* m_callbackArg;
char *m_command;
Print* m_print;
CommandFinished* m_commandFinished;
CliCommandHolder(const char *command, Print* zprint)
: m_print(zprint)
CliCommandHolder(void* callbackArg, const char *command, Print* zprint, CommandFinished* commandFinished)
: m_callbackArg(callbackArg), m_print(zprint), m_commandFinished(commandFinished)
{
size_t len = strlen(command)+1;
m_command = new char[len];
@ -528,7 +531,7 @@ class World
static float GetVisibleObjectGreyDistance() { return m_VisibleObjectGreyDistance; }
void ProcessCliCommands();
void QueueCliCommand( CliCommandHolder::Print* zprintf, char const* input ) { cliCmdQueue.add(new CliCommandHolder(input, zprintf)); }
void QueueCliCommand(CliCommandHolder* commandHolder) { cliCmdQueue.add(commandHolder); }
void UpdateResultQueue();
void InitResultQueue();

View file

@ -35,7 +35,7 @@
#include "Player.h"
#include "Chat.h"
void utf8print(const char* str)
void utf8print(void* arg, const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
wchar_t wtemp_buf[6000];
@ -51,6 +51,12 @@ void utf8print(const char* str)
#endif
}
void commandFinished(void*, bool sucess)
{
printf("mangos>");
fflush(stdout);
}
/// Delete a user account and all associated characters in this realm
/// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
bool ChatHandler::HandleAccountDeleteCommand(const char* args)
@ -342,7 +348,7 @@ void CliRunnable::run()
continue;
}
sWorld.QueueCliCommand(&utf8print,command.c_str());
sWorld.QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
}
else if (feof(stdin))
{

168
src/mangosd/MaNGOSsoap.cpp Normal file
View file

@ -0,0 +1,168 @@
/*
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "MaNGOSsoap.h"
#define POOL_SIZE 5
void MaNGOSsoapRunnable::run()
{
// create pool
SOAPWorkingThread pool;
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
struct soap soap;
int m, s;
soap_init(&soap);
m = soap_bind(&soap, m_host.c_str(), m_port, 100);
// check every 3 seconds if world ended
soap.accept_timeout = 3;
soap.recv_timeout = 5;
soap.send_timeout = 5;
if (m < 0)
{
sLog.outError("MaNGOSsoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
}
sLog.outString("MaNGOSsoap: bound to http://%s:%d", m_host.c_str(), m_port);
while(!World::IsStopped())
{
s = soap_accept(&soap);
if (s < 0)
{
// ran into an accept timeout
continue;
}
sLog.outDebug("MaNGOSsoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
struct soap* thread_soap = soap_copy(&soap);// make a safe copy
ACE_Message_Block *mb = new ACE_Message_Block(sizeof(struct soap*));
ACE_OS::memcpy (mb->wr_ptr (), &thread_soap, sizeof(struct soap*));
pool.putq(mb);
}
pool.msg_queue ()->deactivate ();
pool.wait ();
soap_done(&soap);
}
void SOAPWorkingThread::process_message (ACE_Message_Block *mb)
{
ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message"));
struct soap* soap;
ACE_OS::memcpy (&soap, mb->rd_ptr (), sizeof(struct soap*));
mb->release ();
soap_serve(soap);
soap_destroy(soap); // dealloc C++ data
soap_end(soap); // dealloc data and clean up
soap_done(soap); // detach soap struct
free(soap);
}
/*
Code used for generating stubs:
int ns1__executeCommand(char* command, char** result);
*/
int ns1__executeCommand(soap* soap, char* command, char** result)
{
// security check
if (!soap->userid || !soap->passwd)
{
sLog.outDebug("MaNGOSsoap: Client didn't provide login information");
return 401;
}
uint32 accountId = sAccountMgr.GetId(soap->userid);
if(!accountId)
{
sLog.outDebug("MaNGOSsoap: Client used invalid username '%s'", soap->userid);
return 401;
}
if(!sAccountMgr.CheckPassword(accountId, soap->passwd))
{
sLog.outDebug("MaNGOSsoap: invalid password for account '%s'", soap->userid);
return 401;
}
if(sAccountMgr.GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
sLog.outDebug("MaNGOSsoap: %s's gmlevel is too low", soap->userid);
return 403;
}
if(!command || !*command)
return soap_sender_fault(soap, "Command mustn't be empty", "The supplied command was an empty string");
sLog.outDebug("MaNGOSsoap: got command '%s'", command);
SOAPCommand connection;
// commands are executed in the world thread. We have to wait for them to be completed
{
// CliCommandHolder will be deleted from world, accessing after queueing is NOT save
CliCommandHolder* cmd = new CliCommandHolder(&connection, command, &SOAPCommand::print, &SOAPCommand::commandFinished);
sWorld.QueueCliCommand(cmd);
}
// wait for callback to complete command
connection.pendingCommands.acquire();
// alright, command finished
char* printBuffer = soap_strdup(soap, connection.m_printBuffer.c_str());
if(connection.hasCommandSucceeded())
{
*result = printBuffer;
return SOAP_OK;
}
else
return soap_sender_fault(soap, printBuffer, printBuffer);
}
void SOAPCommand::commandFinished(void* soapconnection, bool success)
{
SOAPCommand* con = (SOAPCommand*)soapconnection;
con->setCommandSuccess(success);
con->pendingCommands.release();
}
////////////////////////////////////////////////////////////////////////////////
//
// Namespace Definition Table
//
////////////////////////////////////////////////////////////////////////////////
struct Namespace namespaces[] =
{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/" }, // must be first
{ "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/" }, // must be second
{ "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance" },
{ "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema" },
{ "ns1", "urn:MaNGOS" }, // "ns1" namespace prefix
{ NULL, NULL }
};

120
src/mangosd/MaNGOSsoap.h Normal file
View file

@ -0,0 +1,120 @@
/*
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MANGOSSOAP_H
#define _MANGOSSOAP_H
#include "Common.h"
#include "World.h"
#include "AccountMgr.h"
#include "Log.h"
#include "soapH.h"
#include "soapStub.h"
#include <ace/SV_Semaphore_Simple.h>
#include <ace/Task.h>
class MaNGOSsoapRunnable: public ACE_Based::Runnable
{
public:
MaNGOSsoapRunnable() { }
void run();
void setListenArguments(std::string host, uint16 port)
{
m_host = host;
m_port = port;
}
private:
std::string m_host;
uint16 m_port;
};
class SOAPWorkingThread : public ACE_Task<ACE_MT_SYNCH>
{
public:
SOAPWorkingThread ()
{ }
virtual int svc (void)
{
while (1)
{
ACE_Message_Block *mb = 0;
if (this->getq (mb) == -1)
{
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("(%t) Shutting down\n")));
break;
}
// Process the message.
process_message (mb);
}
return 0;
}
private:
void process_message (ACE_Message_Block *mb);
};
class SOAPCommand
{
public:
SOAPCommand()
{
ACE_ASSERT (pendingCommands.open("pendingCommands",
ACE_SV_Semaphore_Simple::ACE_CREATE,
0) != -1);
}
~SOAPCommand()
{
}
void appendToPrintBuffer(const char* msg)
{
m_printBuffer += msg;
}
ACE_SV_Semaphore_Simple pendingCommands;
void setCommandSuccess(bool val)
{
m_success = val;
}
bool hasCommandSucceeded()
{
return m_success;
}
static void print(void* callbackArg, const char* msg)
{
((SOAPCommand*)callbackArg)->appendToPrintBuffer(msg);
}
static void commandFinished(void* callbackArg, bool success);
bool m_success;
std::string m_printBuffer;
};
#endif

View file

@ -17,7 +17,7 @@
## Process this file with automake to produce Makefile.in
## CPP flags for includes, defines, etc.
AM_CPPFLAGS = $(MANGOS_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir)/../../dep/include -I$(srcdir)/../framework -I$(srcdir)/../shared -I$(srcdir)/../game -I$(srcdir) -DSYSCONFDIR=\"$(sysconfdir)/\"
AM_CPPFLAGS = $(MANGOS_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir)/../../dep/include -I$(srcdir)/../../dep/include/gsoap -I$(srcdir)/../framework -I$(srcdir)/../shared -I$(srcdir)/../game -I$(srcdir) -DSYSCONFDIR=\"$(sysconfdir)/\"
## Build world daemon as standalone program
bin_PROGRAMS = mangos-worldd
@ -29,8 +29,14 @@ mangos_worldd_SOURCES = \
Master.h \
RASocket.cpp \
RASocket.h \
MaNGOSsoap.cpp \
MaNGOSsoap.h \
WorldRunnable.cpp \
WorldRunnable.h
WorldRunnable.h \
soapH.h \
soapStub.h \
soapC.cpp \
soapServer.cpp
## Link world daemon against the shared library
mangos_worldd_LDADD = \
@ -43,9 +49,10 @@ mangos_worldd_LDADD = \
../shared/vmap/libmangosvmaps.a \
../framework/libmangosframework.a \
../../dep/src/sockets/libmangossockets.a \
../../dep/src/g3dlite/libg3dlite.a
../../dep/src/g3dlite/libg3dlite.a \
../../dep/src/gsoap/libgsoap.a
mangos_worldd_LDFLAGS = -L../../dep/src/sockets -L../../dep/src/g3dlite -L../bindings/universal/ -L$(libdir) $(MANGOS_LIBS) -export-dynamic
mangos_worldd_LDFLAGS = -L../../dep/src/sockets -L../../dep/src/g3dlite -L../../dep/src/gsoap -L../bindings/universal/ -L$(libdir) $(MANGOS_LIBS) -export-dynamic
## Additional files to include when running 'make dist'
# Include world daemon configuration

View file

@ -39,6 +39,7 @@
#include "ScriptCalls.h"
#include "Util.h"
#include "revision_sql.h"
#include "MaNGOSsoap.h"
#include "sockets/TcpSocket.h"
#include "sockets/Utility.h"
@ -223,7 +224,7 @@ int Master::Run()
///- Launch WorldRunnable thread
ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest);
// set realmbuilds depend on mangosd expected builds, and set server online
{
std::string builds = AcceptableClientBuildsListStr();
@ -289,6 +290,18 @@ int Master::Run()
}
#endif
///- Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if(sConfig.GetBoolDefault("SOAP.Enabled", false))
{
MaNGOSsoapRunnable *runnable = new MaNGOSsoapRunnable();
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable);
}
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
@ -322,6 +335,14 @@ int Master::Run()
delete freeze_thread;
}
///- Stop soap thread
if(soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
///- Set server offline in realmlist
loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);

View file

@ -31,43 +31,25 @@
#include "Language.h"
#include "ObjectMgr.h"
/// \todo Make this thread safe if in the future 2 admins should be able to log at the same time.
SOCKET r;
uint32 iSession=0; ///< Session number (incremented each time a new connection is made)
unsigned int iUsers=0; ///< Number of active administrators
typedef int(* pPrintf)(const char*,...);
void ParseCommand(CliCommandHolder::Print*, char*command);
// TODO: drop old socket library and implement RASocket using ACE
/// RASocket constructor
RASocket::RASocket(ISocketHandler &h): TcpSocket(h)
{
///- Increment the session number
iSess =iSession++ ;
///- Get the config parameters
bSecure = sConfig.GetBoolDefault( "RA.Secure", true );
iMinLevel = sConfig.GetIntDefault( "RA.MinLevel", 3 );
///- Initialize buffer and data
iInputLength=0;
buff=new char[RA_BUFF_SIZE];
stage=NONE;
}
/// RASocket destructor
RASocket::~RASocket()
{
///- Delete buffer and decrease active admins count
delete [] buff;
sLog.outRALog("Connection was closed.\n");
if(stage==OK)
iUsers--;
}
/// Accept an incoming connection
@ -75,15 +57,8 @@ void RASocket::OnAccept()
{
std::string ss=GetRemoteAddress();
sLog.outRALog("Incoming connection from %s.\n",ss.c_str());
///- If there is already an active admin, drop the connection
if(iUsers)
{
Sendf(sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_BUSY));
SetCloseAndDelete();
return;
}
///- Else print Motd
///- print Motd
Sendf("%s\r\n",sWorld.GetMotd());
Sendf("\r\n%s",sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_USER));
}
@ -102,14 +77,6 @@ void RASocket::OnRead()
return;
}
///- If there is already an active admin (other than you), drop the connection
if (stage!=OK && iUsers)
{
Sendf(sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_BUSY));
SetCloseAndDelete();
return;
}
char *inp = new char [sz+1];
ibuf.Read(inp,sz);
@ -157,7 +124,8 @@ void RASocket::OnRead()
{
Sendf("-No such user.\r\n");
sLog.outRALog("User %s does not exist.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
if(bSecure)
SetCloseAndDelete();
Sendf("\r\n%s",sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_USER));
}
else
@ -169,7 +137,8 @@ void RASocket::OnRead()
{
Sendf("-Not enough privileges.\r\n");
sLog.outRALog("User %s has no privilege.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
if(bSecure)
SetCloseAndDelete();
Sendf("\r\n%s",sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_USER));
}
else
@ -202,9 +171,8 @@ void RASocket::OnRead()
if (check)
{
delete check;
r=GetSocket();
GetSocket();
stage=OK;
++iUsers;
Sendf("+Logged in.\r\n");
sLog.outRALog("User %s has logged in.\n",szLogin.c_str());
@ -215,7 +183,8 @@ void RASocket::OnRead()
///- Else deny access
Sendf("-Wrong pass.\r\n");
sLog.outRALog("User %s has failed to log in.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
if(bSecure)
SetCloseAndDelete();
Sendf("\r\n%s",sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_PASS));
}
break;
@ -228,7 +197,12 @@ void RASocket::OnRead()
if (strncmp(buff,"quit",4)==0)
SetCloseAndDelete();
else
sWorld.QueueCliCommand(&RASocket::zprint, buff);
{
SetDeleteByHandler(false);
CliCommandHolder* cmd = new CliCommandHolder(this, buff, &RASocket::zprint, &RASocket::commandFinished);
sWorld.QueueCliCommand(cmd);
++pendingCommands;
}
}
else
Sendf("mangos>");
@ -240,23 +214,22 @@ void RASocket::OnRead()
}
/// Output function
void RASocket::zprint( const char * szText )
void RASocket::zprint(void* callbackArg, const char * szText )
{
if( !szText )
return;
#ifdef RA_CRYPT
char *megabuffer = mangos_strdup(szText);
unsigned int sz=strlen(megabuffer);
Encrypt(megabuffer,sz);
send(r,megabuffer,sz,0);
delete [] megabuffer;
#else
unsigned int sz=strlen(szText);
send(r,szText,sz,0);
#endif
send(((RASocket*)callbackArg)->GetSocket(), szText, sz, 0);
}
void RASocket::commandFinished(void* callbackArg, bool success)
{
RASocket* raSocket = (RASocket*)callbackArg;
raSocket->Sendf("mangos>");
uint64 remainingCommands = --raSocket->pendingCommands;
if(remainingCommands == 0)
raSocket->SetDeleteByHandler(true);
}

View file

@ -25,11 +25,14 @@
#include "Common.h"
#include "sockets/TcpSocket.h"
#include <ace/Synch_Traits.h>
#define RA_BUFF_SIZE 1024
class ISocketHandler;
typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, uint64> AtomicInt;
/// Remote Administration socket
class RASocket: public TcpSocket
{
@ -41,14 +44,14 @@ class RASocket: public TcpSocket
void OnAccept();
void OnRead();
AtomicInt pendingCommands;
private:
char * buff;
char buff[RA_BUFF_SIZE];
std::string szLogin;
uint32 iSess;
unsigned int iInputLength;
bool bLog;
bool bSecure; //kick on wrong pass, non exist. user, user with no priv
bool bSecure; //kick on wrong pass, non exist. user OR user with no priv
//will protect from DOS, bruteforce attacks
//some 'smart' protection must be added for more security
uint8 iMinLevel;
@ -56,10 +59,11 @@ class RASocket: public TcpSocket
{
NONE, //initial value
LG, //only login was entered
OK, //both login and pass were given, and they are correct and user have enough priv.
OK, //both login and pass were given, they were correct and user has enough priv.
}stage;
static void zprint( const char * szText );
static void zprint(void* callbackArg, const char * szText );
static void commandFinished(void* callbackArg, bool success);
};
#endif
/// @}

View file

@ -1356,7 +1356,7 @@ Network.OutUBuff = 65536
Network.TcpNodelay = 1
###################################################################################################################
# CONSOLE AND REMOTE ACCESS
# CONSOLE, REMOTE ACCESS AND SOAP
#
# Console.Enable
# Enable console
@ -1380,6 +1380,20 @@ Network.TcpNodelay = 1
# Ra.Secure
# Kick client on wrong pass
#
#
# SOAP.Enable
# Enable soap service
# Default: 0 - off
# 1 - on
#
# SOAP.IP
# Bound SOAP service ip address, use 0.0.0.0 to access from everywhere
# Default: 127.0.0.1
#
# SOAP.Port
# SOAP port
# Default: 7878
#
###################################################################################################################
Console.Enable = 1
@ -1388,3 +1402,8 @@ Ra.IP = 0.0.0.0
Ra.Port = 3443
Ra.MinLevel = 3
Ra.Secure = 1
SOAP.Enabled = 0
SOAP.IP = 127.0.0.1
SOAP.Port = 7878

1645
src/mangosd/soapC.cpp Normal file

File diff suppressed because it is too large Load diff

239
src/mangosd/soapH.h Normal file
View file

@ -0,0 +1,239 @@
/* soapH.h
Generated by gSOAP 2.7.10 from stub.h
Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved.
This part of the software is released under one of the following licenses:
GPL, the gSOAP public license, or Genivia's license for commercial use.
*/
#ifndef soapH_H
#define soapH_H
#include "soapStub.h"
#ifndef WITH_NOIDREF
#ifdef __cplusplus
extern "C" {
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int);
SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int);
SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*);
#ifdef __cplusplus
}
#endif
SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*);
#endif
SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*);
SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 int SOAP_FMAC4 soap_fdelete(struct soap_clist*);
SOAP_FMAC3 void* SOAP_FMAC4 soap_class_id_enter(struct soap*, const char*, void*, int, size_t, const char*, const char*);
#ifndef SOAP_TYPE_byte
#define SOAP_TYPE_byte (3)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*);
SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*);
SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*);
#ifndef SOAP_TYPE_int
#define SOAP_TYPE_int (1)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*);
SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*);
SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*);
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Fault
#define SOAP_TYPE_SOAP_ENV__Fault (18)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*);
SOAP_FMAC5 struct SOAP_ENV__Fault * SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault*);
SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap*, int, int, void*, size_t, const void*, size_t);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Reason
#define SOAP_TYPE_SOAP_ENV__Reason (17)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*);
SOAP_FMAC5 struct SOAP_ENV__Reason * SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason*);
SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap*, int, int, void*, size_t, const void*, size_t);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Detail
#define SOAP_TYPE_SOAP_ENV__Detail (14)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*);
SOAP_FMAC5 struct SOAP_ENV__Detail * SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail*);
SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap*, int, int, void*, size_t, const void*, size_t);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Code
#define SOAP_TYPE_SOAP_ENV__Code (12)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*);
SOAP_FMAC5 struct SOAP_ENV__Code * SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code*);
SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap*, int, int, void*, size_t, const void*, size_t);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Header
#define SOAP_TYPE_SOAP_ENV__Header (11)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*);
SOAP_FMAC5 struct SOAP_ENV__Header * SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header*);
SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap*, int, int, void*, size_t, const void*, size_t);
#endif
#ifndef SOAP_TYPE_ns1__executeCommand
#define SOAP_TYPE_ns1__executeCommand (10)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommand(struct soap*, struct ns1__executeCommand *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap*, const struct ns1__executeCommand *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap*, const struct ns1__executeCommand *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap*, const char*, int, const struct ns1__executeCommand *, const char*);
SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_get_ns1__executeCommand(struct soap*, struct ns1__executeCommand *, const char*, const char*);
SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(struct soap*, const char*, struct ns1__executeCommand *, const char*);
SOAP_FMAC5 struct ns1__executeCommand * SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap*, struct ns1__executeCommand*);
SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap*, int, int, void*, size_t, const void*, size_t);
#ifndef SOAP_TYPE_ns1__executeCommandResponse
#define SOAP_TYPE_ns1__executeCommandResponse (9)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse *);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse *, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap*, const char*, int, const struct ns1__executeCommandResponse *, const char*);
SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_get_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse *, const char*, const char*);
SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeCommandResponse(struct soap*, const char*, struct ns1__executeCommandResponse *, const char*);
SOAP_FMAC5 struct ns1__executeCommandResponse * SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap*, int);
SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse*);
SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap*, int, const char*, const char*, size_t*);
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap*, int, int, void*, size_t, const void*, size_t);
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason
#define SOAP_TYPE_PointerToSOAP_ENV__Reason (20)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail
#define SOAP_TYPE_PointerToSOAP_ENV__Detail (19)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*);
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code
#define SOAP_TYPE_PointerToSOAP_ENV__Code (13)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*);
#endif
#ifndef SOAP_TYPE_PointerTostring
#define SOAP_TYPE_PointerTostring (7)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap*, char **const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap*, char **const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap*, const char *, int, char **const*, const char *);
SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap*, char ***, const char*, const char*);
SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap*, const char*, char ***, const char*);
#ifndef SOAP_TYPE__QName
#define SOAP_TYPE__QName (5)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char **);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*);
SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*);
SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*);
#ifndef SOAP_TYPE_string
#define SOAP_TYPE_string (4)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*);
SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*);
SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*);
#endif
/* End of soapH.h */

127
src/mangosd/soapServer.cpp Normal file
View file

@ -0,0 +1,127 @@
/* soapServer.cpp
Generated by gSOAP 2.7.10 from stub.h
Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved.
This part of the software is released under one of the following licenses:
GPL, the gSOAP public license, or Genivia's license for commercial use.
*/
#include "soapH.h"
SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.7.10 2010-02-18 18:41:56 GMT")
SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap)
{
#ifndef WITH_FASTCGI
unsigned int k = soap->max_keep_alive;
#endif
do
{
#ifdef WITH_FASTCGI
if (FCGI_Accept() < 0)
{
soap->error = SOAP_EOF;
return soap_send_fault(soap);
}
#endif
soap_begin(soap);
#ifndef WITH_FASTCGI
if (soap->max_keep_alive > 0 && !--k)
soap->keep_alive = 0;
#endif
if (soap_begin_recv(soap))
{ if (soap->error < SOAP_STOP)
{
#ifdef WITH_FASTCGI
soap_send_fault(soap);
#else
return soap_send_fault(soap);
#endif
}
soap_closesock(soap);
continue;
}
if (soap_envelope_begin_in(soap)
|| soap_recv_header(soap)
|| soap_body_begin_in(soap)
|| soap_serve_request(soap)
|| (soap->fserveloop && soap->fserveloop(soap)))
{
#ifdef WITH_FASTCGI
soap_send_fault(soap);
#else
return soap_send_fault(soap);
#endif
}
#ifdef WITH_FASTCGI
soap_destroy(soap);
soap_end(soap);
} while (1);
#else
} while (soap->keep_alive);
#endif
return SOAP_OK;
}
#ifndef WITH_NOSERVEREQUEST
SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap)
{
soap_peek_element(soap);
if (!soap_match_tag(soap, soap->tag, "ns1:executeCommand"))
return soap_serve_ns1__executeCommand(soap);
return soap->error = SOAP_NO_METHOD;
}
#endif
SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap)
{ struct ns1__executeCommand soap_tmp_ns1__executeCommand;
struct ns1__executeCommandResponse soap_tmp_ns1__executeCommandResponse;
char * soap_tmp_string;
soap_default_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse);
soap_tmp_string = NULL;
soap_tmp_ns1__executeCommandResponse.result = &soap_tmp_string;
soap_default_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand);
soap->encodingStyle = NULL;
if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", NULL))
return soap->error;
if (soap_body_end_in(soap)
|| soap_envelope_end_in(soap)
|| soap_end_recv(soap))
return soap->error;
soap->error = ns1__executeCommand(soap, soap_tmp_ns1__executeCommand.command, &soap_tmp_string);
if (soap->error)
return soap->error;
soap_serializeheader(soap);
soap_serialize_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse);
if (soap_begin_count(soap))
return soap->error;
if (soap->mode & SOAP_IO_LENGTH)
{ if (soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "")
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap))
return soap->error;
};
if (soap_end_count(soap)
|| soap_response(soap, SOAP_OK)
|| soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "")
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap)
|| soap_end_send(soap))
return soap->error;
return soap_closesock(soap);
}
/* End of soapServer.cpp */

184
src/mangosd/soapStub.h Normal file
View file

@ -0,0 +1,184 @@
/* soapStub.h
Generated by gSOAP 2.7.10 from stub.h
Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved.
This part of the software is released under one of the following licenses:
GPL, the gSOAP public license, or Genivia's license for commercial use.
*/
#ifndef soapStub_H
#define soapStub_H
#include "stdsoap2.h"
/******************************************************************************\
* *
* Enumerations *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Classes and Structs *
* *
\******************************************************************************/
#if 0 /* volatile type: do not redeclare here */
#endif
#ifndef SOAP_TYPE_ns1__executeCommandResponse
#define SOAP_TYPE_ns1__executeCommandResponse (9)
/* ns1:executeCommandResponse */
struct ns1__executeCommandResponse
{
public:
char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */
};
#endif
#ifndef SOAP_TYPE_ns1__executeCommand
#define SOAP_TYPE_ns1__executeCommand (10)
/* ns1:executeCommand */
struct ns1__executeCommand
{
public:
char *command; /* optional element of type xsd:string */
};
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Header
#define SOAP_TYPE_SOAP_ENV__Header (11)
/* SOAP Header: */
struct SOAP_ENV__Header
{
#ifdef WITH_NOEMPTYSTRUCT
private:
char dummy; /* dummy member to enable compilation */
#endif
};
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Code
#define SOAP_TYPE_SOAP_ENV__Code (12)
/* SOAP Fault Code: */
struct SOAP_ENV__Code
{
public:
char *SOAP_ENV__Value; /* optional element of type xsd:QName */
struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */
};
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Detail
#define SOAP_TYPE_SOAP_ENV__Detail (14)
/* SOAP-ENV:Detail */
struct SOAP_ENV__Detail
{
public:
int __type; /* any type of element (defined below) */
void *fault; /* transient */
char *__any;
};
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Reason
#define SOAP_TYPE_SOAP_ENV__Reason (17)
/* SOAP-ENV:Reason */
struct SOAP_ENV__Reason
{
public:
char *SOAP_ENV__Text; /* optional element of type xsd:string */
};
#endif
#ifndef SOAP_TYPE_SOAP_ENV__Fault
#define SOAP_TYPE_SOAP_ENV__Fault (18)
/* SOAP Fault: */
struct SOAP_ENV__Fault
{
public:
char *faultcode; /* optional element of type xsd:QName */
char *faultstring; /* optional element of type xsd:string */
char *faultactor; /* optional element of type xsd:string */
struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */
struct SOAP_ENV__Code *SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */
struct SOAP_ENV__Reason *SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */
char *SOAP_ENV__Node; /* optional element of type xsd:string */
char *SOAP_ENV__Role; /* optional element of type xsd:string */
struct SOAP_ENV__Detail *SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */
};
#endif
/******************************************************************************\
* *
* Types with Custom Serializers *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Typedefs *
* *
\******************************************************************************/
#ifndef SOAP_TYPE__QName
#define SOAP_TYPE__QName (5)
typedef char *_QName;
#endif
#ifndef SOAP_TYPE__XML
#define SOAP_TYPE__XML (6)
typedef char *_XML;
#endif
/******************************************************************************\
* *
* Typedef Synonyms *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Externals *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Service Operations *
* *
\******************************************************************************/
SOAP_FMAC5 int SOAP_FMAC6 ns1__executeCommand(struct soap*, char *command, char **result);
/******************************************************************************\
* *
* Stubs *
* *
\******************************************************************************/
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__executeCommand(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *command, char **result);
/******************************************************************************\
* *
* Skeletons *
* *
\******************************************************************************/
SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap*);
SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap*);
SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap*);
#endif
/* End of soapStub.h */

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9465"
#define REVISION_NR "9466"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9375_01_characters_character_glyphs"
#define REVISION_DB_MANGOS "required_9464_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_9466_01_mangos_mangos_string"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__

View file

@ -151,7 +151,7 @@
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\game;..\..\src\mangosd;..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\dep\include\gsoap;..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\game;..\..\src\mangosd;..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>VERSION="0.16.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -459,6 +459,10 @@
<None Include="..\..\WARNING" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\dep\src\gsoap\stdsoap2.cpp" />
<ClCompile Include="..\..\src\mangosd\soapServer.cpp" />
<ClCompile Include="..\..\src\mangosd\soapC.cpp" />
<ClCompile Include="..\..\src\mangosd\MaNGOSsoap.cpp" />
<ClCompile Include="..\..\src\mangosd\CliRunnable.cpp" />
<ClCompile Include="..\..\src\mangosd\Main.cpp" />
<ClCompile Include="..\..\src\mangosd\Master.cpp" />
@ -467,11 +471,16 @@
<ClCompile Include="..\..\src\shared\WheatyExceptionReport.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\dep\include\gsoap\stdsoap2.h" />
<ClInclude Include="..\..\src\mangosd\soapStub.h" />
<ClInclude Include="..\..\src\mangosd\soapH.h" />
<ClInclude Include="..\..\src\mangosd\MaNGOSsoap.h" />
<ClInclude Include="..\..\src\mangosd\CliRunnable.h" />
<ClInclude Include="..\..\src\mangosd\Master.h" />
<ClInclude Include="..\..\src\mangosd\RASocket.h" />
<ClInclude Include="..\..\src\mangosd\WorldRunnable.h" />
<ClInclude Include="..\..\src\shared\WheatyExceptionReport.h" />
<ClInclude Include="..\..\src\shared\WheatyExceptionReport.h"
/>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\mangosd\mangosd.rc" />

View file

@ -47,7 +47,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers"
AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers;..\..\dep\gsoap"
PreprocessorDefinitions="VERSION=&quot;0.16.0-DEV&quot;;WIN32;NDEBUG;_CONSOLE;ENABLE_CLI;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="2"
@ -679,6 +679,14 @@
RelativePath="..\..\src\mangosd\mangosd.rc"
>
</File>
<File
RelativePath="..\..\src\mangosd\MaNGOSsoap.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\MaNGOSsoap.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\Master.cpp"
>
@ -711,7 +719,31 @@
RelativePath="..\..\src\mangosd\WorldRunnable.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapC.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapH.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapServer.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapStub.h"
>
</File>
<File
RelativePath="..\..\dep\src\gsoap\stdsoap2.cpp"
>
</File>
<File
RelativePath="..\..\dep\include\gsoap\stdsoap2.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
</VisualStudioProject>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="mangosd"
ProjectGUID="{A3A04E47-43A2-4C08-90B3-029CEF558594}"
RootNamespace="mangosd"
@ -48,7 +48,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers"
AdditionalIncludeDirectories="..\..\dep\include\gsoap;..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\game;..\..\src\mangosd;..\..\dep\ACE_wrappers"
PreprocessorDefinitions="VERSION=&quot;0.16.0-DEV&quot;;WIN32;NDEBUG;_CONSOLE;ENABLE_CLI;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="2"
@ -679,6 +679,14 @@
RelativePath="..\..\src\mangosd\mangosd.rc"
>
</File>
<File
RelativePath="..\..\src\mangosd\MaNGOSsoap.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\MaNGOSsoap.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\Master.cpp"
>
@ -695,6 +703,30 @@
RelativePath="..\..\src\mangosd\RASocket.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapC.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapH.h"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapServer.cpp"
>
</File>
<File
RelativePath="..\..\src\mangosd\soapStub.h"
>
</File>
<File
RelativePath="..\..\dep\src\gsoap\stdsoap2.cpp"
>
</File>
<File
RelativePath="..\..\dep\include\gsoap\stdsoap2.h"
>
</File>
<File
RelativePath="..\..\src\shared\WheatyExceptionReport.cpp"
>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="shared"
ProjectGUID="{90297C34-F231-4DF4-848E-A74BCC0E40ED}"
RootNamespace="shared"