1135768Strhodes/*
2135768Strhodes * Copyright (c)1996-2002 by Hartmut Brandt
3135768Strhodes *	All rights reserved.
4135768Strhodes *
5135768Strhodes * Author: Hartmut Brandt
6135768Strhodes *
7135768Strhodes * Redistribution of this software and documentation and use in source and
8135768Strhodes * binary forms, with or without modification, are permitted provided that
9135768Strhodes * the following conditions are met:
10135768Strhodes *
11135768Strhodes * 1. Redistributions of source code or documentation must retain the above
12135768Strhodes *   copyright notice, this list of conditions and the following disclaimer.
13135768Strhodes * 2. Redistributions in binary form must reproduce the above copyright
14135768Strhodes *   notice, this list of conditions and the following disclaimer in the
15135768Strhodes *   documentation and/or other materials provided with the distribution.
16135768Strhodes *
17135768Strhodes * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
18135768Strhodes * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19135768Strhodes * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20135768Strhodes * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
21135768Strhodes * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
22135768Strhodes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23135768Strhodes * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24135768Strhodes * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25135768Strhodes * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26135768Strhodes * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27135768Strhodes * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28135768Strhodes */
29135768Strhodes/*
30135768Strhodes * $Begemot: libbegemot/rpoll.h,v 1.5 2004/09/21 15:49:26 brandt Exp $
31135768Strhodes */
32135768Strhodes# ifndef rpoll_h_
33135768Strhodes# define rpoll_h_
34135768Strhodes
35135768Strhodes# ifdef __cplusplus
36135768Strhodesextern "C" {
37135768Strhodes# endif
38135768Strhodes
39135768Strhodestypedef void (*poll_f)(int fd, int mask, void *arg);
40135768Strhodestypedef void (*timer_f)(int, void *);
41135768Strhodes
42135768Strhodesint	poll_register(int fd, poll_f func, void *arg, int mask);
43135768Strhodesvoid	poll_unregister(int);
44135768Strhodesvoid	poll_dispatch(int wait);
45135768Strhodesint	poll_start_timer(u_int msecs, int repeat, timer_f func, void *arg);
46165009Shartiint	poll_start_utimer(unsigned long long usecs, int repeat, timer_f func,
47165009Sharti    void *arg);
48135768Strhodesvoid	poll_stop_timer(int);
49135768Strhodes
50135768Strhodes# if defined(POLL_IN)
51135768Strhodes#  undef POLL_IN
52135768Strhodes# endif
53135768Strhodes# if defined(POLL_OUT)
54135768Strhodes#  undef POLL_OUT
55135768Strhodes# endif
56135768Strhodes
57135768Strhodes# define POLL_IN	1
58135768Strhodes# define POLL_OUT	2
59135768Strhodes# define POLL_EXCEPT	4
60135768Strhodes
61135768Strhodesextern int	rpoll_policy;
62135768Strhodesextern int	rpoll_trace;
63135768Strhodes
64135768Strhodes# ifdef __cplusplus
65135768Strhodes}
66135768Strhodes# endif
67135768Strhodes
68135768Strhodes# endif
69