diff options
Diffstat (limited to 'Starserver/NetAdminServer.h')
-rw-r--r-- | Starserver/NetAdminServer.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Starserver/NetAdminServer.h b/Starserver/NetAdminServer.h new file mode 100644 index 0000000..804d482 --- /dev/null +++ b/Starserver/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<NetUser>& GetUsers(); + + virtual NetUser* FindUserBySession(Text id); + + virtual void AddChat(NetUser* user, const char* msg); + ListIter<NetChatEntry> 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<NetUser> 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 |