aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net/localwebserver.h
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-16 14:19:18 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit3946f23d172f55411748171af9822d2be3863701 (patch)
treecc4eba5d489c153b5d364f9c82ff34d225a82109 /backends/networking/sdl_net/localwebserver.h
parentceb86a0dd8421047fc3d067da2a4c7faccc2f782 (diff)
downloadscummvm-rg350-3946f23d172f55411748171af9822d2be3863701.tar.gz
scummvm-rg350-3946f23d172f55411748171af9822d2be3863701.tar.bz2
scummvm-rg350-3946f23d172f55411748171af9822d2be3863701.zip
CLOUD: Prepare code for path handlers
LocalWebserver would storage the handlers. Client now has methods like path() or query() to access different parts of the request.
Diffstat (limited to 'backends/networking/sdl_net/localwebserver.h')
-rw-r--r--backends/networking/sdl_net/localwebserver.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/backends/networking/sdl_net/localwebserver.h b/backends/networking/sdl_net/localwebserver.h
index ab453988a8..bda0bfd7c1 100644
--- a/backends/networking/sdl_net/localwebserver.h
+++ b/backends/networking/sdl_net/localwebserver.h
@@ -24,6 +24,8 @@
#define BACKENDS_NETWORKING_SDL_NET_LOCALWEBSERVER_H
#include "backends/networking/sdl_net/client.h"
+#include "common/callback.h"
+#include "common/hash-str.h"
#include "common/singleton.h"
#include "common/scummsys.h"
@@ -38,6 +40,8 @@ class LocalWebserver : public Common::Singleton<LocalWebserver> {
static const uint32 SERVER_PORT = 12345;
static const uint32 MAX_CONNECTIONS = 10;
+ typedef Common::BaseCallback<Client &> *ClientHandler;
+
friend void localWebserverTimer(void *); //calls handle()
SDLNet_SocketSet _set;
@@ -45,6 +49,7 @@ class LocalWebserver : public Common::Singleton<LocalWebserver> {
Client _client[MAX_CONNECTIONS];
int _clients;
bool _timerStarted;
+ Common::HashMap<Common::String, ClientHandler> _pathHandlers;
void startTimer(int interval = TIMER_INTERVAL);
void stopTimer();
@@ -59,6 +64,7 @@ public:
void start();
void stop();
+ void addPathHandler(Common::String path, ClientHandler handler);
};
/** Shortcut for accessing the local webserver. */