]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/io.h
Use correct sender as target for ISUPPORT replies on "VERSION"
[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
9 #ifndef io_H_included
10 #define io_H_included
11
12 /**
13  * @file
14  * I/O abstraction interface (header)
15  */
16
17 #include "portab.h"
18 #include <sys/time.h>
19
20 #define IO_WANTREAD     1
21 #define IO_WANTWRITE    2
22
23 /* init library.
24    sets up epoll/kqueue descriptors and tries to allocate space for ioevlen
25    file descriptors. ioevlen is just the _initial_ size, not a limit. */
26 bool io_library_init PARAMS((unsigned int ioevlen));
27
28 /* shutdown and free all internal data structures */
29 void io_library_shutdown PARAMS((void));
30
31 /* add fd to internal set, enable readability check, set callback */
32 bool io_event_create PARAMS((int fd, short what, void (*cbfunc)(int, short)));
33
34 /* change callback function associated with fd */
35 bool io_event_setcb PARAMS((int fd, void (*cbfunc)(int, short)));
36
37 /* watch fd for event of type what */
38 bool io_event_add PARAMS((int fd, short what));
39
40 /* do not watch fd for event of type what */
41 bool io_event_del PARAMS((int fd, short what));
42
43 /* remove fd from watchlist, close() fd.  */
44 bool io_close PARAMS((int fd));
45
46 /* set O_NONBLOCK */
47 bool io_setnonblock PARAMS((int fd));
48
49 /* set O_CLOEXEC */
50 bool io_setcloexec PARAMS((int fd));
51
52 /* watch fds for activity */
53 int io_dispatch PARAMS((struct timeval *tv));
54
55 #endif /* io_H_included */