Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
SoDispCon.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: SoDispCon.h 6746 2026-11-04 17:20:37Z 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 __SoDispCon_h
42#define __SoDispCon_h
43
44#include <ThreadLib.h>
45#include <SoDisp.h>
46
47struct SharkSslCon;
48
49/*===========================================================================
50 *
51 * SoDispCon
52 *---------------------------------------------------------------------------
53 */
54
55
56
57/* SoDispCon_ExType -> SoDispCon Execute Type.
58 The callback function SoDispCon_Execute in SoDispCon is
59 like having 6 callback functions. SoDispCon_ExType specifies the
60 current callback type.
61 This construction preserves memory as we have 1 callback function pointer
62 instead of 5.
63
64 ExStateRead: read socket data
65 ExStateWrite: write socket data
66 GetSharkSslCon: return the internal SharkSsslCon object
67 ExStateClose: Close connection.
68 ExStateMoveCon: Moving the active connection to another SoDispCon obj.
69 ExStateDispEv: The socket dispatcher signals that data is ready.
70*/
71typedef enum {
72 SoDispCon_ExTypeRead=1,
73 SoDispCon_ExTypeWrite,
74 SoDispCon_GetSharkSslCon,
75 SoDispCon_ExTypeClose,
76 SoDispCon_ExTypeMoveCon,
77 SoDispCon_ExTypeAllocAsynchBuf,
78 SoDispCon_ExTypeAsyncReady,
79 SoDispCon_ExTypeIdle
80} SoDispCon_ExType;
81
82
83/*
84The arguments to the SoDispCon_Execute callback function:
85 SoDispCon_ExTypeRead:
86 d1 pointer to data, d2 length of data, ret #of bytes read, < 0 if failed
87 or 0 if no data.
88 SoDispCon_ExTypeWrite:
89 d1 pointer to data, d2 length, ret < 0 if failed or #of bytes written.
90 SoDispCon_GetSharkSslCon:
91 d1 is pointer pointer to SharkSslCon, d2 not used, ret TRUE of FALSE.
92 SoDispCon_ExTypeClose:
93 d1 not used, d2 not used, ret is void.
94 SoDispCon_ExTypeMoveCon:
95 d1 is a pointer to a SoDispCon object.
96*/
97
98struct SoDispCon;
99struct SharkSsl;
100
101typedef int (*SoDispCon_Execute)(
102 struct SoDispCon* con, ThreadMutex* m,SoDispCon_ExType s,void* d1,int d2);
103
104
108typedef void (*SoDispCon_DispRecEv)(struct SoDispCon* con);
112typedef void (*SoDispCon_DispSendEv)(struct SoDispCon* con);
113
114
119typedef struct SoDispCon
120{
121#ifdef __cplusplus
122 void *operator new(size_t, void *place) { return place; }
123 void operator delete(void*, void *) { }
126
127
148 int connect(const char* host,
149 U16 port,
150 const void* bindIntfName=0,
151 U16 bindPort=0,
152 U32 timeout=1500,
153 BaBool dgram=false, BaBool ipv6=false,
154 char** errinfo=0);
155
159 bool isSecure();
160
169 bool getSharkSslCon(SharkSslCon** sc);
170
171
175 bool isValid();
176
178 bool isIP6();
179
185 int getPeerName(HttpSockaddr* addr,U16* port=0);
186
192 int getSockName(HttpSockaddr* addr,U16* port=0);
193
202 char* addr2String(HttpSockaddr* addr, char* buf, int len);
203
208 bool cmpAddr(HttpSockaddr* addr2);
209
217 void setTCPNoDelay(bool enable);
218
221 struct SoDisp* getDispatcher();
222
225 bool hasMoreData();
226
229 bool dispatcherHasCon();
230
233 bool recEvActive();
234
237 bool sendEvActive();
238
252 int readData(void* data, int len, bool relmutex=false);
256 int setNonblocking();
259 int setBlocking();
267 int sendData(const void* data, int len);
275 int asyncSend(int len);
281 int sendChunkData(const void* data, int len);
286 int asyncReady();
293 void* allocAsynchBuf(int* size);
294#endif
295 CONNECTION_DISPATCHER_OBJ /*Owned and handled by the SoDisp obj.*/
296
297 /* Owned and handled by SSL. */
298 void* sslData;
299 SoDispCon_Execute exec;
300
301 HttpSocket httpSocket;
302 SoDispCon_DispRecEv dispRecEv;
303 SoDispCon_DispSendEv dispSendEv;
304 struct SoDisp* dispatcher;
305 BaBool* sendTermPtr;
306 BaBool* recTermPtr;
307 U16 rtmo; /* Read timeout in 50 millisec intervals */
308 U8 dataBits;
309 U8 isSending;
311
312#define SoDispCon_socketHasNonBlockDataBitMask 0x01
313#define SoDispCon_hasMoreDataDataBitMask 0x02
314
315#define SoDispCon_dispatcherHasConDataBitMask 0x04
316#define SoDispCon_recEvActiveDataBitMask 0x08
317#define SoDispCon_sendEvActiveDataBitMask 0x10
318#define SoDispCon_isNonBlockingDataBitMask 0x20
319#define SoDispCon_IP6DataBitMask 0x40
320#define SoDispCon_DGramBitMask 0x80
321
322#define SoDispCon_setDispHasRecData(o)\
323 ((o)->dataBits |= \
324 (SoDispCon_hasMoreDataDataBitMask | SoDispCon_socketHasNonBlockDataBitMask))
325#define SoDispCon_setDispatcherHasCon(o)\
326 ((o)->dataBits |= SoDispCon_dispatcherHasConDataBitMask)
327#define SoDispCon_setRecEvActive(o)\
328 ((o)->dataBits |= SoDispCon_recEvActiveDataBitMask)
329#define SoDispCon_setSendEvActive(o)\
330 ((o)->dataBits |= SoDispCon_sendEvActiveDataBitMask)
331#define SoDispCon_setIP6(o)\
332 ((o)->dataBits |= SoDispCon_IP6DataBitMask)
333
334#define SoDispCon_clearSocketHasNonBlockData(o)\
335 ((o)->dataBits &= ~(U8)SoDispCon_socketHasNonBlockDataBitMask)
336#define SoDispCon_clearHasMoreData(o)\
337 ((o)->dataBits &= ~(U8)SoDispCon_hasMoreDataDataBitMask)
338#define SoDispCon_clearDispatcherHasCon(o)\
339 ((o)->dataBits &= ~(U8)SoDispCon_dispatcherHasConDataBitMask)
340#define SoDispCon_setRecEvInactive(o)\
341 ((o)->dataBits &= ~(U8)SoDispCon_recEvActiveDataBitMask)
342#define SoDispCon_setSendEvInactive(o)\
343 ((o)->dataBits &= ~(U8)SoDispCon_sendEvActiveDataBitMask)
344#define SoDispCon_clearIP6(o)\
345 ((o)->dataBits &= ~(U8)SoDispCon_IP6DataBitMask)
346
349#define SoDispCon_socketHasNonBlockData(o)\
350 (((o)->dataBits & SoDispCon_socketHasNonBlockDataBitMask) ? TRUE : FALSE)
353#define SoDispCon_hasMoreData(o)\
354 (((o)->dataBits & SoDispCon_hasMoreDataDataBitMask) ? TRUE : FALSE)
357#define SoDispCon_dispatcherHasCon(o)\
358 (((o)->dataBits & SoDispCon_dispatcherHasConDataBitMask)?TRUE:FALSE)
361#define SoDispCon_recEvActive(o)\
362 (((o)->dataBits & SoDispCon_recEvActiveDataBitMask)?TRUE:FALSE)
365#define SoDispCon_sendEvActive(o)\
366 (((o)->dataBits & SoDispCon_sendEvActiveDataBitMask)?TRUE:FALSE)
369#define SoDispCon_isNonBlocking(o)\
370 (((o)->dataBits & SoDispCon_isNonBlockingDataBitMask) ? TRUE : FALSE)
371#ifndef SoDispCon_isIP6
374#define SoDispCon_isIP6(o)\
375 (((o)->dataBits & SoDispCon_IP6DataBitMask) ? TRUE : FALSE)
376#endif
377#ifndef SoDispCon_isDGRAM
380#define SoDispCon_isDGRAM(o) \
381 (((o)->dataBits & SoDispCon_DGramBitMask) ? TRUE : FALSE)
382#endif
387#define SoDispCon_isSecure(o) \
388 ((o)->exec(o,0,SoDispCon_GetSharkSslCon,0,0) > 0)
395#define SoDispCon_getSharkSslCon(o,sharkSslConPtrPtr) \
396 (o)->exec(o,0,SoDispCon_GetSharkSslCon,sharkSslConPtrPtr,0)
399#define SoDispCon_isValid(o) HttpSocket_isValid(&(o)->httpSocket)
400#define SoDispCon_invalidate(o) HttpSocket_invalidate(&(o)->httpSocket)
403#define SoDispCon_getDispatcher(o) (o)->dispatcher
404#define SoDispCon_dispRecEvent(o) (o)->dispRecEv(o)
405#define SoDispCon_dispSendEvent(o) (o)->dispSendEv(o)
409#define SoDispCon_setDispSendEvent(o, dispSendEvFp) \
410 (o)->dispSendEv=dispSendEvFp
411
415#define SoDispCon_setDispRecEvent(o, dispRecEvFp) \
416 (o)->dispRecEv=dispRecEvFp
417
420#define SoDispCon_readData(o, data, len, relmutex) \
421 (o)->exec(o, (relmutex) ? SoDisp_getMutex((o)->dispatcher) : 0, \
422 SoDispCon_ExTypeRead,data,len)
423
424/* The HttpServCon (and classes inherited from HttpServCon) calls the
425 * newConnectionIsReady function after a successful call to
426 * HttpSocket_accept and after the new connection is installed in the
427 * web-server. This is a platform dependent function and is, by default,
428 * disabled as few platforms need this.
429 */
430#ifndef SoDispCon_newConnectionIsReady
431#define SoDispCon_newConnectionIsReady(con)
432#endif
433
442 SoDispCon* o, U8* alertLevel, U8* alertDescription);
443
444#ifdef __cplusplus
445extern "C" {
446#endif
453 SoDispCon* o, struct SoDisp* dispatcher, SoDispCon_DispRecEv e);
454BA_API int SoDispCon_upgrade(SoDispCon* o, struct SharkSsl* ssl,
455 const char* alpn, const char* host, int port);
463BA_API int SoDispCon_blockRead(SoDispCon* o,void* data,int len);
466BA_API int SoDispCon_sendData(SoDispCon* o, const void* data, int len);
473BA_API int SoDispCon_sendDataNT(SoDispCon* o, const void* data, int len);
479BA_API int SoDispCon_sendDataX(SoDispCon* o, const void* data, int len);
482BA_API int SoDispCon_sendChunkData(SoDispCon* o,const void* data, int len);
491#define SoDispCon_asyncReady(o)\
492 (o)->exec(o,0,SoDispCon_ExTypeAsyncReady,0,0)
495#define SoDispCon_asyncSend(o, len) \
496 (o)->exec(o,0,SoDispCon_ExTypeAsyncReady,0,len)
497struct AllocatorIntf;
498
499#ifndef __DOXYGEN__
500typedef struct
501{
502 void* retVal;
503 int size;
504} AllocAsynchBufArgs;
505#endif
506
509BA_API void* SoDispCon_allocAsynchBuf(SoDispCon* o, int* size);
510BA_API void SoDispCon_releaseAsyncBuf(SoDispCon* con);
511BA_API void SoDispCon_internalAllocAsynchBuf(
512 SoDispCon* con, AllocAsynchBufArgs* args);
519BA_API int SoDispCon_peek(SoDispCon* o);
526BA_API int SoDispCon_moveCon(SoDispCon* o, SoDispCon* newCon);
530#define SoDispCon_destructor(o) SoDispCon_zzCloseCon(o,1)
534#define SoDispCon_hardClose(o) SoDispCon_zzCloseCon(o, 2)
538#define SoDispCon_shutdown(o) SoDispCon_zzCloseCon(o, 1)
542#define SoDispCon_closeCon(o) SoDispCon_zzCloseCon(o, 0)
549#define SoDispCon_setReadTmo(o,timeout) (o)->rtmo = (U16)((timeout)/50)
550BA_API void SoDispCon_zzCloseCon(SoDispCon* o, int shutdown);
553BA_API void SoDispCon_setTCPNoDelay(SoDispCon* o, int enable);
556BA_API int SoDispCon_getPeerName(SoDispCon* o,HttpSockaddr* addr,U16* port);
559BA_API int SoDispCon_getSockName(SoDispCon* o, HttpSockaddr* addr, U16* port);
563 SoDispCon* o, HttpSockaddr* addr, char* buf, int len);
566BA_API BaBool SoDispCon_cmpAddr(SoDispCon* o, HttpSockaddr* addr2);
567BA_API void SoDispCon_printSockErr(
568 SoDispCon* o,const char* type,HttpSocket* s,int status);
571#define SoDispCon_getId(o) HttpSocket_getId(&(o)->httpSocket)
572/* Internal */
573#ifndef SoDispCon_platReadData
574int SoDispCon_platReadData(SoDispCon* o, ThreadMutex* m, BaBool* isTerminated,
575 void* data, int len);
576#endif
577
578#if BA_ENABLE_UDP
579/* Stack-owned read transaction; no per-connection storage. */
580typedef struct
581{
582 BaBool terminated;
583#ifndef SoDispCon_platPeekDgram
584 SoDispCon_Execute exec;
585 HttpSocket socket;
586#endif
587} SoDispCon_DgramRead;
588int SoDispCon_beginDgramRead(SoDispCon* o, SoDispCon_DgramRead* read);
589void SoDispCon_endDgramRead(SoDispCon* o, SoDispCon_DgramRead* read);
590
591/* Internal packet probe. The caller holds the dispatcher mutex and registers
592 isTerminated in recTermPtr through probe, allocation and consumption.
593 m may release that mutex while waiting; every return reacquires it.
594 data holds len writable bytes. No packet is consumed. Return byte length
595 + 1 (including 1 for empty), zero for would-block, E_TOO_MUCH_DATA when
596 length is unknown and the buffer is too small, or a negative error.
597 The default wait retains the native handle through bounded readiness waits;
598 native peeks run nonblocking with the mutex held. */
599#ifndef SoDispCon_platPeekDgram
600int SoDispCon_platPeekDgram(SoDispCon* o, ThreadMutex* m,
601 BaBool* isTerminated, void* data, int len);
602#endif
603#ifndef SoDispCon_recvfrom
604int SoDispCon_recvfrom(SoDispCon* o, void* data, int len,
605 HttpSockaddr* addr, U16* port);
606#endif
607#endif
608
611BA_API int
613 const char* host,
614 U16 port,
615 const void* bindIntfName,
616 U16 bindPort,
617 U32 timeout,
618 BaBool dgram, BaBool ipv6,
619 char** errinfo);
620#if BA_HAVE_SOCKET_WRITE_EVENTS
638BA_API int
639SoDispCon_asyncConnect(SoDispCon* o,
640 const char* host,
641 U16 port,
642 const void* bindIntfName,
643 BaBool ipv6,
644 char** errinfo);
650BA_API int SoDispCon_asyncConnectNext(SoDispCon* o);
651#if BA_USE_GETADDRINFO
656BA_API void SoDispCon_asyncConnectRelease(SoDispCon* o);
657#else
658#define SoDispCon_asyncConnectRelease(o)
659#endif
660
661#endif
662#ifdef __cplusplus
663}
664inline int SoDispCon::readData(void* data, int len, bool relmutex) {
665 return SoDispCon_readData(this, data, len, relmutex ? TRUE : FALSE); }
667 return SoDispCon_setNonblocking(this); }
669 return SoDispCon_setBlocking(this); }
670inline bool SoDispCon::isSecure() {
671 return SoDispCon_isSecure(this) ? true : false; }
672inline bool SoDispCon::getSharkSslCon(SharkSslCon** sc) {
673 return SoDispCon_getSharkSslCon(this,sc) ? true : false; }
674inline bool SoDispCon::isIP6() {
675 return SoDispCon_isIP6(this) ? true : false; }
676inline bool SoDispCon::isValid() {
677 return SoDispCon_isValid(this) ? true : false; }
678inline int SoDispCon::getPeerName(HttpSockaddr* addr,U16* port){
679 return SoDispCon_getPeerName(this,addr,port); }
680inline int SoDispCon::getSockName(HttpSockaddr* addr,U16* port){
681 return SoDispCon_getSockName(this, addr,port); }
682inline char* SoDispCon::addr2String(HttpSockaddr* addr,char* buf,int len){
683 return SoDispCon_addr2String(this, addr, buf, len); }
684inline bool SoDispCon::cmpAddr(HttpSockaddr* addr2) {
685 return SoDispCon_cmpAddr(this, addr2) ? true : false;
686}
687inline void SoDispCon::setTCPNoDelay(bool enable) {
688 SoDispCon_setTCPNoDelay(this, enable); }
690 return SoDispCon_hasMoreData(this) ? true : false;
691}
693 return SoDispCon_dispatcherHasCon(this) ? true : false; }
695 return SoDispCon_recEvActive(this) ? true : false; }
697 return SoDispCon_sendEvActive(this) ? true : false; }
699 return SoDispCon_getDispatcher(this); }
701 SoDispCon_setDispSendEvent(this, ev); }
703 SoDispCon_setDispRecEvent(this, ev); }
704inline int SoDispCon::sendData(const void* data, int len) {
705 return SoDispCon_sendData(this,data, len); }
706inline int SoDispCon::asyncSend(int len) {
707 return SoDispCon_asyncSend(this, len); }
708inline int SoDispCon::sendChunkData(const void* data, int len) {
709 return SoDispCon_sendChunkData(this, data, len); }
711 return SoDispCon_asyncReadyF(this) ? true : false; }
712inline void* SoDispCon::allocAsynchBuf(int* size){
713 return SoDispCon_allocAsynchBuf(this, size); }
714inline int SoDispCon::connect(const char* host,
715 U16 port,
716 const void* bindIntfName,
717 U16 bindPort,
718 U32 timeout,
719 BaBool dgram, BaBool ipv6,
720 char** errinfo) {
721 return SoDispCon_connect(this,host,port, bindIntfName,bindPort,timeout,
722 dgram?TRUE:FALSE, ipv6?TRUE:FALSE,errinfo);
723}
724#endif
725
726
727#endif
BA_API int SoDispCon_setBlocking(SoDispCon *o)
Select blocking socket mode.
#define SoDispCon_setDispRecEvent(o, dispRecEvFp)
Install the receive callback before enabling events.
Definition: SoDispCon.h:415
#define SoDispCon_asyncSend(o, len)
Begin or advance a send from the transport's asynchronous buffer.
Definition: SoDispCon.h:495
BA_API int SoDispCon_sendDataX(SoDispCon *o, const void *data, int len)
Send all bytes without releasing the dispatcher mutex.
BA_API int SoDispCon_blockRead(SoDispCon *o, void *data, int len)
Wait for input using a blocking connection.
#define SoDispCon_setDispSendEvent(o, dispSendEvFp)
Install the send-ready callback before enabling events.
Definition: SoDispCon.h:409
BA_API void SoDispCon_setTCPNoDelay(SoDispCon *o, int enable)
Disable the TCP delay.
#define SoDispCon_readData(o, data, len, relmutex)
Read through the installed transport using its recorded readiness.
Definition: SoDispCon.h:420
BA_API int SoDispCon_sendDataNT(SoDispCon *o, const void *data, int len)
Send all bytes with the sendData contract, but omit body tracing.
BA_API int SoDispCon_sendData(SoDispCon *o, const void *data, int len)
Send an entire buffer through the installed transport.
#define SoDispCon_recEvActive(o)
Definition: SoDispCon.h:361
BA_API int SoDispCon_connect(SoDispCon *o, const char *host, U16 port, const void *bindIntfName, U16 bindPort, U32 timeout, BaBool dgram, BaBool ipv6, char **errinfo)
Connect an initialized, empty connection to a remote endpoint.
BA_API BaBool SoDispCon_cmpAddr(SoDispCon *o, HttpSockaddr *addr2)
Compare an address with the current peer address, ignoring port numbers.
#define SoDispCon_isIP6(o)
Definition: SoDispCon.h:374
void(* SoDispCon_DispSendEv)(struct SoDispCon *con)
Dispatcher send-ready notification, invoked with its mutex held.
Definition: SoDispCon.h:112
void(* SoDispCon_DispRecEv)(struct SoDispCon *con)
Dispatcher receive notification, invoked with its mutex held.
Definition: SoDispCon.h:108
BA_API int SoDispCon_moveCon(SoDispCon *o, SoDispCon *newCon)
Move socket and transport ownership without copying object storage.
BA_API void * SoDispCon_allocAsynchBuf(SoDispCon *o, int *size)
Obtain transport-owned writable storage for asynchronous sending.
BA_API void SoDispCon_constructor(SoDispCon *o, struct SoDisp *dispatcher, SoDispCon_DispRecEv e)
Initialize an empty connection without opening a socket.
#define SoDispCon_hasMoreData(o)
Definition: SoDispCon.h:353
#define SoDispCon_dispatcherHasCon(o)
Definition: SoDispCon.h:357
#define SoDispCon_isSecure(o)
Test a successfully installed transport for TLS.
Definition: SoDispCon.h:387
#define SoDispCon_isValid(o)
Definition: SoDispCon.h:399
BA_API int SoDispCon_getSockName(SoDispCon *o, HttpSockaddr *addr, U16 *port)
Read the local socket endpoint.
BA_API char * SoDispCon_addr2String(SoDispCon *o, HttpSockaddr *addr, char *buf, int len)
Format a numeric address without a port number.
#define SoDispCon_sendEvActive(o)
Definition: SoDispCon.h:365
#define SoDispCon_getSharkSslCon(o, sharkSslConPtrPtr)
Inspect a successfully installed transport.
Definition: SoDispCon.h:395
BA_API int SoDispCon_sendChunkData(SoDispCon *o, const void *data, int len)
Send one HTTP chunk, including its hexadecimal size and CRLF delimiters.
BA_API int SoDispCon_getSharkAlert(SoDispCon *o, U8 *alertLevel, U8 *alertDescription)
Read the current SharkSSL alert fields.
struct SoDispCon SoDispCon
Contains information about the physical socket connection.
BA_API int SoDispCon_asyncReadyF(SoDispCon *o)
Advance asynchronous sending; same status contract as SoDispCon_asyncReady.
BA_API int SoDispCon_getPeerName(SoDispCon *o, HttpSockaddr *addr, U16 *port)
Read the remote peer endpoint.
#define SoDispCon_getDispatcher(o)
Definition: SoDispCon.h:403
BA_API int SoDispCon_setNonblocking(SoDispCon *o)
Select nonblocking socket mode.
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:94
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:96
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:121
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
Contains information about the physical socket connection.
Definition: SoDispCon.h:120
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.
Definition: SoDispCon.h:714
int setBlocking()
Select blocking socket mode.
Definition: SoDispCon.h:668
struct SoDisp * getDispatcher()
Definition: SoDispCon.h:698
int asyncSend(int len)
Begin or advance a send from the transport's asynchronous buffer.
Definition: SoDispCon.h:706
SoDispCon()
Uninitialized storage; call SoDispCon_constructor before use.
Definition: SoDispCon.h:125
bool isIP6()
Definition: SoDispCon.h:674
bool isValid()
Definition: SoDispCon.h:676
bool isSecure()
Deprecated: Use getSharkSslCon(NULL).
Definition: SoDispCon.h:670
int sendChunkData(const void *data, int len)
Send one HTTP chunk, including its hexadecimal size and CRLF delimiters.
Definition: SoDispCon.h:708
bool sendEvActive()
Definition: SoDispCon.h:696
void setDispRecEvent(SoDispCon_DispRecEv ev)
Install a receive callback before enabling receive events.
Definition: SoDispCon.h:702
char * addr2String(HttpSockaddr *addr, char *buf, int len)
Format a numeric address without a port number.
Definition: SoDispCon.h:682
bool cmpAddr(HttpSockaddr *addr2)
Compare an address with the current peer address, ignoring port numbers.
Definition: SoDispCon.h:684
bool getSharkSslCon(SharkSslCon **sc)
Inspect a connected transport's TLS implementation.
Definition: SoDispCon.h:672
void setTCPNoDelay(bool enable)
Disable the TCP delay.
Definition: SoDispCon.h:687
bool hasMoreData()
Definition: SoDispCon.h:689
void * allocAsynchBuf(int *size)
Obtain transport-owned writable storage for asynchronous sending.
Definition: SoDispCon.h:712
int asyncReady()
Advance pending output and inspect completion.
Definition: SoDispCon.h:710
int readData(void *data, int len, bool relmutex=false)
Read through the installed transport using its recorded readiness.
Definition: SoDispCon.h:664
bool recEvActive()
Definition: SoDispCon.h:694
int sendData(const void *data, int len)
Send an entire buffer through the installed transport.
Definition: SoDispCon.h:704
int getSockName(HttpSockaddr *addr, U16 *port=0)
Read the local socket endpoint.
Definition: SoDispCon.h:680
void setDispSendEvent(SoDispCon_DispSendEv ev)
Install a send-ready callback before enabling send events.
Definition: SoDispCon.h:700
int setNonblocking()
Select nonblocking socket mode.
Definition: SoDispCon.h:666
bool dispatcherHasCon()
Definition: SoDispCon.h:692
int getPeerName(HttpSockaddr *addr, U16 *port=0)
Read the remote peer endpoint.
Definition: SoDispCon.h:678
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:97
A mutual exclusion class.
Definition: ThreadLib.h:196