2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 2007-04-08 23:04:20 adam
8 * Moved HTTP channel address from struct iochan to struct http_channel.
9 * This fixes compilation on FreeBSD and reverts eventl.{c,h} to original
10 * paraz state. This change, simple as it is, is untested.
12 * Revision 1.1 2006/12/20 20:47:16 quinn
13 * Reorganized source tree
15 * Revision 1.3 2006/12/12 02:36:24 quinn
16 * Implemented session timeout; ping command
18 * Revision 1.2 2006/11/18 05:00:38 quinn
19 * Added record retrieval, etc.
21 * Revision 1.1.1.1 2006/11/14 20:44:38 quinn
24 * Revision 1.1.1.1 2000/02/23 14:40:18 heikki
25 * Original import to cvs
27 * Revision 1.11 1999/04/20 09:56:48 adam
28 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
29 * Modified all encoders/decoders to reflect this change.
31 * Revision 1.10 1998/01/29 13:30:23 adam
32 * Better event handle system for NT/Unix.
34 * Revision 1.9 1997/09/01 09:31:48 adam
35 * Removed definition statserv_remove from statserv.h to eventl.h.
37 * Revision 1.8 1995/06/19 12:39:09 quinn
38 * Fixed bug in timeout code. Added BER dumper.
40 * Revision 1.7 1995/06/16 10:31:34 quinn
41 * Added session timeout.
43 * Revision 1.6 1995/05/16 08:51:02 quinn
44 * License, documentation, and memory fixes
46 * Revision 1.5 1995/05/15 11:56:37 quinn
47 * Asynchronous facilities. Restructuring of seshigh code.
49 * Revision 1.4 1995/03/27 08:34:23 quinn
50 * Added dynamic server functionality.
51 * Released bindings to session.c (is now redundant)
53 * Revision 1.3 1995/03/15 08:37:42 quinn
54 * Now we're pretty much set for nonblocking I/O.
56 * Revision 1.2 1995/03/14 10:28:00 quinn
57 * More work on demo server.
59 * Revision 1.1 1995/03/10 18:22:45 quinn
60 * The rudiments of an asynchronous server.
71 typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
77 #define EVENT_INPUT 0x01
78 #define EVENT_OUTPUT 0x02
79 #define EVENT_EXCEPT 0x04
80 #define EVENT_TIMEOUT 0x08
81 #define EVENT_WORK 0x10
92 #define iochan_destroy(i) (void)((i)->destroyed = 1)
93 #define iochan_getfd(i) ((i)->fd)
94 #define iochan_setfd(i, f) ((i)->fd = (f))
95 #define iochan_getdata(i) ((i)->data)
96 #define iochan_setdata(i, d) ((i)->data = d)
97 #define iochan_getflags(i) ((i)->flags)
98 #define iochan_setflags(i, d) ((i)->flags = d)
99 #define iochan_setflag(i, d) ((i)->flags |= d)
100 #define iochan_clearflag(i, d) ((i)->flags &= ~(d))
101 #define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0)
102 #define iochan_getfun(i) ((i)->fun)
103 #define iochan_setfun(i, d) ((i)->fun = d)
104 #define iochan_setevent(i, e) ((i)->force_event = (e))
105 #define iochan_getnext(i) ((i)->next)
106 #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
107 #define iochan_activity(i) ((i)->last_event = time(0))
109 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags);
110 int event_loop(IOCHAN *iochans);