109dc07e6487d0b7085accbe38dbfb595f645002
[enigma2.git] / lib / network / http_file.h
1 #ifndef __http_file_h
2 #define __http_file_h
3
4 #include "httpd.h"
5
6 class eHTTPFile: public eHTTPDataSource
7 {
8         int fd, size;
9         const char *mime;
10         int method;
11 public:
12         enum { methodGET, methodPUT };
13         eHTTPFile(eHTTPConnection *c, int fd, int method, const char *mime);
14         ~eHTTPFile();
15         int doWrite(int);
16         void haveData(void *data, int len);
17 };
18
19 class eHTTPFilePathResolver: public eHTTPPathResolver
20 {
21         struct eHTTPFilePath
22         {
23                 std::string path;
24                 std::string root;
25                 int authorized; // must be authorized (1 means read, 2 write)
26                 eHTTPFilePath(std::string path, std::string root, int authorized): path(path), root(root), authorized(authorized)
27                 {
28                 }
29         };
30         ePtrList<eHTTPFilePath> translate;
31 public:
32         eHTTPFilePathResolver();
33         eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn);
34         void addTranslation(std::string path, std::string root, int auth);
35 };
36
37 #endif