Merge branch 'newpc92timings' of /scm/spider into newpc92timings
[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.5  2002-01-27 15:39:59  minima
12  * get rid of warning
13  *
14  * Revision 1.4  2002/01/27 15:35:33  minima
15  * try to fix EOF on standard input problems
16  *
17  * Revision 1.3  2000/07/20 14:16:00  minima
18  * can use Sourceforge now!
19  * added user->qra cleaning
20  * added 4 digit qra to user broadcast dxspots if available
21  *
22  * Revision 1.2  2000/03/26 14:22:59  djk
23  * removed some irrelevant log info
24  *
25  * Revision 1.1  2000/03/26 00:03:30  djk
26  * first cut of client
27  *
28  * Revision 1.1  1997/01/03 23:44:31  djk
29  * initial workings
30  *
31  *
32  */
33
34 #ifndef _SEL_H
35 #define _SEL_H
36
37 static char _sel_h_rcsid[] = "$Id$";
38
39 #include "chain.h"
40
41 typedef struct {
42         int cnum;                                                  /* from open */
43         short err;                                                 /* error flag, to delay closing if required */
44         short sort;                                                /* this thing's sort */
45         short flags;                                               /* fdset flags */
46         char *name;                                                /* device name */
47         void *fcb;                                                 /* any fcb associated with this thing */
48         reft *msgbase;                                     /* any messages for this port */
49         int (*handler)();                                  /* the handler for this thingy */
50         void (*closehandler)();         /* special close handler */
51 } sel_t;
52
53 extern sel_t *sel;
54 extern int sel_max;
55 extern int sel_top;
56 extern int sel_inuse;
57 extern time_t sel_systime;
58 extern struct timeval sel_tv;
59
60 #define SEL_INPUT 1
61 #define SEL_OUTPUT 2
62 #define SEL_ERROR 4
63 #define SEL_IOALL 7
64
65 void sel_init(int, long, long);                                    /* initialise the select thing */
66 void sel_run();                                            /* run the select multiplexor */
67 sel_t *sel_open(int, void *, char *, int (*)(), int, int);/*  initialise a slot */
68 void sel_closehandler(sel_t *, void (*)());     /* post a closehandler for this cnum */
69
70 void sel_close(sel_t *);
71 int sel_error(sel_t *, int);               /* set/clear error flag */
72
73 #endif