3 * @brief parameter module creation class.
5 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6 * Copyright (C) 2008 NTT COMWARE Corporation.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 **********************************************************************/
25 #include "parameter_enum.h"
26 #include "parameter.h"
27 #include "parameter_impl.h"
28 #include "logger_wrapper.h"
31 LOG_CATEGORY_TAG param_cat = LOG_CAT_SSLPROXY_PARAMETER;
34 * Constructor of Parameter class
36 l7vs::Parameter::Parameter()
38 if( !ParameterImpl::getInstance().init() ){
39 LOGGER_PUT_LOG_FATAL( param_cat, 1, "Parameter initialize failure" );
40 /*-------- DEBUG LOG for sslproxy --------*/
41 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
42 LOGGER_PUT_LOG_DEBUG(param_cat, 1,
43 "function : Constructor l7vs::Parameter::Parameter() : "
46 /*------ DEBUG LOG END for sslproxy ------*/
52 * Destructor of Parameter class
54 l7vs::Parameter::~Parameter()
60 * @param[in] comp section TAG
61 * @param[in] filename config file name
62 * @return true = success read file / false = failure read file
65 l7vs::Parameter::rereadFile(PARAMETER_COMPONENT_TAG comp, const std::string& filename)
67 /*-------- DEBUG LOG for sslproxy --------*/
68 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
69 LOGGER_PUT_LOG_DEBUG(param_cat, 2,
70 "function : bool l7vs::Parameter::rereadFile("
71 "PARAMETER_COMPONENT_TAG comp, "
72 "const std::string& filename) : "
73 "Call ParameterImpl.rereadFile("
79 /*------ DEBUG LOG END for sslproxy ------*/
80 return ParameterImpl::getInstance().rereadFile(comp, filename);
84 * check whether integer data exists.
85 * @param[in] comp section TAG
86 * @param[in] key key string
87 * @return true = exist setting value / false = non exist setting value
90 l7vs::Parameter::isIntExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
92 return ParameterImpl::getInstance().isIntExist(comp, key);
96 * check whether character data exists.
97 * @param[in] comp section TAG
98 * @param[in] key key string
99 * @return true = exist setting value / false = non exist setting value
102 l7vs::Parameter::isStringExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
104 return ParameterImpl::getInstance().isStringExist(comp, key);
109 * @param[in] comp section TAG
110 * @param[in] key key string
114 l7vs::Parameter::getIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
116 return ParameterImpl::getInstance().getIntValue(comp, key);
120 * get character data.
121 * @param[in] comp section TAG
122 * @param[in] key key string
126 l7vs::Parameter::getStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
128 return ParameterImpl::getInstance().getStringValue(comp, key);
132 * get character map data.
133 * @param[in] comp section TAG
134 * @param[in] key key string
135 * @param[out] retMap map data
139 l7vs::Parameter::getStringMapValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, std::multimap<std::string, std::string>& retMap)
141 /*-------- DEBUG LOG for sslproxy --------*/
142 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
143 LOGGER_PUT_LOG_DEBUG(param_cat, 3,
144 "function : void l7vs::Parameter::getStringMapValue("
145 "const PARAMETER_COMPONENT_TAG comp, "
146 "const std::string& key, "
147 "std::multimap<std::string, std::string>& retMap) : "
148 "Call ParameterImpl.getStringMapValue("
154 /*------ DEBUG LOG END for sslproxy ------*/
155 return ParameterImpl::getInstance().getStringMapValue(comp, key, retMap);
159 * set-parameter function pointer relates component-tag
160 * @param[in] comp section TAG
161 * @param[in] p_func function pointer
164 l7vs::Parameter::registerFunctionPointer(const PARAMETER_COMPONENT_TAG comp, void(*p_func)())
166 ParameterImpl::getInstance().registerFunctionPointer(comp, p_func);