C/C++ Reference
HttpUpload.h
00001 /*
00002  *     ____             _________                __                _
00003  *    / __ \___  ____ _/ /_  __(_)___ ___  ___  / /   ____  ____ _(_)____
00004  *   / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ /   / __ \/ __ `/ / ___/
00005  *  / _, _/  __/ /_/ / / / / / / / / / / /  __/ /___/ /_/ / /_/ / / /__
00006  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
00007  *                                                       /____/
00008  *
00009  *                  Barracuda Embedded Web-Server
00010  *
00011  ****************************************************************************
00012  *                            HEADER
00013  *
00014  *   $Id: HttpUpload.h 2648 2012-04-26 20:27:21Z wini $
00015  *
00016  *   COPYRIGHT:  Real Time Logic LLC, 2006-2008
00017  *
00018  *   This software is copyrighted by and is the sole property of Real
00019  *   Time Logic LLC.  All rights, title, ownership, or other interests in
00020  *   the software remain the property of Real Time Logic LLC.  This
00021  *   software may only be used in accordance with the terms and
00022  *   conditions stipulated in the corresponding license agreement under
00023  *   which the software has been supplied.  Any unauthorized use,
00024  *   duplication, transmission, distribution, or disclosure of this
00025  *   software is expressly forbidden.
00026  *                                                                        
00027  *   This Copyright notice may not be removed or modified without prior
00028  *   written consent of Real Time Logic LLC.
00029  *                                                                         
00030  *   Real Time Logic LLC. reserves the right to modify this software
00031  *   without notice.
00032  *
00033  *               http://www.realtimelogic.com
00034  ****************************************************************************
00035  *
00036  *
00037  */
00038 
00039 #ifndef _HttpUpload_h
00040 #define _HttpUpload_h
00041 
00042 #include <HttpAsynchReq.h>
00043 #include <MultipartUpload.h>
00044 #include <AuthenticatedUser.h>
00045 #include <IoIntf.h>
00046 
00047 struct HttpConnection;
00048 
00068 #ifdef __cplusplus
00069 
00073 struct HttpUploadNode
00074 {
00076       const char* getName();
00077 
00079       const char* getUrl();
00080 
00086       HttpAsynchResp* getResponse();
00087 
00088       struct HttpConnection* getConnection();
00089 
00090       IoIntfPtr getIoIntf();
00091 
00099       HttpSession* getSession();
00100 
00101 
00103       bool isMultipartUpload();
00104 };
00105 #else
00106 struct HttpUploadNode;
00107 #endif
00108 
00109 #ifdef __cplusplus
00110 extern "C" {
00111 #endif
00112 BA_API const char* HttpUploadNode_getName(struct HttpUploadNode* o);
00113 BA_API const char* HttpUploadNode_getUrl(struct HttpUploadNode* o);
00114 BA_API HttpAsynchResp* HttpUploadNode_getResponse(struct HttpUploadNode* o);
00115 BA_API struct HttpConnection* HttpUploadNode_getConnection(
00116    struct HttpUploadNode* o);
00117 BA_API IoIntfPtr HttpUploadNode_getIoIntf(struct HttpUploadNode* o);
00118 BA_API void* HttpUploadNode_getdata(struct HttpUploadNode* o);
00119 BA_API HttpSession* HttpUploadNode_getSession(struct HttpUploadNode* o);
00120 BA_API BaBool HttpUploadNode_isMultipartUpload(struct HttpUploadNode* o);
00121 BA_API BaBool HttpUploadNode_isResponseMode(struct HttpUploadNode* o);
00122 BA_API BaBool HttpUploadNode_initial(struct HttpUploadNode* o);
00123 BA_API int HttpUploadNode_decrRef(struct HttpUploadNode* o);
00124 BA_API void HttpUploadNode_incRef(struct HttpUploadNode* o);
00125 BA_API void set_inflategzip(IoIntf_InflateGzip ptr);
00126 BA_API IoIntf_InflateGzip get_inflategzip(void);
00127 #ifdef __cplusplus
00128 }
00129 inline const char* HttpUploadNode::getName() {
00130    return HttpUploadNode_getName(this); }
00131 inline const char* HttpUploadNode::getUrl() {
00132    return  HttpUploadNode_getUrl(this); }
00133 inline HttpAsynchResp* HttpUploadNode::getResponse() {
00134    return HttpUploadNode_getResponse(this); }
00135 inline struct HttpConnection* HttpUploadNode::getConnection() {
00136    return HttpUploadNode_getConnection(this); }
00137 inline IoIntfPtr HttpUploadNode::getIoIntf() {
00138    return HttpUploadNode_getIoIntf(this); }
00139 inline  HttpSession* HttpUploadNode::getSession() {
00140    return HttpUploadNode_getSession(this); }
00141 inline bool HttpUploadNode::isMultipartUpload() {
00142    return HttpUploadNode_isMultipartUpload(this) ? true : false; }
00143 #endif
00144 
00145 
00146 
00147 #ifndef __DOXYGEN__
00148 struct HttpUploadCbIntf;
00149 #endif
00150 
00151 typedef void (*HttpUploadCbIntf_OnFile)(
00152    struct HttpUploadCbIntf* o, struct HttpUploadNode* node, BaBool completed);
00153 typedef void (*HttpUploadCbIntf_OnError)(
00154    struct HttpUploadCbIntf* o, struct HttpUploadNode* node,
00155    int ecode, const char* extraEcode);
00156 
00162 typedef struct HttpUploadCbIntf
00163 {
00164 #ifdef __cplusplus
00165       HttpUploadCbIntf(){}
00166 
00171       HttpUploadCbIntf(HttpUploadCbIntf_OnFile of,HttpUploadCbIntf_OnError oe);
00172 #endif
00173       HttpUploadCbIntf_OnFile onFileFp;
00174       HttpUploadCbIntf_OnError onErrorFp;
00175 } HttpUploadCbIntf;
00176 
00177 #define HttpUploadCbIntf_constructor(o, onFile, onError) do { \
00178    (o)->onFileFp=onFile; \
00179    (o)->onErrorFp=onError; \
00180 } while(0)
00181 
00182 #ifdef __cplusplus
00183       inline HttpUploadCbIntf::HttpUploadCbIntf(
00184          HttpUploadCbIntf_OnFile of,HttpUploadCbIntf_OnError oe) {
00185          HttpUploadCbIntf_constructor(this, of, oe);
00186       }
00187 #endif
00188 
00189 
00195 typedef struct HttpUpload
00196 {
00197 #ifdef __cplusplus
00198       HttpUpload() {}
00199 
00214       HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
00215                  HttpUploadCbIntf* uploadCb, int maxUploads);
00216 
00219       ~HttpUpload();
00220 
00231       int service(const char* name, HttpCommand* cmd, void* userdata=0);
00232 
00235       IoIntfPtr getIoIntf();
00236 #endif
00237 
00238       DoubleList uploadNodeList;
00239       IoIntfPtr io;
00240       AllocatorIntf* alloc;
00241       HttpUploadCbIntf* uploadCb;
00242       int uploadsLeft;
00243 } HttpUpload;
00244 
00245 #ifdef __cplusplus
00246 extern "C" {
00247 #endif
00248 BA_API void HttpUpload_constructor(
00249    HttpUpload* o, IoIntfPtr io, AllocatorIntf* alloc,
00250    HttpUploadCbIntf* uploadCb, int maxUploads);
00251 BA_API void HttpUpload_destructor(HttpUpload* o);
00252 BA_API int HttpUpload_service(
00253    HttpUpload* o, const char* name, HttpCommand* cmd, void* userdata);
00254 #define HttpUpload_getIoIntf(o) (o)->io
00255 #ifdef __cplusplus
00256 }
00257 inline HttpUpload::HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
00258                               HttpUploadCbIntf* uploadCb, int maxUploads) {
00259    HttpUpload_constructor(this, io, alloc, uploadCb, maxUploads); }
00260 inline HttpUpload::~HttpUpload() {
00261     HttpUpload_destructor(this); }
00262 inline int HttpUpload::service(const char* name, HttpCommand* cmd, void* userdata) {
00263    return  HttpUpload_service(this, name, cmd,userdata); }
00264 inline IoIntfPtr HttpUpload::getIoIntf() {
00265    return HttpUpload_getIoIntf(this); }
00266 #endif
00267  /* end of HttpUpload */
00269 
00270 #endif