Qore Programming Language Reference Manual  0.8.7
 All Classes Namespaces Functions Variables Groups Pages
QC_Socket.dox.h
1 
2 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 
217 int bind(string str, softbool reuseaddr = False);
218 
219 public:
221 
235 int bind(int port, softbool reuseaddr = False);
236 
237 public:
239 
267 nothing bindINET(*string iface, *softstring service, softbool reuseaddr = False, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
268 
269 public:
271 
287 nothing bindUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
288 
289 public:
291 
304 int close();
305 
306 public:
308 
333 nothing connect(string target, timeout timeout_ms = -1);
334 
335 public:
337 
361 nothing connectINET(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
362 
363 public:
365 
390 nothing connectINETSSL(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
391 
392 public:
394 
422 nothing connectSSL(string target, timeout timeout_ms = -1);
423 
424 public:
426 
445 nothing connectUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
446 
447 public:
449 
469 nothing connectUNIXSSL(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
470 
471 public:
473 
476  constructor();
477 
478 public:
480 
483  copy();
484 
485 public:
487 
493 string getCharset();
494 
495 public:
497 
502 string getEncoding();
503 
504 public:
506 
518 bool getNoDelay();
519 
520 public:
522 
533 hash getPeerInfo();
534 
535 public:
537 
547 int getPort();
548 
549 public:
551 
561 int getRecvTimeout();
562 
563 public:
565 
575 *string getSSLCipherName();
576 
577 public:
579 
589 *string getSSLCipherVersion();
590 
591 public:
593 
603 int getSendTimeout();
604 
605 public:
607 
617 int getSocket();
618 
619 public:
621 
633 
634 public:
636 
647 bool isDataAvailable(timeout timeout_ms = 0);
648 
649 public:
651 
661 bool isOpen();
662 
663 public:
665 
675 bool isSecure();
676 
677 public:
679 
690 bool isWriteFinished(timeout timeout_ms = 0);
691 
692 public:
694 
703 int listen();
704 
705 public:
707 
728 hash readHTTPChunkedBody(timeout timeout_ms = -1);
729 
730 public:
732 
753 hash readHTTPChunkedBodyBinary(timeout timeout_ms = -1);
754 
755 public:
757 
788 hash readHTTPHeader(timeout timeout_ms = -1, *reference info);
789 
790 public:
792 
817 string recv(softint size = 0, timeout timeout_ms = -1);
818 
819 public:
821 
844 binary recvBinary(softint size = 0, timeout timeout_ms = -1);
845 
846 public:
848 
870 int recvi1(timeout timeout_ms = -1);
871 
872 public:
874 
896 int recvi2(timeout timeout_ms = -1);
897 
898 public:
900 
922 int recvi2LSB(timeout timeout_ms = -1);
923 
924 public:
926 
948 int recvi4(timeout timeout_ms = -1);
949 
950 public:
952 
974 int recvi4LSB(timeout timeout_ms = -1);
975 
976 public:
978 
1000 int recvi8(timeout timeout_ms = -1);
1001 
1002 public:
1004 
1026 int recvi8LSB(timeout timeout_ms = -1);
1027 
1028 public:
1030 
1052 int recvu1(timeout timeout_ms = -1);
1053 
1054 public:
1056 
1078 int recvu2(timeout timeout_ms = -1);
1079 
1080 public:
1082 
1104 int recvu2LSB(timeout timeout_ms = -1);
1105 
1106 public:
1108 
1130 int recvu4(timeout timeout_ms = -1);
1131 
1132 public:
1134 
1156 int recvu4LSB(timeout timeout_ms = -1);
1157 
1158 public:
1160 
1186 int send(binary bin, int timeout_ms = -1);
1187 
1188 public:
1190 
1218 int send(string str, timeout timeout_ms = -1);
1219 
1220 public:
1222 
1245 nothing send2(binary bin, timeout timeout_ms = -1);
1246 
1247 public:
1249 
1274 nothing send2(string str, timeout timeout_ms = -1);
1275 
1276 public:
1278 
1303 int sendBinary(string str, timeout timeout_ms = -1);
1304 
1305 public:
1307 
1332 int sendBinary(binary bin, timeout timeout_ms = -1);
1333 
1334 public:
1336 
1358 nothing sendBinary2(string str, timeout timeout_ms = -1);
1359 
1360 public:
1362 
1384 nothing sendBinary2(binary bin, timeout timeout_ms = -1);
1385 
1386 public:
1388 
1416 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference info, timeout timeout_ms = -1);
1417 
1418 public:
1420 
1446 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, binary body, *reference info, timeout timeout_ms = -1);
1447 
1448 public:
1450 
1474 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms = -1);
1475 
1476 public:
1478 
1500 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, binary body, timeout timeout_ms = -1);
1501 
1502 public:
1504 
1527 int sendi1(softint i = 0, timeout timeout_ms = -1);
1528 
1529 public:
1531 
1554 int sendi2(softint i = 0, timeout timeout_ms = -1);
1555 
1556 public:
1558 
1581 int sendi2LSB(softint i = 0, timeout timeout_ms = -1);
1582 
1583 public:
1585 
1608 int sendi4(softint i = 0, timeout timeout_ms = -1);
1609 
1610 public:
1612 
1635 int sendi4LSB(softint i = 0, timeout timeout_ms = -1);
1636 
1637 public:
1639 
1662 int sendi8(softint i = 0, timeout timeout_ms = -1);
1663 
1664 public:
1666 
1689 int sendi8LSB(softint i = 0, timeout timeout_ms = -1);
1690 
1691 public:
1693 
1700 nothing setCertificate(SSLCertificate cert);
1701 
1702 public:
1704 
1711 nothing setCertificate(string cert_pem);
1712 
1713 public:
1715 
1722 nothing setCertificate(binary cert_der);
1723 
1724 public:
1726 
1729 nothing setCharset(string encoding);
1730 
1731 public:
1733 
1735 nothing setEncoding(string encoding);
1736 
1737 public:
1739 
1746 nothing setEventQueue();
1747 
1748 public:
1750 
1761 nothing setEventQueue(Queue queue);
1762 
1763 public:
1765 
1783 int setNoDelay(bool nd = True);
1784 
1785 public:
1787 
1794 nothing setPrivateKey(SSLPrivateKey key);
1795 
1796 public:
1798 
1806 nothing setPrivateKey(string key_pem, *string pass);
1807 
1808 public:
1810 
1817 nothing setPrivateKey(binary key_der);
1818 
1819 public:
1821 
1833 int setRecvTimeout(timeout timeout_ms);
1834 
1835 public:
1837 
1849 int setSendTimeout(timeout timeout_ms);
1850 
1851 public:
1853 
1863 int shutdown();
1864 
1865 public:
1867 
1876 nothing shutdownSSL();
1877 
1878 public:
1880 
1885 nothing upgradeClientToSSL();
1886 
1887 public:
1889 
1894 nothing upgradeServerToSSL();
1895 
1896 public:
1898 
1908 *string verifyPeerCertificate();
1909 };
1917 
1919  const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH = "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH";
1921  const X509_V_ERR_AKID_SKID_MISMATCH = "X509_V_ERR_AKID_SKID_MISMATCH";
1923  const X509_V_ERR_APPLICATION_VERIFICATION = "X509_V_ERR_APPLICATION_VERIFICATION";
1925  const X509_V_ERR_CERT_CHAIN_TOO_LONG = "X509_V_ERR_CERT_CHAIN_TOO_LONG";
1927  const X509_V_ERR_CERT_HAS_EXPIRED = "X509_V_ERR_CERT_HAS_EXPIRED";
1929  const X509_V_ERR_CERT_NOT_YET_VALID = "X509_V_ERR_CERT_NOT_YET_VALID";
1931  const X509_V_ERR_CERT_REJECTED = "X509_V_ERR_CERT_REJECTED";
1933  const X509_V_ERR_CERT_REVOKED = "X509_V_ERR_CERT_REVOKED";
1935  const X509_V_ERR_CERT_SIGNATURE_FAILURE = "X509_V_ERR_CERT_SIGNATURE_FAILURE";
1937  const X509_V_ERR_CERT_UNTRUSTED = "X509_V_ERR_CERT_UNTRUSTED";
1939  const X509_V_ERR_CRL_HAS_EXPIRED = "X509_V_ERR_CRL_HAS_EXPIRED";
1941  const X509_V_ERR_CRL_NOT_YET_VALID = "X509_V_ERR_CRL_NOT_YET_VALID";
1943  const X509_V_ERR_CRL_SIGNATURE_FAILURE = "X509_V_ERR_CRL_SIGNATURE_FAILURE";
1945  const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT";
1947  const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD";
1949  const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD";
1951  const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD";
1953  const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD";
1955  const X509_V_ERR_INVALID_CA = "X509_V_ERR_INVALID_CA";
1957  const X509_V_ERR_INVALID_PURPOSE = "X509_V_ERR_INVALID_PURPOSE";
1959  const X509_V_ERR_KEYUSAGE_NO_CERTSIGN = "X509_V_ERR_KEYUSAGE_NO_CERTSIGN";
1961  const X509_V_ERR_OUT_OF_MEM = "X509_V_ERR_OUT_OF_MEM";
1963  const X509_V_ERR_PATH_LENGTH_EXCEEDED = "X509_V_ERR_PATH_LENGTH_EXCEEDED";
1965  const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN = "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN";
1967  const X509_V_ERR_SUBJECT_ISSUER_MISMATCH = "X509_V_ERR_SUBJECT_ISSUER_MISMATCH";
1969  const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY";
1971  const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE";
1973  const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE";
1975  const X509_V_ERR_UNABLE_TO_GET_CRL = "X509_V_ERR_UNABLE_TO_GET_CRL";
1977  const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT";
1979  const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
1981  const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE";
1983  const X509_V_OK = "X509_V_OK";
1986  "X509_V_OK": "OK",
1987  "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT": "Unable to get issuer certificate",
1988  "X509_V_ERR_UNABLE_TO_GET_CRL": "Unable to get certificate CRL",
1989  "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",
1990  "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE": "Unable to decrypt CRL's signature",
1991  "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY": "Unable to decode issuer public key (SubjectPublicKeyInfo)",
1992  "X509_V_ERR_CERT_SIGNATURE_FAILURE": "Certificate signature failure; the signature of the certificate is invalid",
1993  "X509_V_ERR_CRL_SIGNATURE_FAILURE": "CRL signature failure; the signature of the certificate is invalid",
1994  "X509_V_ERR_CERT_NOT_YET_VALID": "Certificate is not yet valid",
1995  "X509_V_ERR_CERT_HAS_EXPIRED": "Certificate has expired",
1996  "X509_V_ERR_CRL_NOT_YET_VALID": "CRL is not yet valid",
1997  "X509_V_ERR_CRL_HAS_EXPIRED": "CRL has expired",
1998  "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD": "Format error in certificate's notBefore field (invalid time)",
1999  "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD": "Format error in certificate's notAfter field (invalid time)",
2000  "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD": "Format error in CRL's lastUpdate field (invalid time)",
2001  "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD": "Format error in CRL's nextUpdate field (invalid time)",
2002  "X509_V_ERR_OUT_OF_MEM": "Out of memory error",
2003  "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT": "Certificate is self-signed and cannot be found in the trusted list",
2004  "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN": "Self signed certificate in certificate chain",
2005  "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",
2006  "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE": "Unable to verify the first certificate",
2007  "X509_V_ERR_CERT_CHAIN_TOO_LONG": "Certificate chain too long",
2008  "X509_V_ERR_CERT_REVOKED": "Certificate has been revoked",
2009  "X509_V_ERR_INVALID_CA": "Invalid CA certificate",
2010  "X509_V_ERR_PATH_LENGTH_EXCEEDED": "The basicConstraints pathlength parameter has been exceeded",
2011  "X509_V_ERR_INVALID_PURPOSE": "The certificate cannot be used for the specified purpose",
2012  "X509_V_ERR_CERT_UNTRUSTED": "Root CA is not marked as trusted for the specified purpose",
2013  "X509_V_ERR_CERT_REJECTED": "Root CA is marked to reject the specified purpose",
2014  "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",
2015  "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",
2016  "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",
2017  "X509_V_ERR_KEYUSAGE_NO_CERTSIGN": "The keyUsage extension does not permit certificate signing",
2018  "X509_V_ERR_APPLICATION_VERIFICATION": "Verification failure",
2019  );
2021 
2025 
2027  const AF_INET = AF_INET;
2033  const AF_UNIX = AF_UNIX;
2037 
2042 
2046  const AI_ALL = AI_ALL;
2052 
2057 
2065 
2069 
2073 
2079 
2083 
2091 };