26 #ifndef _QORE_QORE_SOCKET_OBJECT_H
28 #define _QORE_QORE_SOCKET_OBJECT_H
30 #include <qore/QoreSocket.h>
31 #include <qore/AbstractPrivateData.h>
32 #include <qore/QoreThreadLock.h>
41 friend class my_socket_priv;
48 DLLLOCAL
virtual ~QoreSocketObject();
51 DLLEXPORT QoreSocketObject();
54 DLLEXPORT
virtual void deref();
56 DLLEXPORT
int connect(
const char* name,
int timeout_ms,
ExceptionSink* xsink = NULL);
57 DLLEXPORT
int connectINET(
const char* host,
int port,
int timeout_ms,
ExceptionSink* xsink = NULL);
58 DLLEXPORT
int connectINET2(
const char* host,
const char* service,
int family,
int sock_type,
int protocol,
int timeout_ms = -1,
ExceptionSink* xsink = NULL);
59 DLLEXPORT
int connectUNIX(
const char* p,
int socktype,
int protocol,
ExceptionSink* xsink = NULL);
60 DLLEXPORT
int connectSSL(
const char* name,
int timeout_ms,
ExceptionSink* xsink);
61 DLLEXPORT
int connectINETSSL(
const char* host,
int port,
int timeout_ms,
ExceptionSink* xsink);
62 DLLEXPORT
int connectINET2SSL(
const char* host,
const char* service,
int family,
int sock_type,
int protocol,
int timeout_ms = -1,
ExceptionSink* xsink = NULL);
63 DLLEXPORT
int connectUNIXSSL(
const char* p,
int socktype,
int protocol,
ExceptionSink* xsink);
65 DLLEXPORT
int bind(
const char* name,
bool reuseaddr =
false);
67 DLLEXPORT
int bind(
int port,
bool reuseaddr =
false);
69 DLLEXPORT
int bind(
const char* iface,
int port,
bool reuseaddr =
false);
71 DLLEXPORT
int bindUNIX(
const char* name,
int socktype,
int protocol,
ExceptionSink* xsink);
72 DLLEXPORT
int bindINET(
const char* name,
const char* service,
bool reuseaddr,
int family,
int socktype,
int protocol,
ExceptionSink* xsink);
75 DLLEXPORT
int getPort();
78 DLLEXPORT QoreSocketObject *accept(
int timeout_ms,
ExceptionSink* xsink);
79 DLLEXPORT QoreSocketObject *acceptSSL(
int timeout_ms,
ExceptionSink* xsink);
81 DLLEXPORT
int listen(
int backlog);
83 DLLEXPORT
int send(
const char* buf,
int size);
84 DLLEXPORT
int send(
const char* buf,
int size,
int timeout_ms,
ExceptionSink* xsink);
91 DLLEXPORT
int send(
int fd,
int size = -1);
93 DLLEXPORT
int sendi1(
char b,
int timeout_ms,
ExceptionSink* xsink);
94 DLLEXPORT
int sendi2(
short b,
int timeout_ms,
ExceptionSink* xsink);
95 DLLEXPORT
int sendi4(
int b,
int timeout_ms,
ExceptionSink* xsink);
96 DLLEXPORT
int sendi8(int64 b,
int timeout_ms,
ExceptionSink* xsink);
97 DLLEXPORT
int sendi2LSB(
short b,
int timeout_ms,
ExceptionSink* xsink);
98 DLLEXPORT
int sendi4LSB(
int b,
int timeout_ms,
ExceptionSink* xsink);
99 DLLEXPORT
int sendi8LSB(int64 b,
int timeout_ms,
ExceptionSink* xsink);
109 DLLEXPORT
int recv(
int fd,
int size,
int timeout);
111 DLLEXPORT int64 recvi1(
int timeout,
char* b,
ExceptionSink* xsink);
112 DLLEXPORT int64 recvi2(
int timeout,
short *b,
ExceptionSink* xsink);
113 DLLEXPORT int64 recvi4(
int timeout,
int *b,
ExceptionSink* xsink);
114 DLLEXPORT int64 recvi8(
int timeout, int64 *b,
ExceptionSink* xsink);
115 DLLEXPORT int64 recvi2LSB(
int timeout,
short *b,
ExceptionSink* xsink);
116 DLLEXPORT int64 recvi4LSB(
int timeout,
int *b,
ExceptionSink* xsink);
117 DLLEXPORT int64 recvi8LSB(
int timeout, int64 *b,
ExceptionSink* xsink);
118 DLLEXPORT int64 recvu1(
int timeout,
unsigned char* b,
ExceptionSink* xsink);
119 DLLEXPORT int64 recvu2(
int timeout,
unsigned short *b,
ExceptionSink* xsink);
120 DLLEXPORT int64 recvu4(
int timeout,
unsigned int *b,
ExceptionSink* xsink);
121 DLLEXPORT int64 recvu2LSB(
int timeout,
unsigned short *b,
ExceptionSink* xsink);
122 DLLEXPORT int64 recvu4LSB(
int timeout,
unsigned int *b,
ExceptionSink* xsink);
124 DLLEXPORT
int sendHTTPMessage(
ExceptionSink* xsink,
QoreHashNode* info,
const char* method,
const char* path,
const char* http_version,
const QoreHashNode* headers,
const void* ptr,
int size,
int source,
int timeout_ms);
126 DLLEXPORT
int sendHTTPResponse(
ExceptionSink* xsink,
int code,
const char* desc,
const char* http_version,
const QoreHashNode* headers,
const void* ptr,
int size,
int source,
int timeout_ms);
136 DLLEXPORT
int setSendTimeout(
int ms);
137 DLLEXPORT
int setRecvTimeout(
int ms);
138 DLLEXPORT
int getSendTimeout();
139 DLLEXPORT
int getRecvTimeout();
140 DLLEXPORT
int close();
141 DLLEXPORT
int shutdown();
143 DLLEXPORT
const char* getSSLCipherName();
144 DLLEXPORT
const char* getSSLCipherVersion();
145 DLLEXPORT
bool isSecure();
146 DLLEXPORT
long verifyPeerCertificate();
147 DLLEXPORT
int getSocket();
150 DLLEXPORT
bool isDataAvailable(
ExceptionSink* xsink,
int timeout = 0);
151 DLLEXPORT
bool isWriteFinished(
ExceptionSink* xsink,
int timeout = 0);
152 DLLEXPORT
bool isOpen()
const;
157 DLLEXPORT
int setNoDelay(
int nodelay);
158 DLLEXPORT
int getNoDelay();
159 DLLEXPORT
void setEventQueue(Queue *cbq,
ExceptionSink* xsink);
167 DLLEXPORT
void setWarningQueue(
ExceptionSink* xsink, int64 warning_ms, int64 warning_bs,
class Queue* wq,
AbstractQoreNode* arg, int64 min_ms = 1000);
169 DLLEXPORT
void clearStats();
172 #endif // _QORE_QORE_SOCKET_OBJECT_H
defines string encoding functions in Qore
Definition: QoreEncoding.h:72
a helper class for getting socket origination information
Definition: QoreSocket.h:61
represents an X509 certificate, reference-counted, dynamically-allocated only
Definition: QoreSSLCertificate.h:34
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:41
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:36
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
long qore_offset_t
used for offsets that could be negative
Definition: common.h:65
provides access to a private key data structure for SSL connections
Definition: QoreSSLPrivateKey.h:32
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:42
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:40
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:57
provides access to sockets using Qore data structures
Definition: QoreSocket.h:113
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
holds arbitrary binary data
Definition: BinaryNode.h:33