Write pending data after connecting
[project/ustream-ssl.git] / ustream-ssl.h
index 21d89d57e3136d4d1bf40237c7f7750f518b0a49..d2cdb69f77a8c95f3ee0570f94aadd65b0f2b001 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __USTREAM_SSL_H
 #define __USTREAM_SSL_H
 
+#include <libubox/ustream.h>
+
 struct ustream_ssl {
        struct ustream stream;
        struct ustream *conn;
@@ -27,7 +29,7 @@ struct ustream_ssl {
        void (*notify_connected)(struct ustream_ssl *us);
        void (*notify_error)(struct ustream_ssl *us, int error, const char *str);
 
-       void *ctx;
+       struct ustream_ssl_ctx *ctx;
        void *ssl;
 
        int error;
@@ -35,13 +37,16 @@ struct ustream_ssl {
        bool server;
 };
 
+struct ustream_ssl_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);
+       struct ustream_ssl_ctx *(*context_new)(bool server);
+       int (*context_set_crt_file)(struct ustream_ssl_ctx *ctx, const char *file);
+       int (*context_set_key_file)(struct ustream_ssl_ctx *ctx, const char *file);
+       void (*context_free)(struct ustream_ssl_ctx *ctx);
+
+       int (*init)(struct ustream_ssl *us, struct ustream *conn, struct ustream_ssl_ctx *ctx, bool server);
 };
 
 extern const struct ustream_ssl_ops ustream_ssl_ops;