2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: eventl.h,v 1.1 2003-10-27 12:21:30 adam Exp $
16 typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
22 #define EVENT_INPUT 0x01
23 #define EVENT_OUTPUT 0x02
24 #define EVENT_EXCEPT 0x04
25 #define EVENT_TIMEOUT 0x08
26 #define EVENT_WORK 0x10
37 #define iochan_destroy(i) (void)((i)->destroyed = 1)
38 #define iochan_getfd(i) ((i)->fd)
39 #define iochan_setfd(i, f) ((i)->fd = (f))
40 #define iochan_getdata(i) ((i)->data)
41 #define iochan_setdata(i, d) ((i)->data = d)
42 #define iochan_getflags(i) ((i)->flags)
43 #define iochan_setflags(i, d) ((i)->flags = d)
44 #define iochan_setflag(i, d) ((i)->flags |= d)
45 #define iochan_clearflag(i, d) ((i)->flags &= ~(d))
46 #define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0)
47 #define iochan_getfun(i) ((i)->fun)
48 #define iochan_setfun(i, d) ((i)->fun = d)
49 #define iochan_setevent(i, e) ((i)->force_event = (e))
50 #define iochan_getnext(i) ((i)->next)
51 #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
53 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags);
54 int event_loop(IOCHAN *iochans);
55 void statserv_remove (IOCHAN pIOChannel);