added set/lockout
[spider.git] / src / sel.h
1 /*
2  * sel.c
3  * 
4  * util routines for do the various select activities
5  * 
6  * Copyright 1996 (c) D-J Koopman
7  * 
8  * $Header$
9  * 
10  * $Log$
11  * Revision 1.2  2000-03-26 14:22:59  djk
12  * removed some irrelevant log info
13  *
14  * Revision 1.1  2000/03/26 00:03:30  djk
15  * first cut of client
16  *
17  * Revision 1.1  1997/01/03 23:44:31  djk
18  * initial workings
19  *
20  *
21  */
22
23 #ifndef _SEL_H
24 #define _SEL_H
25
26 static char _sel_h_rcsid[] = "$Id$";
27
28 #include "chain.h"
29
30 typedef struct {
31         int cnum;                                                  /* from open */
32         short err;                                                 /* error flag, to delay closing if required */
33         short sort;                                                /* this thing's sort */
34         short flags;                                               /* fdset flags */
35         char *name;                                                /* device name */
36         void *fcb;                                                 /* any fcb associated with this thing */
37         reft *msgbase;                                     /* any messages for this port */
38         int (*handler)();                                  /* the handler for this thingy */
39 } sel_t;
40
41 extern sel_t *sel;
42 extern int sel_max;
43 extern int sel_top;
44 extern int sel_inuse;
45 extern time_t sel_systime;
46 extern struct timeval sel_tv;
47
48 #define SEL_INPUT 1
49 #define SEL_OUTPUT 2
50 #define SEL_ERROR 4
51 #define SEL_IOALL 7
52
53 void sel_init(int, long, long);                                    /* initialise the select thing */
54 void sel_run();                                            /* run the select multiplexor */
55 sel_t *sel_open(int, void *, char *, int (*)(), int, int);/*  initialise a slot */
56 void sel_close(sel_t *);
57 int sel_error(sel_t *, int);               /* set/clear error flag */
58
59 #endif