summaryrefslogtreecommitdiffhomepage
path: root/windows/nsis-plugins/src/driverlogic/context.h
blob: a93a3bcfcfff9747e057b0b6169360f94d9593d9 (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
#pragma once

#include <set>
#include <string>

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();

private:

	std::set<NetworkAdapter> m_baseline;
	std::set<NetworkAdapter> m_currentState;
};