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