OpenVPN
multi_io.h
Go to the documentation of this file.
1/*
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
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
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.
13 *
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.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23/*
24 * Multi-protocol specific code for --mode server
25 */
26
27#ifndef MULTI_IO_H
28#define MULTI_IO_H
29
30#include "event.h"
31
32/*
33 * I/O processing States
34 */
35
36#define TA_UNDEF 0
37#define TA_SOCKET_READ 1
38#define TA_SOCKET_READ_RESIDUAL 2
39#define TA_SOCKET_WRITE 3
40#define TA_SOCKET_WRITE_READY 4
41#define TA_SOCKET_WRITE_DEFERRED 5
42#define TA_TUN_READ 6
43#define TA_TUN_WRITE 7
44#define TA_INITIAL 8
45#define TA_TIMEOUT 9
46#define TA_TUN_WRITE_TIMEOUT 10
47
48/*
49 * I/O state and events tracker
50 */
52{
53 struct event_set *es;
55 int n_esr;
57 unsigned int tun_rwflags;
58 unsigned int udp_flags;
59#ifdef ENABLE_MANAGEMENT
61#endif
62};
63
64struct multi_io *multi_io_init(int maxevents, int *maxclients);
65
66void multi_io_free(struct multi_io *multi_io);
67
68int multi_io_wait(struct multi_context *m);
69
71
73
74void multi_io_action(struct multi_context *m, struct multi_instance *mi, int action, bool poll);
75
77
78#endif /* ifndef MULTI_IO_H */
void multi_io_process_io(struct multi_context *m)
Definition multi_io.c:423
struct multi_io * multi_io_init(int maxevents, int *maxclients)
Definition multi_io.c:116
void multi_io_free(struct multi_io *multi_io)
Definition multi_io.c:158
void multi_io_set_global_rw_flags(struct multi_context *m, struct multi_instance *mi)
Definition multi_io.c:136
int multi_io_wait(struct multi_context *m)
Definition multi_io.c:169
void multi_io_delete_event(struct multi_io *multi_io, event_t event)
Definition multi_io.c:646
void multi_io_action(struct multi_context *m, struct multi_instance *mi, int action, bool poll)
Definition multi_io.c:559
Main OpenVPN server state structure.
Definition multi.h:164
Server-mode state structure for one single VPN tunnel.
Definition multi.h:103
struct event_set * es
Definition multi_io.h:53
int n_esr
Definition multi_io.h:55
struct event_set_return * esr
Definition multi_io.h:54
unsigned int tun_rwflags
Definition multi_io.h:57
int maxevents
Definition multi_io.h:56
unsigned int udp_flags
Definition multi_io.h:58
unsigned int management_persist_flags
Definition multi_io.h:60