Loading...
Searching...
No Matches
QoreSocket.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreSocket.h
IPv4, IPv6, unix socket class with SSL support
Qore Programming Language
Copyright (C) 2003 - 2022 Qore Technologies, s.r.o.
will unlink (delete) UNIX domain socket files when closed
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef _QORE_QORESOCKET_H
#define _QORE_QORESOCKET_H
#include <qore/Qore.h>
#include <qore/InputStream.h>
#include <qore/OutputStream.h>
#include <qore/AbstractPollState.h>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <strings.h>
#include <sys/types.h>
#include <unistd.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#define QSE_MISC_ERR 0
#define QSE_RECV_ERR -1
#define QSE_NOT_OPEN -2
#define QSE_TIMEOUT -3
#define QSE_SSL_ERR -4
#define QSE_IN_OP -5
#define QSE_IN_OP_THREAD -6
// forward reference
class Queue;
class SocketSource {
friend struct qore_socket_private;
private:
struct qore_socketsource_private *priv; // private implementation
DLLLOCAL SocketSource(const SocketSource&);
DLLLOCAL SocketSource& operator=(const SocketSource&);
public:
DLLEXPORT SocketSource();
DLLEXPORT ~SocketSource();
DLLEXPORT QoreStringNode* takeAddress();
DLLEXPORT QoreStringNode* takeHostName();
DLLEXPORT const char* getAddress() const;
DLLEXPORT const char* getHostName() const;
DLLLOCAL void setAll(QoreObject* o, ExceptionSink* xsink);
};
class QoreSocket {
friend struct qore_socket_private;
friend struct qore_httpclient_priv;
friend class QoreSocketObject;
friend class QoreFtpClient;
friend class HttpClientRecvHeaderPollState;
friend class HttpClientRecvChunkedPollState;
friend class HttpClientRecvUntilClosePollState;
friend class HttpClientConnectSendRecvPollOperation;
friend class my_socket_priv;
public:
DLLEXPORT QoreSocket();
DLLEXPORT ~QoreSocket();
DLLEXPORT AbstractPollState* startConnect(ExceptionSink* xsink, const char* name);
DLLEXPORT AbstractPollState* startSslConnect(ExceptionSink* xsink, X509* cert = nullptr, EVP_PKEY* pkey = nullptr);
DLLEXPORT AbstractPollState* startSend(ExceptionSink* xsink, const char* data, size_t size);
DLLEXPORT AbstractPollState* startRecv(ExceptionSink* xsink, size_t size);
DLLEXPORT AbstractPollState* startRecvUntilBytes(ExceptionSink* xsink, const char* pattern, size_t size);
#if 0
DLLEXPORT AbstractPollState* startAccept(ExceptionSink* xsink);
DLLEXPORT AbstractPollState* startSslAccept(ExceptionSink* xsink, X509* cert, EVP_PKEY* pkey);
#endif
DLLEXPORT int connect(const char* name, ExceptionSink* xsink = nullptr);
DLLEXPORT int connect(const char* name, int timeout_ms, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectINET(const char* host, int prt, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectINET2(const char* name, const char* service, int family = Q_AF_UNSPEC, int sock_type = Q_SOCK_STREAM, int protocol = 0, int timeout_ms = -1, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectINET(const char* host, int prt, int timeout_ms, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectUNIX(const char* p, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectUNIX(const char* p, int socktype, int protocol = 0, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectSSL(const char* name, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int connectSSL(const char* name, int timeout_ms, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int connectINETSSL(const char* host, int prt, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int connectINETSSL(const char* host, int prt, int timeout_ms, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int connectINET2SSL(const char* name, const char* service, int family, int sock_type, int protocol, int timeout_ms, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink = nullptr);
DLLEXPORT int connectUNIXSSL(const char* p, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int connectUNIXSSL(const char* p, int socktype, int protocol, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int bind(const char* name, bool reuseaddr = false);
DLLEXPORT int bind(int prt, bool reuseaddr);
DLLEXPORT int bind(const char* iface, int prt, bool reuseaddr = false);
DLLEXPORT int bind(const struct sockaddr *addr, int addr_size);
DLLEXPORT int bind(int family, const struct sockaddr *addr, int addr_size, int socktype = Q_SOCK_STREAM,
int protocol = 0);
DLLEXPORT int bindUNIX(const char* name, ExceptionSink* xsink = nullptr);
DLLEXPORT int bindUNIX(const char* name, int socktype, int protocol = 0, ExceptionSink* xsink = nullptr);
DLLEXPORT int bindINET(const char* name, const char* service, bool reuseaddr = true, int family = Q_AF_UNSPEC,
int socktype = Q_SOCK_STREAM, int protocol = 0, ExceptionSink* xsink = nullptr);
DLLEXPORT int getPort();
DLLEXPORT QoreSocket* accept(SocketSource* source, ExceptionSink* xsink);
DLLEXPORT QoreSocket* acceptSSL(SocketSource* source, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int acceptAndReplace(SocketSource* source);
DLLEXPORT QoreSocket* accept(int timeout_ms, ExceptionSink* xsink);
DLLEXPORT QoreSocket* acceptSSL(int timeout_ms, X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int acceptAndReplace(int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int listen();
DLLEXPORT int listen(int backlog);
DLLEXPORT int send(const char* buf, size_t size);
DLLEXPORT int send(const char* buf, size_t size, ExceptionSink* xsink);
DLLEXPORT int send(const char* buf, size_t size, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int send(const QoreString *msg, ExceptionSink* xsink);
DLLEXPORT int send(const QoreString *msg, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int send(const QoreStringNode& msg, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int send(const BinaryNode* msg);
DLLEXPORT int send(const BinaryNode* msg, ExceptionSink* xsink);
DLLEXPORT int send(const BinaryNode* msg, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int send(int fd, qore_offset_t size = -1);
DLLEXPORT int send(int fd, qore_offset_t size, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi1(char i);
DLLEXPORT int sendi2(short i);
DLLEXPORT int sendi4(int i);
DLLEXPORT int sendi8(int64 i);
DLLEXPORT int sendi2LSB(short i);
DLLEXPORT int sendi4LSB(int i);
DLLEXPORT int sendi8LSB(int64 i);
DLLEXPORT int sendi1(char i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi2(short i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi4(int i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi8(int64 i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi2LSB(short i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi4LSB(int i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendi8LSB(int64 i, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int recvi1(int timeout_ms, char* val);
DLLEXPORT int recvi2(int timeout_ms, short *val);
DLLEXPORT int recvi4(int timeout_ms, int* val);
DLLEXPORT int recvi8(int timeout_ms, int64 *val);
DLLEXPORT int recvi2LSB(int timeout_ms, short *val);
DLLEXPORT int recvi4LSB(int timeout_ms, int* val);
DLLEXPORT int recvi8LSB(int timeout_ms, int64 *val);
DLLEXPORT int recvu1(int timeout_ms, unsigned char* val);
DLLEXPORT int recvu2(int timeout_ms, unsigned short *val);
DLLEXPORT int recvu4(int timeout_ms, unsigned int* val);
DLLEXPORT int recvu2LSB(int timeout_ms, unsigned short *val);
DLLEXPORT int recvu4LSB(int timeout_ms, unsigned int* val);
DLLEXPORT int64 recvi1(int timeout_ms, char* val, ExceptionSink* xsink);
DLLEXPORT int64 recvi2(int timeout_ms, short *val, ExceptionSink* xsink);
DLLEXPORT int64 recvi4(int timeout_ms, int* val, ExceptionSink* xsink);
DLLEXPORT int64 recvi8(int timeout_ms, int64 *val, ExceptionSink* xsink);
DLLEXPORT int64 recvi2LSB(int timeout_ms, short *val, ExceptionSink* xsink);
DLLEXPORT int64 recvi4LSB(int timeout_ms, int* val, ExceptionSink* xsink);
DLLEXPORT int64 recvi8LSB(int timeout_ms, int64 *val, ExceptionSink* xsink);
DLLEXPORT int64 recvu1(int timeout_ms, unsigned char* val, ExceptionSink* xsink);
DLLEXPORT int64 recvu2(int timeout_ms, unsigned short *val, ExceptionSink* xsink);
DLLEXPORT int64 recvu4(int timeout_ms, unsigned int* val, ExceptionSink* xsink);
DLLEXPORT int64 recvu2LSB(int timeout_ms, unsigned short *val, ExceptionSink* xsink);
DLLEXPORT int64 recvu4LSB(int timeout_ms, unsigned int* val, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* recv(qore_offset_t bufsize, int timeout_ms, int* prc);
DLLEXPORT QoreStringNode* recv(qore_offset_t bufsize, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT BinaryNode* recvBinary(qore_offset_t bufsize, int timeout_ms, int* prc);
DLLEXPORT BinaryNode* recvBinary(qore_offset_t bufsize, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* recv(int timeout_ms, int* prc);
DLLEXPORT QoreStringNode* recv(int timeout_ms, ExceptionSink* xsink);
DLLEXPORT BinaryNode* recvBinary(int timeout_ms, int* prc);
DLLEXPORT BinaryNode* recvBinary(int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int recv(int fd, qore_offset_t size, int timeout_ms);
DLLEXPORT int recv(int fd, qore_offset_t size, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int sendHTTPMessage(const char* method, const char* path, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int sendHTTPMessage(QoreHashNode* info, const char* method, const char* path, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int sendHTTPMessage(ExceptionSink* xsink, QoreHashNode* info, const char* method, const char* path, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int sendHTTPMessage(ExceptionSink* xsink, QoreHashNode* info, const char* method, const char* path, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source, int timeout_ms);
DLLEXPORT int sendHTTPMessageWithCallback(ExceptionSink* xsink, QoreHashNode* info, const char* method, const char* path, const char* http_version, const QoreHashNode* headers, const ResolvedCallReferenceNode& send_callback, int source, int timeout_ms);
DLLEXPORT int sendHTTPResponse(int code, const char* desc, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int sendHTTPResponse(ExceptionSink* xsink, int code, const char* desc, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int sendHTTPResponse(ExceptionSink* xsink, int code, const char* desc, const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source, int timeout_ms);
DLLEXPORT int sendHTTPResponse(ExceptionSink* xsink, QoreHashNode* info, int code, const char* desc,
const char* http_version, const QoreHashNode* headers, const void* data, size_t size, int source,
int timeout_ms);
DLLEXPORT AbstractQoreNode* readHTTPHeader(int timeout_ms, int* prc, int source = QORE_SOURCE_SOCKET);
DLLEXPORT AbstractQoreNode* readHTTPHeader(QoreHashNode* info, int timeout_ms, int* prc, int source = QORE_SOURCE_SOCKET);
DLLEXPORT QoreHashNode* readHTTPHeader(ExceptionSink* xsink, QoreHashNode* info, int timeout_ms, int source = QORE_SOURCE_SOCKET);
DLLEXPORT QoreStringNode* readHTTPHeaderString(ExceptionSink* xsink, int timeout_ms, int source = QORE_SOURCE_SOCKET);
DLLEXPORT QoreHashNode* readHTTPChunkedBodyBinary(int timeout_ms, ExceptionSink* xsink, int source = QORE_SOURCE_SOCKET);
DLLEXPORT QoreHashNode* readHTTPChunkedBody(int timeout_ms, ExceptionSink* xsink, int source = QORE_SOURCE_SOCKET);
DLLEXPORT int setSendTimeout(int ms);
DLLEXPORT int setRecvTimeout(int ms);
DLLEXPORT int getSendTimeout() const;
DLLEXPORT int getRecvTimeout() const;
DLLEXPORT bool isDataAvailable(int timeout_ms = 0) const;
DLLEXPORT bool isDataAvailable(ExceptionSink* xsink, int timeout_ms = 0) const;
DLLEXPORT int asyncIoWait(int timeout_ms, bool read, bool write) const;
DLLEXPORT int close();
DLLEXPORT int shutdown();
DLLEXPORT int shutdownSSL(ExceptionSink* xsink);
DLLEXPORT int getSocket() const;
DLLEXPORT const QoreEncoding *getEncoding() const;
DLLEXPORT void setEncoding(const QoreEncoding *id);
DLLEXPORT bool isOpen() const;
DLLEXPORT const char* getSSLCipherName() const;
DLLEXPORT const char* getSSLCipherVersion() const;
DLLEXPORT bool isSecure() const;
DLLEXPORT long verifyPeerCertificate() const;
DLLEXPORT int upgradeClientToSSL(X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT int upgradeServerToSSL(X509* cert, EVP_PKEY* pkey, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int upgradeClientToSSL(X509* cert, EVP_PKEY* pkey, int timeout_ms, ExceptionSink* xsink);
DLLEXPORT int upgradeServerToSSL(X509* cert, EVP_PKEY* pkey, ExceptionSink* xsink);
DLLEXPORT bool isWriteFinished(int timeout_ms = 0) const;
DLLEXPORT bool isWriteFinished(ExceptionSink* xsink, int timeout_ms = 0) const;
DLLEXPORT QoreHashNode* getPeerInfo(ExceptionSink* xsink) const;
DLLEXPORT QoreHashNode* getPeerInfo(ExceptionSink* xsink, bool host_lookup) const;
DLLEXPORT QoreHashNode* getSocketInfo(ExceptionSink* xsink) const;
DLLEXPORT QoreHashNode* getSocketInfo(ExceptionSink* xsink, bool host_lookup) const;
DLLEXPORT void clearWarningQueue(ExceptionSink* xsink);
DLLEXPORT void setWarningQueue(ExceptionSink* xsink, int64 warning_ms, int64 warning_bs, Queue* wq, QoreValue arg, int64 min_ms = 1000);
DLLEXPORT QoreHashNode* getUsageInfo() const;
DLLEXPORT void clearStats();
DLLEXPORT void cleanup(ExceptionSink* xsink);
DLLEXPORT bool pendingHttpChunkedBody() const;
DLLEXPORT void setSslVerifyMode(int mode);
DLLEXPORT int getSslVerifyMode() const;
DLLEXPORT void acceptAllCertificates(bool accept_all = true);
DLLEXPORT bool getAcceptAllCertificates() const;
DLLEXPORT bool captureRemoteCertificates(bool set);
DLLEXPORT QoreObject* getRemoteCertificate() const;
DLLEXPORT int64 getConnectionId() const;
DLLLOCAL static void doException(int rc, const char* meth, int timeout_ms, ExceptionSink* xsink);
DLLLOCAL void setEventQueue(ExceptionSink* xsink, Queue* q, QoreValue arg, bool with_data);
DLLLOCAL Queue* getQueue();
DLLLOCAL int64 getObjectIDForEvents() const;
DLLLOCAL int setNoDelay(int nodelay);
DLLLOCAL int getNoDelay() const;
DLLLOCAL void setAccept(QoreObject* o);
private:
struct qore_socket_private *priv;
DLLLOCAL QoreSocket(int n_sock, int n_sfamily, int n_stype, int s_prot, const QoreEncoding* csid);
DLLLOCAL static void convertHeaderToHash(QoreHashNode* h, char* p);
DLLLOCAL QoreSocket(const QoreSocket&) = delete;
DLLLOCAL QoreSocket& operator=(const QoreSocket&) = delete;
};
class QoreSocketTimeoutHelper {
protected:
class PrivateQoreSocketTimeoutHelper* priv;
public:
DLLEXPORT QoreSocketTimeoutHelper(QoreSocket& s, const char* op);
DLLEXPORT ~QoreSocketTimeoutHelper();
};
class QoreSocketThroughputHelper {
protected:
class PrivateQoreSocketThroughputHelper* priv;
public:
DLLEXPORT QoreSocketThroughputHelper(QoreSocket& s, bool snd);
DLLEXPORT ~QoreSocketThroughputHelper();
DLLEXPORT void finalize(int64 bytes);
};
#endif // _QORE_QORESOCKET_H
Qore.h
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:41
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
QoreEncoding
defines string encoding functions in Qore
Definition: QoreEncoding.h:83
QoreFtpClient
provides thread-safe access to FTP servers through Qore data structures
Definition: QoreFtpClient.h:71
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
QoreObject
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
QoreSocket
provides access to sockets using Qore data structures
Definition: QoreSocket.h:127
QoreSocket::captureRemoteCertificates
DLLEXPORT bool captureRemoteCertificates(bool set)
sets the capture SSL certificate flag
QoreSocket::send
DLLEXPORT int send(int fd, qore_offset_t size, int timeout_ms, ExceptionSink *xsink)
sends untranslated data from an open file descriptor
QoreSocket::getRecvTimeout
DLLEXPORT int getRecvTimeout() const
get recv timeout in milliseconds
QoreSocket::recvi2LSB
DLLEXPORT int recvi2LSB(int timeout_ms, short *val)
reads a 2-byte signed integer in LSB (Most Significant Byte first, little endian) format from the soc...
QoreSocket::send
DLLEXPORT int send(const char *buf, size_t size)
sends binary data on a connected socket
QoreSocket::recv
DLLEXPORT QoreStringNode * recv(qore_offset_t bufsize, int timeout_ms, int *prc)
receive a certain number of bytes with a timeout value and return a QoreStringNode,...
QoreSocket::recvi8LSB
DLLEXPORT int recvi8LSB(int timeout_ms, int64 *val)
reads an 8-byte signed integer in LSB (Most Significant Byte first, little endian) format from the so...
QoreSocket::startRecvUntilBytes
DLLEXPORT AbstractPollState * startRecvUntilBytes(ExceptionSink *xsink, const char *pattern, size_t size)
Starts a non-blocking receive operation on a connected socket.
QoreSocket::connectINET
DLLEXPORT int connectINET(const char *host, int prt, int timeout_ms, ExceptionSink *xsink=nullptr)
connects to an INET socket by hostname and port number and returns a status code, Qore-language excep...
QoreSocket::setSslVerifyMode
DLLEXPORT void setSslVerifyMode(int mode)
sets the SSL verification mode
QoreSocket::recvu1
DLLEXPORT int64 recvu1(int timeout_ms, unsigned char *val, ExceptionSink *xsink)
reads a 1-byte unsigned integer from the socket with a timeout value and returns the value read as an...
QoreSocket::send
DLLEXPORT int send(const BinaryNode *msg, ExceptionSink *xsink)
sends binary data on a connected socket
QoreSocket::getPeerInfo
DLLEXPORT QoreHashNode * getPeerInfo(ExceptionSink *xsink, bool host_lookup) const
returns peer information for a connected socket
QoreSocket::setEncoding
DLLEXPORT void setEncoding(const QoreEncoding *id)
sets the character encoding for strings sent and received with this socket
QoreSocket::sendHTTPResponse
DLLEXPORT int sendHTTPResponse(ExceptionSink *xsink, QoreHashNode *info, int code, const char *desc, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source, int timeout_ms)
send an HTTP response message on the socket
QoreSocket::setSendTimeout
DLLEXPORT int setSendTimeout(int ms)
set send timeout in milliseconds
QoreSocket::upgradeClientToSSL
DLLEXPORT int upgradeClientToSSL(X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
negotiates an SSL connection from the client side
QoreSocket::connectUNIXSSL
DLLEXPORT int connectUNIXSSL(const char *p, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to a UNIX domain socket, negotiates an SSL connection, and returns a status code,...
QoreSocket::startSend
DLLEXPORT AbstractPollState * startSend(ExceptionSink *xsink, const char *data, size_t size)
Starts a non-blocking send operation on a connected socket.
QoreSocket::sendHTTPMessage
DLLEXPORT int sendHTTPMessage(QoreHashNode *info, const char *method, const char *path, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source=QORE_SOURCE_SOCKET)
send an HTTP request message on the socket
QoreSocket::pendingHttpChunkedBody
DLLEXPORT bool pendingHttpChunkedBody() const
returns true if a HTTP header was read indicating chunked transfer encoding, but no chunked body has ...
QoreSocket::isDataAvailable
DLLEXPORT bool isDataAvailable(ExceptionSink *xsink, int timeout_ms=0) const
returns true if data is available on the socket in the timeout period in milliseconds
QoreSocket::getAcceptAllCertificates
DLLEXPORT bool getAcceptAllCertificates() const
returns the current value of the "accept all certificates" flag
QoreSocket::upgradeClientToSSL
DLLEXPORT int upgradeClientToSSL(X509 *cert, EVP_PKEY *pkey, int timeout_ms, ExceptionSink *xsink)
negotiates an SSL connection from the client side
QoreSocket::connectINET
DLLEXPORT int connectINET(const char *host, int prt, ExceptionSink *xsink=nullptr)
connects to an INET socket by hostname and port number and returns a status code, Qore-language excep...
QoreSocket::getQueue
DLLLOCAL Queue * getQueue()
returns the event queue (not part of the library's public API)
QoreSocket::close
DLLEXPORT int close()
closes the socket
QoreSocket::connectINETSSL
DLLEXPORT int connectINETSSL(const char *host, int prt, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to an INET socket by hostname and port number, negotiates an SSL connection,...
QoreSocket::recvu4
DLLEXPORT int recvu4(int timeout_ms, unsigned int *val)
reads a 4-byte unsigned integer in MSB (Most Significant Byte first, big endian, network) format from...
QoreSocket::upgradeServerToSSL
DLLEXPORT int upgradeServerToSSL(X509 *cert, EVP_PKEY *pkey, int timeout_ms, ExceptionSink *xsink)
negotiates an SSL connection from the client side
QoreSocket::verifyPeerCertificate
DLLEXPORT long verifyPeerCertificate() const
returns the peer certificate verification code if an SSL connection is in progress
QoreSocket::recvi2LSB
DLLEXPORT int64 recvi2LSB(int timeout_ms, short *val, ExceptionSink *xsink)
reads a 2-byte signed integer in LSB (Most Significant Byte first, little endian) format from the soc...
QoreSocket::QoreSocket
DLLEXPORT QoreSocket()
creates an empty, unconnected socket
QoreSocket::asyncIoWait
DLLEXPORT int asyncIoWait(int timeout_ms, bool read, bool write) const
returns 1 if the event was satisfied in the timeout period, 0 if not (= timeout), or -1 in case of an...
QoreSocket::sendHTTPMessageWithCallback
DLLEXPORT int sendHTTPMessageWithCallback(ExceptionSink *xsink, QoreHashNode *info, const char *method, const char *path, const char *http_version, const QoreHashNode *headers, const ResolvedCallReferenceNode &send_callback, int source, int timeout_ms)
send an HTTP request message on the socket with a timeout value with a chunked message body using a c...
QoreSocket::recvi8
DLLEXPORT int64 recvi8(int timeout_ms, int64 *val, ExceptionSink *xsink)
reads an 8-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from ...
QoreSocket::getPort
DLLEXPORT int getPort()
returns the TCP port number, also assigns the interal port number if it must be discovered
QoreSocket::acceptAndReplace
DLLEXPORT int acceptAndReplace(SocketSource *source)
accepts a new connection on a listening socket and replaces the current socket with the new connectio...
QoreSocket::startRecv
DLLEXPORT AbstractPollState * startRecv(ExceptionSink *xsink, size_t size)
Starts a non-blocking receive operation on a connected socket.
QoreSocket::accept
DLLEXPORT QoreSocket * accept(SocketSource *source, ExceptionSink *xsink)
accepts a new connection on a listening socket and returns a new QoreSocket object for the new connec...
QoreSocket::connectSSL
DLLEXPORT int connectSSL(const char *name, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to a socket, negotiates an SSL connection, and returns a status code, Qore-language exceptio...
QoreSocket::isSecure
DLLEXPORT bool isSecure() const
returns true if an SSL connection is active
QoreSocket::getObjectIDForEvents
DLLLOCAL int64 getObjectIDForEvents() const
returns a unique ID for the socket to be used in event messages
QoreSocket::connectINETSSL
DLLEXPORT int connectINETSSL(const char *host, int prt, int timeout_ms, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to an INET socket by hostname and port number, negotiates an SSL connection,...
QoreSocket::acceptAndReplace
DLLEXPORT int acceptAndReplace(int timeout_ms, ExceptionSink *xsink)
accepts a new connection on a listening socket and replaces the current socket with the new connectio...
QoreSocket::sendi2LSB
DLLEXPORT int sendi2LSB(short i)
sends a 2-byte (16bit) binary integer in LSB (Least Significant Byte first, little endian) format thr...
QoreSocket::connect
DLLEXPORT int connect(const char *name, ExceptionSink *xsink=nullptr)
connects to a socket and returns a status code, Qore-language exceptions are raised in the case of an...
QoreSocket::send
DLLEXPORT int send(const BinaryNode *msg)
sends binary data on a connected socket
QoreSocket::acceptAllCertificates
DLLEXPORT void acceptAllCertificates(bool accept_all=true)
with peer verification enabled, all certificates are accepted regardless of the validity of the Certi...
QoreSocket::recv
DLLEXPORT QoreStringNode * recv(int timeout_ms, ExceptionSink *xsink)
receive with a timeout value and return a QoreStringNode, caller owns the reference count returned
QoreSocket::startSslConnect
DLLEXPORT AbstractPollState * startSslConnect(ExceptionSink *xsink, X509 *cert=nullptr, EVP_PKEY *pkey=nullptr)
Starts a non-blocking upgrade to an SSL connection on a connected client connection.
QoreSocket::sendi1
DLLEXPORT int sendi1(char i)
sends a 1-byte binary integer data to a connected socket
QoreSocket::recvu4LSB
DLLEXPORT int64 recvu4LSB(int timeout_ms, unsigned int *val, ExceptionSink *xsink)
reads a 4-byte unsigned integer in LSB (Most Significant Byte first, little endian) format from the s...
QoreSocket::isDataAvailable
DLLEXPORT bool isDataAvailable(int timeout_ms=0) const
returns true if data is available on the socket in the timeout period in milliseconds
QoreSocket::sendi8LSB
DLLEXPORT int sendi8LSB(int64 i, int timeout_ms, ExceptionSink *xsink)
sends an 8-byte (64bit) binary integer in LSB (Least Significant Byte first, little endian) format th...
QoreSocket::setEventQueue
DLLLOCAL void setEventQueue(ExceptionSink *xsink, Queue *q, QoreValue arg, bool with_data)
sets the event queue (not part of the library's pubilc API), must be already referenced before call
QoreSocket::recvi8LSB
DLLEXPORT int64 recvi8LSB(int timeout_ms, int64 *val, ExceptionSink *xsink)
reads an 8-byte signed integer in LSB (Most Significant Byte first, little endian) format from the so...
QoreSocket::isWriteFinished
DLLEXPORT bool isWriteFinished(int timeout_ms=0) const
returns true if all write data has been written within the timeout period in milliseconds
QoreSocket::sendHTTPMessage
DLLEXPORT int sendHTTPMessage(ExceptionSink *xsink, QoreHashNode *info, const char *method, const char *path, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source, int timeout_ms)
send an HTTP request message on the socket with a timeout value
QoreSocket::connectUNIXSSL
DLLEXPORT int connectUNIXSSL(const char *p, int socktype, int protocol, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to a UNIX domain socket, negotiates an SSL connection, and returns a status code,...
QoreSocket::getSslVerifyMode
DLLEXPORT int getSslVerifyMode() const
returns the SSL verification mode
QoreSocket::shutdownSSL
DLLEXPORT int shutdownSSL(ExceptionSink *xsink)
shuts down an active SSL connection
QoreSocket::recvu2LSB
DLLEXPORT int recvu2LSB(int timeout_ms, unsigned short *val)
reads a 2-byte unsigned integer in LSB (Most Significant Byte first, little endian) format from the s...
QoreSocket::recvBinary
DLLEXPORT BinaryNode * recvBinary(int timeout_ms, ExceptionSink *xsink)
receive with a timeout value and return a BinaryNode, caller owns the reference count returned
QoreSocket::getEncoding
DLLEXPORT const QoreEncoding * getEncoding() const
returns the character encoding associated with this socket
QoreSocket::recv
DLLEXPORT int recv(int fd, qore_offset_t size, int timeout_ms, ExceptionSink *xsink)
receive data on the socket and write it to a file descriptor
QoreSocket::cleanup
DLLEXPORT void cleanup(ExceptionSink *xsink)
posts deleted message and removes any event queue
QoreSocket::recv
DLLEXPORT QoreStringNode * recv(qore_offset_t bufsize, int timeout_ms, ExceptionSink *xsink)
receive a certain number of bytes with a timeout value and return a QoreStringNode,...
QoreSocket::send
DLLEXPORT int send(const BinaryNode *msg, int timeout_ms, ExceptionSink *xsink)
sends binary data on a connected socket
QoreSocket::bind
DLLEXPORT int bind(const char *name, bool reuseaddr=false)
binds to a UNIX domain socket or INET interface:port using TCP and returns a status code
QoreSocket::recvi1
DLLEXPORT int recvi1(int timeout_ms, char *val)
reads a 1-byte signed integer from the socket with a timeout value and returns the value read as an o...
QoreSocket::bind
DLLEXPORT int bind(const struct sockaddr *addr, int addr_size)
binds an INET TCP socket to a specific socket address - do not use, deprecated, use bind(int family,...
QoreSocket::isWriteFinished
DLLEXPORT bool isWriteFinished(ExceptionSink *xsink, int timeout_ms=0) const
returns true if all write data has been written within the timeout period in milliseconds
QoreSocket::acceptSSL
DLLEXPORT QoreSocket * acceptSSL(SocketSource *source, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
accepts a new connection on a listening socket, negotiates an SSL connection, and returns a new QoreS...
QoreSocket::sendi8
DLLEXPORT int sendi8(int64 i)
sends an 8-byte (64bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::getPeerInfo
DLLEXPORT QoreHashNode * getPeerInfo(ExceptionSink *xsink) const
returns peer information for a connected socket
QoreSocket::readHTTPChunkedBody
DLLEXPORT QoreHashNode * readHTTPChunkedBody(int timeout_ms, ExceptionSink *xsink, int source=QORE_SOURCE_SOCKET)
receive a string message in HTTP chunked transfer encoding, caller owns QoreHashNode reference count ...
QoreSocket::getSocket
DLLEXPORT int getSocket() const
returns the file descriptor associated with this socket
QoreSocket::connectUNIX
DLLEXPORT int connectUNIX(const char *p, ExceptionSink *xsink=nullptr)
connects to a UNIX domain socket and returns a status code, Qore-language exceptions are raised in th...
QoreSocket::recvBinary
DLLEXPORT BinaryNode * recvBinary(int timeout_ms, int *prc)
receive with a timeout value and return a BinaryNode, caller owns the reference count returned
QoreSocket::listen
DLLEXPORT int listen(int backlog)
sets an open socket to the listening state
QoreSocket::readHTTPHeader
DLLEXPORT AbstractQoreNode * readHTTPHeader(QoreHashNode *info, int timeout_ms, int *prc, int source=QORE_SOURCE_SOCKET)
read and parse HTTP header, caller owns AbstractQoreNode reference count returned
QoreSocket::setAccept
DLLLOCAL void setAccept(QoreObject *o)
sets backwards-compatible members on accept in a new object - will be removed in a future version of ...
QoreSocket::recv
DLLEXPORT QoreStringNode * recv(int timeout_ms, int *prc)
receive with a timeout value and return a QoreStringNode, caller owns the reference count returned
QoreSocket::readHTTPHeaderString
DLLEXPORT QoreStringNode * readHTTPHeaderString(ExceptionSink *xsink, int timeout_ms, int source=QORE_SOURCE_SOCKET)
read a HTTP header, caller owns QoreStringNode reference count returned
QoreSocket::bind
DLLEXPORT int bind(const char *iface, int prt, bool reuseaddr=false)
binds to a TCP INET (ipv4 only) port on the given interface and returns a status code
QoreSocket::bindUNIX
DLLEXPORT int bindUNIX(const char *name, int socktype, int protocol=0, ExceptionSink *xsink=nullptr)
binds to a UNIX domain socket and returns a status code
QoreSocket::recvi4LSB
DLLEXPORT int recvi4LSB(int timeout_ms, int *val)
reads a 4-byte signed integer in LSB (Most Significant Byte first, little endian) format from the soc...
QoreSocket::recvu2
DLLEXPORT int recvu2(int timeout_ms, unsigned short *val)
reads a 2-byte unsigned integer in MSB (Most Significant Byte first, big endian, network) format from...
QoreSocket::getSocketInfo
DLLEXPORT QoreHashNode * getSocketInfo(ExceptionSink *xsink) const
returns information for the current socket; the socket must be open
QoreSocket::sendHTTPResponse
DLLEXPORT int sendHTTPResponse(ExceptionSink *xsink, int code, const char *desc, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source=QORE_SOURCE_SOCKET)
send an HTTP response message on the socket
QoreSocket::isOpen
DLLEXPORT bool isOpen() const
returns true if the socket is open
QoreSocket::connectINET2
DLLEXPORT int connectINET2(const char *name, const char *service, int family=Q_AF_UNSPEC, int sock_type=Q_SOCK_STREAM, int protocol=0, int timeout_ms=-1, ExceptionSink *xsink=nullptr)
connects to an INET or INET6 socket by hostname and port number or service name and returns a status ...
QoreSocket::recv
DLLEXPORT int recv(int fd, qore_offset_t size, int timeout_ms)
receive data on the socket and write it to a file descriptor
QoreSocket::sendi4
DLLEXPORT int sendi4(int i, int timeout_ms, ExceptionSink *xsink)
sends a 4-byte (32bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::acceptSSL
DLLEXPORT QoreSocket * acceptSSL(int timeout_ms, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
accepts a new connection on a listening socket, negotiates an SSL connection, and returns a new QoreS...
QoreSocket::recvi1
DLLEXPORT int64 recvi1(int timeout_ms, char *val, ExceptionSink *xsink)
reads a 1-byte signed integer from the socket with a timeout value and returns the value read as an o...
QoreSocket::sendi4
DLLEXPORT int sendi4(int i)
sends a 4-byte (32bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::send
DLLEXPORT int send(const char *buf, size_t size, int timeout_ms, ExceptionSink *xsink)
sends binary data on a connected socket
QoreSocket::sendHTTPMessage
DLLEXPORT int sendHTTPMessage(const char *method, const char *path, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source=QORE_SOURCE_SOCKET)
send an HTTP request message on the socket
QoreSocket::sendi2
DLLEXPORT int sendi2(short i, int timeout_ms, ExceptionSink *xsink)
sends a 2-byte (16bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::recvi8
DLLEXPORT int recvi8(int timeout_ms, int64 *val)
reads an 8-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from ...
QoreSocket::getSSLCipherName
DLLEXPORT const char * getSSLCipherName() const
returns the name of the SSL Cipher for the currently-connected control connection,...
QoreSocket::accept
DLLEXPORT QoreSocket * accept(int timeout_ms, ExceptionSink *xsink)
accepts a new connection on a listening socket and returns a new QoreSocket object for the new connec...
QoreSocket::connectUNIX
DLLEXPORT int connectUNIX(const char *p, int socktype, int protocol=0, ExceptionSink *xsink=nullptr)
connects to a UNIX domain socket and returns a status code, Qore-language exceptions are raised in th...
QoreSocket::send
DLLEXPORT int send(int fd, qore_offset_t size=-1)
sends untranslated data from an open file descriptor
QoreSocket::recvu4LSB
DLLEXPORT int recvu4LSB(int timeout_ms, unsigned int *val)
reads a 4-byte unsigned integer in LSB (Most Significant Byte first, little endian) format from the s...
QoreSocket::send
DLLEXPORT int send(const QoreString *msg, ExceptionSink *xsink)
sends string data on a connected socket, converts the string encoding to the socket's encoding if nec...
QoreSocket::recvi2
DLLEXPORT int64 recvi2(int timeout_ms, short *val, ExceptionSink *xsink)
reads a 2-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from t...
QoreSocket::send
DLLEXPORT int send(const QoreString *msg, int timeout_ms, ExceptionSink *xsink)
sends string data on a connected socket, converts the string encoding to the socket's encoding if nec...
QoreSocket::recvu2
DLLEXPORT int64 recvu2(int timeout_ms, unsigned short *val, ExceptionSink *xsink)
reads a 2-byte unsigned integer in MSB (Most Significant Byte first, big endian, network) format from...
QoreSocket::recvu1
DLLEXPORT int recvu1(int timeout_ms, unsigned char *val)
reads a 1-byte unsigned integer from the socket with a timeout value and returns the value read as an...
QoreSocket::listen
DLLEXPORT int listen()
sets an open socket to the listening state
QoreSocket::recvi4
DLLEXPORT int recvi4(int timeout_ms, int *val)
reads a 4-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from t...
QoreSocket::readHTTPHeader
DLLEXPORT AbstractQoreNode * readHTTPHeader(int timeout_ms, int *prc, int source=QORE_SOURCE_SOCKET)
read and parse HTTP header, caller owns AbstractQoreNode reference count returned
QoreSocket::startConnect
DLLEXPORT AbstractPollState * startConnect(ExceptionSink *xsink, const char *name)
Starts a non-blocking connection to a socket and returns a status code.
QoreSocket::bindINET
DLLEXPORT int bindINET(const char *name, const char *service, bool reuseaddr=true, int family=Q_AF_UNSPEC, int socktype=Q_SOCK_STREAM, int protocol=0, ExceptionSink *xsink=nullptr)
binds an INET or INET6 TCP socket to a specific socket address
QoreSocket::setRecvTimeout
DLLEXPORT int setRecvTimeout(int ms)
set recv timeout in milliseconds
QoreSocket::sendi8
DLLEXPORT int sendi8(int64 i, int timeout_ms, ExceptionSink *xsink)
sends an 8-byte (64bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::getSSLCipherVersion
DLLEXPORT const char * getSSLCipherVersion() const
returns the version string of the SSL Cipher for the currently-connected control connection,...
QoreSocket::getSendTimeout
DLLEXPORT int getSendTimeout() const
get send timeout in milliseconds
QoreSocket::recvBinary
DLLEXPORT BinaryNode * recvBinary(qore_offset_t bufsize, int timeout_ms, ExceptionSink *xsink)
receive a certain number of bytes with a timeout value and return a BinaryNode, caller owns the refer...
QoreSocket::bind
DLLEXPORT int bind(int prt, bool reuseaddr)
binds to a TCP INET (ipv4 only) port on all interfaces and returns a status code
QoreSocket::sendHTTPResponse
DLLEXPORT int sendHTTPResponse(ExceptionSink *xsink, int code, const char *desc, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source, int timeout_ms)
send an HTTP response message on the socket
QoreSocket::recvu4
DLLEXPORT int64 recvu4(int timeout_ms, unsigned int *val, ExceptionSink *xsink)
reads a 4-byte unsigned integer in MSB (Most Significant Byte first, big endian, network) format from...
QoreSocket::send
DLLEXPORT int send(const QoreStringNode &msg, int timeout_ms, ExceptionSink *xsink)
sends string data on a connected socket, converts the string encoding to the socket's encoding if nec...
QoreSocket::sendHTTPResponse
DLLEXPORT int sendHTTPResponse(int code, const char *desc, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source=QORE_SOURCE_SOCKET)
send an HTTP response message on the socket
QoreSocket::readHTTPHeader
DLLEXPORT QoreHashNode * readHTTPHeader(ExceptionSink *xsink, QoreHashNode *info, int timeout_ms, int source=QORE_SOURCE_SOCKET)
read and parse HTTP header, caller owns QoreHashNode reference count returned
QoreSocket::connectINET2SSL
DLLEXPORT int connectINET2SSL(const char *name, const char *service, int family, int sock_type, int protocol, int timeout_ms, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink=nullptr)
connects to an INET or INET6 socket by hostname and port number or service name and returns a status ...
QoreSocket::sendi4LSB
DLLEXPORT int sendi4LSB(int i, int timeout_ms, ExceptionSink *xsink)
sends a 4-byte (32bit) binary integer in LSB (Least Significant Byte first, little endian) format thr...
QoreSocket::sendHTTPMessage
DLLEXPORT int sendHTTPMessage(ExceptionSink *xsink, QoreHashNode *info, const char *method, const char *path, const char *http_version, const QoreHashNode *headers, const void *data, size_t size, int source=QORE_SOURCE_SOCKET)
send an HTTP request message on the socket
QoreSocket::sendi1
DLLEXPORT int sendi1(char i, int timeout_ms, ExceptionSink *xsink)
sends a 1-byte binary integer data to a connected socket
QoreSocket::connectSSL
DLLEXPORT int connectSSL(const char *name, int timeout_ms, X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
connects to a socket, negotiates an SSL connection, and returns a status code, Qore-language exceptio...
QoreSocket::recvu2LSB
DLLEXPORT int64 recvu2LSB(int timeout_ms, unsigned short *val, ExceptionSink *xsink)
reads a 2-byte unsigned integer in LSB (Most Significant Byte first, little endian) format from the s...
QoreSocket::~QoreSocket
DLLEXPORT ~QoreSocket()
disconnects if necessary, frees all data, and destroys the socket
QoreSocket::getRemoteCertificate
DLLEXPORT QoreObject * getRemoteCertificate() const
returns a remote certificate if available
QoreSocket::sendi2
DLLEXPORT int sendi2(short i)
sends a 2-byte (16bit) binary integer in MSB (Most Significant Byte first, big endian,...
QoreSocket::getConnectionId
DLLEXPORT int64 getConnectionId() const
returns a connection ID to help identifying when new connections are made
QoreSocket::bindUNIX
DLLEXPORT int bindUNIX(const char *name, ExceptionSink *xsink=nullptr)
binds to a UNIX domain socket and returns a status code
QoreSocket::upgradeServerToSSL
DLLEXPORT int upgradeServerToSSL(X509 *cert, EVP_PKEY *pkey, ExceptionSink *xsink)
negotiates an SSL connection from the client side
QoreSocket::recvBinary
DLLEXPORT BinaryNode * recvBinary(qore_offset_t bufsize, int timeout_ms, int *prc)
receive a certain number of bytes with a timeout value and return a BinaryNode, caller owns the refer...
QoreSocket::bind
DLLEXPORT int bind(int family, const struct sockaddr *addr, int addr_size, int socktype=Q_SOCK_STREAM, int protocol=0)
binds an INET or INET6 TCP socket to a specific socket address
QoreSocket::sendi4LSB
DLLEXPORT int sendi4LSB(int i)
sends a 4-byte (32bit) binary integer in LSB (Least Significant Byte first, little endian) format thr...
QoreSocket::shutdown
DLLEXPORT int shutdown()
calls shutdown on the socket
QoreSocket::sendi8LSB
DLLEXPORT int sendi8LSB(int64 i)
sends an 8-byte (64bit) binary integer in LSB (Least Significant Byte first, little endian) format th...
QoreSocket::recvi4LSB
DLLEXPORT int64 recvi4LSB(int timeout_ms, int *val, ExceptionSink *xsink)
reads a 4-byte signed integer in LSB (Most Significant Byte first, little endian) format from the soc...
QoreSocket::recvi4
DLLEXPORT int64 recvi4(int timeout_ms, int *val, ExceptionSink *xsink)
reads a 4-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from t...
QoreSocket::getSocketInfo
DLLEXPORT QoreHashNode * getSocketInfo(ExceptionSink *xsink, bool host_lookup) const
returns information for the current socket; the socket must be open
QoreSocket::send
DLLEXPORT int send(const char *buf, size_t size, ExceptionSink *xsink)
sends binary data on a connected socket
QoreSocket::sendi2LSB
DLLEXPORT int sendi2LSB(short i, int timeout_ms, ExceptionSink *xsink)
sends a 2-byte (16bit) binary integer in LSB (Least Significant Byte first, little endian) format thr...
QoreSocket::readHTTPChunkedBodyBinary
DLLEXPORT QoreHashNode * readHTTPChunkedBodyBinary(int timeout_ms, ExceptionSink *xsink, int source=QORE_SOURCE_SOCKET)
receive a binary message in HTTP chunked transfer encoding, caller owns QoreHashNode reference count ...
QoreSocket::connect
DLLEXPORT int connect(const char *name, int timeout_ms, ExceptionSink *xsink=nullptr)
connects to a socket and returns a status code, Qore-language exceptions are raised in the case of an...
QoreSocket::recvi2
DLLEXPORT int recvi2(int timeout_ms, short *val)
reads a 2-byte signed integer in MSB (Most Significant Byte first, big endian, network) format from t...
QoreString
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
QoreStringNode
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
ResolvedCallReferenceNode
base class for resolved call references
Definition: CallReferenceNode.h:109
SocketSource
a helper class for getting socket origination information
Definition: QoreSocket.h:74
SocketSource::getAddress
DLLEXPORT const char * getAddress() const
returns the host address string as a C string
SocketSource::~SocketSource
DLLEXPORT ~SocketSource()
destroys the object and frees all memory
SocketSource::SocketSource
DLLEXPORT SocketSource()
creates an empty object
SocketSource::getHostName
DLLEXPORT const char * getHostName() const
returns the hostname string as a C string
SocketSource::takeHostName
DLLEXPORT QoreStringNode * takeHostName()
returns the hostname string field and leaves the object's hostname field empty; the caller owns the Q...
SocketSource::takeAddress
DLLEXPORT QoreStringNode * takeAddress()
returns the host address string field and leaves the object's host address field empty; the caller ow...
Q_AF_UNSPEC
#define Q_AF_UNSPEC
cross-platform define for AF_UNSPEC
Definition: common.h:58
Q_SOCK_STREAM
#define Q_SOCK_STREAM
platform-independent define for SOCK_STREAM
Definition: common.h:67
qore_offset_t
intptr_t qore_offset_t
used for offsets that could be negative
Definition: common.h:76
int64
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276