remove commented out include/link directories
[project/ustream-ssl.git] / ustream-ssl.h
1 /*
2 * ustream-ssl - library for SSL over ustream
3 *
4 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef __USTREAM_SSL_H
20 #define __USTREAM_SSL_H
21
22 struct ustream_ssl {
23 struct ustream stream;
24 struct ustream *conn;
25 struct uloop_timeout error_timer;
26
27 void (*notify_connected)(struct ustream_ssl *us);
28 void (*notify_error)(struct ustream_ssl *us, int error, const char *str);
29
30 void *ctx;
31 void *ssl;
32
33 int error;
34 bool connected;
35 bool server;
36 };
37
38 struct ustream_ssl_ops {
39 void *(*context_new)(bool server);
40 int (*context_set_crt_file)(void *ctx, const char *file);
41 int (*context_set_key_file)(void *ctx, const char *file);
42 void (*context_free)(void *ctx);
43
44 int (*init)(struct ustream_ssl *us, struct ustream *conn, void *ctx, bool server);
45 };
46
47 extern const struct ustream_ssl_ops ustream_ssl_ops;
48
49 #define ustream_ssl_context_new ustream_ssl_ops.context_new
50 #define ustream_ssl_context_set_crt_file ustream_ssl_ops.context_set_crt_file
51 #define ustream_ssl_context_set_key_file ustream_ssl_ops.context_set_key_file
52 #define ustream_ssl_context_free ustream_ssl_ops.context_free
53 #define ustream_ssl_init ustream_ssl_ops.init
54
55 #endif