|
C/C++ Reference
|
00001 /* 00002 * ____ _________ __ _ 00003 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____ 00004 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/ 00005 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__ 00006 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/ 00007 * /____/ 00008 * 00009 * Barracuda Embedded Web-Server 00010 * 00011 **************************************************************************** 00012 * HEADER 00013 * 00014 * $Id: HttpResRdr.h 2558 2012-01-04 21:55:24Z wini $ 00015 * 00016 * COPYRIGHT: Real Time Logic LLC, 2006-2008 00017 * http://www.realtimelogic.com 00018 * 00019 * The copyright to the program herein is the property of 00020 * Real Time Logic. The program may be used or copied only 00021 * with the written permission from Real Time Logic LLC or 00022 * in accordance with the terms and conditions stipulated in 00023 * the agreement under which the program has been supplied. 00024 **************************************************************************** 00025 * 00026 * 00027 */ 00028 00029 #ifndef _HttpResRdr_h 00030 #define _HttpResRdr_h 00031 00032 #include "IoIntf.h" 00033 #include "HttpServerLib.h" 00034 #include "HttpServer.h" 00035 00036 00037 struct HttpRdFilter; 00038 typedef void (*HttpRdFilter_Service)(struct HttpRdFilter* o, 00039 const char* name, 00040 IoStat* st, 00041 HttpCommand* cmd); 00042 00046 typedef struct HttpRdFilter 00047 { 00048 DoubleLink super; 00049 HttpRdFilter_Service serviceFp; 00050 const char* ext; /* File Extension */ 00051 } HttpRdFilter; 00052 00053 BA_API void HttpRdFilter_constructor( 00054 HttpRdFilter* o, const char* ext, HttpRdFilter_Service serviceFp); 00055 00056 BA_API void HttpRdFilter_destructor(HttpRdFilter* o); 00057 00058 00122 typedef struct HttpResRdr 00123 #ifdef __cplusplus 00124 : public HttpDir 00125 { 00126 HttpResRdr() {} 00136 HttpResRdr(IoIntf* io, const char* dirName, 00137 AllocatorIntf* alloc=0, S8 priority=0); 00138 00168 HttpResRdr(IoIntf* io, const char* domain, const char* p404, 00169 AllocatorIntf* alloc=0, S8 priority=0); 00170 00182 int insertPrologDir(HttpDir* dir); 00183 00184 /* Terminate a HttpResRdr instance */ 00185 ~HttpResRdr(); 00186 00189 int installFilter(HttpRdFilter* filter); 00190 00195 void setMaxAge(BaTime maxAge); 00196 00208 static void sendFile( 00209 IoIntf* io,const char* name, IoStat* st, HttpCommand* cmd); 00210 00213 IoIntf* getIo(); 00214 #if 0 00215 } 00216 #endif 00217 #else 00218 { 00219 HttpDir super; /* Inherits from HttpDir */ 00220 #endif 00221 DoubleList filterList; 00222 AllocatorIntf* alloc; 00223 IoIntf* io; 00224 HttpDir_Service superServiceFunc; 00225 HttpDir* prologDirRoot; 00226 const char* domain; 00227 const char* p404; 00228 BaTime maxAge; 00229 int maxFilterLen; 00230 } HttpResRdr; 00231 00232 00233 #ifdef __cplusplus 00234 extern "C" { 00235 #endif 00236 BA_API void HttpResRdr_constructor( 00237 HttpResRdr* o, IoIntf* io, const char* dirName, 00238 AllocatorIntf* alloc, S8 priority); 00239 BA_API void HttpResRdr_constructor2( 00240 HttpResRdr* o,IoIntf* io,const char* domain, 00241 const char* p404,AllocatorIntf* alloc, 00242 S8 priority); 00243 BA_API int HttpResRdr_insertPrologDir(HttpResRdr* o, HttpDir* dir); 00244 BA_API void HttpResRdr_destructor(HttpResRdr* o); 00245 BA_API int HttpResRdr_installFilter(HttpResRdr* o, HttpRdFilter* filter); 00246 #define HttpResRdr_setMaxAge(o, maxAgeMA) (o)->maxAge=maxAgeMA 00247 #define HttpResRdr_setAuthenticator(o, authenticator, realm) \ 00248 HttpDir_setAuthenticator((HttpDir*)o, authenticator, realm) 00249 BA_API void HttpResRdr_sendFile(IoIntf* io,const char* name, 00250 IoStat* st,HttpCommand* cmd); 00251 BA_API void set_deflategzip(IoIntf_DeflateGzip ptr); 00252 BA_API IoIntf_DeflateGzip get_deflategzip(void); 00253 00254 00255 #define HttpResRdr_getIo(o) (o)->io 00256 #ifdef __cplusplus 00257 } 00258 inline HttpResRdr::HttpResRdr(IoIntf* io, const char* domain, const char* p404, 00259 AllocatorIntf* alloc, S8 priority) { 00260 HttpResRdr_constructor2(this, io, domain, p404, alloc, priority); 00261 } 00262 inline HttpResRdr::HttpResRdr(IoIntf* io, const char* dirName, 00263 AllocatorIntf* alloc, S8 priority) { 00264 HttpResRdr_constructor(this, io, dirName, alloc, priority); 00265 } 00266 00267 inline int HttpResRdr::insertPrologDir(HttpDir* dir) { 00268 return HttpResRdr_insertPrologDir(this, dir); 00269 } 00270 00271 inline HttpResRdr::~HttpResRdr(){ 00272 HttpResRdr_destructor(this); 00273 } 00274 inline int HttpResRdr::installFilter(HttpRdFilter* filter){ 00275 return HttpResRdr_installFilter(this, filter); 00276 } 00277 inline void HttpResRdr::setMaxAge(BaTime maxAge){ 00278 HttpResRdr_setMaxAge(this, maxAge); 00279 } 00280 inline void HttpResRdr::sendFile( 00281 IoIntf* io, const char* name, IoStat* st, HttpCommand* cmd){ 00282 HttpResRdr_sendFile(io,name,st,cmd); 00283 } 00284 inline IoIntf* HttpResRdr::getIo() { 00285 return HttpResRdr_getIo(this); 00286 } 00287 #endif 00288 00289 00290 #endif