Add SOAP-implementation (based on Benjys patch and adapted for latest core by xk1)

--HG--
branch : trunk
This commit is contained in:
click
2010-07-23 09:26:23 +02:00
parent 912a099d49
commit 3f9ea75bfa
20 changed files with 20158 additions and 73 deletions

View File

@@ -20,6 +20,7 @@ endif()
add_subdirectory(g3dlite)
add_subdirectory(sockets)
add_subdirectory(gsoap)
# temporary disable libmpq building (through CMake at least) for now
# - needs a proper CMakeLists.txt

10
externals/gsoap/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,10 @@
file(GLOB sources *.cpp)
set(gsoap_STAT_SRCS
${sources}
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(gsoap STATIC ${gsoap_STAT_SRCS})

1645
externals/gsoap/soapC.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

239
externals/gsoap/soapH.h vendored 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
externals/gsoap/soapServer.cpp vendored 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
externals/gsoap/soapStub.h vendored 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 */

15198
externals/gsoap/stdsoap2.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

2360
externals/gsoap/stdsoap2.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2402,8 +2402,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

@@ -76,6 +76,7 @@ class ChatHandler
static ChatCommand* getCommandTable();
bool isValidChatMessage(const char* msg);
bool HasSentErrorMessage() { return sentErrorMessage;}
void SendGlobalSysMessage(const char *str);
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
@@ -652,8 +653,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 *GetTrinityString(int32 entry) const;
@@ -665,6 +666,7 @@ class CliHandler : public ChatHandler
int GetSessionDbLocaleIndex() const;
private:
void* m_callbackArg;
Print* m_print;
};

View File

@@ -2445,19 +2445,19 @@ 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("TC> ");
}
void World::SendRNDBroadcast()

View File

@@ -464,19 +464,23 @@ enum WorldStates
/// 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;
CliCommandHolder(const char *command, Print* zprint)
: m_print(zprint)
CommandFinished* m_commandFinished;
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];
memcpy(m_command, command, len);
}
~CliCommandHolder() { delete[] m_command; }
};
@@ -657,7 +661,7 @@ class World
static int32 GetVisibilityNotifyPeriodInBGArenas() { return m_visibility_notify_periodInBGArenas; }
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

@@ -13,6 +13,7 @@
set(worldserver_SRCS
CommandLine/CliRunnable.cpp
RemoteAccess/RASocket.cpp
TCSoap/TCSoap.cpp
WorldThread/WorldRunnable.cpp
Main.cpp
Master.cpp
@@ -23,6 +24,7 @@ include_directories(
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/externals/gsoap
${CMAKE_SOURCE_DIR}/externals/sockets/include
${CMAKE_SOURCE_DIR}/externals/mersennetwister
${CMAKE_SOURCE_DIR}/dep/include
@@ -112,6 +114,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/worldserver
${CMAKE_SOURCE_DIR}/src/server/worldserver/CommandLine
${CMAKE_SOURCE_DIR}/src/server/worldserver/RemoteAccess
${CMAKE_SOURCE_DIR}/src/server/worldserver/TCSoap
${CMAKE_SOURCE_DIR}/src/server/worldserver/WorldThread
)
@@ -154,6 +157,7 @@ if( WIN32 )
trinityconfig
collision
g3dlib
gsoap
${SCRIPT_LIB}
ace
${MYSQL_LIBRARY}
@@ -171,6 +175,7 @@ else()
trinityconfig
collision
g3dlib
gsoap
jemalloc
${SCRIPT_LIB}
${READLINE_LIBRARY}

View File

@@ -85,7 +85,7 @@ char ** cli_completion(const char * text, int start, int end)
}
#endif
void utf8print(const char* str)
void utf8print(void* arg, const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
wchar_t wtemp_buf[6000];
@@ -106,6 +106,11 @@ void utf8print(const char* str)
#endif
}
void commandFinished(void*, bool sucess)
{
printf("TC> ");
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)
@@ -741,7 +746,7 @@ void CliRunnable::run()
continue;
}
fflush(stdout);
sWorld.QueueCliCommand(&utf8print,command.c_str());
sWorld.QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
#if PLATFORM != WINDOWS
add_history(command.c_str());
#endif

View File

@@ -38,6 +38,7 @@
#include "Log.h"
#include "Master.h"
#include "RASocket.h"
#include "TCSoap.h"
#include "Timer.h"
#include "Util.h"
@@ -315,6 +316,15 @@ int Master::Run()
}
}
#endif
//Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if(sConfig.GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable *runnable = new TCSoapRunnable();
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();
@@ -341,6 +351,13 @@ int Master::Run()
sWorldSocketMgr->Wait ();
if(soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
// set server offline
LoginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);

View File

@@ -31,48 +31,28 @@
#include "Util.h"
#include "World.h"
/// \todo Make this thread safe if in the future 2 admins should be able to log at the same time.
SOCKET r;
#define dropclient {Sendf("I'm busy right now, come back later."); \
SetCloseAndDelete(); \
return; \
}
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);
/// 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.outRemote("Connection was closed.\n");
if(stage==OK)
iUsers--;
}
/// Accept an incoming connection
@@ -80,12 +60,8 @@ void RASocket::OnAccept()
{
std::string ss=GetRemoteAddress();
sLog.outRemote("Incoming connection from %s.\n",ss.c_str());
///- If there is already an active admin, drop the connection
if(iUsers)
dropclient
///- Else print Motd
Sendf("%s\r\n",sWorld.GetMotd());
///- print Motd
Sendf("%s\r\n",sWorld.GetMotd());
}
/// Read data from the network
@@ -102,11 +78,7 @@ void RASocket::OnRead()
return;
}
///- If there is already an active admin (other than you), drop the connection
if(stage!=OK && iUsers)
dropclient
char *inp = new char [sz+1];
char *inp = new char [sz+1];
ibuf.Read(inp,sz);
/// \todo Can somebody explain this 'Linux bugfix'?
@@ -209,9 +181,8 @@ void RASocket::OnRead()
if(check)
{
r=GetSocket();
GetSocket();
stage=OK;
++iUsers;
Sendf("+Logged in.\r\n");
sLog.outRemote("User %s has logged in.\n",szLogin.c_str());
@@ -231,7 +202,10 @@ void RASocket::OnRead()
if(strlen(buff))
{
sLog.outRemote("Got '%s' cmd.\n",buff);
sWorld.QueueCliCommand(&RASocket::zprint , buff);
SetDeleteByHandler(false);
CliCommandHolder* cmd = new CliCommandHolder(this, buff, &RASocket::zprint, &RASocket::commandFinished);
sWorld.QueueCliCommand(cmd);
++pendingCommands;
}
else
Sendf("TC>");
@@ -243,23 +217,21 @@ 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=strdup(szText);
unsigned int sz=strlen(megabuffer);
Encrypt(megabuffer,sz);
send(r,megabuffer,sz,0);
free(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("TC>");
uint64 remainingCommands = --raSocket->pendingCommands;
if(remainingCommands == 0)
raSocket->SetDeleteByHandler(true);
}

View File

@@ -28,11 +28,14 @@
#include "TcpSocket.h"
#include "Common.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
{
@@ -44,14 +47,14 @@ class RASocket: public TcpSocket
void OnAccept();
void OnRead();
private:
AtomicInt pendingCommands;
char * buff;
private:
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;
//will protect from DOS, bruteforce attacks
//some 'smart' protection must be added for more security
uint8 iMinLevel;
@@ -62,7 +65,8 @@ class RASocket: public TcpSocket
OK, //both login and pass were given, and they are correct and user have 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

@@ -0,0 +1,175 @@
/*
* Copyright (C) 2005-2010 TrinityCore2 <http://trinitycore.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 "TCSoap.h"
#include "soapH.h"
#include "soapStub.h"
#define POOL_SIZE 5
void TCSoapRunnable::run()
{
// create pool
SOAPWorkingThread pool;
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
struct soap soap;
int m, s;
soap_init(&soap);
soap_set_imode(&soap, SOAP_C_UTFSTRING);
soap_set_omode(&soap, SOAP_C_UTFSTRING);
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("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
}
sLog.outString("TCSoap: 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("TCSoap: 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("TCSoap: Client didn't provide login information");
return 401;
}
uint32 accountId = accmgr.GetId(soap->userid);
if(!accountId)
{
sLog.outDebug("TCSoap: Client used invalid username '%s'", soap->userid);
return 401;
}
if(!accmgr.CheckPassword(accountId, soap->passwd))
{
sLog.outDebug("TCSoap: invalid password for account '%s'", soap->userid);
return 401;
}
if(accmgr.GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
sLog.outDebug("TCSoap: %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("TCSoap: 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
int acc = connection.pendingCommands.acquire();
if(acc)
{
sLog.outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
}
// 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:TC" }, // "ns1" namespace prefix
{ NULL, NULL }
};

View File

@@ -0,0 +1,120 @@
/*
* Copyright (C) 2005-2010 TrinityCore2 <http://trinitycore.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 _TCSOAP_H
#define _TCSOAP_H
#include "Common.h"
#include "World.h"
#include "AccountMgr.h"
#include "Log.h"
#include "soapH.h"
#include "soapStub.h"
#include "stdsoap2.h"
#include <ace/SV_Semaphore_Simple.h>
#include <ace/Task.h>
class TCSoapRunnable: public ACE_Based::Runnable
{
public:
TCSoapRunnable() { }
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

@@ -2084,7 +2084,20 @@ AuctionHouseBot.DisableTGsAboveReqSkillRank = 0
# 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
Ra.Enable = 0
@@ -2093,6 +2106,10 @@ Ra.Port = 3443
Ra.MinLevel = 3
Ra.Secure = 1
SOAP.Enabled = 0
SOAP.IP = 127.0.0.1
SOAP.Port = 7878
###################################################################################################################
# CharDelete.Method
# Character deletion behavior