Diag-Client-Lib
connection_manager.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_CONNECTION_CONNECTION_MANAGER_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CONNECTION_CONNECTION_MANAGER_H_
10 
11 #include <memory>
12 #include <string_view>
13 #include <utility>
14 
16 
17 namespace doip_client {
18 namespace connection {
19 
23 class DoipConnectionManager final {
24  public:
28  DoipConnectionManager() = default;
29 
34 
45  std::unique_ptr<uds_transport::Connection> FindOrCreateTcpConnection(
46  uds_transport::ConversionHandler const &conversation, std::string_view tcp_ip_address, std::uint16_t port_num);
47 
58  std::unique_ptr<uds_transport::Connection> FindOrCreateUdpConnection(
59  uds_transport::ConversionHandler const &conversation, std::string_view udp_ip_address, std::uint16_t port_num);
60 };
61 } // namespace connection
62 } // namespace doip_client
63 
64 #endif // DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CONNECTION_CONNECTION_MANAGER_H_
Manages Doip tcp and udp connections.
~DoipConnectionManager()=default
Destruct an instance of DoipConnectionManager.
std::unique_ptr< uds_transport::Connection > FindOrCreateTcpConnection(uds_transport::ConversionHandler const &conversation, std::string_view tcp_ip_address, std::uint16_t port_num)
Function to find or create a new Tcp connection.
std::unique_ptr< uds_transport::Connection > FindOrCreateUdpConnection(uds_transport::ConversionHandler const &conversation, std::string_view udp_ip_address, std::uint16_t port_num)
Function to find or create a new Udp connection.
DoipConnectionManager()=default
Constructs an instance of DoipConnectionManager.
Class to manage reception from transport protocol handler to connection handler.