Let user set HCConn callback function and data.
[cascardo/rnetproxy.git] / iochannel.h
index daf0bc1..3fbbea7 100644 (file)
@@ -27,4 +27,22 @@ typedef void (*HCServerFunc) (int, struct sockaddr*, socklen_t, gpointer);
 
 void hc_server_add_watch (int, HCServerFunc, gpointer);
 
+typedef struct _hc_conn_t HCConn;
+
+typedef enum
+{
+  HC_EVENT_NULL = 0,
+  HC_EVENT_CONNECT,
+  HC_EVENT_READ,
+  HC_EVENT_CLOSE
+} HCEvent;
+
+typedef void (*HCClientFunc) (HCConn *, HCEvent, gpointer);
+
+HCConn * hc_conn_new (int, HCClientFunc, gpointer);
+ssize_t hc_conn_read (HCConn *, char *, size_t);
+void hc_conn_write (HCConn *, char *, size_t);
+void hc_conn_close (HCConn *);
+void hc_conn_set_callback (HCConn *, HCClientFunc, gpointer);
+
 #endif