Wolframe, 0.0.3

standardConfigs.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 
36 #ifndef _STANDARD_CONFIGS_HPP_INCLUDED
37 #define _STANDARD_CONFIGS_HPP_INCLUDED
38 
42 #include "logger/logLevel.hpp"
44 
45 #include <string>
46 #include <list>
47 
48 
49 namespace _Wolframe {
50 namespace net {
53 {
54 public:
55  unsigned short threads;
56  unsigned short maxConnections;
57 
58  // listen on
59  std::list<net::ServerTCPendpoint> address;
60 #ifdef WITH_SSL
61  std::list<net::ServerSSLendpoint> SSLaddress;
62 #endif // WITH_SSL
63 
65  Configuration();
66 
68  bool parse( const config::ConfigurationNode& pt, const std::string& node,
69  const module::ModulesDirectory* modules );
70  bool check() const;
71  void print( std::ostream& os, size_t indent ) const;
72 
73  void setCanonicalPathes( const std::string& referencePath );
74 
75 // Not implemented yet, inherited from base for the time being
76 // bool test() const;
77 };
78 
79 } // namespace net
80 
81 namespace log {
82 
85 {
86 public:
89 
90  bool logToFile;
91  std::string logFile;
93  std::string logFileIdent;
97  std::string syslogIdent;
98 #if defined( _WIN32 )
99  bool logToEventlog;
100  std::string eventlogLogName;
101  std::string eventlogSource;
102  LogLevel::Level eventlogLogLevel;
103 #endif // defined( _WIN32 )
104 
107 
109  bool parse( const config::ConfigurationNode& pt, const std::string& node,
110  const module::ModulesDirectory* modules );
111  bool check() const;
112  void print( std::ostream& os, size_t indent ) const;
113 
114  void setCanonicalPathes( const std::string& referencePath );
115 
116 // Not implemented yet, inherited from base for the time being
117 // bool test() const;
118 
119  void foreground( LogLevel::Level debugLevel, bool useConfig );
120 };
121 
122 } // namespace log
123 
124 namespace config {
125 
128 {
129 public:
130 #if !defined( _WIN32 )
131  // daemon configuration
132  std::string user;
133  std::string group;
134  std::string pidFile;
135 #endif
136 #if defined( _WIN32 )
137  // Windows service configuration
138  std::string serviceName;
139  std::string serviceDisplayName;
140  std::string serviceDescription;
141 #endif // !defined( _WIN32 )
142 
145 
147  bool parse( const config::ConfigurationNode& pt, const std::string& node,
148  const module::ModulesDirectory* modules );
149  bool check() const;
150  void print( std::ostream& os, size_t indent ) const;
151 
152 // Not implemented yet, inherited from base for the time being
153 // bool test() const;
154 
155 #if !defined( _WIN32 )
156  void setCanonicalPathes( const std::string& referencePath );
157  void override( const std::string& user, const std::string& group, const std::string& pidFile );
158 #endif // !defined( _WIN32 )
159 };
160 
161 
164 {
165  friend class ConfigurationParser;
166 public:
176  };
177 
179  ServiceBanner() : ConfigurationBase( "Service Banner", NULL, "Service banner" ),
180  m_tokens( UNDEFINED ) {}
182  std::string toString() const;
183 
184  bool parse( const config::ConfigurationNode& pt, const std::string& node,
185  const module::ModulesDirectory* modules );
186  bool check() const;
187  void print( std::ostream& os, size_t indent ) const;
188 
189 // Not implemented yet, inherited from base for the time being
190 // bool test() const;
191 protected:
194  std::string m_serverSignature;
195 };
196 
197 } // namespace config
198 } // namespace _Wolframe
199 
200 #endif // _STANDARD_CONFIGS_HPP_INCLUDED
Level
Definition: logLevel.hpp:57
std::string pidFile
Definition: standardConfigs.hpp:134
Base class for the configuration structures.
Definition: configurationBase.hpp:54
std::string logFile
Definition: standardConfigs.hpp:91
SyslogFacility::Facility syslogFacility
Definition: standardConfigs.hpp:95
Property tree node.
Definition: propertyTree.hpp:86
Definition: standardConfigs.hpp:174
void foreground(LogLevel::Level debugLevel, bool useConfig)
Facility
Definition: logSyslogFacility.hpp:57
bool logToFile
Definition: standardConfigs.hpp:90
SignatureTokens
Definition: standardConfigs.hpp:167
bool logToSyslog
Definition: standardConfigs.hpp:94
std::string user
Definition: standardConfigs.hpp:132
The modules directory used by the constructors of the providers to build themselves.
Definition: moduleDirectory.hpp:48
Definition: standardConfigs.hpp:168
std::string group
Definition: standardConfigs.hpp:133
unsigned short maxConnections
Definition: standardConfigs.hpp:56
void print(std::ostream &os, size_t indent) const
friend class ConfigurationParser
Definition: standardConfigs.hpp:165
Defines allowed log levels of the logger.
void print(std::ostream &os, size_t indent) const
Service signature.
Definition: standardConfigs.hpp:163
std::string toString() const
methods
std::string m_serverSignature
Definition: standardConfigs.hpp:194
Definition: standardConfigs.hpp:169
Definition: standardConfigs.hpp:171
Base classes for the configuration structures.
void print(std::ostream &os, size_t indent) const
daemon / service configuration
Definition: standardConfigs.hpp:127
std::list< net::ServerTCPendpoint > address
Definition: standardConfigs.hpp:59
LogLevel::Level syslogLogLevel
Definition: standardConfigs.hpp:96
void setCanonicalPathes(const std::string &referencePath)
LogLevel::Level stderrLogLevel
Definition: standardConfigs.hpp:88
Definition: standardConfigs.hpp:172
bool logToStderr
Definition: standardConfigs.hpp:87
LogLevel::Level logFileLogLevel
Definition: standardConfigs.hpp:92
bool parse(const config::ConfigurationNode &pt, const std::string &node, const module::ModulesDirectory *modules)
methods
std::string syslogIdent
Definition: standardConfigs.hpp:97
network server configuration
Definition: standardConfigs.hpp:52
void setCanonicalPathes(const std::string &referencePath)
bool parse(const config::ConfigurationNode &pt, const std::string &node, const module::ModulesDirectory *modules)
methods
Definition: standardConfigs.hpp:170
std::string logFileIdent
Definition: standardConfigs.hpp:93
bool parse(const config::ConfigurationNode &pt, const std::string &node, const module::ModulesDirectory *modules)
Parse the configuration section.
Definition: standardConfigs.hpp:173
SignatureTokens m_tokens
data members
Definition: standardConfigs.hpp:193
logger configuration
Definition: standardConfigs.hpp:84
void setCanonicalPathes(const std::string &referencePath)
void print(std::ostream &os, size_t indent) const
Defines facilities of the system logger.
Server endpoint classes.
bool parse(const config::ConfigurationNode &pt, const std::string &node, const module::ModulesDirectory *modules)
methods
Configuration tree for the configuration parser.
unsigned short threads
Definition: standardConfigs.hpp:55
ServiceBanner()
constructor
Definition: standardConfigs.hpp:179
Definition: standardConfigs.hpp:175