File indexing completed on 2025-01-18 09:57:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef EVENT2_EVENT_STRUCT_H_INCLUDED_
0028 #define EVENT2_EVENT_STRUCT_H_INCLUDED_
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043 #include <event2/event-config.h>
0044 #ifdef EVENT__HAVE_SYS_TYPES_H
0045 #include <sys/types.h>
0046 #endif
0047 #ifdef EVENT__HAVE_SYS_TIME_H
0048 #include <sys/time.h>
0049 #endif
0050
0051
0052 #include <event2/util.h>
0053
0054
0055 #include <event2/keyvalq_struct.h>
0056
0057 #define EVLIST_TIMEOUT 0x01
0058 #define EVLIST_INSERTED 0x02
0059 #define EVLIST_SIGNAL 0x04
0060 #define EVLIST_ACTIVE 0x08
0061 #define EVLIST_INTERNAL 0x10
0062 #define EVLIST_ACTIVE_LATER 0x20
0063 #define EVLIST_FINALIZING 0x40
0064 #define EVLIST_INIT 0x80
0065
0066 #define EVLIST_ALL 0xff
0067
0068
0069 #ifndef TAILQ_ENTRY
0070 #define EVENT_DEFINED_TQENTRY_
0071 #define TAILQ_ENTRY(type) \
0072 struct { \
0073 struct type *tqe_next; \
0074 struct type **tqe_prev; \
0075 }
0076 #endif
0077
0078 #ifndef TAILQ_HEAD
0079 #define EVENT_DEFINED_TQHEAD_
0080 #define TAILQ_HEAD(name, type) \
0081 struct name { \
0082 struct type *tqh_first; \
0083 struct type **tqh_last; \
0084 }
0085 #endif
0086
0087
0088 #ifndef LIST_ENTRY
0089 #define EVENT_DEFINED_LISTENTRY_
0090 #define LIST_ENTRY(type) \
0091 struct { \
0092 struct type *le_next; \
0093 struct type **le_prev; \
0094 }
0095 #endif
0096
0097 #ifndef LIST_HEAD
0098 #define EVENT_DEFINED_LISTHEAD_
0099 #define LIST_HEAD(name, type) \
0100 struct name { \
0101 struct type *lh_first; \
0102 }
0103 #endif
0104
0105 struct event;
0106
0107 struct event_callback {
0108 TAILQ_ENTRY(event_callback) evcb_active_next;
0109 short evcb_flags;
0110 ev_uint8_t evcb_pri;
0111 ev_uint8_t evcb_closure;
0112
0113 union {
0114 void (*evcb_callback)(evutil_socket_t, short, void *);
0115 void (*evcb_selfcb)(struct event_callback *, void *);
0116 void (*evcb_evfinalize)(struct event *, void *);
0117 void (*evcb_cbfinalize)(struct event_callback *, void *);
0118 } evcb_cb_union;
0119 void *evcb_arg;
0120 };
0121
0122 struct event_base;
0123 struct event {
0124 struct event_callback ev_evcallback;
0125
0126
0127 union {
0128 TAILQ_ENTRY(event) ev_next_with_common_timeout;
0129 int min_heap_idx;
0130 } ev_timeout_pos;
0131 evutil_socket_t ev_fd;
0132
0133 struct event_base *ev_base;
0134
0135 union {
0136
0137 struct {
0138 LIST_ENTRY (event) ev_io_next;
0139 struct timeval ev_timeout;
0140 } ev_io;
0141
0142
0143 struct {
0144 LIST_ENTRY (event) ev_signal_next;
0145 short ev_ncalls;
0146
0147 short *ev_pncalls;
0148 } ev_signal;
0149 } ev_;
0150
0151 short ev_events;
0152 short ev_res;
0153 struct timeval ev_timeout;
0154 };
0155
0156 TAILQ_HEAD (event_list, event);
0157
0158 #ifdef EVENT_DEFINED_TQENTRY_
0159 #undef TAILQ_ENTRY
0160 #endif
0161
0162 #ifdef EVENT_DEFINED_TQHEAD_
0163 #undef TAILQ_HEAD
0164 #endif
0165
0166 LIST_HEAD (event_dlist, event);
0167
0168 #ifdef EVENT_DEFINED_LISTENTRY_
0169 #undef LIST_ENTRY
0170 #endif
0171
0172 #ifdef EVENT_DEFINED_LISTHEAD_
0173 #undef LIST_HEAD
0174 #endif
0175
0176 #ifdef __cplusplus
0177 }
0178 #endif
0179
0180 #endif