1/*
2 * Copyright (c)1996-2002 by Hartmut Brandt
3 *	All rights reserved.
4 *
5 * Author: Hartmut Brandt
6 *
7 * Redistribution of this software and documentation and use in source and
8 * binary forms, with or without modification, are permitted provided that
9 * the following conditions are met:
10 *
11 * 1. Redistributions of source code or documentation must retain the above
12 *   copyright notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *   notice, this list of conditions and the following disclaimer in the
15 *   documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
18 * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
21 * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29/*
30 * $Begemot: libbegemot/rpoll.h,v 1.5 2004/09/21 15:49:26 brandt Exp $
31 */
32# ifndef rpoll_h_
33# define rpoll_h_
34
35# ifdef __cplusplus
36extern "C" {
37# endif
38
39typedef void (*poll_f)(int fd, int mask, void *arg);
40typedef void (*timer_f)(int, void *);
41
42int	poll_register(int fd, poll_f func, void *arg, int mask);
43void	poll_unregister(int);
44void	poll_dispatch(int wait);
45int	poll_start_timer(u_int msecs, int repeat, timer_f func, void *arg);
46int	poll_start_utimer(unsigned long long usecs, int repeat, timer_f func,
47    void *arg);
48void	poll_stop_timer(int);
49
50enum {
51	RPOLL_IN	= 1,
52	RPOLL_OUT	= 2,
53	RPOLL_EXCEPT	= 4,
54};
55
56extern int	rpoll_policy;
57extern int	rpoll_trace;
58
59# ifdef __cplusplus
60}
61# endif
62
63# endif
64