OpenVPN
dco_win.h
Go to the documentation of this file.
1/*
2 * Interface to ovpn-win-dco networking code
3 *
4 * Copyright (C) 2020-2025 Arne Schwabe <arne@rfc2549.org>
5 * Copyright (C) 2020-2025 OpenVPN Inc <sales@openvpn.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program (see the file COPYING included with this
18 * distribution); if not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef DCO_WIN_H
22#define DCO_WIN_H
23
24#if defined(ENABLE_DCO) && defined(_WIN32)
25
26#include <in6addr.h>
27
28#include "buffer.h"
29#include "ovpn_dco_win.h"
30#include "sig.h"
31
32typedef OVPN_KEY_SLOT dco_key_slot_t;
33typedef OVPN_CIPHER_ALG dco_cipher_t;
34
35typedef enum
36{
37 DCO_MODE_UNINIT,
38 DCO_MODE_P2P,
39 DCO_MODE_MP
40} dco_mode_type;
41
42struct dco_context
43{
44 struct tuntap *tt;
45 dco_mode_type ifmode;
46
47 OVPN_NOTIFY_EVENT notif_buf;
48 OVERLAPPED ov;
49 int iostate;
50 struct rw_handle rwhandle;
51 int ov_ret;
53 int dco_message_peer_id;
54 int dco_message_type;
55 int dco_del_peer_reason;
56 struct sockaddr_storage dco_float_peer_ss;
57
58 uint64_t dco_read_bytes;
59 uint64_t dco_write_bytes;
60
61 struct context *c;
62};
63
64typedef struct dco_context dco_context_t;
65
66void dco_mp_start_vpn(HANDLE handle, struct link_socket *sock);
67
68void dco_p2p_new_peer(HANDLE handle, OVERLAPPED *ov, struct link_socket *sock,
69 struct signal_info *sig_info);
70
71void dco_start_tun(struct tuntap *tt);
72
74
75void dco_win_add_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits,
76 unsigned int peer_id);
77
78void dco_win_add_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits,
79 unsigned int peer_id);
80
81void dco_win_del_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits);
82
83void dco_win_del_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits);
84
85#else /* if defined(ENABLE_DCO) && defined(_WIN32) */
86
87static inline void
89{
90 ASSERT(false);
91}
92
93#endif /* defined(_WIN32) */
94#endif /* ifndef DCO_H */
void * dco_context_t
Definition dco.h:261
void dco_mp_start_vpn(HANDLE handle, struct link_socket *sock)
Initializes and binds the kernel UDP transport socket for multipeer mode.
Definition dco_win.c:283
void dco_win_add_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits, unsigned int peer_id)
Definition dco_win.c:1016
void dco_win_del_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits)
Definition dco_win.c:1037
bool dco_win_supports_multipeer(void)
Definition dco_win.c:986
void dco_win_del_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits)
Definition dco_win.c:1058
void dco_p2p_new_peer(HANDLE handle, OVERLAPPED *ov, struct link_socket *sock, struct signal_info *sig_info)
Definition dco_win.c:327
void dco_win_add_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits, unsigned int peer_id)
Definition dco_win.c:993
static void dco_start_tun(struct tuntap *tt)
Definition dco_win.h:88
#define ASSERT(x)
Definition error.h:217
enum _OVPN_KEY_SLOT OVPN_KEY_SLOT
enum _OVPN_CIPHER_ALG OVPN_CIPHER_ALG
Contains all state information for one tunnel.
Definition openvpn.h:474
Definition tun.h:183