Diag-Client-Lib
doip_transport_protocol_handler.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_DOIP_TRANSPORT_PROTOCOL_HANDLER_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_DOIP_TRANSPORT_PROTOCOL_HANDLER_H_
10 
11 #include <memory>
12 #include <string_view>
13 
16 
17 namespace doip_client {
18 namespace transport_protocol_handler {
19 
26  public:
32 
37 
47  uds_transport::UdsTransportProtocolMgr const &transport_protocol_mgr);
48 
53 
59 
63  void Start() override;
64 
68  void Stop() override;
69 
80  std::unique_ptr<uds_transport::Connection> CreateTcpConnection(
81  uds_transport::ConversionHandler &conversation, std::string_view tcp_ip_address,
82  std::uint16_t port_num) override;
83 
94  std::unique_ptr<uds_transport::Connection> CreateUdpConnection(
95  uds_transport::ConversionHandler &conversation, std::string_view udp_ip_address,
96  std::uint16_t port_num) override;
97 
98  private:
102  connection::ConnectionManager connection_mgr_;
103 };
104 
105 } // namespace transport_protocol_handler
106 } // namespace doip_client
107 
108 #endif // DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_DOIP_TRANSPORT_PROTOCOL_HANDLER_H_
Protocol handler class to manage the whole Doip protocol communication.
DoipTransportProtocolHandler(UdsTransportProtocolHandlerId handler_id, uds_transport::UdsTransportProtocolMgr const &transport_protocol_mgr)
Constructs an instance of DoipTransportProtocolHandler.
std::unique_ptr< uds_transport::Connection > CreateUdpConnection(uds_transport::ConversionHandler &conversation, std::string_view udp_ip_address, std::uint16_t port_num) override
Function to create a new Udp connection.
std::unique_ptr< uds_transport::Connection > CreateTcpConnection(uds_transport::ConversionHandler &conversation, std::string_view tcp_ip_address, std::uint16_t port_num) override
Function to create a new Tcp connection.
connection::ConnectionManager connection_mgr_
Store Doip Connection manager.
InitializationResult Initialize() override
Function to initialize the handler.
uds_transport::UdsTransportProtocolHandler::UdsTransportProtocolHandlerId UdsTransportProtocolHandlerId
Type alias for handler id.
~DoipTransportProtocolHandler() final
Destruct an instance of DoipTransportProtocolHandler.
std::uint8_t UdsTransportProtocolHandlerId
Type alias for handler id.
InitializationResult
Definitions of different initialization result.