Rename iochannel to hcconn.
[cascardo/rnetproxy.git] / hcconn.h
diff --git a/hcconn.h b/hcconn.h
new file mode 100644 (file)
index 0000000..3fbbea7
--- /dev/null
+++ b/hcconn.h
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (C) 2009  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#ifndef HC_IOCHANNEL_H
+#define HC_IOCHANNEL_H
+
+#include <glib.h>
+#include <sys/socket.h>
+
+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