Diag-Client-Lib
|
Class to provide implementation of tls client. More...
Public Member Functions | |
TlsClientImpl (std::string_view client_name, std::string_view local_ip_address, std::uint16_t local_port_num, std::string_view ca_certification_path, TlsVersion tls_version) noexcept | |
Constructs an instance of TcpClient. More... | |
TlsClientImpl (const TlsClientImpl &other) noexcept=delete | |
Deleted copy assignment and copy constructor. More... | |
TlsClientImpl & | operator= (const TlsClientImpl &other) noexcept=delete |
TlsClientImpl (TlsClientImpl &&other) noexcept=delete | |
Deleted move assignment and move constructor. More... | |
TlsClientImpl & | operator= (TlsClientImpl &&other) noexcept=delete |
~TlsClientImpl () noexcept=default | |
Destruct an instance of TcpClientImpl. More... | |
void | Initialize () noexcept |
Initialize the client. More... | |
void | DeInitialize () noexcept |
De-initialize the client. More... | |
void | SetReadHandler (HandlerRead read_handler) noexcept |
Function to set the read handler that is invoked when message is received. More... | |
core_type::Result< void > | ConnectToHost (std::string_view host_ip_address, std::uint16_t host_port_num) |
Function to connect to remote ip address and port number. More... | |
core_type::Result< void > | DisconnectFromHost () |
Function to disconnect from remote host if already connected. More... | |
auto | IsConnectedToHost () const noexcept -> bool |
Function to get the connection status. More... | |
core_type::Result< void > | Transmit (MessageConstPtr tcp_message) |
Function to transmit the provided tcp message. More... | |
Private Types | |
using | TlsSocket = socket::tls::TlsSocket |
Type alias for secured socket. More... | |
using | TcpConnectionSecured = connection::tcp::TcpConnection< connection::tcp::ConnectionType::kClient, TlsSocket > |
Type alias for secured tcp connection. More... | |
using | IoContext = boost_support::socket::IoContext |
Type alias for boost context. More... | |
using | TlsContext = boost_support::socket::tls::TlsContext |
Type alias for tls context. More... | |
Private Attributes | |
IoContext | io_context_ |
Stores the io context. More... | |
TlsContext | tls_context_ |
Stores the tls context. More... | |
std::atomic< State > | connection_state_ |
Store the state of tcp connection. More... | |
std::string | client_name_ |
The client name. More... | |
TcpConnectionSecured | tcp_connection_ |
Store the tcp connection. More... | |
Class to provide implementation of tls client.
Definition at line 40 of file tls_client.cpp.
|
private |
Type alias for boost context.
Definition at line 64 of file tls_client.cpp.
|
private |
Type alias for secured tcp connection.
Definition at line 50 of file tls_client.cpp.
|
private |
Type alias for tls context.
Definition at line 69 of file tls_client.cpp.
|
private |
Type alias for secured socket.
Definition at line 45 of file tls_client.cpp.
|
inlinenoexcept |
Constructs an instance of TcpClient.
[in] | local_ip_address | The local ip address of client |
[in] | local_port_num | The local port number of client |
Definition at line 79 of file tls_client.cpp.
|
deletenoexcept |
Deleted copy assignment and copy constructor.
|
deletenoexcept |
Deleted move assignment and move constructor.
|
defaultnoexcept |
Destruct an instance of TcpClientImpl.
|
inline |
Function to connect to remote ip address and port number.
[in] | host_ip_address | The host ip address |
[in] | host_port_num | The host port number |
Definition at line 134 of file tls_client.cpp.
References FILE_NAME, boost_support::common::logger::LibBoostLogger::GetLibBoostLogger(), boost_support::error_domain::kSocketError, and boost_support::error_domain::MakeErrorCode().
|
inlinenoexcept |
|
inline |
Function to disconnect from remote host if already connected.
Definition at line 157 of file tls_client.cpp.
References FILE_NAME, boost_support::common::logger::LibBoostLogger::GetLibBoostLogger(), boost_support::error_domain::kSocketError, and boost_support::error_domain::MakeErrorCode().
|
inlinenoexcept |
|
inlinenoexcept |
Function to get the connection status.
Definition at line 177 of file tls_client.cpp.
|
deletenoexcept |
|
deletenoexcept |
|
inlinenoexcept |
Function to set the read handler that is invoked when message is received.
The ownership of provided read handler is moved
[in] | read_handler | The handler to be set |
Definition at line 122 of file tls_client.cpp.
References boost_support::client::tls::TlsClient< TlsVersion >::TlsClientImpl::SetReadHandler().
Referenced by boost_support::client::tls::TlsClient< TlsVersion >::TlsClientImpl::SetReadHandler().
|
inline |
Function to transmit the provided tcp message.
[in] | tcp_message | The tcp message |
Definition at line 187 of file tls_client.cpp.
References FILE_NAME, boost_support::common::logger::LibBoostLogger::GetLibBoostLogger(), boost_support::error_domain::kGenericError, and boost_support::error_domain::MakeErrorCode().
|
private |
The client name.
Definition at line 221 of file tls_client.cpp.
|
private |
Store the state of tcp connection.
Definition at line 216 of file tls_client.cpp.
|
private |
Stores the io context.
Definition at line 206 of file tls_client.cpp.
|
private |
Store the tcp connection.
Definition at line 226 of file tls_client.cpp.
|
private |
Stores the tls context.
Definition at line 211 of file tls_client.cpp.