modified IOMultiplexer (added epoll & kevent support)
[TransparentIRC.git] / src / IOEngine.h
index dfcbe98bbb3fcb581e64cdafb004f5ac731dc8dd..0f33e81954cb13a83367beb329198a7b4375b97b 100644 (file)
 #include "overall.h"
 
 struct IODescriptor;
+enum IOType;
+enum IOStatus;
+enum IOEventType;
+
+#define timeval_is_bigger(x,y) ((x->tv_sec > y->tv_sec) || (x->tv_sec == y->tv_sec && x->tv_usec > y->tv_usec))
+#define timeval_is_smaler(x,y) ((x->tv_sec < y->tv_sec) || (x->tv_sec == y->tv_sec && x->tv_usec < y->tv_usec))
+
+enum IOLogType {
+    IOLOG_DEBUG,
+    IOLOG_WARNING,
+    IOLOG_ERROR,
+    IOLOG_FATAL
+};
 
 extern struct IODescriptor *first_descriptor;
+extern struct IODescriptor *timer_priority;
 
 struct IOEngine {
     const char *name;
@@ -34,6 +48,10 @@ struct IOEngine {
 
 #define iohandler_wants_writes(IOFD) (IOFD->writebuf.bufpos || IOFD->state == IO_CONNECTING) 
 
+void iohandler_log(enum IOLogType type, char *text, ...);
 void iohandler_events(struct IODescriptor *iofd, int readable, int writeable);
+char *iohandler_iotype_name(enum IOType type);
+char *iohandler_iostatus_name(enum IOStatus status);
+char *iohandler_ioeventtype_name(enum IOEventType type);
 
 #endif