QC_Socket.dox.h
namespace Qore {
class Socket {
public:
Socket accept();
public:
*Socket accept(timeout timeout_ms);
public:
acceptAllCertificates(bool accept_all = True);
public:
Socket acceptSSL();
public:
*Socket acceptSSL(timeout timeout_ms);
public:
int bind(string str, softbool reuseaddr = False);
public:
int bind(int port, softbool reuseaddr = False);
public:
nothing bindINET(*string iface, *softstring service, softbool reuseaddr = False, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
nothing bindUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
clearStats();
public:
nothing clearWarningQueue();
public:
int close();
public:
nothing connect(string target, timeout timeout_ms = -1);
public:
nothing connectINET(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
nothing connectINETSSL(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
nothing connectSSL(string target, timeout timeout_ms = -1);
public:
nothing connectUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
nothing connectUNIXSSL(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
public:
constructor();
public:
copy();
public:
bool getAcceptAllCertificates();
public:
string getCharset();
public:
string getEncoding();
public:
bool getNoDelay();
public:
hash getPeerInfo(bool host_lookup = True);
public:
int getPort();
public:
int getRecvTimeout();
public:
*string getSSLCipherName();
public:
*string getSSLCipherVersion();
public:
int getSendTimeout();
public:
int getSocket();
public:
hash getSocketInfo(bool host_lookup = True);
public:
int getSslVerifyMode();
public:
hash getUsageInfo();
public:
bool isDataAvailable(timeout timeout_ms = 0);
public:
bool isOpen();
public:
bool isSecure();
public:
bool isWriteFinished(timeout timeout_ms = 0);
public:
int listen(int backlog = 20);
public:
bool pendingHttpChunkedBody();
public:
hash readHTTPChunkedBody(timeout timeout_ms = -1);
public:
hash readHTTPChunkedBodyBinary(timeout timeout_ms = -1);
public:
readHTTPChunkedBodyBinaryWithCallback(code rcb, timeout timeout_ms = -1);
public:
hash readHTTPChunkedBodyToOutputStream(Qore::OutputStream os, timeout timeout_ms = -1);
public:
readHTTPChunkedBodyWithCallback(code rcb, timeout timeout_ms = -1);
public:
hash readHTTPHeader(timeout timeout_ms = -1, *reference<hash> info);
public:
string readHTTPHeaderString(timeout timeout_ms = -1);
public:
string recv(softint size = 0, timeout timeout_ms = -1);
public:
binary recvBinary(softint size = 0, timeout timeout_ms = -1);
public:
nothing recvToOutputStream(Qore::OutputStream os, softint size = -1, timeout timeout_ms = -1);
public:
int recvi1(timeout timeout_ms = -1);
public:
int recvi2(timeout timeout_ms = -1);
public:
int recvi2LSB(timeout timeout_ms = -1);
public:
int recvi4(timeout timeout_ms = -1);
public:
int recvi4LSB(timeout timeout_ms = -1);
public:
int recvi8(timeout timeout_ms = -1);
public:
int recvi8LSB(timeout timeout_ms = -1);
public:
int recvu1(timeout timeout_ms = -1);
public:
int recvu2(timeout timeout_ms = -1);
public:
int recvu2LSB(timeout timeout_ms = -1);
public:
int recvu4(timeout timeout_ms = -1);
public:
int recvu4LSB(timeout timeout_ms = -1);
public:
int send(binary bin, timeout timeout_ms = -1);
public:
int send(string str, timeout timeout_ms = -1);
public:
nothing send2(binary bin, timeout timeout_ms = -1);
public:
nothing send2(string str, timeout timeout_ms = -1);
public:
int sendBinary(string str, timeout timeout_ms = -1);
public:
int sendBinary(binary bin, timeout timeout_ms = -1);
public:
nothing sendBinary2(string str, timeout timeout_ms = -1);
public:
nothing sendBinary2(binary bin, timeout timeout_ms = -1);
public:
nothing sendFromInputStream(Qore::InputStream is, softint size = -1, timeout timeout_ms = -1);
public:
nothing sendHTTPChunkedBodyFromInputStream(Qore::InputStream is, int max_chunk_size = 4096, timeout timeout_ms = -1, *code tcb);
public:
nothing sendHTTPChunkedBodyTrailer(*hash trailer, timeout timeout_ms = -1);
public:
nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference<hash> info, timeout timeout_ms = -1);
public:
nothing sendHTTPMessage(string method, string path, string http_version, hash headers, binary body, *reference<hash> info, timeout timeout_ms = -1);
public:
nothing sendHTTPMessageWithCallback(code scb, string method, string path, string http_version, hash headers, *reference<hash> info, timeout timeout_ms = -1);
public:
nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms = -1);
public:
nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, binary body, timeout timeout_ms = -1);
public:
nothing sendHTTPResponseWithCallback(code scb, softint status_code, string status_desc, string http_version, hash headers, timeout timeout_ms = -1);
public:
int sendi1(softint i = 0, timeout timeout_ms = -1);
public:
int sendi2(softint i = 0, timeout timeout_ms = -1);
public:
int sendi2LSB(softint i = 0, timeout timeout_ms = -1);
public:
int sendi4(softint i = 0, timeout timeout_ms = -1);
public:
int sendi4LSB(softint i = 0, timeout timeout_ms = -1);
public:
int sendi8(softint i = 0, timeout timeout_ms = -1);
public:
int sendi8LSB(softint i = 0, timeout timeout_ms = -1);
public:
nothing setCertificate(SSLCertificate cert);
public:
nothing setCertificate(string cert_pem);
public:
nothing setCertificate(binary cert_der);
public:
nothing setCharset(string encoding);
public:
nothing setEncoding(string encoding);
public:
nothing setEventQueue();
public:
nothing setEventQueue(Queue queue);
public:
int setNoDelay(bool nd = True);
public:
nothing setPrivateKey(SSLPrivateKey key);
public:
nothing setPrivateKey(string key_pem, *string pass);
public:
nothing setPrivateKey(binary key_der);
public:
int setRecvTimeout(timeout timeout_ms);
public:
int setSendTimeout(timeout timeout_ms);
public:
setSslVerifyMode(int mode);
public:
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
public:
int shutdown();
public:
nothing shutdownSSL();
public:
nothing upgradeClientToSSL(timeout timeout_ms = -1);
public:
nothing upgradeServerToSSL(timeout timeout_ms = -1);
public:
*string verifyPeerCertificate();
};
const SSL_VERIFY_CLIENT_ONCE = SSL_VERIFY_CLIENT_ONCE;
const SSL_VERIFY_FAIL_IF_NO_PEER_CERT = SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
const SSL_VERIFY_NONE = SSL_VERIFY_NONE;
const SSL_VERIFY_PEER = SSL_VERIFY_PEER;
const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH = "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH";
const X509_V_ERR_AKID_SKID_MISMATCH = "X509_V_ERR_AKID_SKID_MISMATCH";
const X509_V_ERR_APPLICATION_VERIFICATION = "X509_V_ERR_APPLICATION_VERIFICATION";
const X509_V_ERR_CERT_CHAIN_TOO_LONG = "X509_V_ERR_CERT_CHAIN_TOO_LONG";
const X509_V_ERR_CERT_HAS_EXPIRED = "X509_V_ERR_CERT_HAS_EXPIRED";
const X509_V_ERR_CERT_NOT_YET_VALID = "X509_V_ERR_CERT_NOT_YET_VALID";
const X509_V_ERR_CERT_REJECTED = "X509_V_ERR_CERT_REJECTED";
const X509_V_ERR_CERT_REVOKED = "X509_V_ERR_CERT_REVOKED";
const X509_V_ERR_CERT_SIGNATURE_FAILURE = "X509_V_ERR_CERT_SIGNATURE_FAILURE";
const X509_V_ERR_CERT_UNTRUSTED = "X509_V_ERR_CERT_UNTRUSTED";
const X509_V_ERR_CRL_HAS_EXPIRED = "X509_V_ERR_CRL_HAS_EXPIRED";
const X509_V_ERR_CRL_NOT_YET_VALID = "X509_V_ERR_CRL_NOT_YET_VALID";
const X509_V_ERR_CRL_SIGNATURE_FAILURE = "X509_V_ERR_CRL_SIGNATURE_FAILURE";
const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT";
const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD";
const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD";
const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD";
const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD";
const X509_V_ERR_INVALID_CA = "X509_V_ERR_INVALID_CA";
const X509_V_ERR_INVALID_PURPOSE = "X509_V_ERR_INVALID_PURPOSE";
const X509_V_ERR_KEYUSAGE_NO_CERTSIGN = "X509_V_ERR_KEYUSAGE_NO_CERTSIGN";
const X509_V_ERR_OUT_OF_MEM = "X509_V_ERR_OUT_OF_MEM";
const X509_V_ERR_PATH_LENGTH_EXCEEDED = "X509_V_ERR_PATH_LENGTH_EXCEEDED";
const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN = "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN";
const X509_V_ERR_SUBJECT_ISSUER_MISMATCH = "X509_V_ERR_SUBJECT_ISSUER_MISMATCH";
const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY";
const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE";
const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE";
const X509_V_ERR_UNABLE_TO_GET_CRL = "X509_V_ERR_UNABLE_TO_GET_CRL";
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT";
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE";
const X509_V_OK = "X509_V_OK";
const X509_VerificationReasons = (
"X509_V_OK": "OK",
"X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT": "Unable to get issuer certificate",
"X509_V_ERR_UNABLE_TO_GET_CRL": "Unable to get certificate CRL",
"X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE": "Unable to decrypt certificate's signature. This means that the actual signature value could not be determined rather than it not matching the expected value; this is only meaningful for RSA",
"X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE": "Unable to decrypt CRL's signature",
"X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY": "Unable to decode issuer public key (SubjectPublicKeyInfo)",
"X509_V_ERR_CERT_SIGNATURE_FAILURE": "Certificate signature failure; the signature of the certificate is invalid",
"X509_V_ERR_CRL_SIGNATURE_FAILURE": "CRL signature failure; the signature of the certificate is invalid",
"X509_V_ERR_CERT_NOT_YET_VALID": "Certificate is not yet valid",
"X509_V_ERR_CERT_HAS_EXPIRED": "Certificate has expired",
"X509_V_ERR_CRL_NOT_YET_VALID": "CRL is not yet valid",
"X509_V_ERR_CRL_HAS_EXPIRED": "CRL has expired",
"X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD": "Format error in certificate's notBefore field (invalid time)",
"X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD": "Format error in certificate's notAfter field (invalid time)",
"X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD": "Format error in CRL's lastUpdate field (invalid time)",
"X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD": "Format error in CRL's nextUpdate field (invalid time)",
"X509_V_ERR_OUT_OF_MEM": "Out of memory error",
"X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT": "Certificate is self-signed and cannot be found in the trusted list",
"X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN": "Self signed certificate in certificate chain",
"X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY": "Unable to get local issuer certificate. This normally means the list of trusted certificates is not complete",
"X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE": "Unable to verify the first certificate",
"X509_V_ERR_CERT_CHAIN_TOO_LONG": "Certificate chain too long",
"X509_V_ERR_CERT_REVOKED": "Certificate has been revoked",
"X509_V_ERR_INVALID_CA": "Invalid CA certificate",
"X509_V_ERR_PATH_LENGTH_EXCEEDED": "The basicConstraints pathlength parameter has been exceeded",
"X509_V_ERR_INVALID_PURPOSE": "The certificate cannot be used for the specified purpose",
"X509_V_ERR_CERT_UNTRUSTED": "Root CA is not marked as trusted for the specified purpose",
"X509_V_ERR_CERT_REJECTED": "Root CA is marked to reject the specified purpose",
"X509_V_ERR_SUBJECT_ISSUER_MISMATCH": "The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate",
"X509_V_ERR_AKID_SKID_MISMATCH": "The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier of the current certificate",
"X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH": "Issuer name and serial number of candidate certificate do not match the authority key identifier of the current certificate",
"X509_V_ERR_KEYUSAGE_NO_CERTSIGN": "The keyUsage extension does not permit certificate signing",
"X509_V_ERR_APPLICATION_VERIFICATION": "Verification failure",
);
const AFMap = qore(get_network_address_family_map());
const AFStrMap = (
"AF_INET": AF_INET,
"AF_INET6": AF_INET6,
"AF_UNIX": AF_UNIX,
"AF_LOCAL": AF_UNIX,
"AF_UNSPEC": AF_UNSPEC,
);
const AF_INET = AF_INET;
const AF_INET6 = AF_INET6;
const AF_LOCAL = AF_LOCAL;
const AF_UNIX = AF_UNIX;
const AF_UNSPEC = AF_UNSPEC;
const AI_ADDRCONFIG = AI_ADDRCONFIG;
const AI_ALL = AI_ALL;
const AI_CANONNAME = AI_CANONNAME;
const AI_NUMERICHOST = AI_NUMERICHOST;
const AI_NUMERICSERV = AI_NUMERICSERV;
const AI_PASSIVE = AI_PASSIVE;
const AI_V4MAPPED = AI_V4MAPPED;
const IPPROTO_TCP = IPPROTO_TCP;
const IPPROTO_UDP = IPPROTO_UDP;
const SOCK_DGRAM = SOCK_DGRAM;
const SOCK_RAW = SOCK_RAW;
const SOCK_STREAM = SOCK_STREAM;
};
Qore::Socket::shutdown
int shutdown()
Ensures that a socket will be closed even if the file descriptor is shared with other processes (for ...
Qore::Socket::recvi1
int recvi1(timeout timeout_ms=-1)
Receives a 1-byte signed integer from the socket.
Qore::SSL_VERIFY_NONE
const SSL_VERIFY_NONE
Do not verify the peer&#39;s certificate.
Definition: QC_Socket.dox.h:2465
Qore::Socket::recv
string recv(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a string tagged with the Socket&#39;s character encoding...
Qore::Socket::isWriteFinished
bool isWriteFinished(timeout timeout_ms=0)
Returns True or False depending on whether all the data has been written to the socket.
Qore::Socket::connectUNIX
nothing connectUNIX(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to a UNIX domain socket file.
Qore::X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
Certificate is self-signed and cannot be found in the trusted list.
Definition: QC_Socket.dox.h:2519
Qore::AF_UNSPEC
const AF_UNSPEC
unspecified address family
Definition: QC_Socket.dox.h:2619
Qore::SOCK_RAW
const SOCK_RAW
raw socket interface, only available to the superuser, untested
Definition: QC_Socket.dox.h:2671
Qore::AI_NUMERICHOST
const AI_NUMERICHOST
If this bit is set, then the host is assumed to be an address and no hostname lookup will be preforme...
Definition: QC_Socket.dox.h:2634
Qore::X509_V_ERR_CERT_NOT_YET_VALID
const X509_V_ERR_CERT_NOT_YET_VALID
Certificate is not yet valid.
Definition: QC_Socket.dox.h:2503
Qore::X509_V_ERR_OUT_OF_MEM
const X509_V_ERR_OUT_OF_MEM
Out of memory error.
Definition: QC_Socket.dox.h:2535
Qore::X509_V_ERR_PATH_LENGTH_EXCEEDED
const X509_V_ERR_PATH_LENGTH_EXCEEDED
The basicConstraints pathlength parameter has been exceeded.
Definition: QC_Socket.dox.h:2537
Qore::AFMap
const AFMap
mapping from Network Address Family Constants to string codes
Definition: QC_Socket.dox.h:2601
Qore::Socket::connectINETSSL
nothing connectINETSSL(string host, softstring service, timeout timeout_ms=-1, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given host and port and attempts to establish a TLS/SSL connection; accepts an option...
Qore::X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
Unable to decrypt certificate&#39;s signature. This means that the actual signature value could not be de...
Definition: QC_Socket.dox.h:2545
Qore::X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
Format error in CRL&#39;s lastUpdate field (invalid time)
Definition: QC_Socket.dox.h:2525
Qore::X509_V_ERR_APPLICATION_VERIFICATION
const X509_V_ERR_APPLICATION_VERIFICATION
Verification failure.
Definition: QC_Socket.dox.h:2497
Qore::Socket::bind
int bind(string str, softbool reuseaddr=False)
Opens and binds the socket to a port, interface and port (if the bind_to string has a format "host:po...
Qore::AI_ALL
const AI_ALL
If this bit is set along with AI_V4MAPPED then all matching IPv6 and IPv4 addresses are returned...
Definition: QC_Socket.dox.h:2630
Qore::Socket::sendi4
int sendi4(softint i=0, timeout timeout_ms=-1)
Sends a 4-byte (32-bit) integer in big-endian format (network byte order) over the socket...
Qore::Socket::readHTTPHeaderString
string readHTTPHeaderString(timeout timeout_ms=-1)
Retuns a string representing the data in the HTTP header read (reads until "\r\n\r\n") ...
Qore::Socket::upgradeServerToSSL
nothing upgradeServerToSSL(timeout timeout_ms=-1)
Upgrades a server socket connection to a TLS/SSL connection.
Qore::Socket
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:122
Qore::X509_VerificationReasons
const X509_VerificationReasons
maps from varification strings to verification code descriptions
Definition: QC_Socket.dox.h:2559
Qore::Socket::getSendTimeout
int getSendTimeout()
Returns the send timeout socket option value as an integer in milliseconds.
Qore::X509_V_ERR_CERT_UNTRUSTED
const X509_V_ERR_CERT_UNTRUSTED
Root CA is not marked as trusted for the specified purpose.
Definition: QC_Socket.dox.h:2511
Qore::Socket::getSocketInfo
hash getSocketInfo(bool host_lookup=True)
Returns information about the local socket as a hash.
Qore::X509_V_ERR_INVALID_CA
const X509_V_ERR_INVALID_CA
Invalid CA certificate.
Definition: QC_Socket.dox.h:2529
Qore::Socket::recvi8LSB
int recvi8LSB(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in little-endian format from the socket.
Qore::Socket::bindUNIX
nothing bindUNIX(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Opens and binds the socket to the given UNIX domain socket file as given by the filename argument...
Qore::Socket::setPrivateKey
nothing setPrivateKey(SSLPrivateKey key)
Sets the private key to use for negotiating encrypted connections along with the X.509 certificate.
Qore::Socket::setCertificate
nothing setCertificate(SSLCertificate cert)
Sets the X.509 certificate to use for negotiating encrypted connections.
Qore::Socket::getCharset
string getCharset()
Returns the character encoding for the socket.
Qore::Socket::recvi2LSB
int recvi2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in little-endian format from the socket.
Qore::True
const True
logical True
Definition: qc_qore.dox.h:94
Qore::Socket::connect
nothing connect(string target, timeout timeout_ms=-1)
Connects to a remote port (if the string has a format "host:port") or UNIX domain socket file with an...
Qore::AI_NUMERICSERV
const AI_NUMERICSERV
If this bit is set, then the service is assumed to be a numeric port string, and no service lookup wi...
Definition: QC_Socket.dox.h:2639
Qore::Socket::getUsageInfo
hash getUsageInfo()
Returns performance statistics for the socket.
Qore::Socket::readHTTPChunkedBodyBinary
hash readHTTPChunkedBodyBinary(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::send
int send(binary bin, timeout timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
Qore::Socket::readHTTPChunkedBodyBinaryWithCallback
readHTTPChunkedBodyBinaryWithCallback(code rcb, timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::recvi2
int recvi2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::send2
nothing send2(binary bin, timeout timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)
Qore::SSL_VERIFY_PEER
const SSL_VERIFY_PEER
Verify the peer&#39;s certificate.
Definition: QC_Socket.dox.h:2482
Qore::Socket::setWarningQueue
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
Qore::X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
Unable to get issuer certificate.
Definition: QC_Socket.dox.h:2551
Qore::Socket::readHTTPHeader
hash readHTTPHeader(timeout timeout_ms=-1, *reference< hash > info)
Retuns a hash representing the data in the HTTP header read, or, if the data cannot be parsed as an H...
Qore::Socket::getSSLCipherVersion
*string getSSLCipherVersion()
Returns the version string of the cipher for an encrypted connection or NOTHING if a secure connectio...
Qore::Socket::readHTTPChunkedBody
hash readHTTPChunkedBody(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::setSendTimeout
int setSendTimeout(timeout timeout_ms)
sets the send timeout as a socket option
Qore::Socket::recvu4
int recvu4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in big-endian format (network byte order) from the socket...
Qore::Socket::recvu2LSB
int recvu2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in little-endian format from the socket.
Qore::Socket::upgradeClientToSSL
nothing upgradeClientToSSL(timeout timeout_ms=-1)
Upgrades a client socket connection to a TLS/SSL connection.
Qore::False
const False
logical False
Definition: qc_qore.dox.h:92
Qore::Socket::getEncoding
string getEncoding()
Returns the character encoding for the socket.
Qore::Socket::recvi4LSB
int recvi4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in little-endian format from the socket.
Qore::Socket::sendi8LSB
int sendi8LSB(softint i=0, timeout timeout_ms=-1)
Sends an 8-byte (64-bit) integer in little-endian format over the socket.
Qore::Socket::recvi4
int recvi4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::sendHTTPChunkedBodyFromInputStream
nothing sendHTTPChunkedBodyFromInputStream(Qore::InputStream is, int max_chunk_size=4096, timeout timeout_ms=-1, *code tcb)
Sends an HTTP message body in chunked transfer encoding.
Qore::Socket::listen
int listen(int backlog=20)
Listens for connections on a bound socket; sets the socket in a listening state.
Qore::Socket::sendHTTPResponse
nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms=-1)
Sends an HTTP response with user-defined headers given as a hash and an optional message body...
Qore::AFStrMap
const AFStrMap
mapping from network address family string codes to Network Address Family Constants ...
Definition: QC_Socket.dox.h:2603
Qore::X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
Unable to verify the first certificate.
Definition: QC_Socket.dox.h:2555
Qore::X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
Unable to decode issuer public key (SubjectPublicKeyInfo)
Definition: QC_Socket.dox.h:2543
Qore::Socket::sendi2LSB
int sendi2LSB(softint i=0, timeout timeout_ms=-1)
Sends a 2-byte (16-bit) integer in little-endian format over the socket.
Qore::Socket::getSslVerifyMode
int getSslVerifyMode()
returns the current SSL verification mode
Qore::Socket::acceptSSL
Socket acceptSSL()
Accepts connections on a listening socket and attempts to negotiate a TLS/SSL connection.
Qore::X509_V_ERR_CRL_NOT_YET_VALID
const X509_V_ERR_CRL_NOT_YET_VALID
CRL is not yet valid.
Definition: QC_Socket.dox.h:2515
Qore::X509_V_ERR_AKID_SKID_MISMATCH
const X509_V_ERR_AKID_SKID_MISMATCH
The current candidate issuer certificate was rejected because its subject key identifier was present ...
Definition: QC_Socket.dox.h:2495
Qore::X509_V_ERR_INVALID_PURPOSE
const X509_V_ERR_INVALID_PURPOSE
The certificate cannot be used for the specified purpose.
Definition: QC_Socket.dox.h:2531
Qore::Socket::setRecvTimeout
int setRecvTimeout(timeout timeout_ms)
sets the receive timeout as a socket option
Qore::Socket::getSocket
int getSocket()
Returns the socket file descriptor number.
Qore::X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
Format error in CRL&#39;s nextUpdate field (invalid time)
Definition: QC_Socket.dox.h:2527
Qore::Socket::verifyPeerCertificate
*string verifyPeerCertificate()
Returns a string code giving the result of verifying the remote certificate or NOTHING if an encrypte...
Qore::SSL_VERIFY_FAIL_IF_NO_PEER_CERT
const SSL_VERIFY_FAIL_IF_NO_PEER_CERT
Require a client certificate in server mode.
Definition: QC_Socket.dox.h:2456
Qore::Socket::getNoDelay
bool getNoDelay()
Returns the TCP_NODELAY setting for the socket.
Qore::Socket::recvi8
int recvi8(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::connectSSL
nothing connectSSL(string target, timeout timeout_ms=-1)
Connects to a remote socket and attempts to establish a TLS/SSL connection; accepts an optional timeo...
Qore::X509_V_ERR_UNABLE_TO_GET_CRL
const X509_V_ERR_UNABLE_TO_GET_CRL
Unable to get certificate CRL.
Definition: QC_Socket.dox.h:2549
Qore::X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
Format error in certificate&#39;s notAfter field (invalid time)
Definition: QC_Socket.dox.h:2521
Qore::X509_V_ERR_KEYUSAGE_NO_CERTSIGN
const X509_V_ERR_KEYUSAGE_NO_CERTSIGN
The keyUsage extension does not permit certificate signing.
Definition: QC_Socket.dox.h:2533
Qore::X509_V_ERR_CERT_REJECTED
const X509_V_ERR_CERT_REJECTED
Root CA is marked to reject the specified purpose.
Definition: QC_Socket.dox.h:2505
Qore::Socket::getAcceptAllCertificates
bool getAcceptAllCertificates()
returns the current value of the "accept all certificates" flag
Qore::Socket::recvBinary
binary recvBinary(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a binary object.
Qore::Socket::sendi1
int sendi1(softint i=0, timeout timeout_ms=-1)
Sends a 1-byte integer over the socket.
Qore::SSLPrivateKey
This class implements a container for private key data.
Definition: QC_SSLPrivateKey.dox.h:5
Qore::Socket::readHTTPChunkedBodyToOutputStream
hash readHTTPChunkedBodyToOutputStream(Qore::OutputStream os, timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding, writes it in an OutputStream and ret...
Qore::Socket::bindINET
nothing bindINET(*string iface, *softstring service, softbool reuseaddr=False, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Opens and binds the socket to the given IPv4 or IPv6 interface (or if no interface is given...
Qore::AF_INET6
const AF_INET6
IPv6 address family.
Definition: QC_Socket.dox.h:2613
Qore::AF_INET
const AF_INET
IPv4 address family.
Definition: QC_Socket.dox.h:2611
Qore::Socket::clearWarningQueue
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
Qore::OutputStream
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:12
Qore::IPPROTO_UDP
const IPPROTO_UDP
for the UDP protocol
Definition: QC_Socket.dox.h:2661
Qore::Socket::pendingHttpChunkedBody
bool pendingHttpChunkedBody()
returns True if the socket is still connected, and a HTTP header was read indicating chunked transfer...
Qore::X509_V_ERR_CERT_SIGNATURE_FAILURE
const X509_V_ERR_CERT_SIGNATURE_FAILURE
Certificate signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:2509
Qore::Socket::constructor
constructor()
Creates the socket object.
Qore::Socket::sendi4LSB
int sendi4LSB(softint i=0, timeout timeout_ms=-1)
Sends a 4-byte (32-bit) integer in little-endian format over the socket.
Qore::X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
Unable to get local issuer certificate. This normally means the list of trusted certificates is not c...
Definition: QC_Socket.dox.h:2553
Qore::X509_V_ERR_CERT_REVOKED
const X509_V_ERR_CERT_REVOKED
Certificate has been revoked.
Definition: QC_Socket.dox.h:2507
Qore::Socket::sendHTTPChunkedBodyTrailer
nothing sendHTTPChunkedBodyTrailer(*hash trailer, timeout timeout_ms=-1)
Sends the trialer of an HTTP message body in chunked transfer encoding.
Qore::X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
Issuer name and serial number of candidate certificate do not match the authority key identifier of t...
Definition: QC_Socket.dox.h:2493
Qore::AF_UNIX
const AF_UNIX
UNIX domain address family (UNIX socket files)
Definition: QC_Socket.dox.h:2617
Qore::Socket::recvu4LSB
int recvu4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in little-endian format from the socket.
Qore::IPPROTO_TCP
const IPPROTO_TCP
for the TCP protocol
Definition: QC_Socket.dox.h:2659
Qore::X509_V_OK
const X509_V_OK
Verification OK.
Definition: QC_Socket.dox.h:2557
Qore::Socket::getRecvTimeout
int getRecvTimeout()
Returns the receive timeout socket option value as an integer in milliseconds.
Qore::AF_LOCAL
const AF_LOCAL
POSIX synonym for AF_UNIX.
Definition: QC_Socket.dox.h:2615
Qore::AI_V4MAPPED
const AI_V4MAPPED
If this bit is set, getaddrinfo() will return IPv4-mapped IPv6 addresses on finding no matching IPv6 ...
Definition: QC_Socket.dox.h:2651
Qore::X509_V_ERR_SUBJECT_ISSUER_MISMATCH
const X509_V_ERR_SUBJECT_ISSUER_MISMATCH
The current candidate issuer certificate was rejected because its subject name did not match the issu...
Definition: QC_Socket.dox.h:2541
Qore::Socket::sendBinary2
nothing sendBinary2(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket&#39;s encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
Qore::Socket::sendi8
int sendi8(softint i=0, timeout timeout_ms=-1)
Sends an 8-byte (64-bit) integer in big-endian format (network byte order) over the socket...
Qore::SSLCertificate
SSLCertificate objects allow Qore code to work with X.509 certificate data.
Definition: QC_SSLCertificate.dox.h:5
Qore::Socket::getPeerInfo
hash getPeerInfo(bool host_lookup=True)
Returns a hash of information about the remote end for connected sockets.
Qore::Socket::sendi2
int sendi2(softint i=0, timeout timeout_ms=-1)
Sends a 2-byte (16-bit) integer in big-endian format (network byte order) over the socket...
Qore::Socket::acceptAllCertificates
acceptAllCertificates(bool accept_all=True)
with peer verification enabled, all certificates are accepted regardless of the validity of the Certi...
Qore::X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
Format error in certificate&#39;s notBefore field (invalid time)
Definition: QC_Socket.dox.h:2523
Qore::Socket::getSSLCipherName
*string getSSLCipherName()
Returns the name of the cipher for an encrypted connection or NOTHING if a secure connection has not ...
Qore::Socket::copy
copy()
Creates a new Socket object, not based on the source being copied.
Qore::Socket::connectUNIXSSL
nothing connectUNIXSSL(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given UNIX domain socket file and attempts to establish a TLS/SSL connection...
Qore::X509_V_ERR_CRL_SIGNATURE_FAILURE
const X509_V_ERR_CRL_SIGNATURE_FAILURE
CRL signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:2517
Qore::Socket::isSecure
bool isSecure()
Returns True if the connection is a secure TLS/SSL connection.
Qore::Socket::isOpen
bool isOpen()
Returns True if the socket is open.
Qore::X509_V_ERR_CERT_HAS_EXPIRED
const X509_V_ERR_CERT_HAS_EXPIRED
Certificate has expired.
Definition: QC_Socket.dox.h:2501
Qore::AI_CANONNAME
const AI_CANONNAME
If this bit is set, then getaddrinfo() will return the canonical name of the hostname in the "canonna...
Definition: QC_Socket.dox.h:2632
Qore
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:2
Qore::Socket::clearStats
clearStats()
Clears performance statistics.
Qore::Socket::shutdownSSL
nothing shutdownSSL()
Shuts down the SSL connection on a secure connection.
Qore::InputStream
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:12
Qore::Socket::sendFromInputStream
nothing sendFromInputStream(Qore::InputStream is, softint size=-1, timeout timeout_ms=-1)
Reads data from an InputStream and sends the bytes over the socket.
Qore::Socket::isDataAvailable
bool isDataAvailable(timeout timeout_ms=0)
Returns True or False depending on whether there is data to be read on the socket.
Qore::hash
hash hash(object obj)
Returns a hash of an object&#39;s members.
Qore::SSL_VERIFY_CLIENT_ONCE
const SSL_VERIFY_CLIENT_ONCE
Only request a client certificate once in server mode.
Definition: QC_Socket.dox.h:2444
Qore::SOCK_STREAM
const SOCK_STREAM
for sequenced, reliable, two-way connection-based byte streams (the default)
Definition: QC_Socket.dox.h:2673
Qore::AI_ADDRCONFIG
const AI_ADDRCONFIG
if this bit is set, addresses of each family are returned only if they are configured on the system ...
Definition: QC_Socket.dox.h:2628
Qore::Socket::setCharset
nothing setCharset(string encoding)
Sets the character encoding for the socket.
Qore::Socket::setNoDelay
int setNoDelay(bool nd=True)
Sets the boolean TCP_NODELAY setting for the socket.
Qore::Socket::sendBinary
int sendBinary(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket&#39;s encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
Qore::X509_V_ERR_CERT_CHAIN_TOO_LONG
const X509_V_ERR_CERT_CHAIN_TOO_LONG
Certificate chain too long.
Definition: QC_Socket.dox.h:2499
Qore::Socket::close
int close()
Closes an open socket.
Qore::Socket::recvu2
int recvu2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in big-endian format (network byte order) from the socket...
Qore::Socket::setEncoding
nothing setEncoding(string encoding)
Sets the character encoding for the socket.
Qore::X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
Self signed certificate in certificate chain.
Definition: QC_Socket.dox.h:2539
Qore::X509_V_ERR_CRL_HAS_EXPIRED
const X509_V_ERR_CRL_HAS_EXPIRED
CRL has expired.
Definition: QC_Socket.dox.h:2513
Qore::Socket::sendHTTPResponseWithCallback
nothing sendHTTPResponseWithCallback(code scb, softint status_code, string status_desc, string http_version, hash headers, timeout timeout_ms=-1)
Sends an HTTP response with user-defined headers given as a hash and a message body as literal binary...
Qore::Socket::accept
Socket accept()
Accepts connections on a listening socket.
Qore::AI_PASSIVE
const AI_PASSIVE
If this bit is set, then the returned information should be usable for a call to Socket::bind() ...
Definition: QC_Socket.dox.h:2647
Qore::Socket::getPort
int getPort()
Returns the port number of the socket for INET sockets.
Qore::Socket::setEventQueue
nothing setEventQueue()
Removes any Queue object from the Socket object so that socket events are no longer added to the Queu...
Qore::Socket::sendHTTPMessageWithCallback
nothing sendHTTPMessageWithCallback(code scb, string method, string path, string http_version, hash headers, *reference< hash > info, timeout timeout_ms=-1)
Sends an HTTP message with a method and user-defined headers given as a hash and an optional message ...
Qore::Socket::recvu1
int recvu1(timeout timeout_ms=-1)
Receives a 1-byte unsigned integer from the socket.
Qore::Socket::connectINET
nothing connectINET(string host, softstring service, timeout timeout_ms=-1, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given host and port with an optional timeout value with a millisecond resolution...
Qore::SOCK_DGRAM
const SOCK_DGRAM
for datagrams (connectionless, unreliable messages of a fixed (typically small) maximum length ...
Definition: QC_Socket.dox.h:2669
Qore::X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
Unable to decrypt CRL&#39;s signature.
Definition: QC_Socket.dox.h:2547
Qore::Socket::sendHTTPMessage
nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference< hash > info, timeout timeout_ms=-1)
Sends an HTTP message with a method and user-defined headers given as a hash and an optional message ...
Qore::Socket::readHTTPChunkedBodyWithCallback
readHTTPChunkedBodyWithCallback(code rcb, timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::recvToOutputStream
nothing recvToOutputStream(Qore::OutputStream os, softint size=-1, timeout timeout_ms=-1)
Receives data from the socket and writes the bytes to an OutputStream.
Qore::Socket::setSslVerifyMode
setSslVerifyMode(int mode)
sets the SSL verification mode