xref: /freebsd/contrib/libbegemot/rpoll.h (revision 8e9b3e707151d136ec95e7f1d37556e39c1e228c)
1911a190fSTom Rhodes /*
2911a190fSTom Rhodes  * Copyright (c)1996-2002 by Hartmut Brandt
3911a190fSTom Rhodes  *	All rights reserved.
4911a190fSTom Rhodes  *
5911a190fSTom Rhodes  * Author: Hartmut Brandt
6911a190fSTom Rhodes  *
7911a190fSTom Rhodes  * Redistribution of this software and documentation and use in source and
8911a190fSTom Rhodes  * binary forms, with or without modification, are permitted provided that
9911a190fSTom Rhodes  * the following conditions are met:
10911a190fSTom Rhodes  *
11911a190fSTom Rhodes  * 1. Redistributions of source code or documentation must retain the above
12911a190fSTom Rhodes  *   copyright notice, this list of conditions and the following disclaimer.
13911a190fSTom Rhodes  * 2. Redistributions in binary form must reproduce the above copyright
14911a190fSTom Rhodes  *   notice, this list of conditions and the following disclaimer in the
15911a190fSTom Rhodes  *   documentation and/or other materials provided with the distribution.
16911a190fSTom Rhodes  *
17911a190fSTom Rhodes  * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
18911a190fSTom Rhodes  * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19911a190fSTom Rhodes  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20911a190fSTom Rhodes  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
21911a190fSTom Rhodes  * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
22911a190fSTom Rhodes  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23911a190fSTom Rhodes  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24911a190fSTom Rhodes  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25911a190fSTom Rhodes  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26911a190fSTom Rhodes  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27911a190fSTom Rhodes  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28911a190fSTom Rhodes  */
29911a190fSTom Rhodes /*
30911a190fSTom Rhodes  * $Begemot: libbegemot/rpoll.h,v 1.5 2004/09/21 15:49:26 brandt Exp $
31911a190fSTom Rhodes  */
32911a190fSTom Rhodes # ifndef rpoll_h_
33911a190fSTom Rhodes # define rpoll_h_
34911a190fSTom Rhodes 
35911a190fSTom Rhodes # ifdef __cplusplus
36911a190fSTom Rhodes extern "C" {
37911a190fSTom Rhodes # endif
38911a190fSTom Rhodes 
39911a190fSTom Rhodes typedef void (*poll_f)(int fd, int mask, void *arg);
40911a190fSTom Rhodes typedef void (*timer_f)(int, void *);
41911a190fSTom Rhodes 
42911a190fSTom Rhodes int	poll_register(int fd, poll_f func, void *arg, int mask);
43911a190fSTom Rhodes void	poll_unregister(int);
44911a190fSTom Rhodes void	poll_dispatch(int wait);
45911a190fSTom Rhodes int	poll_start_timer(u_int msecs, int repeat, timer_f func, void *arg);
46ca77a23fSHartmut Brandt int	poll_start_utimer(unsigned long long usecs, int repeat, timer_f func,
47ca77a23fSHartmut Brandt     void *arg);
48911a190fSTom Rhodes void	poll_stop_timer(int);
49911a190fSTom Rhodes 
50*8e9b3e70SHartmut Brandt enum {
51*8e9b3e70SHartmut Brandt 	RPOLL_IN	= 1,
52*8e9b3e70SHartmut Brandt 	RPOLL_OUT	= 2,
53*8e9b3e70SHartmut Brandt 	RPOLL_EXCEPT	= 4,
54*8e9b3e70SHartmut Brandt };
55911a190fSTom Rhodes 
56911a190fSTom Rhodes extern int	rpoll_policy;
57911a190fSTom Rhodes extern int	rpoll_trace;
58911a190fSTom Rhodes 
59911a190fSTom Rhodes # ifdef __cplusplus
60911a190fSTom Rhodes }
61911a190fSTom Rhodes # endif
62911a190fSTom Rhodes 
63911a190fSTom Rhodes # endif
64