From 3c487c5cd69c53d6fea948643c0a76df03516605 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 1 Apr 2022 21:23:39 +0200 Subject: Moved Stars45 to StarsEx --- StarsEx/NetAdminServer.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 StarsEx/NetAdminServer.h (limited to 'StarsEx/NetAdminServer.h') diff --git a/StarsEx/NetAdminServer.h b/StarsEx/NetAdminServer.h new file mode 100644 index 0000000..804d482 --- /dev/null +++ b/StarsEx/NetAdminServer.h @@ -0,0 +1,90 @@ +/* Starshatter: The Open Source Project + Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors + Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors + Copyright (c) 1997-2006, Destroyer Studios LLC. + + AUTHOR: John DiCamillo + + + OVERVIEW + ======== + HTTP Servlet Engine for Multiplayer Admin +*/ + + +#ifndef NetAdminServer_h +#define NetAdminServer_h + +#include "HttpServletExec.h" +#include "HttpServlet.h" + +// +-------------------------------------------------------------------+ + +class Mission; +class MissionElement; +class NetChatEntry; +class NetUser; + +// +-------------------------------------------------------------------+ + +class NetAdminServer : public HttpServletExec +{ +public: + virtual ~NetAdminServer(); + + int operator == (const NetAdminServer& s) const { return this == &s; } + + virtual HttpServlet* GetServlet(HttpRequest& request); + + virtual void AddUser(NetUser* user); + virtual void DelUser(NetUser* user); + virtual int NumUsers(); + virtual bool HasHost(); + virtual List& GetUsers(); + + virtual NetUser* FindUserBySession(Text id); + + virtual void AddChat(NetUser* user, const char* msg); + ListIter GetChat(); + DWORD GetStartTime() const { return start_time; } + + virtual void GameOn() { } + virtual void GameOff() { } + + // singleton locator: + static NetAdminServer* GetInstance(WORD port=0); + +protected: + NetAdminServer(WORD port); + virtual void DoSyncedCheck(); + + DWORD start_time; + List admin_users; +}; + +// +-------------------------------------------------------------------+ + +class NetAdminServlet : public HttpServlet +{ +public: + NetAdminServlet(); + virtual ~NetAdminServlet() { } + + virtual bool DoGet(HttpRequest& request, HttpResponse& response); + virtual bool CheckUser(HttpRequest& request, HttpResponse& response); + + virtual Text GetCSS(); + virtual Text GetHead(const char* title=0); + virtual Text GetBody(); + virtual Text GetTitleBar(const char* statline=0, const char* onload=0); + virtual Text GetStatLine(); + virtual Text GetCopyright(); + virtual Text GetContent(); + virtual Text GetBodyClose(); + +protected: + NetAdminServer* admin; + NetUser* user; +}; + +#endif // NetAdminServer_h \ No newline at end of file -- cgit v1.1