Main Page | Class List | File List | Class Members | File Members | Related Pages

event.h

Go to the documentation of this file.
00001 /* 00002 * $Id: event.h,v 1.22 2003/10/16 18:50:54 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __EVENT_H 00018 #define __EVENT_H 00019 00020 /*****************************************************************************/ 00021 00031 /*****************************************************************************/ 00032 00033 #include <sys/types.h> 00034 00035 /*****************************************************************************/ 00036 00037 /* time specifications useful for timer_add calls, which are in msec 00038 * precision */ 00039 #define MSEC (1) 00040 #define SECONDS (1000*MSEC) 00041 #define MINUTES (60*SECONDS) 00042 00043 /* time specs useful for comparing seconds since the epoch */ 00044 #define ESECONDS (1) 00045 #define EMINUTES (60*ESECONDS) 00046 #define EHOURS (60*EMINUTES) 00047 #define EDAYS (24*EHOURS) 00048 00049 /* see input_add */ 00050 #define TIMEOUT_DEF (60*SECONDS) 00051 00052 /*****************************************************************************/ 00053 00054 typedef unsigned int input_id; 00055 typedef unsigned int timer_id; 00057 /*****************************************************************************/ 00058 00063 typedef void (*InputCallback) (int fd, input_id id, void *udata); 00064 00068 typedef enum 00069 { 00070 INPUT_READ = 0x01, 00071 INPUT_WRITE = 0x02, 00072 INPUT_ERROR = 0x04 00073 } InputState; 00074 00075 /*****************************************************************************/ 00076 00085 typedef BOOL (*TimerCallback) (void *udata); 00086 00087 /*****************************************************************************/ 00088 00089 EXTERN_C_BEGIN 00090 00091 /*****************************************************************************/ 00092 00097 LIBGIFT_EXPORT 00098 void event_init (void); 00099 00108 LIBGIFT_EXPORT 00109 void event_quit (int sig); 00110 00114 LIBGIFT_EXPORT 00115 void event_poll_once (void); 00116 00121 LIBGIFT_EXPORT 00122 void event_loop (void); 00123 00124 /*****************************************************************************/ 00125 00141 LIBGIFT_EXPORT 00142 input_id input_add (int fd, void *udata, InputState state, 00143 InputCallback callback, time_t timeout); 00144 00148 LIBGIFT_EXPORT 00149 void input_remove (input_id id); 00150 00158 LIBGIFT_EXPORT 00159 void input_remove_all (int fd); 00160 00166 LIBGIFT_EXPORT 00167 void input_suspend_all (int fd); 00168 00169 #if 0 00170 00173 LIBGIFT_EXPORT 00174 int input_suspended_all (int fd); 00175 #endif 00176 00180 LIBGIFT_EXPORT 00181 void input_resume_all (int fd); 00182 00183 /*****************************************************************************/ 00184 00195 LIBGIFT_EXPORT 00196 timer_id timer_add (time_t interval, TimerCallback callback, void *udata); 00197 00202 LIBGIFT_EXPORT 00203 void timer_reset (timer_id id); 00204 00209 LIBGIFT_EXPORT 00210 void timer_remove (timer_id id); 00211 00216 LIBGIFT_EXPORT 00217 void timer_remove_zero (timer_id *id); 00218 00219 /*****************************************************************************/ 00220 00221 EXTERN_C_END 00222 00223 /*****************************************************************************/ 00224 00225 #endif /* __EVENT_H */

Generated on Sun Aug 22 08:07:10 2004 by doxygen 1.3.7