| 
    Diag-Client-Lib
    
   | 
 
Class used to create a tcp socket for handling transmission and reception of tcp message from driver. More...
#include <tcp_socket.h>
Public Types | |
| enum class | SocketError : std::uint8_t { kOpenFailed , kBindingFailed , kRemoteDisconnected , kGenericError } | 
| Socket error code.  More... | |
| using | TcpMessage = boost_support::message::tcp::TcpMessage | 
| Type alias for Tcp message.  More... | |
| using | TcpMessagePtr = boost_support::message::tcp::TcpMessagePtr | 
| Type alias for Tcp message pointer.  More... | |
| using | TcpMessageConstPtr = boost_support::message::tcp::TcpMessageConstPtr | 
| Type alias for Tcp message const pointer.  More... | |
| using | Tcp = boost::asio::ip::tcp | 
| Type alias for tcp protocol.  More... | |
| using | Socket = Tcp::socket | 
| Type alias for tcp socket.  More... | |
Public Member Functions | |
| TcpSocket (std::string_view local_ip_address, std::uint16_t local_port_num, IoContext &io_context) noexcept | |
| Constructs an instance of TcpSocket.  More... | |
| TcpSocket (Socket socket) noexcept | |
| Constructs an instance of TcpSocket.  More... | |
| TcpSocket (const TcpSocket &other) noexcept=delete | |
| Deleted copy assignment and copy constructor.  More... | |
| TcpSocket & | operator= (const TcpSocket &other) noexcept=delete | 
| TcpSocket (TcpSocket &&other) noexcept=default | |
| Move assignment and Move constructor.  More... | |
| TcpSocket & | operator= (TcpSocket &&other) noexcept=default | 
| ~TcpSocket () noexcept | |
| Destruct an instance of TcpSocket.  More... | |
| core_type::Result< void, SocketError > | Open () noexcept | 
| Function to open and bind the socket to provided ip address & port.  More... | |
| core_type::Result< void, SocketError > | Connect (std::string_view host_ip_address, std::uint16_t host_port_num) noexcept | 
| Function to connect to remote ip address and port number.  More... | |
| core_type::Result< void, SocketError > | Disconnect () noexcept | 
| Function to Disconnect from host.  More... | |
| core_type::Result< void, SocketError > | Transmit (TcpMessageConstPtr tcp_message) noexcept | 
| Function to trigger transmission.  More... | |
| core_type::Result< TcpMessagePtr, SocketError > | Read () noexcept | 
| Function to read message from socket.  More... | |
| core_type::Result< void, SocketError > | Close () noexcept | 
| Function to destroy the socket.  More... | |
Private Types | |
| using | TcpIpAddress = boost::asio::ip::address | 
| Type alias for tcp ip address.  More... | |
| using | TcpErrorCodeType = boost::system::error_code | 
| Type alias for tcp error codes.  More... | |
Private Attributes | |
| Socket | tcp_socket_ | 
| Store the underlying tcp socket.  More... | |
| Tcp::endpoint | local_endpoint_ | 
| Store the local endpoints.  More... | |
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
Definition at line 24 of file tcp_socket.h.
| using boost_support::socket::tcp::TcpSocket::Socket = Tcp::socket | 
Type alias for tcp socket.
Definition at line 59 of file tcp_socket.h.
| using boost_support::socket::tcp::TcpSocket::Tcp = boost::asio::ip::tcp | 
Type alias for tcp protocol.
Definition at line 54 of file tcp_socket.h.
      
  | 
  private | 
Type alias for tcp error codes.
Definition at line 150 of file tcp_socket.h.
      
  | 
  private | 
Type alias for tcp ip address.
Definition at line 145 of file tcp_socket.h.
Type alias for Tcp message.
Definition at line 39 of file tcp_socket.h.
| using boost_support::socket::tcp::TcpSocket::TcpMessageConstPtr = boost_support::message::tcp::TcpMessageConstPtr | 
Type alias for Tcp message const pointer.
Definition at line 49 of file tcp_socket.h.
| using boost_support::socket::tcp::TcpSocket::TcpMessagePtr = boost_support::message::tcp::TcpMessagePtr | 
Type alias for Tcp message pointer.
Definition at line 44 of file tcp_socket.h.
      
  | 
  strong | 
Socket error code.
| Enumerator | |
|---|---|
| kOpenFailed | |
| kBindingFailed | |
| kRemoteDisconnected | |
| kGenericError | |
Definition at line 29 of file tcp_socket.h.
      
  | 
  noexcept | 
Constructs an instance of TcpSocket.
| [in] | local_ip_address | The local ip address | 
| [in] | local_port_num | The local port number | 
| [in] | io_context | The I/O context required to create socket | 
Definition at line 19 of file tcp_socket.cpp.
      
  | 
  explicitnoexcept | 
Constructs an instance of TcpSocket.
| [in] | socket | The socket | 
Definition at line 24 of file tcp_socket.cpp.
      
  | 
  deletenoexcept | 
Deleted copy assignment and copy constructor.
      
  | 
  defaultnoexcept | 
Move assignment and Move constructor.
      
  | 
  defaultnoexcept | 
Destruct an instance of TcpSocket.
      
  | 
  noexcept | 
Function to destroy the socket.
Definition at line 141 of file tcp_socket.cpp.
References kGenericError, and tcp_socket_.
      
  | 
  noexcept | 
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 72 of file tcp_socket.cpp.
References FILE_NAME, and boost_support::common::logger::LibBoostLogger::GetLibBoostLogger().

      
  | 
  noexcept | 
Function to Disconnect from host.
Definition at line 97 of file tcp_socket.cpp.
References FILE_NAME, boost_support::common::logger::LibBoostLogger::GetLibBoostLogger(), kGenericError, and tcp_socket_.

      
  | 
  noexcept | 
Function to open and bind the socket to provided ip address & port.
Definition at line 30 of file tcp_socket.cpp.
References FILE_NAME, and boost_support::common::logger::LibBoostLogger::GetLibBoostLogger().

      
  | 
  deletenoexcept | 
      
  | 
  noexcept | 
Function to read message from socket.
Definition at line 150 of file tcp_socket.cpp.
References FILE_NAME, boost_support::common::logger::LibBoostLogger::GetLibBoostLogger(), boost_support::message::tcp::kDoipheadrSize, kRemoteDisconnected, and tcp_socket_.

      
  | 
  noexcept | 
Function to trigger transmission.
| [in] | tcp_message | The tcp message to be transmitted | 
Definition at line 115 of file tcp_socket.cpp.
References FILE_NAME, and boost_support::common::logger::LibBoostLogger::GetLibBoostLogger().

      
  | 
  private | 
Store the local endpoints.
Definition at line 160 of file tcp_socket.h.
      
  | 
  private | 
Store the underlying tcp socket.
Definition at line 155 of file tcp_socket.h.
Referenced by Close(), Disconnect(), and Read().