Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
HttpUpload.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: HttpUpload.h 5978 2026-09-11 16:13:48Z wini $
15 *
16 * COPYRIGHT: Real Time Logic LLC, 2006-2026
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
41#ifndef _HttpUpload_h
42#define _HttpUpload_h
43
44#include <HttpAsynchReq.h>
45#include <MultipartUpload.h>
46#include <AuthenticatedUser.h>
47#include <IoIntf.h>
48
49struct HttpConnection;
50
70#ifdef __cplusplus
76{
81 const char* getName();
82
88 const char* getUrl();
89
99
105
107 IoIntfPtr getIoIntf();
108
118
119
121 bool isMultipartUpload();
122};
123#else
124struct HttpUploadNode;
125#endif
126
127#ifdef __cplusplus
128extern "C" {
129#endif
132BA_API const char* HttpUploadNode_getName(struct HttpUploadNode* o);
135BA_API const char* HttpUploadNode_getUrl(struct HttpUploadNode* o);
142 struct HttpUploadNode* o);
145BA_API IoIntfPtr HttpUploadNode_getIoIntf(struct HttpUploadNode* o);
181#ifdef __cplusplus
182}
183inline const char* HttpUploadNode::getName() {
184 return HttpUploadNode_getName(this); }
185inline const char* HttpUploadNode::getUrl() {
186 return HttpUploadNode_getUrl(this); }
188 return HttpUploadNode_getResponse(this); }
190 return HttpUploadNode_getConnection(this); }
191inline IoIntfPtr HttpUploadNode::getIoIntf() {
192 return HttpUploadNode_getIoIntf(this); }
194 return HttpUploadNode_getSession(this); }
196 return HttpUploadNode_isMultipartUpload(this) ? true : false; }
197#endif
198
199
200
201#ifndef __DOXYGEN__
202struct HttpUploadCbIntf;
203#endif
204
216 struct HttpUploadCbIntf* o, struct HttpUploadNode* node, BaBool completed);
228 struct HttpUploadCbIntf* o, struct HttpUploadNode* node,
229 int ecode, const char* extraEcode);
230
236typedef struct HttpUploadCbIntf
237{
238#ifdef __cplusplus
241
247#endif
249 HttpUploadCbIntf_OnError onErrorFp;
251
256#define HttpUploadCbIntf_constructor(o, onFile, onError) do { \
257 (o)->onFileFp=onFile; \
258 (o)->onErrorFp=onError; \
259} while(0)
260
261#ifdef __cplusplus
264 HttpUploadCbIntf_constructor(this, of, oe);
265 }
266#endif
267
268
274typedef struct HttpUpload
275{
276#ifdef __cplusplus
279
297 HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
298 HttpUploadCbIntf* uploadCb, int maxUploads);
299
305 ~HttpUpload();
306
323 int service(const char* name, HttpCommand* cmd, void* userdata=0);
324
328 IoIntfPtr getIoIntf();
329#endif
330
331 DoubleList uploadNodeList;
332 IoIntfPtr io;
333 AllocatorIntf* alloc;
334 HttpUploadCbIntf* uploadCb;
335 int uploadsLeft;
337
338#ifdef __cplusplus
339extern "C" {
340#endif
344 HttpUpload* o, IoIntfPtr io, AllocatorIntf* alloc,
345 HttpUploadCbIntf* uploadCb, int maxUploads);
363 HttpUpload* o, const char* name, HttpCommand* cmd, void* userdata);
366#define HttpUpload_getIoIntf(o) (o)->io
367#ifdef __cplusplus
368}
369inline HttpUpload::HttpUpload(IoIntfPtr io, AllocatorIntf* alloc,
370 HttpUploadCbIntf* uploadCb, int maxUploads) {
371 HttpUpload_constructor(this, io, alloc, uploadCb, maxUploads); }
373 HttpUpload_destructor(this); }
374inline int HttpUpload::service(const char* name, HttpCommand* cmd, void* userdata) {
375 return HttpUpload_service(this, name, cmd,userdata); }
376inline IoIntfPtr HttpUpload::getIoIntf() {
377 return HttpUpload_getIoIntf(this); }
378#endif
379 /* end of HttpUpload */
381
382#endif
BA_API HttpAsynchResp * HttpUploadNode_getResponse(struct HttpUploadNode *o)
Switch from receiving the upload to producing its response.
BA_API void * HttpUploadNode_getdata(struct HttpUploadNode *o)
BA_API BaBool HttpUploadNode_initial(struct HttpUploadNode *o)
IoIntfPtr getIoIntf()
Definition: HttpUpload.h:376
struct HttpConnection * getConnection()
Definition: HttpUpload.h:189
BA_API struct HttpConnection * HttpUploadNode_getConnection(struct HttpUploadNode *o)
#define HttpUpload_getIoIntf(o)
Definition: HttpUpload.h:366
~HttpUpload()
Terminate the HttpUpload instance and all active HttpUploadNode instances.
Definition: HttpUpload.h:372
HttpSession * getSession()
Definition: HttpUpload.h:193
BA_API HttpSession * HttpUploadNode_getSession(struct HttpUploadNode *o)
BA_API void HttpUpload_constructor(HttpUpload *o, IoIntfPtr io, AllocatorIntf *alloc, HttpUploadCbIntf *uploadCb, int maxUploads)
Initialize an HttpUpload instance.
BA_API const char * HttpUploadNode_getUrl(struct HttpUploadNode *o)
void(* HttpUploadCbIntf_OnFile)(struct HttpUploadCbIntf *o, struct HttpUploadNode *node, BaBool completed)
Notify the application about a file or completed request.
Definition: HttpUpload.h:215
struct HttpUpload HttpUpload
The HttpUpload node is responsible for creating and starting HttpUploadNode instances.
BA_API BaBool HttpUploadNode_isResponseMode(struct HttpUploadNode *o)
BA_API void HttpUploadNode_incRef(struct HttpUploadNode *o)
Retain a node beyond the current callback.
BA_API int HttpUpload_service(HttpUpload *o, const char *name, HttpCommand *cmd, void *userdata)
Start an upload for a PUT or multipart POST request.
void(* HttpUploadCbIntf_OnError)(struct HttpUploadCbIntf *o, struct HttpUploadNode *node, int ecode, const char *extraEcode)
Report upload failure or parent shutdown.
Definition: HttpUpload.h:227
BA_API IoIntfPtr HttpUploadNode_getIoIntf(struct HttpUploadNode *o)
const char * getUrl()
Definition: HttpUpload.h:185
struct HttpUploadCbIntf HttpUploadCbIntf
The HttpUploadCbIntf interface is an abstract class that must be implemented by code using the HttpUp...
BA_API const char * HttpUploadNode_getName(struct HttpUploadNode *o)
#define HttpUploadCbIntf_constructor(o, onFile, onError)
Install upload callbacks without allocating memory.
Definition: HttpUpload.h:256
BA_API void set_inflategzip(IoIntf_InflateGzip ptr)
Install the process-wide gzip upload adapter in builds with zlib support.
IoIntfPtr getIoIntf()
Definition: HttpUpload.h:191
BA_API IoIntf_InflateGzip get_inflategzip(void)
BA_API int HttpUploadNode_decrRef(struct HttpUploadNode *o)
Release one retained reference.
bool isMultipartUpload()
Definition: HttpUpload.h:195
BA_API BaBool HttpUploadNode_isMultipartUpload(struct HttpUploadNode *o)
BA_API void HttpUpload_destructor(HttpUpload *o)
Abort active uploads and release their storage.
int service(const char *name, HttpCommand *cmd, void *userdata=0)
The HttpUpload service method.
Definition: HttpUpload.h:374
HttpAsynchResp * getResponse()
Switch from receiving the upload to producing its response.
Definition: HttpUpload.h:187
const char * getName()
Definition: HttpUpload.h:183
ResIntfPtr(* IoIntf_InflateGzip)(IoIntfPtr io, const char *name, int *status, const char **ecode)
Open a destination that accepts gzip bytes and stores decompressed data.
Definition: IoIntf.h:274
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
Send data asynchronously to a client.
Definition: HttpAsynchResp.h:114
The HttpCommand class is a container class for the HttpRequest and HttpResponse command pair.
Definition: HttpServer.h:2151
Contains information about the physical socket connection.
Definition: HttpConnection.h:80
Provides a way to identify a user across more than one page request or visit to a web site,...
Definition: HttpServer.h:2305
The HttpUploadCbIntf interface is an abstract class that must be implemented by code using the HttpUp...
Definition: HttpUpload.h:237
HttpUploadCbIntf()
Uninitialized storage; install both callbacks before use.
Definition: HttpUpload.h:240
A HttpUploadNode is dynamically created by an HttpUpload instance for each concurrent upload.
Definition: HttpUpload.h:76
The HttpUpload node is responsible for creating and starting HttpUploadNode instances.
Definition: HttpUpload.h:275
HttpUpload()
Uninitialized storage; initialize before use or destruction.
Definition: HttpUpload.h:278