5148843694d45722177517121c9db7f81524f301
[project/ustream-ssl.git] / ustream-ssl.h
1 #ifndef __USTREAM_SSL_H
2 #define __USTREAM_SSL_H
3
4 struct ustream_ssl {
5         struct ustream stream;
6         struct ustream *conn;
7         struct uloop_timeout error_timer;
8
9         void (*notify_connected)(struct ustream_ssl *us);
10         void (*notify_error)(struct ustream_ssl *us, int error, const char *str);
11
12         void *ctx;
13         void *ssl;
14
15         int error;
16         bool connected;
17         bool server;
18 };
19
20 void *ustream_ssl_context_new(bool server);
21 int ustream_ssl_context_set_crt_file(void *ctx, const char *file);
22 int ustream_ssl_context_set_key_file(void *ctx, const char *file);
23 void ustream_ssl_context_free(void *ctx);
24
25 int ustream_ssl_init(struct ustream_ssl *us, struct ustream *conn, void *ctx, bool server);
26
27 #endif