30 soap_set_imode(&soap, SOAP_C_UTFSTRING);
31 soap_set_omode(&soap, SOAP_C_UTFSTRING);
33#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
34 soap.bind_flags = SO_REUSEADDR;
38 soap.accept_timeout = 3;
39 soap.recv_timeout = 5;
40 soap.send_timeout = 5;
41 if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100)))
43 TC_LOG_ERROR(
"network.soap",
"Couldn't bind to {}:{}", host, port);
47 TC_LOG_INFO(
"network.soap",
"Bound to http://{}:{}", host, port);
51 if (!soap_valid_socket(soap_accept(&soap)))
54 TC_LOG_DEBUG(
"network.soap",
"Accepted connection from IP={}.{}.{}.{}", (
int)(soap.ip>>24)&0xFF, (
int)(soap.ip>>16)&0xFF, (
int)(soap.ip>>8)&0xFF, (
int)soap.ip&0xFF);
55 struct soap* thread_soap = soap_copy(&soap);
66 TC_LOG_TRACE(
"network.soap",
"SOAPWorkingThread::process_message");
68 soap_serve(soap_message);
69 soap_destroy(soap_message);
70 soap_end(soap_message);
71 soap_free(soap_message);
81 if (!soap->userid || !soap->passwd)
83 TC_LOG_INFO(
"network.soap",
"Client didn't provide login information");
90 TC_LOG_INFO(
"network.soap",
"Client used invalid username '{}'", soap->userid);
96 TC_LOG_INFO(
"network.soap",
"Invalid password for account '{}'", soap->userid);
102 TC_LOG_INFO(
"network.soap",
"{}'s gmlevel is too low", soap->userid);
106 if (!command || !*command)
107 return soap_sender_fault(soap,
"Command can not be empty",
"The supplied command was an empty string");
109 TC_LOG_INFO(
"network.soap",
"Received command '{}'", command);
116 sWorld->QueueCliCommand(cmd);
123 char* printBuffer = soap_strdup(soap, connection.
m_printBuffer.c_str());
126 *result = printBuffer;
130 return soap_sender_fault(soap, printBuffer, printBuffer);
146{ {
"SOAP-ENV",
"http://schemas.xmlsoap.org/soap/envelope/",
nullptr,
nullptr },
147 {
"SOAP-ENC",
"http://schemas.xmlsoap.org/soap/encoding/",
nullptr,
nullptr },
148 {
"xsi",
"http://www.w3.org/1999/XMLSchema-instance",
"http://www.w3.org/*/XMLSchema-instance",
nullptr },
149 {
"xsd",
"http://www.w3.org/1999/XMLSchema",
"http://www.w3.org/*/XMLSchema",
nullptr },
150 {
"ns1",
"urn:TC",
nullptr,
nullptr },
151 {
nullptr,
nullptr,
nullptr,
nullptr }
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_TRACE(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
struct Namespace namespaces[]
void process_message(struct soap *soap_message)
void TCSoapThread(const std::string &host, uint16 port)
int ns1__executeCommand(soap *soap, char *command, char **result)
static uint32 GetSecurity(uint32 accountId, int32 realmId)
static bool CheckPassword(std::string username, std::string password)
static uint32 GetId(std::string_view username)
static void commandFinished(void *callbackArg, bool success)
bool hasCommandSucceeded() const
static void print(void *callbackArg, std::string_view msg)
std::string m_printBuffer
void setCommandSuccess(bool val)
std::promise< void > finishedPromise
Storage class for commands issued for delayed execution.
Battlenet::RealmHandle Id