blob: eabf884ba871eb8032f396e4df6d3b65806bfa1d (
plain)
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
61
62
63
64
|
#pragma once
#include <set>
#include <string>
#include <optional>
class Context
{
public:
Context()
{
}
struct NetworkAdapter
{
std::wstring guid;
std::wstring name;
std::wstring alias;
NetworkAdapter(std::wstring _guid, std::wstring _name, std::wstring _alias)
: guid(_guid)
, name(_name)
, alias(_alias)
{
}
bool operator<(const NetworkAdapter &rhs) const
{
return _wcsicmp(guid.c_str(), rhs.guid.c_str()) < 0;
}
};
enum class BaselineStatus
{
NO_TAP_ADAPTERS_PRESENT,
SOME_TAP_ADAPTERS_PRESENT,
MULLVAD_ADAPTER_PRESENT
};
BaselineStatus establishBaseline();
void recordCurrentState();
//
// Identify a single new TAP adapter
//
NetworkAdapter getNewAdapter();
enum class DeletionResult
{
NO_REMAINING_TAP_ADAPTERS,
SOME_REMAINING_TAP_ADAPTERS
};
static DeletionResult DeleteMullvadAdapter();
private:
static std::optional<NetworkAdapter> FindMullvadAdapter(const std::set<NetworkAdapter> &tapAdapters);
std::set<NetworkAdapter> m_baseline;
std::set<NetworkAdapter> m_currentState;
};
|