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"
43constexpr int SPG_CONNECT = 1;
44constexpr int SPG_CONNECT_SSL = 2;
47constexpr int SPS_NONE = 0;
48constexpr int SPS_CONNECTING = 1;
49constexpr int SPS_CONNECTING_SSL = 2;
50constexpr int SPS_CONNECTED = 3;
52class 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";
114class 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;
152class SocketRecvPollOperationBase :
public SocketPollOperationBase {
154 DLLLOCAL SocketRecvPollOperationBase(QoreSocketObject* sock,
bool to_string) : sock(sock),
155 to_string(to_string) {
161 sock->clearNonBlock();
168 DLLLOCAL
virtual bool goalReached()
const {
172 DLLLOCAL
virtual const char* getStateImpl()
const {
173 return received ?
"received" :
"receiving";
176 DLLLOCAL
virtual QoreValue getOutput()
const {
183 std::unique_ptr<AbstractPollState> poll_state;
185 QoreSocketObject* sock;
187 bool set_non_block =
false;
188 bool received =
false;
193class SocketRecvPollOperation :
public SocketRecvPollOperationBase {
196 DLLLOCAL SocketRecvPollOperation(
ExceptionSink* xsink, ssize_t size, QoreSocketObject* sock,
bool to_string);
202class SocketRecvUntilBytesPollOperation :
public SocketRecvPollOperationBase {
206 QoreSocketObject* sock,
bool to_string);
212class SocketUpgradeClientSslPollOperation :
public SocketPollOperationBase {
214 DLLLOCAL SocketUpgradeClientSslPollOperation(
ExceptionSink* xsink, QoreSocketObject* sock);
219 sock->clearNonBlock();
226 DLLLOCAL
virtual bool goalReached()
const {
232 DLLLOCAL
virtual const char* getStateImpl()
const {
233 return "connecting-ssl";
237 QoreSocketObject* sock;
238 std::unique_ptr<AbstractPollState> poll_state;
239 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:50
defines a Qore-language class
Definition: QoreClass.h:253
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
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition: ReferenceHolder.h:127
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276
DLLEXPORT QoreValue refSelf() const
references the contained value if type == QV_Node, returns itself