2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: eventl.h,v 1.6 2005-06-25 15:46:04 adam Exp $
10 * \brief Definitions for event loop handling for GFS.
12 * This "private" header defines various functions for the
13 * main event loop in GFS.
23 typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
29 #define EVENT_INPUT 0x01
30 #define EVENT_OUTPUT 0x02
31 #define EVENT_EXCEPT 0x04
32 #define EVENT_TIMEOUT 0x08
33 #define EVENT_WORK 0x10
42 int chan_id; /* listening port (0 if none ) */
45 #define iochan_destroy(i) (void)((i)->destroyed = 1)
46 #define iochan_getfd(i) ((i)->fd)
47 #define iochan_setfd(i, f) ((i)->fd = (f))
48 #define iochan_getdata(i) ((i)->data)
49 #define iochan_setdata(i, d) ((i)->data = d)
50 #define iochan_getflags(i) ((i)->flags)
51 #define iochan_setflags(i, d) ((i)->flags = d)
52 #define iochan_setflag(i, d) ((i)->flags |= d)
53 #define iochan_clearflag(i, d) ((i)->flags &= ~(d))
54 #define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0)
55 #define iochan_getfun(i) ((i)->fun)
56 #define iochan_setfun(i, d) ((i)->fun = d)
57 #define iochan_setevent(i, e) ((i)->force_event = (e))
58 #define iochan_getnext(i) ((i)->next)
59 #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
61 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags, int port);
62 int event_loop(IOCHAN *iochans);
63 void statserv_remove (IOCHAN pIOChannel);
68 * indent-tabs-mode: nil
70 * vim: shiftwidth=4 tabstop=8 expandtab