39#ifndef __HttpAsynchReq_h
40#define __HttpAsynchReq_h
70 void* data,
S32 size);
98 void operator delete(
void* d) {
if(d)
::baFree(d); }
99 void *
operator new(size_t,
void *place) {
return place; }
100 void operator delete(
void*,
void *) { }
220#define HttpAsynchReq_getPacketSizeLeft(o) (o)->packetSizeLeft
223#define HttpAsynchReq_getBuffer(o) (o)->buffer
226#define HttpAsynchReq_getBufferSize(o) (o)->bufferSize
229#define HttpAsynchReq_isChunkEncoding(o) (o)->chunkEncoding
232#define HttpAsynchReq_getServer(o) \
233 HttpConnection_getServer((HttpConnection*)(o))
329 void* sendBuf,
S32 sendBufSize);
411#define HttpAsynchReqResp_destructor(o) do {\
412 HttpAsynchResp_destructor(&(o)->resp);\
413 HttpAsynchReq_destructor((HttpAsynchReq*)(o));\
416#define HttpAsynchReqResp_getPacketSizeLeft(o)\
417 HttpAsynchReq_getPacketSizeLeft((HttpAsynchReq*)o)
419#define HttpAsynchReqResp_getBuffer(o)\
420 HttpAsynchReq_getBuffer((HttpAsynchReq*)o)
422#define HttpAsynchReqResp_getBufferSize(o)\
423 HttpAsynchReq_getBufferSize((HttpAsynchReq*)o)
425#define HttpAsynchReqResp_isChunkEncoding(o)\
426 HttpAsynchReq_isChunkEncoding((HttpAsynchReq*)o)
428#define HttpAsynchReqResp_calcPacketSize(req)\
429 HttpAsynchReq_calcPacketSize(req)
433#define HttpAsynchReqResp_getCon(o) ((o))->resp.con
436#define HttpAsynchReqResp_getMutex(o) \
437 SoDisp_getMutex(HttpConnection_getDispatcher( \
438 HttpAsynchReqResp_getCon(o)))
441#define HttpAsynchReqResp_getServer(o) \
442 HttpConnection_getServer(HttpAsynchReqResp_getCon(o))
445#define HttpAsynchReqResp_getResponse(o) (&(o)->resp)
458 this,req,recBuf,recBufSize,sendBuf,sendBufSize); }
464inline void HttpAsynchReqResp::disableRecEv() {
465 HttpAsynchReqResp_disableRecEv(
this); }
466inline void HttpAsynchReqResp::enableRecEv() {
467 HttpAsynchReqResp_enableRecEv(
this); }
void * baMalloc(size_t size)
Allocate uninitialized storage using the target's configured allocator.
void baFree(void *p)
Release storage using the target's configured allocator.
BA_API int HttpAsynchReqResp_startResp(HttpAsynchReqResp *o, HttpRequest *req, void *sendBuf, S32 sendBufSize)
Start response if you know that all data was received by the web-server.
int startResp(HttpRequest *req, void *sendBuf, S32 sendBufSize)
Start response if you know that all data was received by the web-server.
Definition: HttpAsynchReq.h:459
SBaFileSize getBufferSize()
Definition: HttpAsynchReq.h:264
#define HttpAsynchReqResp_getMutex(o)
Definition: HttpAsynchReq.h:436
BA_API void HttpAsynchReq_constructor(HttpAsynchReq *o, HttpServer *server, HttpAsynchReq_OnData data)
Create an instance of HttpAsynchReq.
#define HttpAsynchReqResp_getServer(o)
Definition: HttpAsynchReq.h:441
BA_API int HttpAsynchReq_start(HttpAsynchReq *o, HttpRequest *req, void *buffer, S32 bufferSize)
Take over the request connection and start asynchronous reception.
#define HttpAsynchReq_getBufferSize(o)
Definition: HttpAsynchReq.h:226
BA_API int HttpAsynchReqResp_start(HttpAsynchReqResp *o, HttpRequest *req, void *recBuf, S32 recBufSize, void *sendBuf, S32 sendBufSize)
Start the HttpAsynchReqResp object.
BA_API SBaFileSize HttpAsynchReq_calcPacketSize(HttpRequest *req)
Inspect the request's body framing without consuming it.
struct HttpAsynchReq HttpAsynchReq
Asynchronously receive data in a resource such as HttpDir or HttpPage.
int start(HttpRequest *req, void *buffer, S32 bufferSize)
Take over the request connection and start asynchronous reception.
Definition: HttpAsynchReq.h:273
BA_API HttpConnection * HttpAsynchReq_getCon(HttpAsynchReq *o)
Stop receiving and expose the embedded connection for handoff.
void * getBuffer()
Returns a pointer to the internal buffer where the received data is stored.
Definition: HttpAsynchReq.h:261
#define HttpAsynchReq_getPacketSizeLeft(o)
Definition: HttpAsynchReq.h:220
HttpConnection * getCon(HttpAsynchReq *o)
Stop dispatcher reception and obtain the connection for handoff.
Definition: HttpAsynchReq.h:280
static SBaFileSize calcPacketSize(HttpRequest *req)
Inspect the request's body framing without consuming it.
Definition: HttpAsynchReq.h:270
#define HttpAsynchReq_isChunkEncoding(o)
Definition: HttpAsynchReq.h:229
BA_API void HttpAsynchReqResp_constructor(HttpAsynchReqResp *o, HttpServer *server, HttpAsynchReq_OnData data)
Initialize combined receive/response state.
bool isChunkEncoding()
Definition: HttpAsynchReq.h:267
BA_API void HttpAsynchReq_stop(HttpAsynchReq *o)
#define HttpAsynchReqResp_getResponse(o)
Definition: HttpAsynchReq.h:445
~HttpAsynchReq()
Stop dispatcher reception and destroy the owned connection.
Definition: HttpAsynchReq.h:255
int start(HttpRequest *req, void *recBuf, S32 recBufSize, void *sendBuf, S32 sendBufSize)
Start the HttpAsynchReqResp object.
Definition: HttpAsynchReq.h:452
HttpServer * getServer()
Definition: HttpAsynchReq.h:472
HttpAsynchResp * getResponse()
Definition: HttpAsynchReq.h:475
ThreadMutex * getMutex()
Definition: HttpAsynchReq.h:469
SBaFileSize getPacketSizeLeft()
Inspect receive progress after successful start.
Definition: HttpAsynchReq.h:258
#define HttpAsynchReq_getBuffer(o)
Definition: HttpAsynchReq.h:223
HttpAsynchReqResp HttpAsynchReqResp
Simultaneously receive and send a stream of data.
void(* HttpAsynchReq_OnData)(struct HttpAsynchReq *super, void *data, S32 size)
Receive data, completion, or an error.
Definition: HttpAsynchReq.h:69
BA_API void HttpAsynchReq_destructor(HttpAsynchReq *o)
void stop()
Remove active dispatcher reception, mark an active connection terminated, and clear receive-buffer st...
Definition: HttpAsynchReq.h:276
S32 SBaFileSize
Signed file-size value in bytes; 32 bits without BA_FILESIZE64.
Definition: GenPrimT.h:138
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:85
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Simultaneously receive and send a stream of data.
Definition: HttpAsynchReq.h:297
HttpAsynchReqResp()
Uninitialized storage; initialize before use or destruction.
Definition: HttpAsynchReq.h:299
Asynchronously receive data in a resource such as HttpDir or HttpPage.
Definition: HttpAsynchReq.h:95
HttpAsynchReq()
Uninitialized storage; initialize before use or destruction.
Definition: HttpAsynchReq.h:103
Send data asynchronously to a client.
Definition: HttpAsynchResp.h:114
Contains information about the physical socket connection.
Definition: HttpConnection.h:80
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
Definition: HttpServer.h:950
The Web Server.
Definition: HttpServer.h:3393
A mutual exclusion class.
Definition: ThreadLib.h:196