Barracuda Application Server C/C++ Reference
NO
HttpUpload.h
1 /*
2  * ____ _________ __ _
3  * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4  * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5  * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7  * /____/
8  *
9  * Barracuda Embedded Web-Server
10  *
11  ****************************************************************************
12  * HEADER
13  *
14  * $Id: HttpUpload.h 4915 2021-12-01 18:26:55Z wini $
15  *
16  * COPYRIGHT: Real Time Logic LLC, 2006-2008
17  *
18  * This software is copyrighted by and is the sole property of Real
19  * Time Logic LLC. All rights, title, ownership, or other interests in
20  * the software remain the property of Real Time Logic LLC. This
21  * software may only be used in accordance with the terms and
22  * conditions stipulated in the corresponding license agreement under
23  * which the software has been supplied. Any unauthorized use,
24  * duplication, transmission, distribution, or disclosure of this
25  * software is expressly forbidden.
26  *
27  * This Copyright notice may not be removed or modified without prior
28  * written consent of Real Time Logic LLC.
29  *
30  * Real Time Logic LLC. reserves the right to modify this software
31  * without notice.
32  *
33  * http://www.realtimelogic.com
34  ****************************************************************************
35  *
36  *
37  */
38 
39 #ifndef _HttpUpload_h
40 #define _HttpUpload_h
41 
42 #include <HttpAsynchReq.h>
43 #include <MultipartUpload.h>
44 #include <AuthenticatedUser.h>
45 #include <IoIntf.h>
46 
47 struct HttpConnection;
48 
68 #ifdef __cplusplus
69 
74 {
76  const char* getName();
77 
79  const char* getUrl();
80 
87 
88  struct HttpConnection* getConnection();
89 
90  IoIntfPtr getIoIntf();
91 
100 
101 
103  bool isMultipartUpload();
104 };
105 #else
106 struct HttpUploadNode;
107 #endif
108 
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112 BA_API const char* HttpUploadNode_getName(struct HttpUploadNode* o);
113 BA_API const char* HttpUploadNode_getUrl(struct HttpUploadNode* o);
114 BA_API HttpAsynchResp* HttpUploadNode_getResponse(struct HttpUploadNode* o);
115 BA_API struct HttpConnection* HttpUploadNode_getConnection(
116  struct HttpUploadNode* o);
117 BA_API IoIntfPtr HttpUploadNode_getIoIntf(struct HttpUploadNode* o);
118 BA_API void* HttpUploadNode_getdata(struct HttpUploadNode* o);
119 BA_API HttpSession* HttpUploadNode_getSession(struct HttpUploadNode* o);
120 BA_API BaBool HttpUploadNode_isMultipartUpload(struct HttpUploadNode* o);
121 BA_API BaBool HttpUploadNode_isResponseMode(struct HttpUploadNode* o);
122 BA_API BaBool HttpUploadNode_initial(struct HttpUploadNode* o);
123 BA_API int HttpUploadNode_decrRef(struct HttpUploadNode* o);
124 BA_API void HttpUploadNode_incRef(struct HttpUploadNode* o);
125 BA_API void set_inflategzip(IoIntf_InflateGzip ptr);
126 BA_API IoIntf_InflateGzip get_inflategzip(void);
127 #ifdef __cplusplus
128 }
129 inline const char* HttpUploadNode::getName() {
130  return HttpUploadNode_getName(this); }
131 inline const char* HttpUploadNode::getUrl() {
132  return HttpUploadNode_getUrl(this); }
134  return HttpUploadNode_getResponse(this); }
135 inline struct HttpConnection* HttpUploadNode::getConnection() {
136  return HttpUploadNode_getConnection(this); }
137 inline IoIntfPtr HttpUploadNode::getIoIntf() {
138  return HttpUploadNode_getIoIntf(this); }
140  return HttpUploadNode_getSession(this); }
142  return HttpUploadNode_isMultipartUpload(this) ? true : false; }
143 #endif
144 
145 
146 
147 #ifndef __DOXYGEN__
148 struct HttpUploadCbIntf;
149 #endif
150 
151 typedef void (*HttpUploadCbIntf_OnFile)(
152  struct HttpUploadCbIntf* o, struct HttpUploadNode* node, BaBool completed);
153 typedef void (*HttpUploadCbIntf_OnError)(
154  struct HttpUploadCbIntf* o, struct HttpUploadNode* node,
155  int ecode, const char* extraEcode);
156 
162 typedef struct HttpUploadCbIntf
163 {
164 #ifdef __cplusplus
165  HttpUploadCbIntf(){}
166 
171  HttpUploadCbIntf(HttpUploadCbIntf_OnFile of,HttpUploadCbIntf_OnError oe);
172 #endif
173  HttpUploadCbIntf_OnFile onFileFp;
174  HttpUploadCbIntf_OnError onErrorFp;
176 
177 #define HttpUploadCbIntf_constructor(o, onFile, onError) do { \
178  (o)->onFileFp=onFile; \
179  (o)->onErrorFp=onError; \
180 } while(0)
181 
182 #ifdef __cplusplus
183  inline HttpUploadCbIntf::HttpUploadCbIntf(
184  HttpUploadCbIntf_OnFile of,HttpUploadCbIntf_OnError oe) {
185  HttpUploadCbIntf_constructor(this, of, oe);
186  }
187 #endif
188 
189 
195 typedef struct HttpUpload
196 {
197 #ifdef __cplusplus
198  HttpUpload() {}
199 
214  HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
215  HttpUploadCbIntf* uploadCb, int maxUploads);
216 
219  ~HttpUpload();
220 
231  int service(const char* name, HttpCommand* cmd, void* userdata=0);
232 
235  IoIntfPtr getIoIntf();
236 #endif
237 
238  DoubleList uploadNodeList;
239  IoIntfPtr io;
240  AllocatorIntf* alloc;
241  HttpUploadCbIntf* uploadCb;
242  int uploadsLeft;
244 
245 #ifdef __cplusplus
246 extern "C" {
247 #endif
248 BA_API void HttpUpload_constructor(
249  HttpUpload* o, IoIntfPtr io, AllocatorIntf* alloc,
250  HttpUploadCbIntf* uploadCb, int maxUploads);
251 BA_API void HttpUpload_destructor(HttpUpload* o);
252 BA_API int HttpUpload_service(
253  HttpUpload* o, const char* name, HttpCommand* cmd, void* userdata);
254 #define HttpUpload_getIoIntf(o) (o)->io
255 #ifdef __cplusplus
256 }
257 inline HttpUpload::HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
258  HttpUploadCbIntf* uploadCb, int maxUploads) {
259  HttpUpload_constructor(this, io, alloc, uploadCb, maxUploads); }
261  HttpUpload_destructor(this); }
262 inline int HttpUpload::service(const char* name, HttpCommand* cmd, void* userdata) {
263  return HttpUpload_service(this, name, cmd,userdata); }
264 inline IoIntfPtr HttpUpload::getIoIntf() {
265  return HttpUpload_getIoIntf(this); }
266 #endif
267  /* end of HttpUpload */
269 
270 #endif
HttpUploadCbIntf
struct HttpUploadCbIntf HttpUploadCbIntf
The HttpUploadCbIntf interface is an abstract class that must be implemented by code using the HttpUp...
AllocatorIntf
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:83
HttpUpload
The HttpUpload node is responsible for creating and starting HttpUploadNode instances.
Definition: HttpUpload.h:196
HttpSession
Provides a way to identify a user across more than one page request or visit to a web site,...
Definition: HttpServer.h:1975
HttpUploadNode::getResponse
HttpAsynchResp * getResponse()
Fetch the response object.
Definition: HttpUpload.h:133
HttpAsynchResp
Send data asynchronously to a client.
Definition: HttpAsynchResp.h:110
HttpUploadNode
A HttpUploadNode is dynamically created by an HttpUpload instance for each concurrent upload.
Definition: HttpUpload.h:74
HttpUploadNode::getSession
HttpSession * getSession()
Returns the HttpSession object or null if no session object.
Definition: HttpUpload.h:139
HttpConnection
Contains information about the physical socket connection.
Definition: HttpConnection.h:76
HttpUpload::getIoIntf
IoIntfPtr getIoIntf()
Return a pointer to the IoIntf implementation.
Definition: HttpUpload.h:264
HttpUploadCbIntf
The HttpUploadCbIntf interface is an abstract class that must be implemented by code using the HttpUp...
Definition: HttpUpload.h:163
HttpUploadNode::getName
const char * getName()
Returns the file name including the relative path.
Definition: HttpUpload.h:129
IoIntf_InflateGzip
ResIntfPtr(* IoIntf_InflateGzip)(IoIntfPtr io, const char *name, int *status, const char **ecode)
Open a file for writing.
Definition: IoIntf.h:260
HttpUpload::service
int service(const char *name, HttpCommand *cmd, void *userdata=0)
The HttpUpload service method.
Definition: HttpUpload.h:262
HttpUploadNode::getUrl
const char * getUrl()
Returns the full URL the client used when sending data.
Definition: HttpUpload.h:131
HttpCommand
The HttpCommand class is a container class for the HttpRequest and HttpResponse command pair.
Definition: HttpServer.h:1834
HttpUpload::~HttpUpload
~HttpUpload()
Terminate the HttpUpload instance and all active HttpUploadNode instances.
Definition: HttpUpload.h:260
HttpUpload
struct HttpUpload HttpUpload
The HttpUpload node is responsible for creating and starting HttpUploadNode instances.
HttpUploadNode::isMultipartUpload
bool isMultipartUpload()
Returns true if HTTP POST.
Definition: HttpUpload.h:141