add dynamic m3u playlist
[enigma2.git] / lib / network / http_dyn.h
1 #ifndef __http_dyn_h_
2 #define __http_dyn_h_
3 #include <string>
4 #include <lib/network/httpd.h>
5
6 class eHTTPDyn: public eHTTPDataSource
7 {
8         DECLARE_REF(eHTTPDyn);
9 private:
10         std::string result;
11         int wptr, size;
12 public:
13         eHTTPDyn(eHTTPConnection *c, std::string result);
14         ~eHTTPDyn();
15         int doWrite(int);
16 };
17
18 class eHTTPDynPathResolver: public iHTTPPathResolver
19 {
20         DECLARE_REF(eHTTPDynPathResolver);
21 private:
22         struct eHTTPDynEntry: public iObject
23         {
24                 DECLARE_REF(eHTTPDynEntry);
25         public:
26                 std::string request, path;
27                 std::string (*function)(std::string request, std::string path, std::string opt, eHTTPConnection *content);
28                 
29                 eHTTPDynEntry(std::string request, std::string path, std::string (*function)(std::string, std::string, std::string, eHTTPConnection *)): request(request), path(path), function(function)
30                 {
31                 }
32         };
33         eSmartPtrList<eHTTPDynEntry> dyn;
34 public:
35         void addDyn(std::string request, std::string path, std::string (*function)(std::string, std::string, std::string, eHTTPConnection *conn));
36         eHTTPDynPathResolver();
37         RESULT getDataSource(eHTTPDataSourcePtr &ptr, std::string request, std::string path, eHTTPConnection *conn);
38 };
39
40 #endif