00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __EVENT_H
00018
#define __EVENT_H
00019
00020
00021
00031
00032
00033
#include <sys/types.h>
00034
00035
00036
00037
00038
00039
#define MSEC (1)
00040
#define SECONDS (1000*MSEC)
00041
#define MINUTES (60*SECONDS)
00042
00043
00044
#define ESECONDS (1)
00045
#define EMINUTES (60*ESECONDS)
00046
#define EHOURS (60*EMINUTES)
00047
#define EDAYS (24*EHOURS)
00048
00049
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