src/sock.c
changeset 9 4c4c906cc649
parent 8 be88e543c8ff
child 10 9fe218576d13
--- a/src/sock.c	Sun Feb 22 08:21:22 2009 +0200
+++ b/src/sock.c	Sun Feb 22 08:48:21 2009 +0200
@@ -4,8 +4,14 @@
 
 #include <assert.h>
 
-err_t sock_init (struct error_info *err)
+// global sock_stream_ctx instance
+struct sock_stream_ctx _sock_stream_ctx;
+
+err_t sock_init (struct event_base *ev_base, struct error_info *err)
 {
+    // store ev_base
+    _sock_stream_ctx.ev_base = ev_base;
+
     // XXX: just call these all directly for now
     if (sock_gnutls_global_init(err))
         return ERROR_CODE(err);
@@ -23,6 +29,13 @@
     sock->type = type;
 }
 
+void sock_stream_set_callbacks (struct sock_stream *sock, const struct sock_stream_callbacks *callbacks, void *arg)
+{
+    // store
+    sock->cb_info = callbacks;
+    sock->cb_arg = arg;
+}
+
 err_t sock_stream_read (struct sock_stream *sock, void *buf, size_t len)
 {
     // proxy off to method handler