- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

configuration.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
20
21 #ifndef G_MAIN_CONFIGURATION_H
22 #define G_MAIN_CONFIGURATION_H
23
24 #include "gdef.h"
25 #include "gsmtp.h"
26 #include "gpath.h"
27 #include "gstrings.h"
28 #include <string>
29
31 namespace Main
32 {
33 class Configuration ;
34 class CommandLine ;
35 }
36
45 class Main::Configuration
46 {
47 public:
48 explicit Configuration( const CommandLine & cl ) ;
50
51 unsigned int port() const ;
53
54 G::Strings listeningInterfaces( const std::string & protocol = std::string() ) const ;
56
57 std::string clientInterface() const ;
59
60 bool closeStderr() const ;
62
63 bool log() const ;
65
66 std::string logFile() const ;
68
69 bool verbose() const ;
71
72 bool debug() const ;
74
75 bool useSyslog() const ;
77
78 bool logTimestamp() const ;
80
81 bool daemon() const ;
83
84 bool doForwardingOnStartup() const ;
86
87 bool doServing() const ;
89
90 bool doSmtp() const ;
92
93 bool doPop() const ;
95
96 bool popByName() const ;
99
100 bool popNoDelete() const ;
102
103 bool doAdmin() const ;
105
106 unsigned int adminPort() const ;
108
109 unsigned int popPort() const ;
111
112 bool allowRemoteClients() const ;
114
115 G::Path spoolDir() const ;
117
118 std::string serverAddress() const ;
120
121 bool usePidFile() const ;
123
124 std::string pidFile() const ;
126
127 bool useFilter() const ;
129
130 std::string filter() const ;
132
133 std::string clientFilter() const ;
135
136 unsigned int filterTimeout() const ;
139
140 unsigned int icon() const ;
142
143 bool hidden() const ;
145
146 unsigned int responseTimeout() const ;
148
149 unsigned int connectionTimeout() const ;
151
152 unsigned int secureConnectionTimeout() const ;
154
155 unsigned int promptTimeout() const ;
157
158 std::string clientSecretsFile() const ;
161
162 std::string serverSecretsFile() const ;
165
166 std::string popSecretsFile() const ;
169
170 std::string fqdn( std::string default_ = std::string() ) const ;
172
173 std::string nobody() const ;
176
177 std::string verifier() const ;
179
180 bool doPolling() const ;
182
183 bool pollingLog() const ;
185
186 unsigned int pollingTimeout() const ;
188
189 bool immediate() const ;
193
194 bool forwardingOnStore() const ;
198
199 bool forwardingOnDisconnect() const ;
202
203 bool withTerminate() const ;
206
207 std::string scannerAddress() const ;
209
210 unsigned int scannerConnectionTimeout() const ;
212
213 unsigned int scannerResponseTimeout() const ;
215
216 bool anonymous() const ;
219
220 bool clientTls() const ;
223
224 bool clientOverTls() const ;
227
228 unsigned int tlsConfig() const ;
230
231 std::string serverTlsFile() const ;
234
235 unsigned int maxSize() const ;
237
238 bool peerLookup() const ;
242
243 private:
244 bool contains( const char * ) const ;
245 std::string value( const char * ) const ;
246 unsigned int value( const char * , unsigned int ) const ;
247
248 private:
249 const CommandLine & m_cl ;
250 } ;
251
252 #endif
253
Main::Configuration::peerLookup
bool peerLookup() const
Returns true if there should be some attempt to look up the userid of SMTP peers connected from the t...
Definition: configuration.cpp:384
Main
Application-level classes.
Main::Configuration::doSmtp
bool doSmtp() const
Returns true if listening for smtp connections.
Definition: configuration.cpp:214
Main::Configuration::immediate
bool immediate() const
Returns true if forwarding should occur as soon as each message body is received and before receipt i...
Definition: configuration.cpp:165
Main::Configuration::clientOverTls
bool clientOverTls() const
Returns true if using the SMTP over TLS (vs.
Definition: configuration.cpp:294
Main::Configuration::verifier
std::string verifier() const
Returns the path of an external address verifier program.
Definition: configuration.cpp:344
Main::Configuration::serverAddress
std::string serverAddress() const
Returns the downstream server's address string.
Definition: configuration.cpp:145
Main::Configuration::pollingLog
bool pollingLog() const
Returns true if polling activity should be logged.
Definition: configuration.cpp:180
gstrings.h
Main::Configuration::filter
std::string filter() const
Returns the path to a server-side pre-processor.
Definition: configuration.cpp:264
Main::Configuration::doServing
bool doServing() const
Returns true if running as a server (SMTP, POP, admin or COM).
Definition: configuration.cpp:160
Main::Configuration::daemon
bool daemon() const
Returns true if running as a daemon.
Definition: configuration.cpp:133
G::Strings
std::list< std::string > Strings
A std::list of std::strings.
Definition: gstrings.h:39
Main::Configuration::anonymous
bool anonymous() const
Returns true if the server protocol should be slightly more anonymous.
Definition: configuration.cpp:374
Main::Configuration::popNoDelete
bool popNoDelete() const
Returns true if pop deletion is to be disabled.
Definition: configuration.cpp:229
Main::Configuration::popPort
unsigned int popPort() const
Returns the pop port number.
Definition: configuration.cpp:234
Main::Configuration::allowRemoteClients
bool allowRemoteClients() const
Returns true if allowing remote clients to connect.
Definition: configuration.cpp:239
Main::Configuration::closeStderr
bool closeStderr() const
Returns true if stderr should be closed.
Definition: configuration.cpp:125
Main::Configuration::spoolDir
G::Path spoolDir() const
Returns the spool directory.
Definition: configuration.cpp:138
Main::Configuration::doAdmin
bool doAdmin() const
Returns true if listening for admin connections.
Definition: configuration.cpp:244
Main::Configuration::listeningInterfaces
G::Strings listeningInterfaces(const std::string &protocol=std::string()) const
Returns the listening interface(s).
Definition: configuration.cpp:77
Main::Configuration::useSyslog
bool useSyslog() const
Returns true if generating syslog events.
Definition: configuration.cpp:55
Main::Configuration::forwardingOnStore
bool forwardingOnStore() const
Returns true if forwarding should occur as each message is stored, after it is acknowledged.
Definition: configuration.cpp:186
Main::Configuration::secureConnectionTimeout
unsigned int secureConnectionTimeout() const
Returns the timeout for establishing a secure connection.
Definition: configuration.cpp:329
Main::Configuration::verbose
bool verbose() const
Returns true if doing verbose logging.
Definition: configuration.cpp:45
Main::Configuration::serverTlsFile
std::string serverTlsFile() const
Returns the tls certificate file if the server should support tls.
Definition: configuration.cpp:304
Main::Configuration::debug
bool debug() const
Returns true if doing debug-level logging.
Definition: configuration.cpp:50
Main::Configuration::scannerConnectionTimeout
unsigned int scannerConnectionTimeout() const
Returns a timeout for connecting to the scanner process.
Definition: configuration.cpp:364
Main::Configuration::serverSecretsFile
std::string serverSecretsFile() const
Returns the server-side autentication secrets (password) file.
Definition: configuration.cpp:314
Main::Configuration::promptTimeout
unsigned int promptTimeout() const
Returns the timeout for getting a prompt from the SMTP server.
Definition: configuration.cpp:209
Main::Configuration::nobody
std::string nobody() const
Returns the name of an unprivileged user.
Definition: configuration.cpp:339
Main::CommandLine
A class which deals with the command-line interface to the process, both input and output...
Definition: commandline.h:44
Main::Configuration::log
bool log() const
Returns true if doing logging.
Definition: configuration.cpp:36
Main::Configuration::connectionTimeout
unsigned int connectionTimeout() const
Returns the client-side connection timeout value.
Definition: configuration.cpp:324
Main::Configuration::fqdn
std::string fqdn(std::string default_=std::string()) const
Returns the fully-qualified-domain-name override.
Definition: configuration.cpp:334
Main::Configuration::pollingTimeout
unsigned int pollingTimeout() const
Returns the timeout for periodic polling.
Definition: configuration.cpp:175
Main::Configuration::logFile
std::string logFile() const
Returns the path of a stderr replacement for logging.
Definition: configuration.cpp:67
Main::Configuration::maxSize
unsigned int maxSize() const
Returns the maximum size of submitted messages, or zero.
Definition: configuration.cpp:354
Main::Configuration::clientFilter
std::string clientFilter() const
Returns the path to a client-side pre-processor.
Definition: configuration.cpp:269
Main::Configuration::pidFile
std::string pidFile() const
Returns the pid file's path.
Definition: configuration.cpp:254
Main::Configuration::useFilter
bool useFilter() const
Returns true if pre-processing.
Definition: configuration.cpp:259
Main::Configuration::Configuration
Configuration(const CommandLine &cl)
Constructor. The reference is kept.
Definition: configuration.cpp:31
Main::Configuration::icon
unsigned int icon() const
Returns the icon selector (win32).
Definition: configuration.cpp:274
Main::Configuration::withTerminate
bool withTerminate() const
Returns true if the admin interface should support the terminate command.
Definition: configuration.cpp:349
Main::Configuration::logTimestamp
bool logTimestamp() const
Returns true if logging output should be timestamped.
Definition: configuration.cpp:62
Main::Configuration::clientInterface
std::string clientInterface() const
Returns the sending interface.
Definition: configuration.cpp:98
gpath.h
Main::Configuration::popByName
bool popByName() const
Returns true if the pop spool directory is modified according to the client name. ...
Definition: configuration.cpp:224
Main::Configuration::port
unsigned int port() const
Returns the main listening port number.
Definition: configuration.cpp:72
Main::Configuration::forwardingOnDisconnect
bool forwardingOnDisconnect() const
Returns true if forwarding should occur when the submitter's network connection disconnects.
Definition: configuration.cpp:193
Main::Configuration::doForwardingOnStartup
bool doForwardingOnStartup() const
Returns true if running as a client.
Definition: configuration.cpp:155
gsmtp.h
Main::Configuration::adminPort
unsigned int adminPort() const
Returns the admin port number.
Definition: configuration.cpp:120
Main::Configuration::hidden
bool hidden() const
Returns true if the main window is hidden (win32).
Definition: configuration.cpp:279
Main::Configuration::tlsConfig
unsigned int tlsConfig() const
Returns TLS configuration flags.
Definition: configuration.cpp:299
Main::Configuration::scannerAddress
std::string scannerAddress() const
Returns the address of a scanner process.
Definition: configuration.cpp:359
Main::Configuration::clientSecretsFile
std::string clientSecretsFile() const
Returns the client-side autentication secrets (password) file.
Definition: configuration.cpp:284
Main::Configuration::usePidFile
bool usePidFile() const
Returns true if writing a pid file.
Definition: configuration.cpp:249
G::Path
A Path object represents a file system path.
Definition: gpath.h:44
Main::Configuration
An interface for returning application configuration information.
Definition: configuration.h:45
Main::Configuration::doPolling
bool doPolling() const
Returns true if doing poll-based forwarding.
Definition: configuration.cpp:170
Main::Configuration::doPop
bool doPop() const
Returns true if listening for pop connections.
Definition: configuration.cpp:219
Main::Configuration::scannerResponseTimeout
unsigned int scannerResponseTimeout() const
Returns a timeout for talking to the scanner process.
Definition: configuration.cpp:369
Main::Configuration::responseTimeout
unsigned int responseTimeout() const
Returns the client-side protocol timeout value.
Definition: configuration.cpp:319
Main::Configuration::filterTimeout
unsigned int filterTimeout() const
Returns the timeout for executing an ansynchronous filter() or clientFilter() program.
Definition: configuration.cpp:379
Main::Configuration::clientTls
bool clientTls() const
Returns true if the client protocol should take account of the server's tls capability.
Definition: configuration.cpp:289
Main::Configuration::popSecretsFile
std::string popSecretsFile() const
Returns the pop-server autentication secrets (password) file.
Definition: configuration.cpp:309