X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FIOEngine.h;h=8f4053b4823126e661c5b52d45eab8b4134a82aa;hb=HEAD;hp=dfcbe98bbb3fcb581e64cdafb004f5ac731dc8dd;hpb=0e2ac9360b71a7d054d7e945be575c0d21fa880c;p=TransparentIRC.git diff --git a/src/IOEngine.h b/src/IOEngine.h index dfcbe98..8f4053b 100644 --- a/src/IOEngine.h +++ b/src/IOEngine.h @@ -19,8 +19,22 @@ #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; @@ -32,8 +46,12 @@ struct IOEngine { void (*cleanup)(void); }; -#define iohandler_wants_writes(IOFD) (IOFD->writebuf.bufpos || IOFD->state == IO_CONNECTING) +#define iohandler_wants_writes(IOFD) ((IOFD->writebuf.bufpos && !IOFD->ssl_hs_read) || IOFD->state == IO_CONNECTING || IOFD->ssl_hs_write) +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