8 #ifndef DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_SOCKETS_TCP_SOCKET_HANDLER_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_SOCKETS_TCP_SOCKET_HANDLER_H_
14 #include <string_view>
22 namespace tcp_channel {
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
Immutable class to store received tcp message.
Class type to contains a value (of type ValueType), or an error (of type ErrorType)
Class to manage a tcp channel as per DoIP protocol.
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
boost_support::socket::tcp::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
boost_support::socket::tcp::TcpMessageConstPtr TcpMessageConstPtr
Type alias for Tcp message const pointer.
core_type::Result< void > DisconnectFromHost()
Function to disconnect from remote host if already connected.
SocketHandlerState
Definitions of different socket state.
TcpSocketHandler(std::string_view local_ip_address, TcpChannel &channel)
Constructs an instance of TcpSocketHandler.
void Stop()
Function to stop the socket handler.
SocketHandlerState GetSocketHandlerState() const
Function to get the current state of socket handler.
void Start()
Function to start the socket handler.
~TcpSocketHandler()=default
Destruct an instance of TcpSocketHandler.
std::optional< TcpSocket > tcp_socket_
Store the socket object.
core_type::Result< void > Transmit(TcpMessageConstPtr tcp_message)
Function to transmit the provided tcp message.
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::string local_ip_address_
Store the local ip address.
TcpChannel & channel_
Store the reference to tcp channel.
std::uint16_t local_port_num_
Store the local port number.
std::atomic< SocketHandlerState > state_
Store the state of handler.
std::unique_ptr< const TcpMessage > TcpMessageConstPtr
The unique pointer to const TcpMessage.
std::unique_ptr< TcpMessage > TcpMessagePtr
The unique pointer to TcpMessage.