The rudiments of an asynchronous server.
[yaz-moved-to-github.git] / server / eventl.h
1 /*
2  * Copyright (C) 1994, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: eventl.h,v $
7  * Revision 1.1  1995-03-10 18:22:45  quinn
8  * The rudiments of an asynchronous server.
9  *
10  */
11
12 #ifndef EVENTL_H
13 #define EVENTL_H
14
15 struct iochan;
16
17 typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
18
19 typedef struct iochan
20 {
21     int fd;
22     int flags;
23 #define EVENT_INPUT     0x01
24 #define EVENT_OUTPUT    0x02
25 #define EVENT_EXCEPT    0x04
26 #define EVENT_TIMEOUT   0x08
27     IOC_CALLBACK fun;
28     void *data;
29     int destroyed;
30     
31     struct iochan *next;
32 } *IOCHAN;
33
34 #define iochan_destroy(i) (void)((i)->destroyed = 1)
35 #define iochan_getfd(i)
36 #define iochan_getdata(i) ((i)->data)
37 #define iochan_setdata(i, d) ((i)->data = d)
38 #define iochan_getflags(i) ((i)->flags)
39 #define iochan_setflags(i, d) ((i)->flags = d)
40 #define iochan_getfun(i) ((i)->fun)
41 #define iochan_setfun(i, d) ((i)->fun = d)
42
43 #endif