29                                    std::uint16_t port_num) {
 
   30   std::string connection_name{client_name};
 
   31   connection_name.append(
"_");
 
   32   connection_name.append(ip_address);
 
   33   connection_name.append(
"_");
 
   34   connection_name.append(std::to_string(port_num));
 
   35   return connection_name;
 
   53   enum class State : std::uint8_t {
 
   71   TcpClientImpl(std::string_view client_name, std::string_view local_ip_address,
 
   72                 std::uint16_t local_port_num) noexcept
 
  125                                         std::uint16_t host_port_num) {
 
  131         result.EmplaceValue();
 
  135       result.EmplaceValue();
 
  138           [](std::stringstream &msg) { msg << 
"Tcp client is already connected"; });
 
  153       result.EmplaceValue();
 
  158           [](std::stringstream &msg) { msg << 
"Tcp client is in disconnected state"; });
 
  181       if (
tcp_connection_.Transmit(std::move(tcp_message))) { result.EmplaceValue(); }
 
  185           FILE_NAME, __LINE__, __func__, [](std::stringstream &msg) {
 
  186             msg << 
"Tcp client is Offline, please connect to server first";
 
  215                      std::uint16_t local_port_num) noexcept
 
  217           std::make_unique<TcpClientImpl>(client_name, local_ip_address, local_port_num)} {}
 
  230   tcp_client_impl_->SetReadHandler(std::move(read_handler));
 
  234                                                  std::uint16_t host_port_num) {
 
Class to provide implementation of tcp client.
 
TcpClientImpl & operator=(TcpClientImpl &&other) noexcept=delete
 
void SetReadHandler(HandlerRead read_handler) noexcept
Function to set the read handler that is invoked when message is received.
 
~TcpClientImpl() noexcept=default
Destruct an instance of TcpClientImpl.
 
std::string client_name_
The client name.
 
TcpClientImpl(const TcpClientImpl &other) noexcept=delete
Deleted copy assignment and copy constructor.
 
State
Definitions of different connection state.
 
TcpConnection tcp_connection_
Store the tcp connection.
 
TcpClientImpl & operator=(const TcpClientImpl &other) noexcept=delete
 
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.
 
IoContext io_context_
Stores the io context.
 
void DeInitialize() noexcept
De-initialize the client.
 
void Initialize() noexcept
Initialize the client.
 
core_type::Result< void > DisconnectFromHost()
Function to disconnect from remote host if already connected.
 
TcpClientImpl(std::string_view client_name, std::string_view local_ip_address, std::uint16_t local_port_num) noexcept
Constructs an instance of TcpClientImpl.
 
auto IsConnectedToHost() const noexcept -> bool
Function to get the connection status.
 
std::atomic< State > connection_state_
Store the state of tcp connection.
 
TcpClientImpl(TcpClientImpl &&other) noexcept=delete
Deleted move assignment and move constructor.
 
core_type::Result< void > Transmit(MessageConstPtr tcp_message)
Function to transmit the provided tcp message.
 
Client that manages unsecured/ secured tcp connection.
 
TcpClient & operator=(const TcpClient &other) noexcept=delete
 
TcpClient(std::string_view client_name, std::string_view local_ip_address, std::uint16_t local_port_num) noexcept
Constructs an instance of TcpClient.
 
core_type::Result< void > DisconnectFromHost()
Function to disconnect from remote host if already connected.
 
boost_support::message::tcp::TcpMessageConstPtr MessageConstPtr
Type alias for Tcp message const pointer.
 
void Initialize() noexcept
Initialize the client.
 
void SetReadHandler(HandlerRead read_handler) noexcept
Function to set the read handler that is invoked when message is received.
 
core_type::Result< void > Transmit(MessageConstPtr tcp_message)
Function to transmit the provided tcp message.
 
void DeInitialize() noexcept
De-initialize the client.
 
~TcpClient() noexcept
Destruct an instance of TcpClient.
 
auto IsConnectedToHost() const noexcept -> bool
Function to get the connection status.
 
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.
 
std::function< void(MessagePtr)> HandlerRead
Tcp function template used for reception.
 
std::unique_ptr< TcpClientImpl > tcp_client_impl_
Unique pointer to tcp client implementation.
 
static auto GetLibBoostLogger() noexcept -> LibBoostLogger &
 
Wrapper class to hold boost io context required for io object( sockets)
 
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
 
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
 
std::string AppendIpAddressAndPort(std::string_view client_name, std::string_view ip_address, std::uint16_t port_num)
Function to append the ip address and port number to the connection name.
 
auto MakeErrorCode(BoostSupportErrorDomain::Errc code, BoostSupportErrorDomain::SupportDataType data) noexcept -> core_type::ErrorCode
Create a new ErrorCode within DoipErrorDomain.