Initial revision 6759
[qball-mpd.git] / src / .svn / text-base / ioops.h.svn-base
blobe797a71532fa355487c32f9fe1d40a9796c14955
1 /* the Music Player Daemon (MPD)
2  * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3  * This project's homepage is: http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
19 #ifndef IOOPS_H
20 #define IOOPS_H
22 #include <sys/select.h>
24 struct ioOps {
25         struct ioOps *prev, *next;
27         /*
28          * Called before each 'select' statement.
29          *   To register for IO, call FD_SET for each required queue
30          * Return the highest fd number you registered
31          */
32         int (*fdset) ( fd_set *rfds, fd_set *wfds, fd_set *efds );
34         /*
35          * Called after each 'select' statement.
36          *   fdCount is the number of fds total in all sets.  It may be 0.
37          *   For each fd you registered for in (fdset), you should FD_CLR it from the
38          *   appropriate queue(s).
39          * Return the total number of fds left in all sets (Ie, return fdCount
40          *   minus the number of times you called FD_CLR).
41          */
42         int (*consume) ( int fdCount, fd_set *rfds, fd_set *wfds, fd_set *efds );
45 /* Call this to register your io operation handler struct */
46 void registerIO( struct ioOps *ops );
48 /* Call this to deregister your io operation handler struct */
49 void deregisterIO( struct ioOps *ops );
51 #endif