Go to the documentation of this file.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 <event2/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
00053 #include <event2/keyvalq_struct.h>
00054
00055 #define EVLIST_TIMEOUT 0x01
00056 #define EVLIST_INSERTED 0x02
00057 #define EVLIST_SIGNAL 0x04
00058 #define EVLIST_ACTIVE 0x08
00059 #define EVLIST_INTERNAL 0x10
00060 #define EVLIST_INIT 0x80
00061
00062
00063 #define EVLIST_ALL (0xf000 | 0x9f)
00064
00065
00066 #ifndef TAILQ_ENTRY
00067 #define _EVENT_DEFINED_TQENTRY
00068 #define TAILQ_ENTRY(type) \
00069 struct { \
00070 struct type *tqe_next; \
00071 struct type **tqe_prev; \
00072 }
00073 #endif
00074
00075 #ifndef TAILQ_HEAD
00076 #define _EVENT_DEFINED_TQHEAD
00077 #define TAILQ_HEAD(name, type) \
00078 struct name { \
00079 struct type *tqh_first; \
00080 struct type **tqh_last; \
00081 }
00082 #endif
00083
00084 struct event_base;
00085 struct event {
00086 TAILQ_ENTRY(event) ev_active_next;
00087 TAILQ_ENTRY(event) ev_next;
00088
00089 union {
00090 TAILQ_ENTRY(event) ev_next_with_common_timeout;
00091 int min_heap_idx;
00092 } ev_timeout_pos;
00093 evutil_socket_t ev_fd;
00094
00095 struct event_base *ev_base;
00096
00097 union {
00098
00099 struct {
00100 TAILQ_ENTRY(event) ev_io_next;
00101 struct timeval ev_timeout;
00102 } ev_io;
00103
00104
00105 struct {
00106 TAILQ_ENTRY(event) ev_signal_next;
00107 short ev_ncalls;
00108
00109 short *ev_pncalls;
00110 } ev_signal;
00111 } _ev;
00112
00113 short ev_events;
00114 short ev_res;
00115 short ev_flags;
00116 ev_uint8_t ev_pri;
00117 ev_uint8_t ev_closure;
00118 struct timeval ev_timeout;
00119
00120
00121 void (*ev_callback)(evutil_socket_t, short, void *arg);
00122 void *ev_arg;
00123 };
00124
00125 TAILQ_HEAD (event_list, event);
00126
00127 #ifdef _EVENT_DEFINED_TQENTRY
00128 #undef TAILQ_ENTRY
00129 #endif
00130
00131 #ifdef _EVENT_DEFINED_TQHEAD
00132 #undef TAILQ_HEAD
00133 #endif
00134
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138
00139 #endif