diff options
author | Alex <b0ris@b0ris-satellite.localdomain> | 2011-11-03 21:30:37 +0200 |
---|---|---|
committer | Alex <b0ris@b0ris-satellite.localdomain> | 2011-11-03 21:30:37 +0200 |
commit | 718768b7bc4593acf7527db4865ca17beb4e7346 (patch) | |
tree | 0229509fbec86089d85351911d9ed84f1ef0a4ae /client/Config.h | |
parent | 83f10691557953e9d164df36a12f8a0fd7d33dc4 (diff) |
Config docs and helper classes
Diffstat (limited to 'client/Config.h')
-rw-r--r-- | client/Config.h | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/client/Config.h b/client/Config.h index f9e797e..3701cd7 100644 --- a/client/Config.h +++ b/client/Config.h @@ -10,12 +10,62 @@ class ProxyEntryGeneric; class ProxyEntryStatic; /** - * @brief Singleton class that represents client configuration + * @brief Singleton class that represents client configuration<br/> + * At the first time this object is accessed config.cfg is read to + * determine initial settings, server addresses, etc.<br/> + * Then retries is made to connect to server and acqire actual config, + * firewall list, etc. */ class Config { public: /** + * @brief Class to represent 'firewall' record in the config file + */ + class FirewallRecord + { + public: + FirewallRecord(): block(false), host("127.0.0.1") + { + } + /** + * @brief Firewall action: true - to block access to the host, + * false - to allow access to the host + */ + bool block; + /** + * @brief Hostname or address to allow/block access to + */ + std::string host; + }; + + /** + * @brief Class to represend 'server' record in the config file + */ + class ServerRecord + { + public: + ServerRecord(): host("127.0.0.1"), timeout(120), retry(60) + { + } + /** + * @brief Hostname or address of server<br/> + * Note that default port is 13666 as specified in SslClient + */ + std::string host; + /** + * @brief Cumulative timeout value (in seconds)<br/> + * When this time is expired then no further attempts is made + * to connect to this particular server + */ + unsigned timeout; + /** + * @brief Time (in seconds) between consecutive retries + */ + unsigned retry; + }; + + /** * @brief Retrieve application-wide instance of Config class * @return Pointer to singleton instance of Config class */ @@ -30,7 +80,7 @@ public: /** * @brief Check whether current confguration is valid <br/> * It may become invalid in case if server is not reachable. - * So every time you want to access Config membres or methods you should check this value + * So every time you want to access Config members or methods you should check this value * @return true if configuration is valid and false otherwise */ bool IsConfigValid(); @@ -113,6 +163,7 @@ private: bool configValid; std::vector<ProxyEntryGeneric> genericProxy; std::vector<ProxyEntryStatic> staticProxy; + std::vector<FirewallRecord> firewallList; int ReadGenericProxy(); int ReadStaticProxy(); |