00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _EVENT2_EVENT_STRUCT_H_
00028 #define _EVENT2_EVENT_STRUCT_H_
00029
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041 #include <event-config.h>
00042 #ifdef _EVENT_HAVE_SYS_TYPES_H
00043 #include <sys/types.h>
00044 #endif
00045 #ifdef _EVENT_HAVE_SYS_TIME_H
00046 #include <sys/time.h>
00047 #endif
00048
00049
00050 #include <event2/util.h>
00051
00052 #ifdef WIN32
00053 #define WIN32_LEAN_AND_MEAN
00054 #include <windows.h>
00055 #undef WIN32_LEAN_AND_MEAN
00056 #endif
00057
00058 #define EVLIST_TIMEOUT 0x01
00059 #define EVLIST_INSERTED 0x02
00060 #define EVLIST_SIGNAL 0x04
00061 #define EVLIST_ACTIVE 0x08
00062 #define EVLIST_INTERNAL 0x10
00063 #define EVLIST_INIT 0x80
00064
00065
00066 #define EVLIST_ALL (0xf000 | 0x9f)
00067
00068
00069 #ifndef TAILQ_ENTRY
00070 #define _EVENT_DEFINED_TQENTRY
00071 #define TAILQ_ENTRY(type) \
00072 struct { \
00073 struct type *tqe_next; \
00074 struct type **tqe_prev; \
00075 }
00076 #endif
00077
00078 struct event_base;
00079 struct event {
00080 TAILQ_ENTRY (event) (ev_active_next);
00081 TAILQ_ENTRY (event) (ev_next);
00082 int min_heap_idx;
00083
00084 struct event_base *ev_base;
00085
00086 evutil_socket_t ev_fd;
00087 union {
00088
00089 struct {
00090 TAILQ_ENTRY (event) (ev_io_next);
00091 struct timeval ev_timeout;
00092 } ev_io;
00093
00094
00095 struct {
00096 TAILQ_ENTRY (event) (ev_signal_next);
00097 short ev_ncalls;
00098
00099 short *ev_pncalls;
00100 } ev_signal;
00101 } _ev;
00102
00103 short ev_events;
00104
00105 struct timeval ev_timeout;
00106
00107 int ev_pri;
00108
00109
00110 void (*ev_closure)(struct event_base *, struct event *);
00111 void (*ev_callback)(evutil_socket_t, short, void *arg);
00112 void *ev_arg;
00113
00114 int ev_res;
00115 int ev_flags;
00116 };
00117
00118 #ifdef EVENT_FD
00119
00120
00121 #undef EVENT_FD
00122 #undef EVENT_SIGNAL
00123 #define EVENT_SIGNAL(ev) ((int)(ev)->ev_fd)
00124 #define EVENT_FD(ev) ((int)(ev)->ev_fd)
00125 #endif
00126
00127
00128
00129
00130
00131 struct evkeyval {
00132 TAILQ_ENTRY(evkeyval) next;
00133
00134 char *key;
00135 char *value;
00136 };
00137
00138 #ifdef _EVENT_DEFINED_TQENTRY
00139 #undef TAILQ_ENTRY
00140 struct event_list;
00141 struct evkeyvalq;
00142 #undef _EVENT_DEFINED_TQENTRY
00143 #else
00144 TAILQ_HEAD (event_list, event);
00145 TAILQ_HEAD (evkeyvalq, evkeyval);
00146 #endif
00147
00148 #ifdef __cplusplus
00149 }
00150 #endif
00151
00152 #endif