summaryrefslogtreecommitdiff
path: root/client/Proxifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'client/Proxifier.h')
-rw-r--r--client/Proxifier.h90
1 files changed, 78 insertions, 12 deletions
diff --git a/client/Proxifier.h b/client/Proxifier.h
index 37ea3fd..320ba44 100644
--- a/client/Proxifier.h
+++ b/client/Proxifier.h
@@ -6,6 +6,7 @@
#include <vector>
#include <string>
#include <QDomElement>
+#include <QString>
using namespace std;
@@ -29,8 +30,9 @@ public:
// proxifier-specific fields
int id;
short option;
- bool emptyAuth;
-
+ bool useAuth; // whether to authenticate on server
+ bool emptyAuth; // self-closing auth (for Proxifier it means to use current login+pass)
+
Proxy();
};
@@ -86,29 +88,93 @@ public:
/**
* @brief action parameter (applicable only to 'Chain' and 'Proxy' actions)
*/
- int id;
+ int actId;
Rule();
};
-
static Proxifier* GetInstance();
+
+ /**
+ * @brief Chack if the current config is valid
+ * @return true if the config is valid or false otherwise
+ * @note you may wish to try ReadConfig() before but if it doesn't help
+ */
bool IsValid();
- void Update();
-
+ /**
+ * @brief read Proxifier config from file and parse it
+ * @note you should check IsValid() method to get to know if the config is valid
+ */
+ void ReadConfig();
+
private:
+ /**
+ * @brief XML indentation level
+ */
+ static const int indent = 4;
+ /**
+ * @brief pointer to sigleton instance
+ */
static Proxifier *instance;
-
+ /**
+ * @brief XML file name to read data from
+ */
+ QString filename;
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);
+ bool ReadProxyList(QDomElement& root);
+ bool ReadChainList(QDomElement& root);
+ bool ReadRuleList(QDomElement& root);
+ /**
+ * @brief gets the next valid ID fo proxy/chain
+ * @note this ID numbers are shared among chains and proxies
+ * @return next valid ID number
+ */
+ int GetNextId();
+ /**
+ * @brief add new proxy record to Proxifier config
+ * @param proxy proxy class representing Proxifier's proxy entry
+ * id new proxy id will be set there
+ * @return true on success or false otherwise
+ */
+ bool AddProxy(Proxy& proxy, int* id);
+ /**
+ * @brief add new chain to proxifier config
+ * @param name the name of the chain
+ * id new chain id
+ * @return true on success or false otherwise
+ */
+ bool AddChain(string& name, int *id);
+ /**
+ * @brief add proxy to proxy chain
+ * @param proxyId proxy ID to add to proxy chain
+ * chainId chain ID to add proxy to
+ * @return true on success or false otherwise
+ */
+ bool AddChainProxy(int proxyId, int chainId);
+ /**
+ * @brief remove proxy from proxy chain
+ * @param proxyId proxy ID to remove to proxy chain
+ * chainId chain ID to remove proxy from
+ * @return true on success or false otherwise
+ */
+ bool RemoveChainProxy(int proxyId, int chainId);
+ /**
+ * @brief add new rule to Proxifier config
+ * @param rule rule class representing Proxifier's rule entry
+ * @return true on success or false otherwise
+ */
+ bool AddRule(Rule& rule);
+ /**
+ * @brief remove rule to Proxifier config
+ * @param name name of the rule to remove from Rule list
+ * @return true on success or false otherwise
+ */
+ bool RemoveRule(string name);
};
#endif