blob: 37ea3fd64e7492ae88f2f0fe4512b4f5b0886be2 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#ifndef PROXIFIER_CONFIG
#define PROXIFIER_CONFIG
#include <vector>
#include <string>
#include <QDomElement>
using namespace std;
class QDomDocument;
class Proxifier
{
public:
/**
* @brief class representing Proxifier's proxy setting
*/
class Proxy
{
public:
string login;
string password;
string host;
string type;
short port;
// proxifier-specific fields
int id;
short option;
bool emptyAuth;
Proxy();
};
/**
* @brief class representing Proxifier's proxy chain
*/
class Chain
{
public:
/**
* @brief chain id
*/
int id;
/**
* @brief chain name
*/
string name;
/**
* @brief associative array of proxies in the chain - [id: isEnabled]
*/
map<int, bool> proxies;
Chain();
};
class Rule
{
public:
/**
* @brief indicates if the rule is enabled
*/
bool isEnabled;
/**
* @brief rule name
*/
string name;
/**
* @brief list of applications the rule affects
*/
string apps;
/**
* @brief rule targets (list of hosts separeted w ';')
*/
string targets;
/**
* @brief rule ports (e.g.: 80; 8000-9000; 8080)
*/
string ports;
/**
* @brief rule action (one of: 'Direct', 'Block', 'Chain', 'Proxy')
*/
string action;
/**
* @brief action parameter (applicable only to 'Chain' and 'Proxy' actions)
*/
int id;
Rule();
};
static Proxifier* GetInstance();
bool IsValid();
void Update();
private:
static Proxifier *instance;
bool valid;
QDomDocument *configDom;
vector<Proxy> proxyList;
vector<Chain> chainList;
vector<Rule> ruleList;
Proxifier();
bool UpdateProxyList(QDomElement& root);
bool UpdateChainList(QDomElement& root);
bool UpdateRuleList(QDomElement& root);
};
#endif
|