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
bool noCloseNotifyIsEOFOpt = false

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 }
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 * 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(), 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 172 of file ConfigTls.cpp.

172 {
173 return caCertOpt->as<std::string>();
174 }

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 208 of file ConfigTls.cpp.

208 {
209 return caCertAcceptUnknownOpt->as<bool>();
210 }

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 184 of file ConfigTls.cpp.

184 {
185 return caCertDirOpt->as<std::string>();
186 }

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 196 of file ConfigTls.cpp.

196 {
197 return caCertUseDefaultDirOpt->as<bool>();
198 }

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 136 of file ConfigTls.cpp.

136 {
137 return certOpt->as<std::string>();
138 }

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 148 of file ConfigTls.cpp.

148 {
149 return certKeyOpt->as<std::string>();
150 }

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 160 of file ConfigTls.cpp.

160 {
161 return certKeyPasswordOpt->as<std::string>();
162 }

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 220 of file ConfigTls.cpp.

220 {
221 return cipherListOpt->as<std::string>();
222 }

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 254 of file ConfigTls.cpp.

254 {
255 return initTimeoutOpt->as<utils::Timeval>();
256 }

References initTimeoutOpt.

◆ getNoCloseNotifyIsEOF()

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

Definition at line 242 of file ConfigTls.cpp.

242 {
244 }

References noCloseNotifyIsEOFOpt.

◆ getShutdownTimeout()

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

Definition at line 266 of file ConfigTls.cpp.

266 {
267 return shutdownTimeoutOpt //
268 ->as<utils::Timeval>();
269 }

References shutdownTimeoutOpt.

◆ getSslOptions()

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

Definition at line 232 of file ConfigTls.cpp.

232 {
233 return sslOptionsOpt->as<ssl_option_t>();
234 }

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 164 of file ConfigTls.cpp.

164 {
165 caCertOpt //
166 ->default_val(caCert)
167 ->clear();
168
169 return *this;
170 }

References caCertOpt.

◆ setCaCertAcceptUnknown()

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

Definition at line 200 of file ConfigTls.cpp.

200 {
202 ->default_val(set ? "true" : "false")
203 ->clear();
204
205 return *this;
206 }

References caCertAcceptUnknownOpt.

◆ setCaCertDir()

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

Definition at line 176 of file ConfigTls.cpp.

176 {
177 caCertDirOpt //
178 ->default_val(caCertDir)
179 ->clear();
180
181 return *this;
182 }

References caCertDirOpt.

◆ setCaCertUseDefaultDir()

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

Definition at line 188 of file ConfigTls.cpp.

188 {
190 ->default_val(set ? "true" : "false")
191 ->clear();
192
193 return *this;
194 }

References caCertUseDefaultDirOpt.

◆ setCert()

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

Definition at line 128 of file ConfigTls.cpp.

128 {
129 certOpt //
130 ->default_val(cert)
131 ->clear();
132
133 return *this;
134 }

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 140 of file ConfigTls.cpp.

140 {
141 certKeyOpt //
142 ->default_val(certKey)
143 ->clear();
144
145 return *this;
146 }

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 152 of file ConfigTls.cpp.

152 {
154 ->default_val(certKeyPassword)
155 ->clear();
156
157 return *this;
158 }

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 212 of file ConfigTls.cpp.

212 {
214 ->default_val(cipherList)
215 ->clear();
216
217 return *this;
218 }

References cipherListOpt.

◆ setInitTimeout()

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

Definition at line 246 of file ConfigTls.cpp.

246 {
248 ->default_val(newInitTimeout)
249 ->clear();
250
251 return *this;
252 }

References initTimeoutOpt.

◆ setNoCloseNotifyIsEOF()

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

Definition at line 236 of file ConfigTls.cpp.

236 {
237 this->noCloseNotifyIsEOFOpt = noCloseNotifyIsEOF;
238
239 return *this;
240 }

References noCloseNotifyIsEOFOpt.

◆ setShutdownTimeout()

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

Definition at line 258 of file ConfigTls.cpp.

258 {
260 ->default_val(newShutdownTimeout)
261 ->clear();
262
263 return *this;
264 }

References shutdownTimeoutOpt.

◆ setSslOptions()

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

Definition at line 224 of file ConfigTls.cpp.

224 {
226 ->default_val(sslOptions)
227 ->clear();
228
229 return *this;
230 }

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

bool net::config::ConfigTls::noCloseNotifyIsEOFOpt = false
private

Definition at line 118 of file ConfigTls.h.

Referenced by 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: