SNode.C
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
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 65 of file ConfigTls.h.

Constructor & Destructor Documentation

◆ ConfigTls()

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

Definition at line 52 of file ConfigTls.cpp.

53 : ConfigSection(instance, "tls", "Configuration of SSL/TLS behavior") {
54 certOpt = addOption( //
55 "--cert",
56 "Certificate chain file",
57 "filename:PEM-FILE",
58 "");
59
61 "--cert-key",
62 "Certificate key file",
63 "filename:PEM-FILE",
64 "");
65
67 "--cert-key-password",
68 "Password for the certificate key file",
69 "password",
70 "",
71 CLI::TypeValidator<std::string>());
72
74 "--ca-cert",
75 "CA-certificate file",
76 "filename:PEM-FILE",
77 "");
78
80 "--ca-cert-dir",
81 "CA-certificate directory",
82 "directory:PEM-CONTAINER-DIR",
83 "");
84
86 "--ca-cert-use-default-dir{true}",
87 "Use default CA-certificate directory",
88 "bool",
89 "false",
90 CLI::IsMember({"true", "false"}));
91
93 "--ca-cert-accept-unknown{true}",
94 "Accept unknown certificates (unsecure)",
95 "bool",
96 "false",
97 CLI::IsMember({"true", "false"}));
98
100 "--cipher-list",
101 "Cipher list (OpenSSL syntax)",
102 "cipher_list",
103 "",
104 CLI::TypeValidator<std::string>("CIPHER"));
105
107 "--ssl-options",
108 "OR combined SSL/TLS options (OpenSSL values)",
109 "options",
110 0,
111 CLI::TypeValidator<ssl_option_t>());
112
114 "--init-timeout",
115 "SSL/TLS initialization timeout in seconds",
116 "timeout",
117 TLS_INIT_TIMEOUT,
118 CLI::PositiveNumber);
119
121 "--shutdown-timeout",
122 "SSL/TLS shutdown timeout in seconds",
123 "timeout",
124 TLS_SHUTDOWN_TIMEOUT,
125 CLI::PositiveNumber);
126
128 "--no-close-notify-is-eof{true}",
129 "Do not interpret a SSL/TLS close_notify alert as EOF",
130 "bool",
131 "false",
132 CLI::IsMember({"true", "false"}));
133 }
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:112
CLI::Option * certOpt
Definition ConfigTls.h:107
CLI::Option * shutdownTimeoutOpt
Definition ConfigTls.h:117
CLI::Option * caCertDirOpt
Definition ConfigTls.h:111
CLI::Option * caCertAcceptUnknownOpt
Definition ConfigTls.h:113
CLI::Option * caCertOpt
Definition ConfigTls.h:110
CLI::Option * certKeyOpt
Definition ConfigTls.h:108
CLI::Option * initTimeoutOpt
Definition ConfigTls.h:116
CLI::Option * sslOptionsOpt
Definition ConfigTls.h:115
CLI::Option * noCloseNotifyIsEOFOpt
Definition ConfigTls.h:118
CLI::Option * certKeyPasswordOpt
Definition ConfigTls.h:109
CLI::Option * cipherListOpt
Definition ConfigTls.h:114

References net::config::ConfigSection::addFlag(), net::config::ConfigSection::addOption(), net::config::ConfigSection::addOption(), caCertAcceptUnknownOpt, caCertDirOpt, caCertOpt, caCertUseDefaultDirOpt, certKeyOpt, certKeyPasswordOpt, certOpt, cipherListOpt, net::config::ConfigSection::ConfigSection(), noCloseNotifyIsEOFOpt, and sslOptionsOpt.

Referenced by net::config::ConfigTlsClient::ConfigTlsClient(), and net::config::ConfigTlsServer::ConfigTlsServer().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getCaCert()

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

Definition at line 179 of file ConfigTls.cpp.

179 {
180 return caCertOpt->as<std::string>();
181 }

References caCertOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCaCertAcceptUnknown()

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

Definition at line 215 of file ConfigTls.cpp.

215 {
216 return caCertAcceptUnknownOpt->as<bool>();
217 }

References caCertAcceptUnknownOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCaCertDir()

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

Definition at line 191 of file ConfigTls.cpp.

191 {
192 return caCertDirOpt->as<std::string>();
193 }

References caCertDirOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCaCertUseDefaultDir()

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

Definition at line 203 of file ConfigTls.cpp.

203 {
204 return caCertUseDefaultDirOpt->as<bool>();
205 }

References caCertUseDefaultDirOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCert()

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

Definition at line 143 of file ConfigTls.cpp.

143 {
144 return certOpt->as<std::string>();
145 }

References certOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCertKey()

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

Definition at line 155 of file ConfigTls.cpp.

155 {
156 return certKeyOpt->as<std::string>();
157 }

References certKeyOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCertKeyPassword()

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

Definition at line 167 of file ConfigTls.cpp.

167 {
168 return certKeyPasswordOpt->as<std::string>();
169 }

References certKeyPasswordOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getCipherList()

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

Definition at line 227 of file ConfigTls.cpp.

227 {
228 return cipherListOpt->as<std::string>();
229 }

References cipherListOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ getInitTimeout()

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

Definition at line 262 of file ConfigTls.cpp.

262 {
263 return initTimeoutOpt->as<utils::Timeval>();
264 }

References initTimeoutOpt.

◆ getNoCloseNotifyIsEOF()

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

Definition at line 250 of file ConfigTls.cpp.

250 {
251 return noCloseNotifyIsEOFOpt->as<bool>();
252 }

References noCloseNotifyIsEOFOpt.

◆ getShutdownTimeout()

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

Definition at line 274 of file ConfigTls.cpp.

274 {
275 return shutdownTimeoutOpt //
276 ->as<utils::Timeval>();
277 }

References shutdownTimeoutOpt.

◆ getSslOptions()

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

Definition at line 239 of file ConfigTls.cpp.

239 {
240 return sslOptionsOpt->as<ssl_option_t>();
241 }

References sslOptionsOpt.

Referenced by net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), and net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx().

Here is the caller graph for this function:

◆ setCaCert()

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

Definition at line 171 of file ConfigTls.cpp.

171 {
172 caCertOpt //
173 ->default_val(caCert)
174 ->clear();
175
176 return *this;
177 }

References caCertOpt.

◆ setCaCertAcceptUnknown()

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

Definition at line 207 of file ConfigTls.cpp.

207 {
209 ->default_val(set ? "true" : "false")
210 ->clear();
211
212 return *this;
213 }

References caCertAcceptUnknownOpt.

◆ setCaCertDir()

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

Definition at line 183 of file ConfigTls.cpp.

183 {
184 caCertDirOpt //
185 ->default_val(caCertDir)
186 ->clear();
187
188 return *this;
189 }

References caCertDirOpt.

◆ setCaCertUseDefaultDir()

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

Definition at line 195 of file ConfigTls.cpp.

195 {
197 ->default_val(set ? "true" : "false")
198 ->clear();
199
200 return *this;
201 }

References caCertUseDefaultDirOpt.

◆ setCert()

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

Definition at line 135 of file ConfigTls.cpp.

135 {
136 certOpt //
137 ->default_val(cert)
138 ->clear();
139
140 return *this;
141 }

References certOpt.

Referenced by main().

Here is the caller graph for this function:

◆ setCertKey()

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

Definition at line 147 of file ConfigTls.cpp.

147 {
148 certKeyOpt //
149 ->default_val(certKey)
150 ->clear();
151
152 return *this;
153 }

References certKeyOpt.

Referenced by main().

Here is the caller graph for this function:

◆ setCertKeyPassword()

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

Definition at line 159 of file ConfigTls.cpp.

159 {
161 ->default_val(certKeyPassword)
162 ->clear();
163
164 return *this;
165 }

References certKeyPasswordOpt.

Referenced by main().

Here is the caller graph for this function:

◆ setCipherList()

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

Definition at line 219 of file ConfigTls.cpp.

219 {
221 ->default_val(cipherList)
222 ->clear();
223
224 return *this;
225 }

References cipherListOpt.

◆ setInitTimeout()

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

Definition at line 254 of file ConfigTls.cpp.

254 {
256 ->default_val(newInitTimeout)
257 ->clear();
258
259 return *this;
260 }

References initTimeoutOpt.

◆ setNoCloseNotifyIsEOF()

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

Definition at line 243 of file ConfigTls.cpp.

243 {
245 ->default_val(closeNotifyIsEOF ? "true" : "false")
246 ->clear();
247 return *this;
248 }

References noCloseNotifyIsEOFOpt.

◆ setShutdownTimeout()

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

Definition at line 266 of file ConfigTls.cpp.

266 {
268 ->default_val(newShutdownTimeout)
269 ->clear();
270
271 return *this;
272 }

References shutdownTimeoutOpt.

◆ setSslOptions()

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

Definition at line 231 of file ConfigTls.cpp.

231 {
233 ->default_val(sslOptions)
234 ->clear();
235
236 return *this;
237 }

References sslOptionsOpt.

Member Data Documentation

◆ caCertAcceptUnknownOpt

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

Definition at line 113 of file ConfigTls.h.

Referenced by ConfigTls(), getCaCertAcceptUnknown(), and setCaCertAcceptUnknown().

◆ caCertDirOpt

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

Definition at line 111 of file ConfigTls.h.

Referenced by ConfigTls(), getCaCertDir(), and setCaCertDir().

◆ caCertOpt

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

Definition at line 110 of file ConfigTls.h.

Referenced by ConfigTls(), getCaCert(), and setCaCert().

◆ caCertUseDefaultDirOpt

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

Definition at line 112 of file ConfigTls.h.

Referenced by ConfigTls(), getCaCertUseDefaultDir(), and setCaCertUseDefaultDir().

◆ certKeyOpt

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

Definition at line 108 of file ConfigTls.h.

Referenced by ConfigTls(), getCertKey(), and setCertKey().

◆ certKeyPasswordOpt

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

Definition at line 109 of file ConfigTls.h.

Referenced by ConfigTls(), getCertKeyPassword(), and setCertKeyPassword().

◆ certOpt

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

Definition at line 107 of file ConfigTls.h.

Referenced by ConfigTls(), getCert(), and setCert().

◆ cipherListOpt

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

Definition at line 114 of file ConfigTls.h.

Referenced by ConfigTls(), getCipherList(), and setCipherList().

◆ initTimeoutOpt

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

Definition at line 116 of file ConfigTls.h.

Referenced by getInitTimeout(), and setInitTimeout().

◆ noCloseNotifyIsEOFOpt

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

Definition at line 118 of file ConfigTls.h.

Referenced by ConfigTls(), getNoCloseNotifyIsEOF(), and setNoCloseNotifyIsEOF().

◆ shutdownTimeoutOpt

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

Definition at line 117 of file ConfigTls.h.

Referenced by getShutdownTimeout(), and setShutdownTimeout().

◆ sslOptionsOpt

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

Definition at line 115 of file ConfigTls.h.

Referenced by ConfigTls(), getSslOptions(), and setSslOptions().


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