author | Mikael Berthe <mikael@lilotux.net> |
Sat, 27 Oct 2007 13:01:03 +0200 | |
changeset 1335 | ab1b7f7a682e |
parent 938 | 40175f3dcef7 |
permissions | -rw-r--r-- |
25 | 1 |
#ifndef __CONNWRAP_H__ |
2 |
#define __CONNWRAP_H__ |
|
3 |
||
69 | 4 |
#if HAVE_CONFIG_H |
5 |
# include <config.h> |
|
6 |
#endif |
|
7 |
||
25 | 8 |
#ifdef __cplusplus |
9 |
extern "C" { |
|
10 |
#endif |
|
11 |
||
12 |
#include <sys/types.h> |
|
13 |
#include <sys/socket.h> |
|
14 |
||
15 |
int cw_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl); |
|
16 |
||
17 |
#define CW_CONNECT_STARTED 0x1 |
|
18 |
#define CW_CONNECT_SSL 0x2 |
|
19 |
#define CW_CONNECT_WANT_READ 0x4 |
|
20 |
#define CW_CONNECT_WANT_WRITE 0x8 |
|
21 |
#define CW_CONNECT_WANT_SOMETHING 0xC |
|
22 |
#define CW_CONNECT_BLOCKING 0x10 |
|
414
ec86d759ed54
Trailing whitespace cleanup
Mikael Berthe <mikael@lilotux.net>
parents:
235
diff
changeset
|
23 |
|
25 | 24 |
/* non-blocking socket |
414
ec86d759ed54
Trailing whitespace cleanup
Mikael Berthe <mikael@lilotux.net>
parents:
235
diff
changeset
|
25 |
state should be initialized with 0, subsequent calls should keep the |
ec86d759ed54
Trailing whitespace cleanup
Mikael Berthe <mikael@lilotux.net>
parents:
235
diff
changeset
|
26 |
modified state (state is a bitwise OR between CW_CONNECT_XXX) |
25 | 27 |
returns 0 for OK, or if it wants subsequent calls |
28 |
-1 for a fatal error |
|
29 |
*/ |
|
30 |
int cw_nb_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl, int *state); |
|
31 |
int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl); |
|
32 |
||
33 |
int cw_write(int fd, const void *buf, int count, int ssl); |
|
34 |
int cw_read(int fd, void *buf, int count, int ssl); |
|
35 |
||
235 | 36 |
void cw_close(int fd); |
25 | 37 |
|
938
40175f3dcef7
SSL server certificate verification
Jefferson Ogata <ogata@antibozo.net>
parents:
414
diff
changeset
|
38 |
void cw_set_ssl_options(int sslverify, const char *sslcafile, const char *sslcapath, const char *sslciphers, const char *sslpeer); |
40175f3dcef7
SSL server certificate verification
Jefferson Ogata <ogata@antibozo.net>
parents:
414
diff
changeset
|
39 |
const char *cw_get_ssl_error(void); |
25 | 40 |
void cw_setproxy(const char *aproxyhost, int aproxyport, const char *aproxyuser, const char *aproxypass); |
41 |
void cw_setbind(const char *abindaddr); |
|
42 |
||
43 |
char *cw_base64_encode(const char *in); |
|
44 |
||
45 |
#ifdef __cplusplus |
|
46 |
} |
|
47 |
#endif |
|
48 |
||
49 |
#endif |