2 * @file configurator.hpp
4 * @brief settingsd configuration manager header.
6 * @author Ossama Othman @<ossama.othman@@intel.com@>
9 * Copyright 2012, 2013 Intel Corporation All Rights Reserved.
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301 USA
26 * @note This is an internal header.
29 #ifndef IVI_SETTINGS_CONFIGURATOR_HPP
30 #define IVI_SETTINGS_CONFIGURATOR_HPP
33 #include <boost/program_options.hpp>
41 * @brief Settingsd configuration manager
43 * The @c configurator class parses command line and file based
44 * settingsd configuration options.
51 configurator(int & argc, char * argv[], char const * logger_name);
53 /// Get directory containing the settings plugins.
54 std::string settings_dir() const;
56 /// The port on which the web socket server should listen.
57 int websocket_port() const;
60 /// Websocket server SSL certificate file.
61 char const * ssl_cert_file() const;
63 /// Websocket server SSL private key file.
64 char const * ssl_private_key_file() const;
66 /// Websocket server SSL CA certificate file.
67 char const * ssl_ca_file() const;
72 * @name Prevent copying
75 configurator(configurator const &) = delete;
76 configurator & operator=(configurator const &) = delete;
80 * @brief Parse the settingsd configuration.
82 * Configuration options are obtained from the command line, the
83 * user configuration file and the system configuration file, in
84 * order of decreasing precedence.
86 void parse_config(int & argc, char * argv[]);
88 /// Display settingsd's version and copyright notices.
89 void display_version_info() const;
91 /// Configure the underlying logger.
92 void configure_logger(char const * logger_name);
94 /// Set the log level in the underlying logger.
98 * libwebsockets wants a @c nullptr for SSL certificate/key
99 * paths if they won't be used.
101 * @param[in] option SSL certificate relate program option.
103 * @returns C string if @a option is not empty, @c nullptr
106 char const * libwebsocket_ssl_filepath(
107 std::string const & option) const;
111 /// Map of settingsd program options.
112 boost::program_options::variables_map vm_;
118 #endif /* IVI_SETTINGS_CONFIGURATOR_HPP */
124 // indent-tabs-mode: nil