41#ifndef __HttpConnection_h
42#define __HttpConnection_h
61 HttpConnection_Free=0,
62 HttpConnection_Connected,
64 HttpConnection_Running,
66 HttpConnection_Terminated,
69 HttpConnection_HardClose
81 void *
operator new(size_t,
void *place) {
return place; }
82 void operator delete(
void*,
void *) { }
108 int pushBackDataSize;
115#define HttpConnection_setKeepAlive(o) (o)->keepAlive=TRUE
118#define HttpConnection_clearKeepAlive(o) (o)->keepAlive=FALSE
121#define HttpConnection_keepAlive(o) (o)->keepAlive
124#define HttpConnection_getState(o) (o)->state
127#define HttpConnection_getServer(o) (o)->server
130#define HttpConnection_getDispatcher(o) SoDispCon_getDispatcher((SoDispCon*)o)
131#define HttpConnection_dispRecEvent(o) SoDispCon_dispRecEvent((SoDispCon*)o)
132#define HttpConnection_newConnectionIsReady(con) \
133 SoDispCon_newConnectionIsReady(con)
146 struct SoDisp* dispatcher,
164int HttpConnection_sendChunkData6bOffs(
180#define HttpConnection_isSecure(o)\
181 SoDispCon_isSecure((SoDispCon*)o)
183#define HttpConnection_isValid(o)\
184 SoDispCon_isValid((SoDispCon*)o)
186#define HttpConnection_sendData(o, data, len)\
187 SoDispCon_sendData((SoDispCon*)o, data, len)
189#define HttpConnection_sendDataNT(o, data, len)\
190 SoDispCon_sendDataNT((SoDispCon*)o, data, len)
192#define HttpConnection_sendChunkData(o,data, len)\
193 SoDispCon_sendChunkData((SoDispCon*)o,data, len)
198#define HttpConnection_allocAsynchBuf(o, sizePtr)\
199 SoDispCon_allocAsynchBuf((SoDispCon*)o, sizePtr)
201#define HttpConnection_asyncSend(o,len) SoDispCon_asyncSend((SoDispCon*)o,len)
203#define HttpConnection_asyncReady(o) SoDispCon_asyncReady((SoDispCon*)o)
222#define HttpConnection_setNonblocking(o)\
223 SoDispCon_setNonblocking((SoDispCon*)o)
225#define HttpConnection_setBlocking(o)\
226 SoDispCon_setBlocking((SoDispCon*)o)
227#define HttpConnection_peek(o)\
228 SoDispCon_peek((SoDispCon*)o)
230#define HttpConnection_setTCPNoDelay(o, enable)\
231 SoDispCon_setTCPNoDelay((SoDispCon*)o, enable)
233#define HttpConnection_getPeerName(o, addr,port)\
234 SoDispCon_getPeerName((SoDispCon*)o, addr,port)
236#define HttpConnection_getSockName(o, addr,port)\
237 SoDispCon_getSockName((SoDispCon*)o, addr,port)
239#define HttpConnection_addr2String(o, addr, buf, len)\
240 SoDispCon_addr2String((SoDispCon*)o, addr, buf, len)
242#define HttpConnection_cmpAddr(o, addr2)\
243 SoDispCon_cmpAddr((SoDispCon*)o, addr2)
245#define HttpConnection_recEvActive(o)\
246 SoDispCon_recEvActive((SoDispCon*)o)
248#define HttpConnection_sendEvActive(o)\
249 SoDispCon_sendEvActive((SoDispCon*)o)
252#define HttpConnection_hasMoreData(o)\
253 (SoDispCon_hasMoreData((SoDispCon*)o) || (o)->pushBackData)
255#define HttpConnection_dispatcherHasCon(o)\
256 SoDispCon_dispatcherHasCon((SoDispCon*)o)
258#define HttpConnection_setDispSendEvent(o, dispSendEvFp)\
259 SoDispCon_setDispSendEvent((SoDispCon*)o, dispSendEvFp)
BA_API int HttpConnection_blockRead(HttpConnection *con, void *data, int len)
Read buffered bytes or wait for socket data.
BA_API int HttpConnection_pushBack(HttpConnection *o, const void *d, int s)
Prepend copied bytes to the input returned by subsequent reads.
BA_API void HttpConnection_setState(HttpConnection *o, HttpConnection_State state)
Change lifecycle state, performing the associated cleanup.
#define HttpConnection_setKeepAlive(o)
Enable persistent reuse after a completed HTTP request.
Definition: HttpConnection.h:115
BA_API int HttpConnection_readData(HttpConnection *con, void *data, int len)
Read pending pushback bytes first, otherwise perform an event-oriented read.
BA_API int HttpConnection_moveCon(HttpConnection *o, HttpConnection *newCon)
Move the socket, transport state and pending input to another object.
BA_API void HttpConnection_constructor(HttpConnection *o, struct HttpServer *server, struct SoDisp *dispatcher, SoDispCon_DispRecEv e)
Initialize connection storage without opening a socket.
HttpConnection HttpConnection
Contains information about the physical socket connection.
#define HttpConnection_clearKeepAlive(o)
Disable persistent reuse without immediately closing the socket.
Definition: HttpConnection.h:118
BA_API void HttpConnection_destructor(HttpConnection *o)
Release pushback storage, unregister events, and close the connection.
HttpConnection_State
Server connection lifecycle states.
Definition: HttpConnection.h:60
void(* SoDispCon_DispRecEv)(struct SoDispCon *con)
Dispatcher receive notification, invoked with its mutex held.
Definition: SoDispCon.h:108
struct HttpServer * getServer()
Definition: HttpServer.h:3745
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
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
void clearKeepAlive()
Disable persistent connection reuse after the request completes.
Definition: HttpConnection.h:265
HttpConnection()
Uninitialized storage; use HttpConnection_constructor before use.
Definition: HttpConnection.h:84
void setKeepAlive()
Enable persistent connection reuse after a completed HTTP request.
Definition: HttpConnection.h:262
The Web Server.
Definition: HttpServer.h:3393
Contains information about the physical socket connection.
Definition: SoDispCon.h:120
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:91