28 #ifndef _QORE_QORESOCKET_H
30 #define _QORE_QORESOCKET_H
34 #include <sys/types.h>
42 #include <openssl/ssl.h>
43 #include <openssl/err.h>
45 #define QSE_MISC_ERR 0
46 #define QSE_RECV_ERR -1
47 #define QSE_NOT_OPEN -2
48 #define QSE_TIMEOUT -3
49 #define QSE_SSL_ERR -4
62 friend struct qore_socket_private;
64 struct qore_socketsource_private *priv;
70 DLLLOCAL SocketSource& operator=(
const SocketSource&);
116 struct qore_socket_private *priv;
121 DLLLOCAL
static void convertHeaderToHash(
QoreHashNode *h,
char *p);
127 DLLLOCAL QoreSocket& operator=(
const QoreSocket&);
324 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 = 0);
367 DLLEXPORT
int bind(
const char *name,
bool reuseaddr =
false);
375 DLLEXPORT
int bind(
int prt,
bool reuseaddr);
384 DLLEXPORT
int bind(
const char *iface,
int prt,
bool reuseaddr =
false);
394 DLLEXPORT
int bind(
const struct sockaddr *addr,
int addr_size);
405 DLLEXPORT
int bind(
int family,
const struct sockaddr *addr,
int addr_size,
int socktype =
Q_SOCK_STREAM,
int protocol = 0);
636 DLLEXPORT
int sendi1(
char i);
644 DLLEXPORT
int sendi2(
short i);
652 DLLEXPORT
int sendi4(
int i);
660 DLLEXPORT
int sendi8(int64 i);
785 DLLEXPORT
int recvi1(
int timeout_ms,
char *val);
796 DLLEXPORT
int recvi2(
int timeout_ms,
short *val);
807 DLLEXPORT
int recvi4(
int timeout_ms,
int *val);
818 DLLEXPORT
int recvi8(
int timeout_ms, int64 *val);
830 DLLEXPORT
int recvi2LSB(
int timeout_ms,
short *val);
842 DLLEXPORT
int recvi4LSB(
int timeout_ms,
int *val);
852 DLLEXPORT
int recvi8LSB(
int timeout_ms, int64 *val);
861 DLLEXPORT
int recvu1(
int timeout_ms,
unsigned char *val);
872 DLLEXPORT
int recvu2(
int timeout_ms,
unsigned short *val);
883 DLLEXPORT
int recvu4(
int timeout_ms,
unsigned int *val);
895 DLLEXPORT
int recvu2LSB(
int timeout_ms,
unsigned short *val);
907 DLLEXPORT
int recvu4LSB(
int timeout_ms,
unsigned int *val);
1191 DLLEXPORT
int sendHTTPMessage(
const char *method,
const char *path,
const char *http_version,
const QoreHashNode *headers,
const void *data,
qore_size_t size,
int source = QORE_SOURCE_SOCKET);
1374 DLLEXPORT
int close();
1410 DLLEXPORT
bool isOpen()
const;
1488 DLLLOCAL
static void doException(
int rc,
const char *meth,
int timeout_ms,
ExceptionSink *xsink);
1502 DLLLOCAL
int setNoDelay(
int nodelay);
1503 DLLLOCAL
int getNoDelay()
const;
1509 #endif // _QORE_QORESOCKET_H