2
* OpenVPN -- An application to securely tunnel IP networks
3
* over a single TCP/UDP port, with support for SSL/TLS-based
4
* session authentication and key exchange,
5
* packet encryption, packet authentication, and
8
* Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License version 2
12
* as published by the Free Software Foundation.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program (see the file COPYING included with this
21
* distribution); if not, write to the Free Software Foundation, Inc.,
22
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33
* rwflags passed to event_ctl and returned by
34
* struct event_set_return.
37
#define EVENT_READ (1<<0)
38
#define EVENT_WRITE (1<<1)
40
* Initialization flags passed to event_set_init
42
#define EVENT_METHOD_US_TIMEOUT (1<<0)
43
#define EVENT_METHOD_FAST (1<<1)
47
typedef const struct rw_handle *event_t;
49
#define UNDEFINED_EVENT (NULL)
55
#define UNDEFINED_EVENT (-1)
60
struct event_set_return;
62
struct event_set_functions
64
void (*free)(struct event_set *es);
65
void (*reset)(struct event_set *es);
66
void (*del)(struct event_set *es, event_t event);
67
void (*ctl)(struct event_set *es, event_t event, unsigned int rwflags, void *arg);
70
* Return status for wait:
71
* -1 on signal or error
73
* length of event_set_return if at least 1 event is returned
75
int (*wait)(struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen);
78
struct event_set_return
86
struct event_set_functions func;
90
* maxevents on input: desired max number of event_t descriptors
91
* simultaneously set with event_ctl
92
* maxevents on output: may be modified down, depending on limitations
94
* flags: EVENT_METHOD_x flags
96
struct event_set *event_set_init (int *maxevents, unsigned int flags);
99
event_free (struct event_set *es)
102
(*es->func.free)(es);
106
event_reset (struct event_set *es)
108
(*es->func.reset)(es);
112
event_del (struct event_set *es, event_t event)
114
(*es->func.del)(es, event);
118
event_ctl (struct event_set *es, event_t event, unsigned int rwflags, void *arg)
120
(*es->func.ctl)(es, event, rwflags, arg);
124
event_wait (struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen)
127
perf_push (PERF_IO_WAIT);
128
ret = (*es->func.wait)(es, tv, out, outlen);
134
event_set_return_init (struct event_set_return *esr)
143
wait_signal (struct event_set *es, void *arg)
145
if (HANDLE_DEFINED (win32_signal.in.read))
146
event_ctl (es, &win32_signal.in, EVENT_READ, arg);
152
wait_signal (struct event_set *es, void *arg)