1 #ifndef __my_ssl_h__
2 #define __my_ssl_h__
3 
4 //
5 // opaque connection structure
6 //
7 typedef void *SSL_CONN;
8 //
9 // opaque certificate structure
10 //
11 typedef void *SSL_CERT;
12 
13 //
14 // Create copy of certificate signed by "other" CA
15 //
16 SSL_CERT ssl_copy_cert(SSL_CERT cert);
17 
18 //
19 // SSL/TLS handshakes
20 //
21 SSL_CONN ssl_handshake_to_server(SOCKET s, char * hostname, SSL_CERT *server_cert, char **errSSL);
22 SSL_CONN ssl_handshake_to_client(SOCKET s, SSL_CERT server_cert, char **errSSL);
23 
24 //
25 // SSL/TLS Read/Write
26 //
27 int ssl_read(SSL_CONN connection, void * buf, int bufsize);
28 int ssl_write(SSL_CONN connection, void * buf, int bufsize);
29 int ssl_pending(SSL_CONN connection);
30 
31 //
32 // Release of opaque structures
33 //
34 void ssl_conn_free(SSL_CONN connection);
35 void _ssl_cert_free(SSL_CERT cert);
36 
37 //
38 // Global (de)initialization
39 //
40 void ssl_init(void);
41 void ssl_release(void);
42 
43 #endif // __my_ssl_h__