mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 13:36:36 +00:00
Cleaned up web interface server, starting work on getting tcp connections to persist then will hook it up to the websockets/http/whatever else we deem worthy.
This commit is contained in:
@@ -23,8 +23,8 @@ SET(world_sources
|
||||
perl_EQW.cpp
|
||||
perl_HTTPRequest.cpp
|
||||
queryserv.cpp
|
||||
socket_server.cpp
|
||||
ucs.cpp
|
||||
web_interface.cpp
|
||||
wguild_mgr.cpp
|
||||
world_logsys.cpp
|
||||
WorldConfig.cpp
|
||||
@@ -54,9 +54,9 @@ SET(world_headers
|
||||
LoginServerList.h
|
||||
net.h
|
||||
queryserv.h
|
||||
socket_server.h
|
||||
SoFCharCreateData.h
|
||||
ucs.h
|
||||
web_interface.h
|
||||
wguild_mgr.h
|
||||
WorldConfig.h
|
||||
worlddb.h
|
||||
|
||||
+5
-5
@@ -46,7 +46,7 @@
|
||||
#include "LauncherList.h"
|
||||
#include "ucs.h"
|
||||
#include "queryserv.h"
|
||||
#include "socket_server.h"
|
||||
#include "web_interface.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
@@ -61,7 +61,7 @@ extern ClientList client_list;
|
||||
extern LauncherList launcher_list;
|
||||
extern UCSConnection UCSLink;
|
||||
extern QueryServConnection QSLink;
|
||||
extern Socket_Server_Connection SSLink;
|
||||
extern WebInterfaceConnection WILink;
|
||||
extern volatile bool RunLoops;
|
||||
|
||||
ConsoleList console_list;
|
||||
@@ -265,10 +265,10 @@ bool Console::Process() {
|
||||
QSLink.SetConnection(tcpc);
|
||||
tcpc = 0;
|
||||
}
|
||||
else if (tcpc->GetPacketMode() == EmuTCPConnection::packetModeSocket_Server)
|
||||
else if (tcpc->GetPacketMode() == EmuTCPConnection::packetModeWebInterface)
|
||||
{
|
||||
_log(WORLD__CONSOLE, "New Socket Server Connection from %s:%d", inet_ntoa(in), GetPort());
|
||||
SSLink.SetConnection(tcpc);
|
||||
_log(WORLD__CONSOLE, "New WI Connection from %s:%d", inet_ntoa(in), GetPort());
|
||||
WILink.SetConnection(tcpc);
|
||||
tcpc = 0;
|
||||
}
|
||||
else {
|
||||
|
||||
+3
-3
@@ -86,7 +86,7 @@
|
||||
#include "AdventureManager.h"
|
||||
#include "ucs.h"
|
||||
#include "queryserv.h"
|
||||
#include "socket_server.h"
|
||||
#include "web_interface.h"
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
EQStreamFactory eqsf(WorldStream,9000);
|
||||
@@ -98,7 +98,7 @@ LoginServerList loginserverlist;
|
||||
EQWHTTPServer http_server;
|
||||
UCSConnection UCSLink;
|
||||
QueryServConnection QSLink;
|
||||
Socket_Server_Connection SSLink;
|
||||
WebInterfaceConnection WILink;
|
||||
LauncherList launcher_list;
|
||||
AdventureManager adventure_manager;
|
||||
DBAsync *dbasync = nullptr;
|
||||
@@ -456,7 +456,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
QSLink.Process();
|
||||
|
||||
SSLink.Process();
|
||||
WILink.Process();
|
||||
|
||||
LFPGroupList.Process();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../common/debug.h"
|
||||
#include "socket_server.h"
|
||||
#include "web_interface.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "clientlist.h"
|
||||
#include "zonelist.h"
|
||||
@@ -12,33 +12,33 @@
|
||||
extern ClientList client_list;
|
||||
extern ZSList zoneserver_list;
|
||||
|
||||
Socket_Server_Connection::Socket_Server_Connection()
|
||||
WebInterfaceConnection::WebInterfaceConnection()
|
||||
{
|
||||
Stream = 0;
|
||||
stream = 0;
|
||||
authenticated = false;
|
||||
}
|
||||
|
||||
void Socket_Server_Connection::SetConnection(EmuTCPConnection *inStream)
|
||||
void WebInterfaceConnection::SetConnection(EmuTCPConnection *inStream)
|
||||
{
|
||||
if(Stream)
|
||||
if(stream)
|
||||
{
|
||||
_log(SOCKET_SERVER__ERROR, "Incoming Socket_Server Connection while we were already connected to a Socket_Server.");
|
||||
Stream->Disconnect();
|
||||
_log(WEB_INTERFACE__ERROR, "Incoming WebInterface Connection while we were already connected to a WebInterface.");
|
||||
stream->Disconnect();
|
||||
}
|
||||
|
||||
Stream = inStream;
|
||||
stream = inStream;
|
||||
|
||||
authenticated = false;
|
||||
}
|
||||
|
||||
bool Socket_Server_Connection::Process()
|
||||
bool WebInterfaceConnection::Process()
|
||||
{
|
||||
if (!Stream || !Stream->Connected())
|
||||
if (!stream || !stream->Connected())
|
||||
return false;
|
||||
|
||||
ServerPacket *pack = 0;
|
||||
|
||||
while((pack = Stream->PopPacket()))
|
||||
while((pack = stream->PopPacket()))
|
||||
{
|
||||
if (!authenticated)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ bool Socket_Server_Connection::Process()
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = GetIP();
|
||||
_log(SOCKET_SERVER__ERROR, "Socket_Server authorization failed.");
|
||||
_log(WEB_INTERFACE__ERROR, "WebInterface authorization failed.");
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
@@ -68,7 +68,7 @@ bool Socket_Server_Connection::Process()
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = GetIP();
|
||||
_log(SOCKET_SERVER__ERROR, "Socket_Server_ authorization failed.");
|
||||
_log(WEB_INTERFACE__ERROR, "WebInterface authorization failed.");
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
@@ -78,7 +78,7 @@ bool Socket_Server_Connection::Process()
|
||||
}
|
||||
else
|
||||
{
|
||||
_log(SOCKET_SERVER__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthorized zone access.");
|
||||
_log(WEB_INTERFACE__ERROR, "**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthorized zone access.");
|
||||
authenticated = true;
|
||||
}
|
||||
delete pack;
|
||||
@@ -96,17 +96,12 @@ bool Socket_Server_Connection::Process()
|
||||
}
|
||||
case ServerOP_ZAAuth:
|
||||
{
|
||||
_log(SOCKET_SERVER__ERROR, "Got authentication from Socket_Server_ when they are already authenticated.");
|
||||
break;
|
||||
}
|
||||
case ServerOP_LFGuildUpdate:
|
||||
{
|
||||
zoneserver_list.SendPacket(pack);
|
||||
_log(WEB_INTERFACE__ERROR, "Got authentication from WebInterface when they are already authenticated.");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_log(SOCKET_SERVER__ERROR, "Unknown ServerOPcode from Socket_Server_ 0x%04x, size %d", pack->opcode, pack->size);
|
||||
_log(WEB_INTERFACE__ERROR, "Unknown ServerOPcode from WebInterface 0x%04x, size %d", pack->opcode, pack->size);
|
||||
DumpPacket(pack->pBuffer, pack->size);
|
||||
break;
|
||||
}
|
||||
@@ -117,11 +112,11 @@ bool Socket_Server_Connection::Process()
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool Socket_Server_Connection::SendPacket(ServerPacket* pack)
|
||||
bool WebInterfaceConnection::SendPacket(ServerPacket* pack)
|
||||
{
|
||||
if(!Stream)
|
||||
if(!stream)
|
||||
return false;
|
||||
|
||||
return Stream->SendPacket(pack);
|
||||
return stream->SendPacket(pack);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#ifndef Socket_Server__H
|
||||
#define Socket_Server__H
|
||||
#ifndef WORLD_WEB_INTERFACE_H
|
||||
#define WORLD_WEB_INTERFACE_H
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/EmuTCPConnection.h"
|
||||
#include "../common/servertalk.h"
|
||||
|
||||
class Socket_Server_Connection
|
||||
class WebInterfaceConnection
|
||||
{
|
||||
public:
|
||||
Socket_Server_Connection();
|
||||
WebInterfaceConnection();
|
||||
void SetConnection(EmuTCPConnection *inStream);
|
||||
bool Process();
|
||||
bool SendPacket(ServerPacket* pack);
|
||||
void Disconnect() { if(Stream) Stream->Disconnect(); }
|
||||
void Disconnect() { if(stream) stream->Disconnect(); }
|
||||
void SendMessage(const char *From, const char *Message);
|
||||
private:
|
||||
inline uint32 GetIP() const { return Stream ? Stream->GetrIP() : 0; }
|
||||
EmuTCPConnection *Stream;
|
||||
inline uint32 GetIP() const { return stream ? stream->GetrIP() : 0; }
|
||||
EmuTCPConnection *stream;
|
||||
bool authenticated;
|
||||
};
|
||||
|
||||
#endif /*Socket_Server__H_*/
|
||||
#endif /*WORLD_WEB_INTERFACE_H*/
|
||||
Reference in New Issue
Block a user