SNode.C
Loading...
Searching...
No Matches
tlslegacyclient.cpp File Reference
Include dependency graph for tlslegacyclient.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 12 of file tlslegacyclient.cpp.

12 {
13 core::SNodeC::init(argc, argv);
14
16 const SocketClient client("tls-legacy-client");
17
18 client.getConfig()->setCaCert("/home/voc/projects/snodec/snode.c/certs/Volker_Christian_-_Web_CA.crt");
19
20 client.getConfig()->setCert("/home/voc/projects/snodec/snode.c/certs/snode.c_-_client.pem");
21 client.getConfig()->setCertKey("/home/voc/projects/snodec/snode.c/certs/snode.c_-_client.key.encrypted.pem");
22 client.getConfig()->setCertKeyPassword("snode.c");
23
24 client.getConfig()->setCaCertAcceptUnknown(false);
25 client.getConfig()->setNoCloseNotifyIsEOF(true); // switch back to unencrypted exchange in case tls shutdown was successful
26
27 client.connect([instanceName = client.getConfig()->getInstanceName()](const SocketClient::SocketAddress& socketAddress,
28 const core::socket::State& state) {
29 if (state == core::socket::State::OK) {
30 VLOG(1) << instanceName << ": connected to " << socketAddress.toString();
31 } else if (state == core::socket::State::ERROR) {
32 LOG(ERROR) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
33 }
34 });
35
36 return core::SNodeC::start();
37}
#define LOG(level)
Definition Logger.h:148
static void init(int argc, char *argv[])
Definition SNodeC.cpp:54
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
Definition SNodeC.cpp:60
static constexpr int ERROR
Definition State.h:57
std::string what() const
Definition State.cpp:114
net::in::stream::SocketClient< core::socket::stream::tls::SocketConnector, net::in::stream::tls::config::ConfigSocketClient, SocketContextFactoryT, Args... > SocketClient
net::in::stream::tls::SocketClient< apps::http::SimpleSocketProtocolFactory > SocketClient

References core::socket::stream::SocketClient< SocketConnectorT, SocketContextFactoryT, Args >::connect(), core::socket::State::ERROR, logger::ERROR, core::socket::Socket< ConfigT >::getConfig(), net::config::ConfigInstance::getInstanceName(), core::SNodeC::init(), logger::LogMessage::LogMessage(), core::socket::State::OK, core::socket::State::operator==(), net::config::ConfigTls::setCaCert(), net::config::ConfigTls::setCaCertAcceptUnknown(), net::config::ConfigTls::setCert(), net::config::ConfigTls::setCertKey(), net::config::ConfigTls::setCertKeyPassword(), net::config::ConfigTls::setNoCloseNotifyIsEOF(), core::SNodeC::start(), net::in::SocketAddress::toString(), and core::socket::State::what().

Here is the call graph for this function: