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"
30 LOG_CATEGORY_TAG param_cat = LOG_CAT_SSLPROXY_PARAMETER;
33 * Constructor of Parameter class
35 l7vs::Parameter::Parameter()
37 if( !ParameterImpl::getInstance().init() ){
38 LOGGER_PUT_LOG_FATAL( param_cat, 1, "Parameter initialize failure" );
39 /*-------- DEBUG LOG for sslproxy --------*/
40 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
41 LOGGER_PUT_LOG_DEBUG(param_cat, 1,
42 "function : Constructor l7vs::Parameter::Parameter() : "
45 /*------ DEBUG LOG END for sslproxy ------*/
51 * Destructor of Parameter class
53 l7vs::Parameter::~Parameter()
59 * @param[in] comp section TAG
60 * @param[in] filename config file name
61 * @return true = success read file / false = failure read file
64 l7vs::Parameter::rereadFile(PARAMETER_COMPONENT_TAG comp, const std::string& filename)
66 /*-------- DEBUG LOG for sslproxy --------*/
67 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
68 LOGGER_PUT_LOG_DEBUG(param_cat, 2,
69 "function : bool l7vs::Parameter::rereadFile("
70 "PARAMETER_COMPONENT_TAG comp, "
71 "const std::string& filename) : "
72 "Call ParameterImpl.rereadFile("
78 /*------ DEBUG LOG END for sslproxy ------*/
79 return ParameterImpl::getInstance().rereadFile(comp, filename);
83 * check whether integer data exists.
84 * @param[in] comp section TAG
85 * @param[in] key key string
86 * @return true = exist setting value / false = non exist setting value
89 l7vs::Parameter::isIntExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
91 return ParameterImpl::getInstance().isIntExist(comp, key);
95 * check whether character data exists.
96 * @param[in] comp section TAG
97 * @param[in] key key string
98 * @return true = exist setting value / false = non exist setting value
101 l7vs::Parameter::isStringExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
103 return ParameterImpl::getInstance().isStringExist(comp, key);
108 * @param[in] comp section TAG
109 * @param[in] key key string
113 l7vs::Parameter::getIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
115 return ParameterImpl::getInstance().getIntValue(comp, key);
119 * get character data.
120 * @param[in] comp section TAG
121 * @param[in] key key string
125 l7vs::Parameter::getStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
127 return ParameterImpl::getInstance().getStringValue(comp, key);
131 * get character map data.
132 * @param[in] comp section TAG
133 * @param[in] key key string
134 * @param[out] retMap map data
138 l7vs::Parameter::getStringMapValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, std::multimap<std::string, std::string>& retMap)
140 /*-------- DEBUG LOG for sslproxy --------*/
141 if (LOG_LV_DEBUG == logger_get_log_level(param_cat)) {
142 LOGGER_PUT_LOG_DEBUG(param_cat, 3,
143 "function : void l7vs::Parameter::getStringMapValue("
144 "const PARAMETER_COMPONENT_TAG comp, "
145 "const std::string& key, "
146 "std::multimap<std::string, std::string>& retMap) : "
147 "Call ParameterImpl.getStringMapValue("
153 /*------ DEBUG LOG END for sslproxy ------*/
154 return ParameterImpl::getInstance().getStringMapValue(comp, key, retMap);
158 * set-parameter function pointer relates component-tag
159 * @param[in] comp section TAG
160 * @param[in] p_func function pointer
163 l7vs::Parameter::registerFunctionPointer(const PARAMETER_COMPONENT_TAG comp, void(*p_func)())
165 ParameterImpl::getInstance().registerFunctionPointer(comp, p_func);