13 #include "common/logger.h"
18 namespace tcp_channel {
21 : tcp_socket_handler_{tcp_ip_address, *this},
22 tcp_channel_handler_{tcp_socket_handler_, *this},
23 connection_{connection} {}
52 __FILE__, __LINE__, __func__, [&kHostIpAddress, &kHostPortNumber](std::stringstream &msg) {
53 msg <<
"Doip Tcp socket connect failed for remote endpoints : "
54 <<
"<Ip: " << kHostIpAddress <<
", Port: " << kHostPortNumber <<
">";
86 __FILE__, __LINE__, __func__,
87 [](std::stringstream &msg) { msg <<
"Routing Activation required, please connect to server first"; });
92 std::pair<uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtr>
auto IsRoutingActivated() noexcept -> bool
Check if routing activation is active for this handler.
void Start()
Function to start the handler.
void Reset()
Function to reset the handler.
auto SendDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to send diagnostic request.
void Stop()
Function to stop the handler.
auto SendRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept -> uds_transport::UdsTransportProtocolMgr::ConnectionResult
Function to send routing activation request.
void HandleMessage(TcpMessagePtr tcp_rx_message) noexcept
Function to process the received message.
void Stop()
Function to stop the channel.
uds_transport::Connection & connection_
Store the reference to doip connection.
void HandleMessage(uds_transport::UdsMessagePtr message)
Function to Hands over a valid received Uds message to upper layer.
void Start()
Function to start the channel.
DoipTcpChannelHandler tcp_channel_handler_
Store the doip channel handler.
std::pair< uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtr > IndicateMessage(uds_transport::UdsMessage::Address source_addr, uds_transport::UdsMessage::Address target_addr, uds_transport::UdsMessage::TargetAddressType type, uds_transport::ChannelID channel_id, std::size_t size, uds_transport::Priority priority, uds_transport::ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info)
Function to indicate a start of reception of message.
sockets::TcpSocketHandler::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
bool IsConnectToHost()
Function to check if connected to host remote server.
uds_transport::UdsTransportProtocolMgr::ConnectionResult ConnectToHost(uds_transport::UdsMessageConstPtr message)
Function to establish connection to remote host server.
void ProcessReceivedTcpMessage(TcpMessagePtr tcp_rx_message)
Function to process the received Tcp message from socket layer.
uds_transport::UdsTransportProtocolMgr::DisconnectionResult DisconnectFromHost()
Function to disconnect from remote host server.
DoipTcpChannel(std::string_view tcp_ip_address, std::uint16_t port_num, uds_transport::Connection &connection)
Constructs an instance of TcpChannel.
uds_transport::UdsTransportProtocolMgr::TransmissionResult Transmit(uds_transport::UdsMessageConstPtr message)
Function to transmit a valid Uds message.
TcpSocketHandler tcp_socket_handler_
Store the tcp socket handler.
static auto GetDiagClientLogger() noexcept -> DoipClientLogger &
core_type::Result< void > DisconnectFromHost()
Function to disconnect from remote host if already connected.
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.
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.
Interface class to handle connection between two layers.
virtual std::pair< UdsTransportProtocolMgr::IndicationResult, UdsMessagePtr > IndicateMessage(UdsMessage::Address source_addr, UdsMessage::Address target_addr, UdsMessage::TargetAddressType type, ChannelID channel_id, std::size_t size, Priority priority, ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info)=0
Function to indicate a start of reception of message.
virtual void HandleMessage(UdsMessagePtr message)=0
Function to Hands over a valid received Uds message.
std::string_view IpAddress
std::string_view ProtocolKind
std::unique_ptr< const UdsMessage > UdsMessageConstPtr
std::unique_ptr< UdsMessage > UdsMessagePtr