15 #include "common/logger.h"
20 namespace tcp_channel {
68 : routing_activation_handler_{tcp_socket_handler},
69 diagnostic_message_handler_{tcp_socket_handler, channel} {}
89 return routing_activation_handler_.HandleRoutingActivationRequest(
90 std::move(routing_activation_request));
96 return diagnostic_message_handler_.HandleDiagnosticRequest(std::move(diagnostic_request));
100 std::uint8_t nack_code{};
102 tcp_rx_message->GetHostPortNumber(), tcp_rx_message->GetPayload()};
104 if (ProcessDoIPHeader(doip_rx_message, nack_code)) {
105 ProcessDoIPPayload(doip_rx_message);
117 std::uint8_t &nack_code) noexcept ->
bool {
118 bool ret_val =
false;
121 (doip_rx_message.GetInverseProtocolVersion() ==
124 (doip_rx_message.GetInverseProtocolVersion() ==
137 if (ProcessDoIPPayloadLength(doip_rx_message.GetPayloadLength(),
138 doip_rx_message.GetPayloadType())) {
164 std::uint16_t payload_type) noexcept ->
bool {
166 switch (payload_type) {
193 std::lock_guard<std::mutex>
const lck(channel_handler_lock);
194 switch (doip_payload.GetPayloadType()) {
197 routing_activation_handler_.ProcessDoIPRoutingActivationResponse(doip_payload);
201 diagnostic_message_handler_.ProcessDoIPDiagnosticMessageResponse(doip_payload);
206 diagnostic_message_handler_.ProcessDoIPDiagnosticAckMessageResponse(doip_payload);
Immutable class to store received doip message.
void Stop()
Function to stop the handler.
void Start()
Function to start the handler.
void Reset()
Function to reset the handler.
auto ProcessDoIPPayloadLength(std::uint32_t payload_len, std::uint16_t payload_type) noexcept -> bool
Function to verify payload length of various payload type.
auto IsRoutingActivated() noexcept -> bool
Check if routing activation is active for this handler.
RoutingActivationHandler routing_activation_handler_
Handler to process routing activation req/ resp.
DiagnosticMessageHandler diagnostic_message_handler_
Handler to process diagnostic message req/ resp.
sockets::TcpSocketHandler::MessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
void Start()
Function to start the handler.
void Reset()
Function to reset the handler.
DoipTcpChannelHandler(sockets::TcpSocketHandler &tcp_socket_handler, DoipTcpChannel &channel)
Constructs an instance of DoipTcpChannelHandler.
auto SendDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to send diagnostic request.
void Stop()
Function to stop the handler.
void ProcessDoIPPayload(DoipMessage &doip_payload) noexcept
Function to process the doip payload.
auto SendRoutingActivationRequest(uds_transport::UdsMessageConstPtr routing_activation_request) noexcept -> uds_transport::UdsTransportProtocolMgr::ConnectionResult
Function to send routing activation request.
auto ProcessDoIPHeader(DoipMessage &doip_rx_message, std::uint8_t &nack_code) noexcept -> bool
Function to process doip header in received response.
void HandleMessage(TcpMessagePtr tcp_rx_message) noexcept
Function to process the received message.
Class to manage a tcp channel as per DoIP protocol.
void Stop()
Function to stop the handler.
void Reset()
Function to reset the handler.
auto IsRoutingActivated() noexcept -> bool
Check if routing activation is active for this handler.
void Start()
Function to start the handler.
Handler class to manage different socket of various client (Udp / Tcp)
constexpr std::uint16_t kDoip_AliveCheck_ResType
constexpr std::uint8_t kDoip_GenericHeader_MessageTooLarge
constexpr std::uint16_t kDoip_RoutingActivation_ResType
Routing Activation response Type.
constexpr std::uint8_t kDoipDiagMessageReqResMinLen
Diagnostic Message request/response lengths.
constexpr std::uint16_t kDoipDiagMessagePosAck
constexpr std::uint16_t kDoip_AliveCheck_ReqType
Alive check type.
constexpr std::uint8_t kDoip_GenericHeader_OutOfMemory
constexpr std::uint8_t kDoip_GenericHeader_InvalidPayloadLen
constexpr std::uint16_t kDoipDiagMessage
Diagnostic message type.
constexpr std::uint8_t kDoipDiagMessageAckResMinLen
constexpr std::uint8_t kDoip_GenericHeader_UnknownPayload
constexpr std::uint32_t kDoipRoutingActivationResMaxLen
constexpr std::uint8_t kDoip_GenericHeader_IncorrectPattern
Generic DoIP Header NACK codes.
constexpr std::uint16_t kDoipDiagMessageNegAck
constexpr std::uint32_t kDoipRoutingActivationResMinLen
Routing Activation request lengths.
constexpr std::uint8_t kDoip_ProtocolVersion_Def
constexpr std::uint32_t kDoip_Protocol_MaxPayload
constexpr std::uint8_t kDoip_ProtocolVersion
constexpr std::uint32_t kTcpChannelLength
std::unique_ptr< const UdsMessage > UdsMessageConstPtr