SNode.C
Loading...
Searching...
No Matches
net::config::ConfigTls Class Reference

#include <ConfigTls.h>

Inheritance diagram for net::config::ConfigTls:
Collaboration diagram for net::config::ConfigTls:

Public Member Functions

ConfigTlssetInitTimeout (const utils::Timeval &newInitTimeout)
 
utils::Timeval getInitTimeout () const
 
ConfigTlssetShutdownTimeout (const utils::Timeval &newShutdownTimeout)
 
utils::Timeval getShutdownTimeout () const
 
ConfigTlssetCert (const std::string &cert)
 
std::string getCert () const
 
ConfigTlssetCertKey (const std::string &certKey)
 
std::string getCertKey () const
 
ConfigTlssetCertKeyPassword (const std::string &certKeyPassword)
 
std::string getCertKeyPassword () const
 
ConfigTlssetCaCert (const std::string &caCert)
 
std::string getCaCert () const
 
ConfigTlssetCaCertDir (const std::string &caCertDir)
 
std::string getCaCertDir () const
 
ConfigTlssetCaCertUseDefaultDir (bool set=true)
 
bool getCaCertUseDefaultDir () const
 
ConfigTlssetCaCertAcceptUnknown (bool set=true)
 
bool getCaCertAcceptUnknown () const
 
ConfigTlssetCipherList (const std::string &cipherList)
 
std::string getCipherList () const
 
ConfigTlssetSslOptions (ssl_option_t sslOptions)
 
ssl_option_t getSslOptions () const
 
ConfigTlssetNoCloseNotifyIsEOF (bool noCloseNotifyIsEOF=true)
 
bool getNoCloseNotifyIsEOF () const
 

Protected Member Functions

 ConfigTls (ConfigInstance *instance)
 
- Protected Member Functions inherited from net::config::ConfigSection
 ConfigSection (ConfigInstance *instance, const std::string &name, const std::string &description)
 
 ConfigSection (const ConfigSection &)=delete
 
 ConfigSection (ConfigSection &&)=delete
 
ConfigSectionoperator= (const ConfigSection &)=delete
 
ConfigSectionoperator= (ConfigSection &&)=delete
 
CLI::Option * addOption (const std::string &name, const std::string &description)
 
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName)
 
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
 
template<typename ValueTypeT >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
 
template<typename ValueTypeT >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
 
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName)
 
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
 
template<typename ValueTypeT >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
 
template<typename ValueTypeT >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
 
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue)
 
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator)
 
void required (CLI::Option *opt, bool req=true)
 
bool required () const
 
template<typename ValueType >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
 
template<typename ValueType >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
 
template<typename ValueType >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
 
template<typename ValueType >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
 

Private Attributes

CLI::Option * certOpt = nullptr
 
CLI::Option * certKeyOpt = nullptr
 
CLI::Option * certKeyPasswordOpt = nullptr
 
CLI::Option * caCertOpt = nullptr
 
CLI::Option * caCertDirOpt = nullptr
 
CLI::Option * caCertUseDefaultDirOpt = nullptr
 
CLI::Option * caCertAcceptUnknownOpt = nullptr
 
CLI::Option * cipherListOpt = nullptr
 
CLI::Option * sslOptionsOpt = nullptr
 
CLI::Option * initTimeoutOpt = nullptr
 
CLI::Option * shutdownTimeoutOpt = nullptr
 
CLI::Option * noCloseNotifyIsEOFOpt = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from net::config::ConfigSection
CLI::App * section = nullptr
 

Detailed Description

Definition at line 43 of file ConfigTls.h.

Constructor & Destructor Documentation

◆ ConfigTls()

net::config::ConfigTls::ConfigTls ( ConfigInstance * instance)
explicitprotected

Definition at line 30 of file ConfigTls.cpp.

31 : ConfigSection(instance, "tls", "Configuration of SSL/TLS behavior") {
32 certOpt = addOption( //
33 "--cert",
34 "Certificate chain file",
35 "filename:PEM-FILE",
36 "");
37
39 "--cert-key",
40 "Certificate key file",
41 "filename:PEM-FILE",
42 "");
43
45 "--cert-key-password",
46 "Password for the certificate key file",
47 "password",
48 "",
49 CLI::TypeValidator<std::string>());
50
52 "--ca-cert",
53 "CA-certificate file",
54 "filename:PEM-FILE",
55 "");
56
58 "--ca-cert-dir",
59 "CA-certificate directory",
60 "directory:PEM-CONTAINER-DIR",
61 "");
62
64 "--ca-cert-use-default-dir{true}",
65 "Use default CA-certificate directory",
66 "bool",
67 "false",
68 CLI::IsMember({"true", "false"}));
69
71 "--ca-cert-accept-unknown{true}",
72 "Accept unknown certificates (unsecure)",
73 "bool",
74 "false",
75 CLI::IsMember({"true", "false"}));
76
78 "--cipher-list",
79 "Cipher list (OpenSSL syntax)",
80 "cipher_list",
81 "",
82 CLI::TypeValidator<std::string>("CIPHER"));
83
85 "--ssl-options",
86 "OR combined SSL/TLS options (OpenSSL values)",
87 "options",
88 0,
89 CLI::TypeValidator<ssl_option_t>());
90
92 "--init-timeout",
93 "SSL/TLS initialization timeout in seconds",
94 "timeout",
95 TLS_INIT_TIMEOUT,
96 CLI::PositiveNumber);
97
99 "--shutdown-timeout",
100 "SSL/TLS shutdown timeout in seconds",
101 "timeout",
102 TLS_SHUTDOWN_TIMEOUT,
103 CLI::PositiveNumber);
104
106 "--no-close-notify-is-eof{true}",
107 "Do not interpret a SSL/TLS close_notify alert as EOF",
108 "bool",
109 "false",
110 CLI::IsMember({"true", "false"}));
111 }
ConfigSection(ConfigInstance *instance, const std::string &name, const std::string &description)
CLI::Option * addOption(const std::string &name, const std::string &description)
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName)
CLI::Option * caCertUseDefaultDirOpt
Definition ConfigTls.h:90
CLI::Option * certOpt
Definition ConfigTls.h:85
CLI::Option * shutdownTimeoutOpt
Definition ConfigTls.h:95
CLI::Option * caCertDirOpt
Definition ConfigTls.h:89
CLI::Option * caCertAcceptUnknownOpt
Definition ConfigTls.h:91
CLI::Option * caCertOpt
Definition ConfigTls.h:88
CLI::Option * certKeyOpt
Definition ConfigTls.h:86
CLI::Option * initTimeoutOpt
Definition ConfigTls.h:94
CLI::Option * sslOptionsOpt
Definition ConfigTls.h:93
CLI::Option * noCloseNotifyIsEOFOpt
Definition ConfigTls.h:96
CLI::Option * certKeyPasswordOpt
Definition ConfigTls.h:87
CLI::Option * cipherListOpt
Definition ConfigTls.h:92

Member Function Documentation

◆ getCaCert()

std::string net::config::ConfigTls::getCaCert ( ) const

Definition at line 157 of file ConfigTls.cpp.

157 {
158 return caCertOpt->as<std::string>();
159 }

◆ getCaCertAcceptUnknown()

bool net::config::ConfigTls::getCaCertAcceptUnknown ( ) const

Definition at line 193 of file ConfigTls.cpp.

193 {
194 return caCertAcceptUnknownOpt->as<bool>();
195 }

◆ getCaCertDir()

std::string net::config::ConfigTls::getCaCertDir ( ) const

Definition at line 169 of file ConfigTls.cpp.

169 {
170 return caCertDirOpt->as<std::string>();
171 }

◆ getCaCertUseDefaultDir()

bool net::config::ConfigTls::getCaCertUseDefaultDir ( ) const

Definition at line 181 of file ConfigTls.cpp.

181 {
182 return caCertUseDefaultDirOpt->as<bool>();
183 }

◆ getCert()

std::string net::config::ConfigTls::getCert ( ) const

Definition at line 121 of file ConfigTls.cpp.

121 {
122 return certOpt->as<std::string>();
123 }

◆ getCertKey()

std::string net::config::ConfigTls::getCertKey ( ) const

Definition at line 133 of file ConfigTls.cpp.

133 {
134 return certKeyOpt->as<std::string>();
135 }

◆ getCertKeyPassword()

std::string net::config::ConfigTls::getCertKeyPassword ( ) const

Definition at line 145 of file ConfigTls.cpp.

145 {
146 return certKeyPasswordOpt->as<std::string>();
147 }

◆ getCipherList()

std::string net::config::ConfigTls::getCipherList ( ) const

Definition at line 205 of file ConfigTls.cpp.

205 {
206 return cipherListOpt->as<std::string>();
207 }

◆ getInitTimeout()

utils::Timeval net::config::ConfigTls::getInitTimeout ( ) const

Definition at line 240 of file ConfigTls.cpp.

240 {
241 return initTimeoutOpt->as<utils::Timeval>();
242 }

◆ getNoCloseNotifyIsEOF()

bool net::config::ConfigTls::getNoCloseNotifyIsEOF ( ) const

Definition at line 228 of file ConfigTls.cpp.

228 {
229 return noCloseNotifyIsEOFOpt->as<bool>();
230 }

◆ getShutdownTimeout()

utils::Timeval net::config::ConfigTls::getShutdownTimeout ( ) const

Definition at line 252 of file ConfigTls.cpp.

252 {
253 return shutdownTimeoutOpt //
254 ->as<utils::Timeval>();
255 }

◆ getSslOptions()

ssl_option_t net::config::ConfigTls::getSslOptions ( ) const

Definition at line 217 of file ConfigTls.cpp.

217 {
218 return sslOptionsOpt->as<ssl_option_t>();
219 }

◆ setCaCert()

ConfigTls & net::config::ConfigTls::setCaCert ( const std::string & caCert)

Definition at line 149 of file ConfigTls.cpp.

149 {
150 caCertOpt //
151 ->default_val(caCert)
152 ->clear();
153
154 return *this;
155 }

◆ setCaCertAcceptUnknown()

ConfigTls & net::config::ConfigTls::setCaCertAcceptUnknown ( bool set = true)

Definition at line 185 of file ConfigTls.cpp.

185 {
187 ->default_val(set ? "true" : "false")
188 ->clear();
189
190 return *this;
191 }

◆ setCaCertDir()

ConfigTls & net::config::ConfigTls::setCaCertDir ( const std::string & caCertDir)

Definition at line 161 of file ConfigTls.cpp.

161 {
162 caCertDirOpt //
163 ->default_val(caCertDir)
164 ->clear();
165
166 return *this;
167 }

◆ setCaCertUseDefaultDir()

ConfigTls & net::config::ConfigTls::setCaCertUseDefaultDir ( bool set = true)

Definition at line 173 of file ConfigTls.cpp.

173 {
175 ->default_val(set ? "true" : "false")
176 ->clear();
177
178 return *this;
179 }

◆ setCert()

ConfigTls & net::config::ConfigTls::setCert ( const std::string & cert)

Definition at line 113 of file ConfigTls.cpp.

113 {
114 certOpt //
115 ->default_val(cert)
116 ->clear();
117
118 return *this;
119 }

◆ setCertKey()

ConfigTls & net::config::ConfigTls::setCertKey ( const std::string & certKey)

Definition at line 125 of file ConfigTls.cpp.

125 {
126 certKeyOpt //
127 ->default_val(certKey)
128 ->clear();
129
130 return *this;
131 }

◆ setCertKeyPassword()

ConfigTls & net::config::ConfigTls::setCertKeyPassword ( const std::string & certKeyPassword)

Definition at line 137 of file ConfigTls.cpp.

137 {
139 ->default_val(certKeyPassword)
140 ->clear();
141
142 return *this;
143 }

◆ setCipherList()

ConfigTls & net::config::ConfigTls::setCipherList ( const std::string & cipherList)

Definition at line 197 of file ConfigTls.cpp.

197 {
199 ->default_val(cipherList)
200 ->clear();
201
202 return *this;
203 }

◆ setInitTimeout()

ConfigTls & net::config::ConfigTls::setInitTimeout ( const utils::Timeval & newInitTimeout)

Definition at line 232 of file ConfigTls.cpp.

232 {
234 ->default_val(newInitTimeout)
235 ->clear();
236
237 return *this;
238 }

◆ setNoCloseNotifyIsEOF()

ConfigTls & net::config::ConfigTls::setNoCloseNotifyIsEOF ( bool noCloseNotifyIsEOF = true)

Definition at line 221 of file ConfigTls.cpp.

221 {
223 ->default_val(closeNotifyIsEOF ? "true" : "false")
224 ->clear();
225 return *this;
226 }

◆ setShutdownTimeout()

ConfigTls & net::config::ConfigTls::setShutdownTimeout ( const utils::Timeval & newShutdownTimeout)

Definition at line 244 of file ConfigTls.cpp.

244 {
246 ->default_val(newShutdownTimeout)
247 ->clear();
248
249 return *this;
250 }

◆ setSslOptions()

ConfigTls & net::config::ConfigTls::setSslOptions ( ssl_option_t sslOptions)

Definition at line 209 of file ConfigTls.cpp.

209 {
211 ->default_val(sslOptions)
212 ->clear();
213
214 return *this;
215 }

Member Data Documentation

◆ caCertAcceptUnknownOpt

CLI::Option* net::config::ConfigTls::caCertAcceptUnknownOpt = nullptr
private

Definition at line 91 of file ConfigTls.h.

◆ caCertDirOpt

CLI::Option* net::config::ConfigTls::caCertDirOpt = nullptr
private

Definition at line 89 of file ConfigTls.h.

◆ caCertOpt

CLI::Option* net::config::ConfigTls::caCertOpt = nullptr
private

Definition at line 88 of file ConfigTls.h.

◆ caCertUseDefaultDirOpt

CLI::Option* net::config::ConfigTls::caCertUseDefaultDirOpt = nullptr
private

Definition at line 90 of file ConfigTls.h.

◆ certKeyOpt

CLI::Option* net::config::ConfigTls::certKeyOpt = nullptr
private

Definition at line 86 of file ConfigTls.h.

◆ certKeyPasswordOpt

CLI::Option* net::config::ConfigTls::certKeyPasswordOpt = nullptr
private

Definition at line 87 of file ConfigTls.h.

◆ certOpt

CLI::Option* net::config::ConfigTls::certOpt = nullptr
private

Definition at line 85 of file ConfigTls.h.

◆ cipherListOpt

CLI::Option* net::config::ConfigTls::cipherListOpt = nullptr
private

Definition at line 92 of file ConfigTls.h.

◆ initTimeoutOpt

CLI::Option* net::config::ConfigTls::initTimeoutOpt = nullptr
private

Definition at line 94 of file ConfigTls.h.

◆ noCloseNotifyIsEOFOpt

CLI::Option* net::config::ConfigTls::noCloseNotifyIsEOFOpt = nullptr
private

Definition at line 96 of file ConfigTls.h.

◆ shutdownTimeoutOpt

CLI::Option* net::config::ConfigTls::shutdownTimeoutOpt = nullptr
private

Definition at line 95 of file ConfigTls.h.

◆ sslOptionsOpt

CLI::Option* net::config::ConfigTls::sslOptionsOpt = nullptr
private

Definition at line 93 of file ConfigTls.h.


The documentation for this class was generated from the following files: