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

Public Member Functions | |
| SoDispCon () | |
| Uninitialized storage; call SoDispCon_constructor before use. More... | |
| int | connect (const char *host, U16 port, const void *bindIntfName=0, U16 bindPort=0, U32 timeout=1500, BaBool dgram=false, BaBool ipv6=false, char **errinfo=0) |
| Connect an initialized, empty connection to a remote endpoint. More... | |
| bool | isSecure () |
| Deprecated: Use getSharkSslCon(NULL). More... | |
| bool | getSharkSslCon (SharkSslCon **sc) |
| Inspect a connected transport's TLS implementation. More... | |
| bool | isValid () |
| bool | isIP6 () |
| int | getPeerName (HttpSockaddr *addr, U16 *port=0) |
| Read the remote peer endpoint. More... | |
| int | getSockName (HttpSockaddr *addr, U16 *port=0) |
| Read the local socket endpoint. More... | |
| char * | addr2String (HttpSockaddr *addr, char *buf, int len) |
| Format a numeric address without a port number. More... | |
| bool | cmpAddr (HttpSockaddr *addr2) |
| Compare an address with the current peer address, ignoring port numbers. More... | |
| void | setTCPNoDelay (bool enable) |
| Disable the TCP delay. More... | |
| struct SoDisp * | getDispatcher () |
| bool | hasMoreData () |
| bool | dispatcherHasCon () |
| bool | recEvActive () |
| bool | sendEvActive () |
| void | setDispSendEvent (SoDispCon_DispSendEv ev) |
| Install a send-ready callback before enabling send events. More... | |
| void | setDispRecEvent (SoDispCon_DispRecEv ev) |
| Install a receive callback before enabling receive events. More... | |
| int | readData (void *data, int len, bool relmutex=false) |
| Read through the installed transport using its recorded readiness. More... | |
| int | setNonblocking () |
| Select nonblocking socket mode. More... | |
| int | setBlocking () |
| Select blocking socket mode. More... | |
| int | sendData (const void *data, int len) |
| Send an entire buffer through the installed transport. More... | |
| int | asyncSend (int len) |
| Begin or advance a send from the transport's asynchronous buffer. More... | |
| int | sendChunkData (const void *data, int len) |
| Send one HTTP chunk, including its hexadecimal size and CRLF delimiters. More... | |
| int | asyncReady () |
| Advance pending output and inspect completion. More... | |
| void * | allocAsynchBuf (int *size) |
| Obtain transport-owned writable storage for asynchronous sending. More... | |
| SoDispCon::SoDispCon | ( | ) |
Uninitialized storage; call SoDispCon_constructor before use.
| char * SoDispCon::addr2String | ( | HttpSockaddr * | addr, |
| char * | buf, | ||
| int | 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. |
| void * SoDispCon::allocAsynchBuf | ( | int * | size | ) |
Obtain transport-owned writable storage for asynchronous sending.
| [in,out] | size | Required positive requested capacity in bytes; receives the actual capacity, which may differ. Always use the returned capacity. |
| int SoDispCon::asyncReady | ( | ) |
Advance pending output and inspect completion.
| int SoDispCon::asyncSend | ( | int | 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. |
| bool SoDispCon::cmpAddr | ( | HttpSockaddr * | addr2 | ) |
Compare an address with the current peer address, ignoring port numbers.
| [in] | addr2 | Required address to compare; IPv4-mapped IPv6 is recognized. |
| int SoDispCon::connect | ( | const char * | host, |
| U16 | port, | ||
| const void * | bindIntfName = 0, |
||
| U16 | bindPort = 0, |
||
| U32 | timeout = 1500, |
||
| BaBool | dgram = false, |
||
| BaBool | ipv6 = false, |
||
| char ** | errinfo = 0 |
||
| ) |
Connect an initialized, empty connection to a remote endpoint.
| [in] | host | Required NUL-terminated hostname or numeric IP address. |
| [in] | port | Remote TCP/UDP port in host byte order, 1..65535. |
| [in] | bindIntfName | Optional borrowed platform local interface/address used during the call; NULL selects the default. |
| [in] | bindPort | Local port in host byte order; zero lets the OS choose. |
| [in] | timeout | Positive connect timeout in milliseconds, default 1500. The legacy resolver path ignores this value; USE_ADDRINFO applies it to individual address attempts, not the entire DNS-and-connect operation. |
| [in] | dgram | TRUE selects UDP, FALSE TCP (default). |
| [in] | ipv6 | TRUE requests IPv6, FALSE IPv4 (default); resolution depends on the selected network port. |
| [out] | errinfo | Optional output for borrowed platform resolver text; initialized to NULL. Do not free it or rely on text as a stable error code. |
| bool SoDispCon::dispatcherHasCon | ( | ) |
| struct SoDisp * SoDispCon::getDispatcher | ( | ) |
| int SoDispCon::getPeerName | ( | HttpSockaddr * | addr, |
| U16 * | port = 0 |
||
| ) |
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. |
| bool SoDispCon::getSharkSslCon | ( | SharkSslCon ** | sc | ) |
Inspect a connected transport's TLS implementation.
| [out] | sc | Optional output for a borrowed SharkSslCon pointer. Use it only when the call reports a SharkSSL connection; no ownership is transferred. NULL requests a secure-transport test, which can also succeed for OpenSSL. |
| int SoDispCon::getSockName | ( | HttpSockaddr * | addr, |
| U16 * | port = 0 |
||
| ) |
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. |
| bool SoDispCon::hasMoreData | ( | ) |
| bool SoDispCon::isIP6 | ( | ) |
| bool SoDispCon::isSecure | ( | ) |
Deprecated: Use getSharkSslCon(NULL).
| bool SoDispCon::isValid | ( | ) |
| int SoDispCon::readData | ( | void * | data, |
| int | len, | ||
| bool | relmutex = false |
||
| ) |
Read through the installed transport using its recorded readiness.
| [out] | data | Required writable buffer; returned bytes are not NUL-terminated. |
| [in] | len | Positive capacity in bytes. |
| [in] | relmutex | True allows the transport to release the owned dispatcher mutex while waiting, then reacquire it; false (default) keeps it held. |
| bool SoDispCon::recEvActive | ( | ) |
| int SoDispCon::sendChunkData | ( | const void * | data, |
| int | 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. |
| int SoDispCon::sendData | ( | const void * | data, |
| int | len | ||
| ) |
Send an entire buffer through the installed transport.
| [in] | data | Borrowed source containing len readable bytes. |
| [in] | len | Nonnegative byte count. |
| bool SoDispCon::sendEvActive | ( | ) |
| int SoDispCon::setBlocking | ( | ) |
Select blocking socket mode.
| void SoDispCon::setDispRecEvent | ( | SoDispCon_DispRecEv | ev | ) |
Install a receive callback before enabling receive events.
| [in] | ev | Required callback while receive events are active; borrowed. |
| void SoDispCon::setDispSendEvent | ( | SoDispCon_DispSendEv | ev | ) |
Install a send-ready callback before enabling send events.
| [in] | ev | Required callback while send events are active; borrowed. |
| int SoDispCon::setNonblocking | ( | ) |
Select nonblocking socket mode.
| void SoDispCon::setTCPNoDelay | ( | bool | 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. |