Blame


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