Qore Programming Language Reference Manual  0.8.8
 All Classes Namespaces Functions Variables Groups Pages
QC_Socket.dox.h
1 namespace Qore {
4 
122 class Socket {
123 
124 public:
126 
140 Socket accept();
141 
142 public:
144 
160 *Socket accept(timeout timeout_ms);
161 
162 public:
164 
178 Socket acceptSSL();
179 
180 public:
182 
198 *Socket acceptSSL(timeout timeout_ms);
199 
200 public:
202 
222 int bind(string str, softbool reuseaddr = False);
223 
224 public:
226 
240 int bind(int port, softbool reuseaddr = False);
241 
242 public:
244 
272 nothing bindINET(*string iface, *softstring service, softbool reuseaddr = False, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
273 
274 public:
276 
292 nothing bindUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
293 
294 public:
296 
309 int close();
310 
311 public:
313 
338 nothing connect(string target, timeout timeout_ms = -1);
339 
340 public:
342 
366 nothing connectINET(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
367 
368 public:
370 
395 nothing connectINETSSL(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
396 
397 public:
399 
427 nothing connectSSL(string target, timeout timeout_ms = -1);
428 
429 public:
431 
450 nothing connectUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
451 
452 public:
454 
474 nothing connectUNIXSSL(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
475 
476 public:
478 
481  constructor();
482 
483 public:
485 
488  copy();
489 
490 public:
492 
498 string getCharset();
499 
500 public:
502 
507 string getEncoding();
508 
509 public:
511 
523 bool getNoDelay();
524 
525 public:
527 
542 hash getPeerInfo(bool host_lookup = True);
543 
544 public:
546 
556 int getPort();
557 
558 public:
560 
570 int getRecvTimeout();
571 
572 public:
574 
584 *string getSSLCipherName();
585 
586 public:
588 
598 *string getSSLCipherVersion();
599 
600 public:
602 
612 int getSendTimeout();
613 
614 public:
616 
626 int getSocket();
627 
628 public:
630 
645 hash getSocketInfo(bool host_lookup = True);
646 
647 public:
649 
663 bool isDataAvailable(timeout timeout_ms = 0);
664 
665 public:
667 
677 bool isOpen();
678 
679 public:
681 
691 bool isSecure();
692 
693 public:
695 
709 bool isWriteFinished(timeout timeout_ms = 0);
710 
711 public:
713 
726 int listen(int backlog = 20);
727 
728 public:
730 
751 hash readHTTPChunkedBody(timeout timeout_ms = -1);
752 
753 public:
755 
776 hash readHTTPChunkedBodyBinary(timeout timeout_ms = -1);
777 
778 public:
780 
825 hash readHTTPHeader(timeout timeout_ms = -1, *reference info);
826 
827 public:
829 
852 string readHTTPHeaderString(timeout timeout_ms = -1);
853 
854 public:
856 
881 string recv(softint size = 0, timeout timeout_ms = -1);
882 
883 public:
885 
908 binary recvBinary(softint size = 0, timeout timeout_ms = -1);
909 
910 public:
912 
934 int recvi1(timeout timeout_ms = -1);
935 
936 public:
938 
960 int recvi2(timeout timeout_ms = -1);
961 
962 public:
964 
986 int recvi2LSB(timeout timeout_ms = -1);
987 
988 public:
990 
1012 int recvi4(timeout timeout_ms = -1);
1013 
1014 public:
1016 
1038 int recvi4LSB(timeout timeout_ms = -1);
1039 
1040 public:
1042 
1064 int recvi8(timeout timeout_ms = -1);
1065 
1066 public:
1068 
1090 int recvi8LSB(timeout timeout_ms = -1);
1091 
1092 public:
1094 
1116 int recvu1(timeout timeout_ms = -1);
1117 
1118 public:
1120 
1142 int recvu2(timeout timeout_ms = -1);
1143 
1144 public:
1146 
1168 int recvu2LSB(timeout timeout_ms = -1);
1169 
1170 public:
1172 
1194 int recvu4(timeout timeout_ms = -1);
1195 
1196 public:
1198 
1220 int recvu4LSB(timeout timeout_ms = -1);
1221 
1222 public:
1224 
1250 int send(binary bin, int timeout_ms = -1);
1251 
1252 public:
1254 
1282 int send(string str, timeout timeout_ms = -1);
1283 
1284 public:
1286 
1309 nothing send2(binary bin, timeout timeout_ms = -1);
1310 
1311 public:
1313 
1338 nothing send2(string str, timeout timeout_ms = -1);
1339 
1340 public:
1342 
1367 int sendBinary(string str, timeout timeout_ms = -1);
1368 
1369 public:
1371 
1396 int sendBinary(binary bin, timeout timeout_ms = -1);
1397 
1398 public:
1400 
1422 nothing sendBinary2(string str, timeout timeout_ms = -1);
1423 
1424 public:
1426 
1448 nothing sendBinary2(binary bin, timeout timeout_ms = -1);
1449 
1450 public:
1452 
1480 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference info, timeout timeout_ms = -1);
1481 
1482 public:
1484 
1510 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, binary body, *reference info, timeout timeout_ms = -1);
1511 
1512 public:
1514 
1538 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms = -1);
1539 
1540 public:
1542 
1564 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, binary body, timeout timeout_ms = -1);
1565 
1566 public:
1568 
1591 int sendi1(softint i = 0, timeout timeout_ms = -1);
1592 
1593 public:
1595 
1618 int sendi2(softint i = 0, timeout timeout_ms = -1);
1619 
1620 public:
1622 
1645 int sendi2LSB(softint i = 0, timeout timeout_ms = -1);
1646 
1647 public:
1649 
1672 int sendi4(softint i = 0, timeout timeout_ms = -1);
1673 
1674 public:
1676 
1699 int sendi4LSB(softint i = 0, timeout timeout_ms = -1);
1700 
1701 public:
1703 
1726 int sendi8(softint i = 0, timeout timeout_ms = -1);
1727 
1728 public:
1730 
1753 int sendi8LSB(softint i = 0, timeout timeout_ms = -1);
1754 
1755 public:
1757 
1764 nothing setCertificate(SSLCertificate cert);
1765 
1766 public:
1768 
1775 nothing setCertificate(string cert_pem);
1776 
1777 public:
1779 
1786 nothing setCertificate(binary cert_der);
1787 
1788 public:
1790 
1793 nothing setCharset(string encoding);
1794 
1795 public:
1797 
1799 nothing setEncoding(string encoding);
1800 
1801 public:
1803 
1810 nothing setEventQueue();
1811 
1812 public:
1814 
1825 nothing setEventQueue(Queue queue);
1826 
1827 public:
1829 
1847 int setNoDelay(bool nd = True);
1848 
1849 public:
1851 
1858 nothing setPrivateKey(SSLPrivateKey key);
1859 
1860 public:
1862 
1870 nothing setPrivateKey(string key_pem, *string pass);
1871 
1872 public:
1874 
1881 nothing setPrivateKey(binary key_der);
1882 
1883 public:
1885 
1897 int setRecvTimeout(timeout timeout_ms);
1898 
1899 public:
1901 
1913 int setSendTimeout(timeout timeout_ms);
1914 
1915 public:
1917 
1927 int shutdown();
1928 
1929 public:
1931 
1940 nothing shutdownSSL();
1941 
1942 public:
1944 
1949 nothing upgradeClientToSSL();
1950 
1951 public:
1953 
1958 nothing upgradeServerToSSL();
1959 
1960 public:
1962 
1972 *string verifyPeerCertificate();
1973 };
1981 
1983  const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH = "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH";
1985  const X509_V_ERR_AKID_SKID_MISMATCH = "X509_V_ERR_AKID_SKID_MISMATCH";
1987  const X509_V_ERR_APPLICATION_VERIFICATION = "X509_V_ERR_APPLICATION_VERIFICATION";
1989  const X509_V_ERR_CERT_CHAIN_TOO_LONG = "X509_V_ERR_CERT_CHAIN_TOO_LONG";
1991  const X509_V_ERR_CERT_HAS_EXPIRED = "X509_V_ERR_CERT_HAS_EXPIRED";
1993  const X509_V_ERR_CERT_NOT_YET_VALID = "X509_V_ERR_CERT_NOT_YET_VALID";
1995  const X509_V_ERR_CERT_REJECTED = "X509_V_ERR_CERT_REJECTED";
1997  const X509_V_ERR_CERT_REVOKED = "X509_V_ERR_CERT_REVOKED";
1999  const X509_V_ERR_CERT_SIGNATURE_FAILURE = "X509_V_ERR_CERT_SIGNATURE_FAILURE";
2001  const X509_V_ERR_CERT_UNTRUSTED = "X509_V_ERR_CERT_UNTRUSTED";
2003  const X509_V_ERR_CRL_HAS_EXPIRED = "X509_V_ERR_CRL_HAS_EXPIRED";
2005  const X509_V_ERR_CRL_NOT_YET_VALID = "X509_V_ERR_CRL_NOT_YET_VALID";
2007  const X509_V_ERR_CRL_SIGNATURE_FAILURE = "X509_V_ERR_CRL_SIGNATURE_FAILURE";
2009  const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT";
2011  const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD";
2013  const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD";
2015  const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD";
2017  const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD";
2019  const X509_V_ERR_INVALID_CA = "X509_V_ERR_INVALID_CA";
2021  const X509_V_ERR_INVALID_PURPOSE = "X509_V_ERR_INVALID_PURPOSE";
2023  const X509_V_ERR_KEYUSAGE_NO_CERTSIGN = "X509_V_ERR_KEYUSAGE_NO_CERTSIGN";
2025  const X509_V_ERR_OUT_OF_MEM = "X509_V_ERR_OUT_OF_MEM";
2027  const X509_V_ERR_PATH_LENGTH_EXCEEDED = "X509_V_ERR_PATH_LENGTH_EXCEEDED";
2029  const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN = "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN";
2031  const X509_V_ERR_SUBJECT_ISSUER_MISMATCH = "X509_V_ERR_SUBJECT_ISSUER_MISMATCH";
2033  const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY";
2035  const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE";
2037  const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE";
2039  const X509_V_ERR_UNABLE_TO_GET_CRL = "X509_V_ERR_UNABLE_TO_GET_CRL";
2041  const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT";
2043  const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
2045  const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE";
2047  const X509_V_OK = "X509_V_OK";
2050  "X509_V_OK": "OK",
2051  "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT": "Unable to get issuer certificate",
2052  "X509_V_ERR_UNABLE_TO_GET_CRL": "Unable to get certificate CRL",
2053  "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",
2054  "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE": "Unable to decrypt CRL's signature",
2055  "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY": "Unable to decode issuer public key (SubjectPublicKeyInfo)",
2056  "X509_V_ERR_CERT_SIGNATURE_FAILURE": "Certificate signature failure; the signature of the certificate is invalid",
2057  "X509_V_ERR_CRL_SIGNATURE_FAILURE": "CRL signature failure; the signature of the certificate is invalid",
2058  "X509_V_ERR_CERT_NOT_YET_VALID": "Certificate is not yet valid",
2059  "X509_V_ERR_CERT_HAS_EXPIRED": "Certificate has expired",
2060  "X509_V_ERR_CRL_NOT_YET_VALID": "CRL is not yet valid",
2061  "X509_V_ERR_CRL_HAS_EXPIRED": "CRL has expired",
2062  "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD": "Format error in certificate's notBefore field (invalid time)",
2063  "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD": "Format error in certificate's notAfter field (invalid time)",
2064  "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD": "Format error in CRL's lastUpdate field (invalid time)",
2065  "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD": "Format error in CRL's nextUpdate field (invalid time)",
2066  "X509_V_ERR_OUT_OF_MEM": "Out of memory error",
2067  "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT": "Certificate is self-signed and cannot be found in the trusted list",
2068  "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN": "Self signed certificate in certificate chain",
2069  "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",
2070  "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE": "Unable to verify the first certificate",
2071  "X509_V_ERR_CERT_CHAIN_TOO_LONG": "Certificate chain too long",
2072  "X509_V_ERR_CERT_REVOKED": "Certificate has been revoked",
2073  "X509_V_ERR_INVALID_CA": "Invalid CA certificate",
2074  "X509_V_ERR_PATH_LENGTH_EXCEEDED": "The basicConstraints pathlength parameter has been exceeded",
2075  "X509_V_ERR_INVALID_PURPOSE": "The certificate cannot be used for the specified purpose",
2076  "X509_V_ERR_CERT_UNTRUSTED": "Root CA is not marked as trusted for the specified purpose",
2077  "X509_V_ERR_CERT_REJECTED": "Root CA is marked to reject the specified purpose",
2078  "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",
2079  "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",
2080  "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",
2081  "X509_V_ERR_KEYUSAGE_NO_CERTSIGN": "The keyUsage extension does not permit certificate signing",
2082  "X509_V_ERR_APPLICATION_VERIFICATION": "Verification failure",
2083  );
2085 
2089 
2091  const AF_INET = AF_INET;
2097  const AF_UNIX = AF_UNIX;
2101 
2106 
2110  const AI_ALL = AI_ALL;
2116 
2121 
2129 
2133 
2137 
2143 
2147 
2155 };
int shutdown()
Ensures that a socket will be closed even if the file descriptor is shared with other processes (for ...
int recvi1(timeout timeout_ms=-1)
Receives a 1-byte signed integer from the socket.
string recv(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a string tagged with the Socket's character encoding...
bool isWriteFinished(timeout timeout_ms=0)
Returns True or False depending on whether all the data has been written to the socket.
nothing connectUNIX(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to a UNIX domain socket file.
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:2009
const AF_UNSPEC
unspecified address family
Definition: QC_Socket.dox.h:2099
const SOCK_RAW
raw socket interface, only available to the superuser, untested
Definition: QC_Socket.dox.h:2151
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:2114
const X509_V_ERR_CERT_NOT_YET_VALID
Certificate is not yet valid.
Definition: QC_Socket.dox.h:1993
const X509_V_ERR_OUT_OF_MEM
Out of memory error.
Definition: QC_Socket.dox.h:2025
const X509_V_ERR_PATH_LENGTH_EXCEEDED
The basicConstraints pathlength parameter has been exceeded.
Definition: QC_Socket.dox.h:2027
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...
const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
Unable to decrypt certificate's signature. This means that the actual signature value could not be de...
Definition: QC_Socket.dox.h:2035
const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
Format error in CRL's lastUpdate field (invalid time)
Definition: QC_Socket.dox.h:2015
const X509_V_ERR_APPLICATION_VERIFICATION
Verification failure.
Definition: QC_Socket.dox.h:1987
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:p...
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:2110
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...
string readHTTPHeaderString(timeout timeout_ms=-1)
Retuns a string representing the data in the HTTP header read (reads until "\r\n\r\n") ...
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:122
const X509_VerificationReasons
maps from varification strings to verification code descriptions
Definition: QC_Socket.dox.h:2049
int getSendTimeout()
Returns the send timeout socket option value as an integer in milliseconds.
const X509_V_ERR_CERT_UNTRUSTED
Root CA is not marked as trusted for the specified purpose.
Definition: QC_Socket.dox.h:2001
hash getSocketInfo(bool host_lookup=True)
Returns information about the local socket as a hash.
int send(binary bin, int timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
const X509_V_ERR_INVALID_CA
Invalid CA certificate.
Definition: QC_Socket.dox.h:2019
int recvi8LSB(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in little-endian format from the socket.
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...
nothing setPrivateKey(SSLPrivateKey key)
Sets the private key to use for negotiating encrypted connections along with the X.509 certificate.
nothing setCertificate(SSLCertificate cert)
Sets the X.509 certificate to use for negotiating encrypted connections.
string getCharset()
Returns the character encoding for the socket.
int recvi2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in little-endian format from the socket.
const True
logical True
Definition: qc_qore.dox.h:94
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...
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:2119
hash readHTTPChunkedBodyBinary(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
hash readHTTPHeader(timeout timeout_ms=-1, *reference info)
Retuns a hash representing the data in the HTTP header read, or, if the data cannot be parsed as an H...
int recvi2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in big-endian format (network byte order) from the socket...
nothing send2(binary bin, timeout timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
binary binary()
Always returns an empty binary object (of zero length)
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
Unable to get issuer certificate.
Definition: QC_Socket.dox.h:2041
*string getSSLCipherVersion()
Returns the version string of the cipher for an encrypted connection or NOTHING if a secure connectio...
hash readHTTPChunkedBody(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
int setSendTimeout(timeout timeout_ms)
sets the send timeout as a socket option
int recvu4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in big-endian format (network byte order) from the socket...
int recvu2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in little-endian format from the socket.
const False
logical False
Definition: qc_qore.dox.h:92
string getEncoding()
Returns the character encoding for the socket.
int recvi4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in little-endian format from the socket.
int sendi8LSB(softint i=0, timeout timeout_ms=-1)
Sends an 8-byte (64-bit) integer in little-endian format over the socket.
int recvi4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in big-endian format (network byte order) from the socket...
int listen(int backlog=20)
Listens for connections on a bound socket; sets the socket in a listening state.
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...
const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
Unable to verify the first certificate.
Definition: QC_Socket.dox.h:2045
const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
Unable to decode issuer public key (SubjectPublicKeyInfo)
Definition: QC_Socket.dox.h:2033
int sendi2LSB(softint i=0, timeout timeout_ms=-1)
Sends a 2-byte (16-bit) integer in little-endian format over the socket.
Socket acceptSSL()
Accepts connections on a listening socket and attempts to negotiate a TLS/SSL connection.
const X509_V_ERR_CRL_NOT_YET_VALID
CRL is not yet valid.
Definition: QC_Socket.dox.h:2005
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:1985
const X509_V_ERR_INVALID_PURPOSE
The certificate cannot be used for the specified purpose.
Definition: QC_Socket.dox.h:2021
int setRecvTimeout(timeout timeout_ms)
sets the receive timeout as a socket option
int getSocket()
Returns the socket file descriptor number.
const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
Format error in CRL's nextUpdate field (invalid time)
Definition: QC_Socket.dox.h:2017
*string verifyPeerCertificate()
Returns a string code giving the result of verifying the remote certificate or NOTHING if an encrypte...
bool getNoDelay()
Returns the TCP_NODELAY setting for the socket.
int recvi8(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in big-endian format (network byte order) from the socket...
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...
const X509_V_ERR_UNABLE_TO_GET_CRL
Unable to get certificate CRL.
Definition: QC_Socket.dox.h:2039
const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
Format error in certificate's notAfter field (invalid time)
Definition: QC_Socket.dox.h:2011
const X509_V_ERR_KEYUSAGE_NO_CERTSIGN
The keyUsage extension does not permit certificate signing.
Definition: QC_Socket.dox.h:2023
nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference info, timeout timeout_ms=-1)
Sends an HTTP message with a method and user-defined headers given as a hash and an optional message ...
const X509_V_ERR_CERT_REJECTED
Root CA is marked to reject the specified purpose.
Definition: QC_Socket.dox.h:1995
binary recvBinary(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a binary object.
int sendi1(softint i=0, timeout timeout_ms=-1)
Sends a 1-byte integer over the socket.
This class implements a container for private key data.
Definition: QC_SSLPrivateKey.dox.h:5
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...
const AF_INET6
IPv6 address family.
Definition: QC_Socket.dox.h:2093
const AF_INET
IPv4 address family.
Definition: QC_Socket.dox.h:2091
const IPPROTO_UDP
for the UDP protocol
Definition: QC_Socket.dox.h:2141
const X509_V_ERR_CERT_SIGNATURE_FAILURE
Certificate signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:1999
constructor()
Creates the socket object.
int sendi4LSB(softint i=0, timeout timeout_ms=-1)
Sends a 4-byte (32-bit) integer in little-endian format over the socket.
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:2043
const X509_V_ERR_CERT_REVOKED
Certificate has been revoked.
Definition: QC_Socket.dox.h:1997
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:1983
const AF_UNIX
UNIX domain address family (UNIX socket files)
Definition: QC_Socket.dox.h:2097
int recvu4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in little-endian format from the socket.
const IPPROTO_TCP
for the TCP protocol
Definition: QC_Socket.dox.h:2139
const X509_V_OK
Verification OK.
Definition: QC_Socket.dox.h:2047
int getRecvTimeout()
Returns the receive timeout socket option value as an integer in milliseconds.
const AF_LOCAL
POSIX synonym for AF_UNIX.
Definition: QC_Socket.dox.h:2095
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:2131
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:2031
nothing sendBinary2(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket's encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
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...
SSLCertificate objects allow Qore code to work with X.509 certificate data.
Definition: QC_SSLCertificate.dox.h:5
hash getPeerInfo(bool host_lookup=True)
Returns a hash of information about the remote end for connected sockets.
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...
const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
Format error in certificate's notBefore field (invalid time)
Definition: QC_Socket.dox.h:2013
*string getSSLCipherName()
Returns the name of the cipher for an encrypted connection or NOTHING if a secure connection has not ...
copy()
Creates a new Socket object, not based on the source being copied.
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...
const X509_V_ERR_CRL_SIGNATURE_FAILURE
CRL signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:2007
bool isSecure()
Returns True if the connection is a secure TLS/SSL connection.
bool isOpen()
Returns True if the socket is open.
nothing upgradeServerToSSL()
Upgrades a server socket connection to a TLS/SSL connection.
nothing upgradeClientToSSL()
Upgrades a client socket connection to a TLS/SSL connection.
const X509_V_ERR_CERT_HAS_EXPIRED
Certificate has expired.
Definition: QC_Socket.dox.h:1991
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:2112
nothing shutdownSSL()
Shuts down the SSL connection on a secure connection.
bool isDataAvailable(timeout timeout_ms=0)
Returns True or False depending on whether there is data to be read on the socket.
hash hash(object obj)
Returns a hash of an object's members.
const SOCK_STREAM
for sequenced, reliable, two-way connection-based byte streams (the default)
Definition: QC_Socket.dox.h:2153
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:2108
nothing setCharset(string encoding)
Sets the character encoding for the socket.
int setNoDelay(bool nd=True)
Sets the boolean TCP_NODELAY setting for the socket.
int sendBinary(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket's encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
const X509_V_ERR_CERT_CHAIN_TOO_LONG
Certificate chain too long.
Definition: QC_Socket.dox.h:1989
int close()
Closes an open socket.
int recvu2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in big-endian format (network byte order) from the socket...
nothing setEncoding(string encoding)
Sets the character encoding for the socket.
const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
Self signed certificate in certificate chain.
Definition: QC_Socket.dox.h:2029
const X509_V_ERR_CRL_HAS_EXPIRED
CRL has expired.
Definition: QC_Socket.dox.h:2003
Socket accept()
Accepts connections on a listening socket.
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:2127
int getPort()
Returns the port number of the socket for INET sockets.
nothing setEventQueue()
Removes any Queue object from the Socket object so that socket events are no longer added to the Queu...
int recvu1(timeout timeout_ms=-1)
Receives a 1-byte unsigned integer from the socket.
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...
const SOCK_DGRAM
for datagrams (connectionless, unreliable messages of a fixed (typically small) maximum length ...
Definition: QC_Socket.dox.h:2149
const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
Unable to decrypt CRL's signature.
Definition: QC_Socket.dox.h:2037