comparison 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
comparison
equal deleted inserted replaced
408:5a3a4a25e568 409:63f707278fc8
42 42
43 namespace Orthanc 43 namespace Orthanc
44 { 44 {
45 class ChunkStore; 45 class ChunkStore;
46 46
47 class IIncomingHttpRequestFilter
48 {
49 public:
50 virtual ~IIncomingHttpRequestFilter()
51 {
52 }
53
54 virtual bool IsAllowed(Orthanc_HttpMethod method,
55 const char* uri,
56 const char* ip,
57 const char* username) const = 0;
58 };
59
47 class MongooseServer 60 class MongooseServer
48 { 61 {
49 private: 62 private:
50 // http://stackoverflow.com/questions/311166/stdauto-ptr-or-boostshared-ptr-for-pimpl-idiom 63 // http://stackoverflow.com/questions/311166/stdauto-ptr-or-boostshared-ptr-for-pimpl-idiom
51 struct PImpl; 64 struct PImpl;
60 bool remoteAllowed_; 73 bool remoteAllowed_;
61 bool authentication_; 74 bool authentication_;
62 bool ssl_; 75 bool ssl_;
63 std::string certificate_; 76 std::string certificate_;
64 uint16_t port_; 77 uint16_t port_;
78 IIncomingHttpRequestFilter* filter_;
65 79
66 bool IsRunning() const; 80 bool IsRunning() const;
67 81
68 public: 82 public:
69 MongooseServer(); 83 MongooseServer();
114 return remoteAllowed_; 128 return remoteAllowed_;
115 } 129 }
116 130
117 void SetRemoteAccessAllowed(bool allowed); 131 void SetRemoteAccessAllowed(bool allowed);
118 132
133 const IIncomingHttpRequestFilter* GetIncomingHttpRequestFilter() const
134 {
135 return filter_;
136 }
137
138 void SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter);
139
119 void ClearHandlers(); 140 void ClearHandlers();
120 141
121 // Can return NULL if no handler is associated to this URI 142 // Can return NULL if no handler is associated to this URI
122 HttpHandler* FindHandler(const UriComponents& forUri) const; 143 HttpHandler* FindHandler(const UriComponents& forUri) const;
123 144