summaryrefslogtreecommitdiff
path: root/ustream-ssl.h
blob: 5148843694d45722177517121c9db7f81524f301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __USTREAM_SSL_H
#define __USTREAM_SSL_H

struct ustream_ssl {
	struct ustream stream;
	struct ustream *conn;
	struct uloop_timeout error_timer;

	void (*notify_connected)(struct ustream_ssl *us);
	void (*notify_error)(struct ustream_ssl *us, int error, const char *str);

	void *ctx;
	void *ssl;

	int error;
	bool connected;
	bool server;
};

void *ustream_ssl_context_new(bool server);
int ustream_ssl_context_set_crt_file(void *ctx, const char *file);
int ustream_ssl_context_set_key_file(void *ctx, const char *file);
void ustream_ssl_context_free(void *ctx);

int ustream_ssl_init(struct ustream_ssl *us, struct ustream *conn, void *ctx, bool server);

#endif