mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 04:02:15 +02:00
481a4319e2
Use the latest uapi header. Instead of using vcpkg port overlay, copy file into repository. Signed-off-by: Lev Stipakov <lev@openvpn.net>
130 lines
4.0 KiB
C
130 lines
4.0 KiB
C
/*
|
|
* ovpn-dco-win OpenVPN protocol accelerator for Windows
|
|
*
|
|
* Copyright (C) 2020-2021 OpenVPN Inc <sales@openvpn.net>
|
|
*
|
|
* Author: Lev Stipakov <lev@openvpn.net>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
/*
|
|
This particular file (ovpn-dco.h) is also licensed using the MIT License.
|
|
|
|
Copyright 2022 OpenVPN, Inc
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
this software and associated documentation files(the "Software"), to deal in the
|
|
Software without restriction, including without limitation the rights to use,
|
|
copy, modify, merge, publish, distribute, sublicense, and /or sell copies of the
|
|
Software, and to permit persons to whom the Software is furnished to do so,
|
|
subject to the following conditions :
|
|
|
|
The above copyright noticeand this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
|
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#pragma once
|
|
#ifndef _KERNEL_MODE
|
|
#include <winsock2.h>
|
|
#endif
|
|
#include <ws2def.h>
|
|
#include <ws2ipdef.h>
|
|
|
|
typedef enum {
|
|
OVPN_PROTO_UDP,
|
|
OVPN_PROTO_TCP
|
|
} OVPN_PROTO;
|
|
|
|
typedef struct _OVPN_NEW_PEER {
|
|
union {
|
|
SOCKADDR_IN Addr4;
|
|
SOCKADDR_IN6 Addr6;
|
|
} Local;
|
|
|
|
union {
|
|
SOCKADDR_IN Addr4;
|
|
SOCKADDR_IN6 Addr6;
|
|
} Remote;
|
|
|
|
OVPN_PROTO Proto;
|
|
} OVPN_NEW_PEER, * POVPN_NEW_PEER;
|
|
|
|
typedef struct _OVPN_STATS {
|
|
LONG LostInControlPackets;
|
|
LONG LostOutControlPackets;
|
|
|
|
LONG LostInDataPackets;
|
|
LONG LostOutDataPackets;
|
|
|
|
LONG ReceivedDataPackets;
|
|
LONG ReceivedControlPackets;
|
|
|
|
LONG SentControlPackets;
|
|
LONG SentDataPackets;
|
|
|
|
LONG64 TransportBytesSent;
|
|
LONG64 TransportBytesReceived;
|
|
|
|
LONG64 TunBytesSent;
|
|
LONG64 TunBytesReceived;
|
|
} OVPN_STATS, * POVPN_STATS;
|
|
|
|
typedef enum _OVPN_KEY_SLOT {
|
|
OVPN_KEY_SLOT_PRIMARY,
|
|
OVPN_KEY_SLOT_SECONDARY
|
|
} OVPN_KEY_SLOT;
|
|
|
|
typedef enum _OVPN_CIPHER_ALG {
|
|
OVPN_CIPHER_ALG_NONE,
|
|
OVPN_CIPHER_ALG_AES_GCM,
|
|
OVPN_CIPHER_ALG_CHACHA20_POLY1305
|
|
} OVPN_CIPHER_ALG;
|
|
|
|
typedef struct _OVPN_KEY_DIRECTION
|
|
{
|
|
unsigned char Key[32];
|
|
unsigned char KeyLen; // 16/24/32 -> AES-128-GCM/AES-192-GCM/AES-256-GCM
|
|
unsigned char NonceTail[8];
|
|
} OVPN_KEY_DIRECTION;
|
|
|
|
typedef struct _OVPN_CRYPTO_DATA {
|
|
OVPN_KEY_DIRECTION Encrypt;
|
|
OVPN_KEY_DIRECTION Decrypt;
|
|
OVPN_KEY_SLOT KeySlot;
|
|
OVPN_CIPHER_ALG CipherAlg;
|
|
unsigned char KeyId;
|
|
int PeerId;
|
|
} OVPN_CRYPTO_DATA, * POVPN_CRYPTO_DATA;
|
|
|
|
typedef struct _OVPN_SET_PEER {
|
|
LONG KeepaliveInterval;
|
|
LONG KeepaliveTimeout;
|
|
LONG MSS;
|
|
} OVPN_SET_PEER, * POVPN_SET_PEER;
|
|
|
|
#define OVPN_IOCTL_NEW_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
#define OVPN_IOCTL_GET_STATS CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
#define OVPN_IOCTL_NEW_KEY CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
#define OVPN_IOCTL_SWAP_KEYS CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
#define OVPN_IOCTL_SET_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
#define OVPN_IOCTL_START_VPN CTL_CODE(FILE_DEVICE_UNKNOWN, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
|