-
Notifications
You must be signed in to change notification settings - Fork 22
/
adapter.h
60 lines (48 loc) · 1.68 KB
/
adapter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* ovpn-dco-win OpenVPN protocol accelerator for Windows
*
* Copyright (C) 2020-2021 OpenVPN Inc <[email protected]>
*
* Author: Lev Stipakov <[email protected]>
*
* 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.
*/
#pragma once
#include <ntddk.h>
#include <wdf.h>
#include <netadaptercx.h>
#define OVPN_DCO_MTU_MAX 1500
// Context for NETADAPTER
struct OVPN_ADAPTER
{
// WDF handles associated with this context
NETADAPTER NetAdapter;
WDFDEVICE WdfDevice;
// Handle to Rx Queue
NETPACKETQUEUE RxQueue;
};
typedef OVPN_ADAPTER * POVPN_ADAPTER;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(OVPN_ADAPTER, OvpnGetAdapterContext);
struct OVPN_DEVICE;
_Must_inspect_result_
_IRQL_requires_(PASSIVE_LEVEL)
_IRQL_requires_same_
NTSTATUS
OvpnAdapterCreate(OVPN_DEVICE* device);
// notify NetAdapter (if it is ready) that more packets are available
VOID
OvpnAdapterNotifyRx(NETADAPTER netAdapter);
VOID
OvpnAdapterSetLinkState(_In_ POVPN_ADAPTER adapter, NET_IF_MEDIA_CONNECT_STATE state);
#define OVPN_PAYLOAD_BACKFILL 26 // 2 + 4 + 4 + 16 -> tcp packet size + data_v2 + pktid + auth-tag;