OpenVPN
ovpn_dco_win.h
Go to the documentation of this file.
1 /*
2  * ovpn-dco-win OpenVPN protocol accelerator for Windows
3  *
4  * Copyright (C) 2020-2021 OpenVPN Inc <sales@openvpn.net>
5  *
6  * Author: Lev Stipakov <lev@openvpn.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * This particular file (uapi.h) is also licensed using the MIT license (see COPYRIGHT.MIT).
22  */
23 
24 #pragma once
25 #ifndef _KERNEL_MODE
26 #include <winsock2.h>
27 #endif
28 #include <ws2def.h>
29 #include <ws2ipdef.h>
30 
31 typedef enum {
34 } OVPN_PROTO;
35 
36 typedef struct _OVPN_NEW_PEER {
37  union {
38  SOCKADDR_IN Addr4;
39  SOCKADDR_IN6 Addr6;
40  } Local;
41 
42  union {
43  SOCKADDR_IN Addr4;
44  SOCKADDR_IN6 Addr6;
45  } Remote;
46 
49 
50 typedef struct _OVPN_STATS {
53 
56 
59 
62 
65 
66  LONG64 TunBytesSent;
69 
70 typedef enum _OVPN_KEY_SLOT {
74 
75 typedef enum _OVPN_CIPHER_ALG {
80 
81 typedef struct _OVPN_KEY_DIRECTION
82 {
83  unsigned char Key[32];
84  unsigned char KeyLen; // 16/24/32 -> AES-128-GCM/AES-192-GCM/AES-256-GCM
85  unsigned char NonceTail[8];
87 
88 typedef struct _OVPN_CRYPTO_DATA {
93  unsigned char KeyId;
94  int PeerId;
96 
97 typedef struct _OVPN_SET_PEER {
100  LONG MSS;
102 
103 typedef struct _OVPN_VERSION {
104  LONG Major;
105  LONG Minor;
106  LONG Patch;
108 
109 #define OVPN_IOCTL_NEW_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
110 #define OVPN_IOCTL_GET_STATS CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
111 #define OVPN_IOCTL_NEW_KEY CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
112 #define OVPN_IOCTL_SWAP_KEYS CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
113 #define OVPN_IOCTL_SET_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
114 #define OVPN_IOCTL_START_VPN CTL_CODE(FILE_DEVICE_UNKNOWN, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
115 #define OVPN_IOCTL_DEL_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
116 #define OVPN_IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
_OVPN_NEW_PEER::Proto
OVPN_PROTO Proto
Definition: ovpn_dco_win.h:47
_OVPN_STATS::ReceivedDataPackets
LONG ReceivedDataPackets
Definition: ovpn_dco_win.h:57
_OVPN_STATS
Definition: ovpn_dco_win.h:50
_OVPN_VERSION::Minor
LONG Minor
Definition: ovpn_dco_win.h:105
_OVPN_STATS::LostInDataPackets
LONG LostInDataPackets
Definition: ovpn_dco_win.h:54
_OVPN_SET_PEER::MSS
LONG MSS
Definition: ovpn_dco_win.h:100
_OVPN_STATS::TunBytesReceived
LONG64 TunBytesReceived
Definition: ovpn_dco_win.h:67
_OVPN_STATS::TransportBytesReceived
LONG64 TransportBytesReceived
Definition: ovpn_dco_win.h:64
_OVPN_STATS::ReceivedControlPackets
LONG ReceivedControlPackets
Definition: ovpn_dco_win.h:58
OVPN_VERSION
struct _OVPN_VERSION OVPN_VERSION
_OVPN_SET_PEER
Definition: ovpn_dco_win.h:97
OVPN_PROTO_UDP
@ OVPN_PROTO_UDP
Definition: ovpn_dco_win.h:32
_OVPN_KEY_SLOT
_OVPN_KEY_SLOT
Definition: ovpn_dco_win.h:70
_OVPN_STATS::LostOutDataPackets
LONG LostOutDataPackets
Definition: ovpn_dco_win.h:55
OVPN_PROTO
OVPN_PROTO
Definition: ovpn_dco_win.h:31
_OVPN_STATS::TransportBytesSent
LONG64 TransportBytesSent
Definition: ovpn_dco_win.h:63
OVPN_CIPHER_ALG_CHACHA20_POLY1305
@ OVPN_CIPHER_ALG_CHACHA20_POLY1305
Definition: ovpn_dco_win.h:78
_OVPN_CRYPTO_DATA::PeerId
int PeerId
Definition: ovpn_dco_win.h:94
OVPN_CIPHER_ALG
enum _OVPN_CIPHER_ALG OVPN_CIPHER_ALG
OVPN_STATS
struct _OVPN_STATS OVPN_STATS
_OVPN_SET_PEER::KeepaliveTimeout
LONG KeepaliveTimeout
Definition: ovpn_dco_win.h:99
_OVPN_CRYPTO_DATA::KeyId
unsigned char KeyId
Definition: ovpn_dco_win.h:93
_OVPN_STATS::TunBytesSent
LONG64 TunBytesSent
Definition: ovpn_dco_win.h:66
POVPN_SET_PEER
struct _OVPN_SET_PEER * POVPN_SET_PEER
_OVPN_NEW_PEER
Definition: ovpn_dco_win.h:36
POVPN_VERSION
struct _OVPN_VERSION * POVPN_VERSION
_OVPN_STATS::SentDataPackets
LONG SentDataPackets
Definition: ovpn_dco_win.h:61
OVPN_KEY_SLOT_SECONDARY
@ OVPN_KEY_SLOT_SECONDARY
Definition: ovpn_dco_win.h:72
_OVPN_KEY_DIRECTION
Definition: ovpn_dco_win.h:81
OVPN_CRYPTO_DATA
struct _OVPN_CRYPTO_DATA OVPN_CRYPTO_DATA
_OVPN_NEW_PEER::Local
union _OVPN_NEW_PEER::@8 Local
_OVPN_NEW_PEER::Addr4
SOCKADDR_IN Addr4
Definition: ovpn_dco_win.h:38
OVPN_SET_PEER
struct _OVPN_SET_PEER OVPN_SET_PEER
_OVPN_CRYPTO_DATA::KeySlot
OVPN_KEY_SLOT KeySlot
Definition: ovpn_dco_win.h:91
_OVPN_VERSION
Definition: ovpn_dco_win.h:103
_OVPN_CIPHER_ALG
_OVPN_CIPHER_ALG
Definition: ovpn_dco_win.h:75
OVPN_KEY_SLOT
enum _OVPN_KEY_SLOT OVPN_KEY_SLOT
_OVPN_CRYPTO_DATA
Definition: ovpn_dco_win.h:88
OVPN_KEY_DIRECTION
struct _OVPN_KEY_DIRECTION OVPN_KEY_DIRECTION
_OVPN_SET_PEER::KeepaliveInterval
LONG KeepaliveInterval
Definition: ovpn_dco_win.h:98
_OVPN_CRYPTO_DATA::Decrypt
OVPN_KEY_DIRECTION Decrypt
Definition: ovpn_dco_win.h:90
POVPN_CRYPTO_DATA
struct _OVPN_CRYPTO_DATA * POVPN_CRYPTO_DATA
_OVPN_STATS::LostOutControlPackets
LONG LostOutControlPackets
Definition: ovpn_dco_win.h:52
_OVPN_CRYPTO_DATA::Encrypt
OVPN_KEY_DIRECTION Encrypt
Definition: ovpn_dco_win.h:89
_OVPN_KEY_DIRECTION::NonceTail
unsigned char NonceTail[8]
Definition: ovpn_dco_win.h:85
_OVPN_VERSION::Major
LONG Major
Definition: ovpn_dco_win.h:104
POVPN_NEW_PEER
struct _OVPN_NEW_PEER * POVPN_NEW_PEER
OVPN_PROTO_TCP
@ OVPN_PROTO_TCP
Definition: ovpn_dco_win.h:33
OVPN_CIPHER_ALG_NONE
@ OVPN_CIPHER_ALG_NONE
Definition: ovpn_dco_win.h:76
_OVPN_KEY_DIRECTION::KeyLen
unsigned char KeyLen
Definition: ovpn_dco_win.h:84
_OVPN_KEY_DIRECTION::Key
unsigned char Key[32]
Definition: ovpn_dco_win.h:83
_OVPN_STATS::SentControlPackets
LONG SentControlPackets
Definition: ovpn_dco_win.h:60
OVPN_CIPHER_ALG_AES_GCM
@ OVPN_CIPHER_ALG_AES_GCM
Definition: ovpn_dco_win.h:77
OVPN_KEY_SLOT_PRIMARY
@ OVPN_KEY_SLOT_PRIMARY
Definition: ovpn_dco_win.h:71
_OVPN_NEW_PEER::Remote
union _OVPN_NEW_PEER::@9 Remote
_OVPN_NEW_PEER::Addr6
SOCKADDR_IN6 Addr6
Definition: ovpn_dco_win.h:39
_OVPN_VERSION::Patch
LONG Patch
Definition: ovpn_dco_win.h:106
_OVPN_CRYPTO_DATA::CipherAlg
OVPN_CIPHER_ALG CipherAlg
Definition: ovpn_dco_win.h:92
_OVPN_STATS::LostInControlPackets
LONG LostInControlPackets
Definition: ovpn_dco_win.h:51
POVPN_STATS
struct _OVPN_STATS * POVPN_STATS
OVPN_NEW_PEER
struct _OVPN_NEW_PEER OVPN_NEW_PEER