]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/io.h
Fixed typo in #ifdef which tests if this header is already included or not.
[ngircd-alex.git] / src / ngircd / io.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  * Please read the file COPYING, README and AUTHORS for more information.
7  *
8  * I/O abstraction interface header
9  *
10  * $Id: io.h,v 1.4 2006/12/25 22:53:52 alex Exp $
11  */
12
13 #ifndef io_H_included
14 #define io_H_included
15
16 #include "portab.h"
17 #include <sys/time.h>
18
19 #define IO_WANTREAD     1
20 #define IO_WANTWRITE    2
21
22 /* init library.
23    sets up epoll/kqueue descriptors and tries to allocate space for ioevlen
24    file descriptors. ioevlen is just the _initial_ size, not a limit. */
25 bool io_library_init PARAMS((unsigned int ioevlen));
26
27 /* shutdown and free all internal data structures */
28 void io_library_shutdown PARAMS((void));
29
30 /* add fd to internal set, enable readability check, set callback */
31 bool io_event_create PARAMS((int fd, short what, void (*cbfunc)(int, short)));
32
33 /* change callback function associated with fd */
34 bool io_event_setcb PARAMS((int fd, void (*cbfunc)(int, short)));
35
36 /* watch fd for event of type what */
37 bool io_event_add PARAMS((int fd, short what));
38
39 /* do not watch fd for event of type what */
40 bool io_event_del PARAMS((int fd, short what));
41
42 /* remove fd from watchlist, close() fd.  */
43 bool io_close PARAMS((int fd));
44
45 /* set O_NONBLOCK */
46 bool io_setnonblock PARAMS((int fd));
47
48 /* watch fds for activity */
49 int io_dispatch PARAMS((struct timeval *tv));
50
51 #endif /* io_H_included */