From 718768b7bc4593acf7527db4865ca17beb4e7346 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Nov 2011 21:30:37 +0200 Subject: Config docs and helper classes --- client/Config.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'client/Config.h') diff --git a/client/Config.h b/client/Config.h index f9e797e..3701cd7 100644 --- a/client/Config.h +++ b/client/Config.h @@ -10,11 +10,61 @@ class ProxyEntryGeneric; class ProxyEntryStatic; /** - * @brief Singleton class that represents client configuration + * @brief Singleton class that represents client configuration
+ * At the first time this object is accessed config.cfg is read to + * determine initial settings, server addresses, etc.
+ * 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
+ * Note that default port is 13666 as specified in SslClient + */ + std::string host; + /** + * @brief Cumulative timeout value (in seconds)
+ * 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
* 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 genericProxy; std::vector staticProxy; + std::vector firewallList; int ReadGenericProxy(); int ReadStaticProxy(); -- cgit v1.2.3