Diag-Client-Lib
doip_routing_activation_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_CHANNEL_TCP_CHANNEL_DOIP_ROUTING_ACTIVATION_HANDLER_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CHANNEL_TCP_CHANNEL_DOIP_ROUTING_ACTIVATION_HANDLER_H_
10 
11 #include <memory>
12 #include <vector>
13 
14 #include "common/doip_message.h"
18 
19 namespace doip_client {
20 namespace channel {
21 namespace tcp_channel {
22 
23 // Forward declaration
24 class DoipTcpChannel;
25 
30  public:
35 
40 
41  public:
47  explicit RoutingActivationHandler(sockets::TcpSocketHandler &tcp_socket_handler);
48 
53 
57  void Start();
58 
63  void Stop();
64 
69  void Reset();
70 
76  void ProcessDoIPRoutingActivationResponse(DoipMessage &doip_payload) noexcept;
77 
84  auto HandleRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept
86 
91  auto IsRoutingActivated() noexcept -> bool;
92 
93  private:
100  auto SendRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept
101  -> uds_transport::UdsTransportProtocolMgr::TransmissionResult;
102 
112  static void CreateDoipGenericHeader(std::vector<std::uint8_t> &doip_header, std::uint16_t payload_type,
113  std::uint32_t payload_len);
114 
115  private:
120 
125 };
126 
127 } // namespace tcp_channel
128 } // namespace channel
129 } // namespace doip_client
130 #endif //DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CHANNEL_TCP_CHANNEL_DOIP_ROUTING_ACTIVATION_HANDLER_H_
Immutable class to store received tcp message.
Definition: tcp_message.h:25
Immutable class to store received doip message.
Definition: doip_message.h:21
Class used as a handler to process routing activation messages.
sockets::TcpSocketHandler::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
static void CreateDoipGenericHeader(std::vector< std::uint8_t > &doip_header, std::uint16_t payload_type, std::uint32_t payload_len)
Function to create doip generic header.
void ProcessDoIPRoutingActivationResponse(DoipMessage &doip_payload) noexcept
Function to process received routing activation response.
auto SendRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to send routing activation request.
~RoutingActivationHandler()
Destruct an instance of RoutingActivationHandler.
RoutingActivationHandler(sockets::TcpSocketHandler &tcp_socket_handler)
Constructs an instance of RoutingActivationHandler.
std::unique_ptr< RoutingActivationHandlerImpl > handler_impl_
Stores the Handler implementation.
auto HandleRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept -> uds_transport::UdsTransportProtocolMgr::ConnectionResult
Function to handle sending of routing activation request.
auto IsRoutingActivated() noexcept -> bool
Check if routing activation is active for this handler.
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::TcpMessage TcpMessage
Type alias for Tcp message.
std::unique_ptr< const UdsMessage > UdsMessageConstPtr
Definition: uds_message.h:69