32 #ifndef _QORE_CLASS_SOCKETPOLLOPERATION_H
34 #define _QORE_CLASS_SOCKETPOLLOPERATION_H
36 #include "qore/intern/QC_SocketPollOperationBase.h"
37 #include "qore/intern/qore_socket_private.h"
38 #include "qore/QoreSocketObject.h"
43 constexpr
int SPG_CONNECT = 1;
44 constexpr
int SPG_CONNECT_SSL = 2;
47 constexpr
int SPS_NONE = 0;
48 constexpr
int SPS_CONNECTING = 1;
49 constexpr
int SPS_CONNECTING_SSL = 2;
50 constexpr
int SPS_CONNECTED = 3;
52 class SocketConnectPollOperation :
public SocketPollOperationBase {
54 DLLLOCAL SocketConnectPollOperation(
ExceptionSink* xsink,
bool ssl,
const char* target, QoreSocketObject* sock);
59 sock->clearNonBlock();
66 DLLLOCAL
virtual bool goalReached()
const {
67 return state == SPS_CONNECTED;
73 QoreSocketObject* sock;
81 DLLLOCAL
virtual void connected();
87 std::unique_ptr<AbstractPollState> poll_state;
93 bool set_non_block =
false;
95 DLLLOCAL
virtual const char* getStateImpl()
const {
101 case SPS_CONNECTING_SSL:
102 return "connecting-ssl";
114 class SocketSendPollOperation :
public SocketPollOperationBase {
125 sock->clearNonBlock();
132 DLLLOCAL
virtual bool goalReached()
const {
136 DLLLOCAL
virtual const char* getStateImpl()
const {
137 return sent ?
"sent" :
"sending";
143 std::unique_ptr<AbstractPollState> poll_state;
145 QoreSocketObject* sock;
148 bool set_non_block =
false;
153 class SocketRecvPollOperationBase :
public SocketPollOperationBase {
155 DLLLOCAL SocketRecvPollOperationBase(QoreSocketObject* sock,
bool to_string) : sock(sock),
156 to_string(to_string) {
162 sock->clearNonBlock();
169 DLLLOCAL
virtual bool goalReached()
const {
173 DLLLOCAL
virtual const char* getStateImpl()
const {
174 return received ?
"received" :
"receiving";
177 DLLLOCAL
virtual QoreValue getOutput()
const {
184 std::unique_ptr<AbstractPollState> poll_state;
186 QoreSocketObject* sock;
188 bool set_non_block =
false;
189 bool received =
false;
194 class SocketRecvPollOperation :
public SocketRecvPollOperationBase {
197 DLLLOCAL SocketRecvPollOperation(
ExceptionSink* xsink, ssize_t size, QoreSocketObject* sock,
bool to_string);
203 class SocketRecvUntilBytesPollOperation :
public SocketRecvPollOperationBase {
207 QoreSocketObject* sock,
bool to_string);
213 class SocketUpgradeClientSslPollOperation :
public SocketPollOperationBase {
215 DLLLOCAL SocketUpgradeClientSslPollOperation(
ExceptionSink* xsink, QoreSocketObject* sock);
220 sock->clearNonBlock();
227 DLLLOCAL
virtual bool goalReached()
const {
233 DLLLOCAL
virtual const char* getStateImpl()
const {
234 return "connecting-ssl";
238 QoreSocketObject* sock;
239 std::unique_ptr<AbstractPollState> poll_state;
240 bool set_non_block =
false;
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:65
holds arbitrary binary data
Definition: BinaryNode.h:41
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
defines a Qore-language class
Definition: QoreClass.h:249
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:65
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275
DLLEXPORT QoreValue refSelf() const
references the contained value if type == QV_Node, returns itself