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-2024 Arne Schwabe <arne@rfc2549.org>
5 * Copyright (C) 2020-2024 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, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef DCO_WIN_H
23#define DCO_WIN_H
24
25#if defined(ENABLE_DCO) && defined(_WIN32)
26
27#include <in6addr.h>
28
29#include "buffer.h"
30#include "ovpn_dco_win.h"
31#include "sig.h"
32
33typedef OVPN_KEY_SLOT dco_key_slot_t;
34typedef OVPN_CIPHER_ALG dco_cipher_t;
35
36typedef enum {
37 DCO_MODE_UNINIT,
38 DCO_MODE_P2P,
39 DCO_MODE_MP
40} dco_mode_type;
41
42struct dco_context {
43 struct tuntap *tt;
44 dco_mode_type ifmode;
45
46 OVPN_NOTIFY_EVENT notif_buf;
47 OVERLAPPED ov;
48 int iostate;
49 struct rw_handle rwhandle;
50 int ov_ret;
52 int dco_message_peer_id;
53 int dco_message_type;
54 int dco_del_peer_reason;
55
56 uint64_t dco_read_bytes;
57 uint64_t dco_write_bytes;
58};
59
60typedef struct dco_context dco_context_t;
61
62void
63dco_mp_start_vpn(HANDLE handle, struct link_socket *sock);
64
65void
66dco_p2p_new_peer(HANDLE handle, struct link_socket *sock, struct signal_info *sig_info);
67
68void
69dco_start_tun(struct tuntap *tt);
70
71bool
73
74void
75dco_win_add_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits, unsigned int peer_id);
76
77void
78dco_win_add_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits, unsigned int peer_id);
79
80void
81dco_win_del_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits);
82
83void
84dco_win_del_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits);
85
86#else /* if defined(ENABLE_DCO) && defined(_WIN32) */
87
88static inline void
90{
91 ASSERT(false);
92}
93
94#endif /* defined(_WIN32) */
95#endif /* ifndef DCO_H */
void * dco_context_t
Definition dco.h:267
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:280
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:847
void dco_win_del_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits)
Definition dco_win.c:866
bool dco_win_supports_multipeer(void)
Definition dco_win.c:821
void dco_win_del_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits)
Definition dco_win.c:885
void dco_p2p_new_peer(HANDLE handle, struct link_socket *sock, struct signal_info *sig_info)
Definition dco_win.c:324
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:828
static void dco_start_tun(struct tuntap *tt)
Definition dco_win.h:89
#define ASSERT(x)
Definition error.h:195
enum _OVPN_KEY_SLOT OVPN_KEY_SLOT
enum _OVPN_CIPHER_ALG OVPN_CIPHER_ALG
Definition tun.h:181