Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

inputevt.h

Go to the documentation of this file.
00001 /*
00002  * $Id: inputevt.h,v 1.17 2005/09/27 20:11:30 rmanfredi Exp $
00003  *
00004  * Copyright (c) 2002, ko (ko-@wanadoo.fr)
00005  * Copyright (c) 2005, Christian Biere
00006  *
00007  *----------------------------------------------------------------------
00008  * This file is part of gtk-gnutella.
00009  *
00010  *  gtk-gnutella is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  gtk-gnutella is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with gtk-gnutella; if not, write to the Free Software
00022  *  Foundation, Inc.:
00023  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *----------------------------------------------------------------------
00025  */
00026 
00039 #ifndef _inputevt_h_
00040 #define _inputevt_h_
00041 
00042 #include <glib.h>
00043 
00047 typedef enum {
00048     INPUT_EVENT_R           = 1 << 0,   /* poll for Read events */
00049     INPUT_EVENT_W           = 1 << 1,   /* poll for Write events */
00050     INPUT_EVENT_EXCEPTION   = 1 << 2,   /* poll for exceptions */
00051 
00052     INPUT_EVENT_RX = ((guint) INPUT_EVENT_R | (guint) INPUT_EVENT_EXCEPTION),
00053     INPUT_EVENT_WX = ((guint) INPUT_EVENT_W | (guint) INPUT_EVENT_EXCEPTION),
00054     
00055     INPUT_EVENT_RW = ((guint) INPUT_EVENT_R | (guint) INPUT_EVENT_W),
00056     INPUT_EVENT_RWX = ((guint) INPUT_EVENT_RW | (guint) INPUT_EVENT_EXCEPTION),
00057 } inputevt_cond_t;
00058 
00062 typedef void (*inputevt_handler_t) (
00063     gpointer data,
00064     gint source,
00065     inputevt_cond_t condition
00066 );
00067 
00068 /*
00069  * Module initialization and cleanup functions.
00070  * These don't do anything and are not called (yet).
00071  */
00072 void inputevt_init(void);
00073 void inputevt_close(void);
00074 
00078 guint inputevt_add(gint source, inputevt_cond_t condition,
00079     inputevt_handler_t handler, gpointer data);
00080 
00081 const gchar *inputevt_cond_to_string(inputevt_cond_t cond);
00082 
00083 #if defined(HAS_EPOLL) || defined(HAS_KQUEUE)
00084 void inputevt_remove(guint id);
00085 #else /* !(HAS_EPOLL || HAS_KQUEUE) */
00086 #define inputevt_remove(source) (g_source_remove(source))
00087 #define inputevt_timer()
00088 #endif /* HAS_EPOLL || HAS_KQUEUE */
00089 
00090 #endif  /* _inputevt_h_ */
00091 
00092 /* vi: set ts=4 sw=4 cindent: */

Generated on Sun Feb 12 10:49:56 2006 for Gtk-Gnutella by doxygen 1.3.6