/* * * ProLinga-UI * * Copyright (C) 2002-2008 Xobas Software. * All rights reserved. * * This file is part of ProLinga-UI. * * ProLinga-UI is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ProLinga-UI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ProLinga-UI. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #ifndef __UI_CONFIG_HPP #define __UI_CONFIG_HPP #define PRODUCT_NAME "UI" /* Default configuration settings */ #define DEF_CONFIG_FILE SYSCONFDIR"/prolingauicfg.xml" /* Config file name */ #define DEF_LOG_FILE "prolinga.log" /* Log file name */ #define DEF_LOG_LEVEL 2 /* Log Level */ #define DEF_CLIENT_HOST "localhost" /* Client Hostname or IP */ #define DEF_CLIENT_PORT 8009 /* Client TCP port */ #define DEF_CLIENT_COMP_LEVEL 6 /* Compression Level (range 0-9) */ #define DEF_SERVER_HOST "localhost" /* Server Hostname or IP */ #define DEF_SERVER_PORT 8009 /* Server TCP port */ #define DEF_NUMBER_THREADS 5 /* Number of Threads */ #define DEF_SERVER_COMP_LEVEL 6 /* Compression Level (range 0-9) */ #define DEF_RUN_HOST "localhost" /* Run Server Hostname or IP */ #define DEF_RUN_PORT 8005 /* Run Server TCP port */ #define DEF_EXT_SCREEN_PAINTER "glade-2" /* External Screen Painter */ /* XML Config keys */ #define ENV_KEY_LOGFILE "LogFile" #define ENV_KEY_LOGLEVEL "LogLevel" #define ENV_KEY_THREADS "NumberOfThreads" #define ENV_KEY_CLIENT_HOST "ClientHost" #define ENV_KEY_CLIENT_PORT "ClientPort" #define ENV_KEY_CLIENT_COMP "ClientCompressionLevel" #define ENV_KEY_SERVER_HOST "ServerHost" #define ENV_KEY_SERVER_PORT "ServerPort" #define ENV_KEY_SERVER_COMP "ServerCompressionLevel" #define ENV_KEY_RUN_HOST "RunHost" #define ENV_KEY_RUN_PORT "RunPort" #define ENV_KEY_RUN_COMP "RunCompressionLevel" /* Log Levels */ #define LOG_LEVEL_0 0 /* No logging */ #define LOG_LEVEL_1 1 /* Free */ #define LOG_LEVEL_2 2 /* + Messages/Errors */ #define LOG_LEVEL_3 3 /* Free */ #define LOG_LEVEL_4 4 /* + Soap request/response info */ #define LOG_LEVEL_5 5 /* Free */ class ConfigUISetting { friend class ConfigUI; public: ConfigUISetting(); ~ConfigUISetting(); private: char *getStringValue(ConfigUISetting *confsetPtr, const char *name, const char *defValue); int getNumberValue(ConfigUISetting *confsetPtr, const char *name, const int defValue); void putStringValue(ConfigUISetting **confsetPtr, const char *name, const char *value); void putNumberValue(ConfigUISetting **confsetPtr, const char *name, const int value); void deleteList(ConfigUISetting **confsetPtr); void printList(ConfigUISetting *confsetPtr) const; char confsetName[32]; char *confsetStringValue; int confsetNumberValue; ConfigUISetting *nextPtr; }; typedef ConfigUISetting *ConfigUISettingPtr; class ConfigUI { public: ConfigUI(const char *configFileName); ~ConfigUI(); char *getStringValue(const char *name, const char *defValue); int getNumberValue(const char *name, const int defValue); void putStringValue(const char *name, const char *value); void putNumberValue(const char *name, const int value); void writeConfig(const char *logFileName) const; void printList(void) const; private: ConfigUISetting *startPtr; }; typedef ConfigUI *ConfigUIPtr; #endif /* __UI_CONFIG_HPP */