Back to index

php5  5.3.10
fpm_events.h
Go to the documentation of this file.
00001 
00002        /* $Id: fpm_events.h,v 1.9 2008/05/24 17:38:47 anight Exp $ */
00003        /* (c) 2007,2008 Andrei Nigmatulin */
00004 
00005 #ifndef FPM_EVENTS_H
00006 #define FPM_EVENTS_H 1
00007 
00008 #define FPM_EV_TIMEOUT  (1 << 0)
00009 #define FPM_EV_READ     (1 << 1)
00010 #define FPM_EV_PERSIST  (1 << 2)
00011 #define FPM_EV_EDGE     (1 << 3)
00012 
00013 #define fpm_event_set_timer(ev, flags, cb, arg) fpm_event_set((ev), -1, (flags), (cb), (arg))
00014 
00015 struct fpm_event_s {
00016        int fd;                   /* not set with FPM_EV_TIMEOUT */
00017        struct timeval timeout;   /* next time to trigger */
00018        struct timeval frequency;
00019        void (*callback)(struct fpm_event_s *, short, void *);
00020        void *arg;
00021        int flags;
00022        int index;                /* index of the fd in the ufds array */
00023        short which;              /* type of event */
00024 };
00025 
00026 typedef struct fpm_event_queue_s {
00027        struct fpm_event_queue_s *prev;
00028        struct fpm_event_queue_s *next;
00029        struct fpm_event_s *ev;
00030 } fpm_event_queue;
00031 
00032 struct fpm_event_module_s {
00033        const char *name;
00034        int support_edge_trigger;
00035        int (*init)(int max_fd);
00036        int (*clean)(void);
00037        int (*wait)(struct fpm_event_queue_s *queue, unsigned long int timeout);
00038        int (*add)(struct fpm_event_s *ev);
00039        int (*remove)(struct fpm_event_s *ev);
00040 };
00041 
00042 void fpm_event_loop(int err);
00043 void fpm_event_fire(struct fpm_event_s *ev);
00044 int fpm_event_init_main();
00045 int fpm_event_set(struct fpm_event_s *ev, int fd, int flags, void (*callback)(struct fpm_event_s *, short, void *), void *arg);
00046 int fpm_event_add(struct fpm_event_s *ev, unsigned long int timeout);
00047 int fpm_event_del(struct fpm_event_s *ev);
00048 int fpm_event_pre_init(char *machanism);
00049 const char *fpm_event_machanism_name();
00050 int fpm_event_support_edge_trigger();
00051 
00052 #endif