add copyright info and license
[project/ustream-ssl.git] / ustream-ssl.h
index 5148843694d45722177517121c9db7f81524f301..21d89d57e3136d4d1bf40237c7f7750f518b0a49 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * ustream-ssl - library for SSL over ustream
+ *
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
 #ifndef __USTREAM_SSL_H
 #define __USTREAM_SSL_H
 
@@ -17,11 +35,21 @@ struct ustream_ssl {
        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);
+struct ustream_ssl_ops {
+       void *(*context_new)(bool server);
+       int (*context_set_crt_file)(void *ctx, const char *file);
+       int (*context_set_key_file)(void *ctx, const char *file);
+       void (*context_free)(void *ctx);
+
+       int (*init)(struct ustream_ssl *us, struct ustream *conn, void *ctx, bool server);
+};
+
+extern const struct ustream_ssl_ops ustream_ssl_ops;
 
-int ustream_ssl_init(struct ustream_ssl *us, struct ustream *conn, void *ctx, bool server);
+#define ustream_ssl_context_new                        ustream_ssl_ops.context_new
+#define ustream_ssl_context_set_crt_file       ustream_ssl_ops.context_set_crt_file
+#define ustream_ssl_context_set_key_file       ustream_ssl_ops.context_set_key_file
+#define ustream_ssl_context_free               ustream_ssl_ops.context_free
+#define ustream_ssl_init                       ustream_ssl_ops.init
 
 #endif