1 /* $NetBSD: event_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $ */
2 /* $NetBSD: event_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $ */
4 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
5 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef _EVENT2_EVENT_STRUCT_H_
30 #define _EVENT2_EVENT_STRUCT_H_
32 /** @file event2/event_struct.h
34 Structures used by event.h. Using these structures directly WILL harm
35 forward compatibility: be careful.
37 No field declared in this file should be used directly in user code. Except
38 for historical reasons, these fields would not be exposed at all.
45 #include <event2/event-config.h>
46 #ifdef _EVENT_HAVE_SYS_TYPES_H
47 #include <sys/types.h>
49 #ifdef _EVENT_HAVE_SYS_TIME_H
54 #include <event2/util.h>
57 #include <event2/keyvalq_struct.h>
59 #define EVLIST_TIMEOUT 0x01
60 #define EVLIST_INSERTED 0x02
61 #define EVLIST_SIGNAL 0x04
62 #define EVLIST_ACTIVE 0x08
63 #define EVLIST_INTERNAL 0x10
64 #define EVLIST_INIT 0x80
66 /* EVLIST_X_ Private space: 0x1000-0xf000 */
67 #define EVLIST_ALL (0xf000 | 0x9f)
69 /* Fix so that people don't have to run with <sys/queue.h> */
71 #define _EVENT_DEFINED_TQENTRY
72 #define TAILQ_ENTRY(type) \
74 struct type *tqe_next; /* next element */ \
75 struct type **tqe_prev; /* address of previous next element */ \
77 #endif /* !TAILQ_ENTRY */
80 #define _EVENT_DEFINED_TQHEAD
81 #define TAILQ_HEAD(name, type) \
83 struct type *tqh_first; \
84 struct type **tqh_last; \
90 TAILQ_ENTRY(event
) ev_active_next
;
91 TAILQ_ENTRY(event
) ev_next
;
92 /* for managing timeouts */
94 TAILQ_ENTRY(event
) ev_next_with_common_timeout
;
97 evutil_socket_t ev_fd
;
99 struct event_base
*ev_base
;
102 /* used for io events */
104 TAILQ_ENTRY(event
) ev_io_next
;
105 struct timeval ev_timeout
;
108 /* used by signal events */
110 TAILQ_ENTRY(event
) ev_signal_next
;
112 /* Allows deletes in callback */
118 short ev_res
; /* result passed to event callback */
120 ev_uint8_t ev_pri
; /* smaller numbers are higher priority */
121 ev_uint8_t ev_closure
;
122 struct timeval ev_timeout
;
124 /* allows us to adopt for different types of events */
125 void (*ev_callback
)(evutil_socket_t
, short, void *arg
);
129 TAILQ_HEAD (event_list
, event
);
131 #ifdef _EVENT_DEFINED_TQENTRY
135 #ifdef _EVENT_DEFINED_TQHEAD
143 #endif /* _EVENT2_EVENT_STRUCT_H_ */