diff options
Diffstat (limited to 'client/Proxifier.h')
-rw-r--r-- | client/Proxifier.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/client/Proxifier.h b/client/Proxifier.h new file mode 100644 index 0000000..37ea3fd --- /dev/null +++ b/client/Proxifier.h @@ -0,0 +1,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 |