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 
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 
bool peerLookup() const
Returns true if there should be some attempt to look up the userid of SMTP peers connected from the t...
Application-level classes.
bool doSmtp() const
Returns true if listening for smtp connections.
bool immediate() const
Returns true if forwarding should occur as soon as each message body is received and before receipt i...
bool clientOverTls() const
Returns true if using the SMTP over TLS (vs.
std::string verifier() const
Returns the path of an external address verifier program.
std::string serverAddress() const
Returns the downstream server's address string.
bool pollingLog() const
Returns true if polling activity should be logged.
std::string filter() const
Returns the path to a server-side pre-processor.
bool doServing() const
Returns true if running as a server (SMTP, POP, admin or COM).
bool daemon() const
Returns true if running as a daemon.
std::list< std::string > Strings
A std::list of std::strings.
Definition: gstrings.h:39
bool anonymous() const
Returns true if the server protocol should be slightly more anonymous.
bool popNoDelete() const
Returns true if pop deletion is to be disabled.
unsigned int popPort() const
Returns the pop port number.
bool allowRemoteClients() const
Returns true if allowing remote clients to connect.
bool closeStderr() const
Returns true if stderr should be closed.
G::Path spoolDir() const
Returns the spool directory.
bool doAdmin() const
Returns true if listening for admin connections.
G::Strings listeningInterfaces(const std::string &protocol=std::string()) const
Returns the listening interface(s).
bool useSyslog() const
Returns true if generating syslog events.
bool forwardingOnStore() const
Returns true if forwarding should occur as each message is stored, after it is acknowledged.
unsigned int secureConnectionTimeout() const
Returns the timeout for establishing a secure connection.
bool verbose() const
Returns true if doing verbose logging.
std::string serverTlsFile() const
Returns the tls certificate file if the server should support tls.
bool debug() const
Returns true if doing debug-level logging.
unsigned int scannerConnectionTimeout() const
Returns a timeout for connecting to the scanner process.
std::string serverSecretsFile() const
Returns the server-side autentication secrets (password) file.
unsigned int promptTimeout() const
Returns the timeout for getting a prompt from the SMTP server.
std::string nobody() const
Returns the name of an unprivileged user.
A class which deals with the command-line interface to the process, both input and output...
Definition: commandline.h:44
bool log() const
Returns true if doing logging.
unsigned int connectionTimeout() const
Returns the client-side connection timeout value.
std::string fqdn(std::string default_=std::string()) const
Returns the fully-qualified-domain-name override.
unsigned int pollingTimeout() const
Returns the timeout for periodic polling.
std::string logFile() const
Returns the path of a stderr replacement for logging.
unsigned int maxSize() const
Returns the maximum size of submitted messages, or zero.
std::string clientFilter() const
Returns the path to a client-side pre-processor.
std::string pidFile() const
Returns the pid file's path.
bool useFilter() const
Returns true if pre-processing.
Configuration(const CommandLine &cl)
Constructor. The reference is kept.
unsigned int icon() const
Returns the icon selector (win32).
bool withTerminate() const
Returns true if the admin interface should support the terminate command.
bool logTimestamp() const
Returns true if logging output should be timestamped.
std::string clientInterface() const
Returns the sending interface.
bool popByName() const
Returns true if the pop spool directory is modified according to the client name. ...
unsigned int port() const
Returns the main listening port number.
bool forwardingOnDisconnect() const
Returns true if forwarding should occur when the submitter's network connection disconnects.
bool doForwardingOnStartup() const
Returns true if running as a client.
unsigned int adminPort() const
Returns the admin port number.
bool hidden() const
Returns true if the main window is hidden (win32).
unsigned int tlsConfig() const
Returns TLS configuration flags.
std::string scannerAddress() const
Returns the address of a scanner process.
std::string clientSecretsFile() const
Returns the client-side autentication secrets (password) file.
bool usePidFile() const
Returns true if writing a pid file.
A Path object represents a file system path.
Definition: gpath.h:44
An interface for returning application configuration information.
Definition: configuration.h:45
bool doPolling() const
Returns true if doing poll-based forwarding.
bool doPop() const
Returns true if listening for pop connections.
unsigned int scannerResponseTimeout() const
Returns a timeout for talking to the scanner process.
unsigned int responseTimeout() const
Returns the client-side protocol timeout value.
unsigned int filterTimeout() const
Returns the timeout for executing an ansynchronous filter() or clientFilter() program.
bool clientTls() const
Returns true if the client protocol should take account of the server's tls capability.
std::string popSecretsFile() const
Returns the pop-server autentication secrets (password) file.