|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
#include <SoDispCon.h>

Go to the source code of this file.
Classes | |
| struct | HttpConnection |
| Contains information about the physical socket connection. More... | |
Macros | |
| #define | HttpConnection_setKeepAlive(o) (o)->keepAlive=TRUE |
| Enable persistent reuse after a completed HTTP request. More... | |
| #define | HttpConnection_clearKeepAlive(o) (o)->keepAlive=FALSE |
| Disable persistent reuse without immediately closing the socket. More... | |
| #define | HttpConnection_keepAlive(o) (o)->keepAlive |
| #define | HttpConnection_getState(o) (o)->state |
| #define | HttpConnection_getServer(o) (o)->server |
| #define | HttpConnection_getDispatcher(o) SoDispCon_getDispatcher((SoDispCon*)o) |
| #define | HttpConnection_isSecure(o) SoDispCon_isSecure((SoDispCon*)o) |
| Test a successfully installed transport for TLS. More... | |
| #define | HttpConnection_isValid(o) SoDispCon_isValid((SoDispCon*)o) |
| #define | HttpConnection_sendData(o, data, len) SoDispCon_sendData((SoDispCon*)o, data, len) |
| Send an entire buffer through the installed transport. More... | |
| #define | HttpConnection_sendDataNT(o, data, len) SoDispCon_sendDataNT((SoDispCon*)o, data, len) |
| Send all bytes with the sendData contract, but omit body tracing. More... | |
| #define | HttpConnection_sendChunkData(o, data, len) SoDispCon_sendChunkData((SoDispCon*)o,data, len) |
| Send one HTTP chunk, including its hexadecimal size and CRLF delimiters. More... | |
| #define | HttpConnection_allocAsynchBuf(o, sizePtr) SoDispCon_allocAsynchBuf((SoDispCon*)o, sizePtr) |
| Obtain transport-owned asynchronous send storage. More... | |
| #define | HttpConnection_asyncSend(o, len) SoDispCon_asyncSend((SoDispCon*)o,len) |
| Begin or advance a send from the transport's asynchronous buffer. More... | |
| #define | HttpConnection_asyncReady(o) SoDispCon_asyncReady((SoDispCon*)o) |
| Advance any pending asynchronous send without modifying its payload. More... | |
| #define | HttpConnection_setNonblocking(o) SoDispCon_setNonblocking((SoDispCon*)o) |
| Select nonblocking socket mode. More... | |
| #define | HttpConnection_setBlocking(o) SoDispCon_setBlocking((SoDispCon*)o) |
| Select blocking socket mode. More... | |
| #define | HttpConnection_setTCPNoDelay(o, enable) SoDispCon_setTCPNoDelay((SoDispCon*)o, enable) |
| Disable the TCP delay. More... | |
| #define | HttpConnection_getPeerName(o, addr, port) SoDispCon_getPeerName((SoDispCon*)o, addr,port) |
| Read the remote peer endpoint. More... | |
| #define | HttpConnection_getSockName(o, addr, port) SoDispCon_getSockName((SoDispCon*)o, addr,port) |
| Read the local socket endpoint. More... | |
| #define | HttpConnection_addr2String(o, addr, buf, len) SoDispCon_addr2String((SoDispCon*)o, addr, buf, len) |
| Format a numeric address without a port number. More... | |
| #define | HttpConnection_cmpAddr(o, addr2) SoDispCon_cmpAddr((SoDispCon*)o, addr2) |
| Compare an address with the current peer address, ignoring port numbers. More... | |
| #define | HttpConnection_recEvActive(o) SoDispCon_recEvActive((SoDispCon*)o) |
| #define | HttpConnection_sendEvActive(o) SoDispCon_sendEvActive((SoDispCon*)o) |
| #define | HttpConnection_hasMoreData(o) (SoDispCon_hasMoreData((SoDispCon*)o) || (o)->pushBackData) |
| #define | HttpConnection_dispatcherHasCon(o) SoDispCon_dispatcherHasCon((SoDispCon*)o) |
| #define | HttpConnection_setDispSendEvent(o, dispSendEvFp) SoDispCon_setDispSendEvent((SoDispCon*)o, dispSendEvFp) |
| Install the send-ready callback before enabling events. More... | |
Typedefs | |
| typedef HttpConnection | HttpConnection |
| Contains information about the physical socket connection. More... | |
Enumerations | |
| enum | HttpConnection_State |
| Server connection lifecycle states. More... | |
Functions | |
| BA_API void | HttpConnection_constructor (HttpConnection *o, struct HttpServer *server, struct SoDisp *dispatcher, SoDispCon_DispRecEv e) |
| Initialize connection storage without opening a socket. More... | |
| BA_API void | HttpConnection_setState (HttpConnection *o, HttpConnection_State state) |
| Change lifecycle state, performing the associated cleanup. More... | |
| BA_API int | HttpConnection_moveCon (HttpConnection *o, HttpConnection *newCon) |
| Move the socket, transport state and pending input to another object. More... | |
| BA_API void | HttpConnection_destructor (HttpConnection *o) |
| Release pushback storage, unregister events, and close the connection. More... | |
| BA_API int | HttpConnection_pushBack (HttpConnection *o, const void *d, int s) |
| Prepend copied bytes to the input returned by subsequent reads. More... | |
| BA_API int | HttpConnection_readData (HttpConnection *con, void *data, int len) |
| Read pending pushback bytes first, otherwise perform an event-oriented read. More... | |
| BA_API int | HttpConnection_blockRead (HttpConnection *con, void *data, int len) |
| Read buffered bytes or wait for socket data. More... | |
| #define HttpConnection_addr2String | ( | o, | |
| addr, | |||
| buf, | |||
| len | |||
| ) | SoDispCon_addr2String((SoDispCon*)o, addr, buf, len) |
Format a numeric address without a port number.
| [in] | addr | Required address with the same family as this connection. |
| [out] | buf | Required writable storage for a NUL-terminated result. |
| [in] | len | Capacity in bytes including NUL; at least 16 for IPv4 or 46 for IPv6. Always provide writable storage even if capacity is rejected. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_allocAsynchBuf | ( | o, | |
| sizePtr | |||
| ) | SoDispCon_allocAsynchBuf((SoDispCon*)o, sizePtr) |
Obtain transport-owned asynchronous send storage.
| [in,out] | o | Connected object. |
| [in,out] | sizePtr | Positive requested capacity; receives actual capacity. |
| #define HttpConnection_asyncReady | ( | o | ) | SoDispCon_asyncReady((SoDispCon*)o) |
Advance any pending asynchronous send without modifying its payload.
| [in,out] | o | Connected object with an allocated asynchronous buffer. |
| #define HttpConnection_asyncSend | ( | o, | |
| len | |||
| ) | SoDispCon_asyncSend((SoDispCon*)o,len) |
Begin or advance a send from the transport's asynchronous buffer.
| [in] | len | Positive payload byte count within the capacity returned by allocAsynchBuf for a new send. Do not alter the buffer until completion; use asyncReady to continue a pending send. |
| [in,out] | o | Connected object with an allocated asynchronous buffer. |
| #define HttpConnection_clearKeepAlive | ( | o | ) | (o)->keepAlive=FALSE |
Disable persistent reuse without immediately closing the socket.
| [in,out] | o | Initialized connection. |
| #define HttpConnection_cmpAddr | ( | o, | |
| addr2 | |||
| ) | SoDispCon_cmpAddr((SoDispCon*)o, addr2) |
Compare an address with the current peer address, ignoring port numbers.
| [in] | addr2 | Required address to compare; IPv4-mapped IPv6 is recognized. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_dispatcherHasCon | ( | o | ) | SoDispCon_dispatcherHasCon((SoDispCon*)o) |
| [in] | o | Initialized connection. |
| #define HttpConnection_getDispatcher | ( | o | ) | SoDispCon_getDispatcher((SoDispCon*)o) |
| [in] | o | Initialized connection. |
| #define HttpConnection_getPeerName | ( | o, | |
| addr, | |||
| port | |||
| ) | SoDispCon_getPeerName((SoDispCon*)o, addr,port) |
Read the remote peer endpoint.
| [out] | addr | Required address output, valid only on success. |
| [out] | port | Optional port output in host byte order; NULL omits it. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_getServer | ( | o | ) | (o)->server |
| [in] | o | Initialized connection. |
| #define HttpConnection_getSockName | ( | o, | |
| addr, | |||
| port | |||
| ) | SoDispCon_getSockName((SoDispCon*)o, addr,port) |
Read the local socket endpoint.
| [out] | addr | Required address output, valid only on success. |
| [out] | port | Optional port output in host byte order; NULL omits it. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_getState | ( | o | ) | (o)->state |
| [in] | o | Initialized connection. |
| #define HttpConnection_hasMoreData | ( | o | ) | (SoDispCon_hasMoreData((SoDispCon*)o) || (o)->pushBackData) |
| [in] | o | Initialized connection. |
| #define HttpConnection_isSecure | ( | o | ) | SoDispCon_isSecure((SoDispCon*)o) |
Test a successfully installed transport for TLS.
| [in] | o | Connected object with an installed transport. |
| #define HttpConnection_isValid | ( | o | ) | SoDispCon_isValid((SoDispCon*)o) |
| [in] | o | Initialized connection. |
| #define HttpConnection_keepAlive | ( | o | ) | (o)->keepAlive |
| [in] | o | Initialized connection. |
| #define HttpConnection_recEvActive | ( | o | ) | SoDispCon_recEvActive((SoDispCon*)o) |
| [in] | o | Initialized connection. |
| #define HttpConnection_sendChunkData | ( | o, | |
| data, | |||
| len | |||
| ) | SoDispCon_sendChunkData((SoDispCon*)o,data, len) |
Send one HTTP chunk, including its hexadecimal size and CRLF delimiters.
| [in] | data | Borrowed source containing len readable bytes. |
| [in] | len | Byte count from 0 through 65535. Zero sends the final empty chunk. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_sendData | ( | o, | |
| data, | |||
| len | |||
| ) | SoDispCon_sendData((SoDispCon*)o, data, len) |
Send an entire buffer through the installed transport.
| [in] | data | Borrowed source containing len readable bytes. |
| [in] | len | Nonnegative byte count. |
| [in,out] | o | Initialized connection. |
| #define HttpConnection_sendDataNT | ( | o, | |
| data, | |||
| len | |||
| ) | SoDispCon_sendDataNT((SoDispCon*)o, data, len) |
Send all bytes with the sendData contract, but omit body tracing.
| [in,out] | o | Connected object. |
| [in] | data | Borrowed source containing len bytes. |
| [in] | len | Nonnegative byte count. |
| #define HttpConnection_sendEvActive | ( | o | ) | SoDispCon_sendEvActive((SoDispCon*)o) |
| [in] | o | Initialized connection. |
| #define HttpConnection_setBlocking | ( | o | ) | SoDispCon_setBlocking((SoDispCon*)o) |
Select blocking socket mode.
| [in,out] | o | Initialized connection. |
| #define HttpConnection_setDispSendEvent | ( | o, | |
| dispSendEvFp | |||
| ) | SoDispCon_setDispSendEvent((SoDispCon*)o, dispSendEvFp) |
Install the send-ready callback before enabling events.
| [in,out] | o | Initialized connection. |
| [in] | dispSendEvFp | Required callback while send events are active. |
| #define HttpConnection_setKeepAlive | ( | o | ) | (o)->keepAlive=TRUE |
Enable persistent reuse after a completed HTTP request.
| [in,out] | o | Initialized connection. |
| #define HttpConnection_setNonblocking | ( | o | ) | SoDispCon_setNonblocking((SoDispCon*)o) |
Select nonblocking socket mode.
| [in,out] | o | Initialized connection. |
| #define HttpConnection_setTCPNoDelay | ( | o, | |
| enable | |||
| ) | SoDispCon_setTCPNoDelay((SoDispCon*)o, enable) |
Disable the TCP delay.
What TCP normally does is queue up data so it only sends full packets out when possible. (This is called Nagle's algorithm.) Call this function if you do not want that behavior.
| [in] | enable | True disables Nagle; false enables it. No socket-option error status is returned; errors can be traced. |
| [in,out] | o | Initialized connection. |
| typedef HttpConnection HttpConnection |
Contains information about the physical socket connection.
This object is used internally by HttpServer when sending and receiving data on either an insecure or secure SSL connection.
| enum HttpConnection_State |
Server connection lifecycle states.
Use setState for transitions that must release buffered bytes or terminate a socket.
| BA_API int HttpConnection_blockRead | ( | HttpConnection * | con, |
| void * | data, | ||
| int | len | ||
| ) |
Read buffered bytes or wait for socket data.
| [in,out] | con | Initialized connection configured for blocking reads. |
| [out] | data | Writable storage of at least len bytes, not NUL-terminated. |
| [in] | len | Positive capacity in bytes. |
| BA_API void HttpConnection_constructor | ( | HttpConnection * | o, |
| struct HttpServer * | server, | ||
| struct SoDisp * | dispatcher, | ||
| SoDispCon_DispRecEv | e | ||
| ) |
Initialize connection storage without opening a socket.
| [out] | o | Caller-owned storage; initially Free and not keep-alive. |
| [in] | server | Borrowed server, or NULL for non-HTTP use. |
| [in] | dispatcher | Borrowed dispatcher, valid throughout registered use. |
| [in] | e | Receive-event callback; required before enabling receive events. Establish or move in a socket separately before registering events. |
| BA_API void HttpConnection_destructor | ( | HttpConnection * | o | ) |
Release pushback storage, unregister events, and close the connection.
| [in,out] | o | Initialized object; its storage and borrowed server are not freed. Stop other users before destruction. |
| BA_API int HttpConnection_moveCon | ( | HttpConnection * | o, |
| HttpConnection * | newCon | ||
| ) |
Move the socket, transport state and pending input to another object.
| [in,out] | o | Live source associated with the same server as newCon. Its socket and pushback ownership are removed and its state becomes Moved. |
| [in,out] | newCon | Initialized empty destination with the appropriate dispatcher/callback setup. It must not own a socket or pending input. |
| BA_API int HttpConnection_pushBack | ( | HttpConnection * | o, |
| const void * | d, | ||
| int | s | ||
| ) |
Prepend copied bytes to the input returned by subsequent reads.
| [in,out] | o | Initialized connection. |
| [in] | d | Borrowed source containing s bytes. |
| [in] | s | Positive byte count; combined pending length must fit int. |
| BA_API int HttpConnection_readData | ( | HttpConnection * | con, |
| void * | data, | ||
| int | len | ||
| ) |
Read pending pushback bytes first, otherwise perform an event-oriented read.
| [in,out] | con | Initialized connection. |
| [out] | data | Writable storage of at least len bytes, not NUL-terminated. |
| [in] | len | Positive capacity in bytes. |
| BA_API void HttpConnection_setState | ( | HttpConnection * | o, |
| HttpConnection_State | state | ||
| ) |
Change lifecycle state, performing the associated cleanup.
| [in,out] | o | Initialized connection; serialize with its dispatcher. |
| [in] | state | A HttpConnection_State value. Free/Terminated release pushback storage and shut down the socket. HardClose performs an abortive close and stores Terminated. Other states are intended for server lifecycle handling; setting Running alone does not create a usable socket. |