diff Core/HttpServer/MongooseServer.h @ 409:63f707278fc8 lua-scripting

lua filtering of incoming http requests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2013 12:23:02 +0200
parents bdd72233b105
children c9a5d72f8481
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.h	Thu May 02 16:51:40 2013 +0200
+++ b/Core/HttpServer/MongooseServer.h	Fri May 03 12:23:02 2013 +0200
@@ -44,6 +44,19 @@
 {
   class ChunkStore;
 
+  class IIncomingHttpRequestFilter
+  {
+  public:
+    virtual ~IIncomingHttpRequestFilter()
+    {
+    }
+
+    virtual bool IsAllowed(Orthanc_HttpMethod method,
+                           const char* uri,
+                           const char* ip,
+                           const char* username) const = 0;
+  };
+
   class MongooseServer
   {
   private:
@@ -62,6 +75,7 @@
     bool ssl_;
     std::string certificate_;
     uint16_t port_;
+    IIncomingHttpRequestFilter* filter_;
   
     bool IsRunning() const;
 
@@ -116,6 +130,13 @@
 
     void SetRemoteAccessAllowed(bool allowed);
 
+    const IIncomingHttpRequestFilter* GetIncomingHttpRequestFilter() const
+    {
+      return filter_;
+    }
+
+    void SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter);
+
     void ClearHandlers();
 
     // Can return NULL if no handler is associated to this URI