Re-add gnutls_record_send in connwrap.c
[centerim/funkyfish.git] / connwrap / connwrap.h
blob6b62b98bb68f47c1b3d7db0c8e08bdd543fe5752
1 #ifndef __CONNWRAP_H__
2 #define __CONNWRAP_H__
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include <sys/types.h>
9 #include <sys/socket.h>
11 int cw_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl);
13 #define CW_CONNECT_STARTED 0x1
14 #define CW_CONNECT_SSL 0x2
15 #define CW_CONNECT_WANT_READ 0x4
16 #define CW_CONNECT_WANT_WRITE 0x8
17 #define CW_CONNECT_WANT_SOMETHING 0xC
18 #define CW_CONNECT_BLOCKING 0x10
20 /* non-blocking socket
21 state should be initialized with 0, subsequent calls should keep the modified state (state is a bitwise OR between CW_CONNECT_XXX)
22 returns 0 for OK, or if it wants subsequent calls
23 -1 for a fatal error
25 int cw_nb_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl, int *state);
26 int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl);
28 int cw_write(int fd, const void *buf, int count, int ssl);
29 int cw_read(int fd, void *buf, int count, int ssl);
31 int cw_close(int fd);
33 void cw_setproxy(const char *aproxyhost, int aproxyport, const char *aproxyuser, const char *aproxypass);
34 void cw_setbind(const char *abindaddr);
36 char *cw_base64_encode(const char *in);
38 #ifdef __cplusplus
40 #endif
42 #endif