some cleanup
[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                 eString path;
24                 eString root;
25                 int authorized; // must be authorized (1 means read, 2 write)
26                 eHTTPFilePath(eString path, eString root, int authorized): path(path), root(root), authorized(authorized)
27                 {
28                 }
29         };
30         ePtrList<eHTTPFilePath> translate;
31 public:
32         eHTTPFilePathResolver();
33         eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn);
34         void addTranslation(eString path, eString root, int auth);
35 };
36
37 #endif