Diag-Client-Lib
|
Class to handle tcp received messages from lower layer. More...
#include <doip_tcp_channel_handler.h>
Public Types | |
using | TcpMessagePtr = sockets::TcpSocketHandler::MessagePtr |
Type alias for Tcp message pointer. More... | |
Public Member Functions | |
DoipTcpChannelHandler (sockets::TcpSocketHandler &tcp_socket_handler, DoipTcpChannel &channel) | |
Constructs an instance of DoipTcpChannelHandler. More... | |
void | Start () |
Function to start the handler. More... | |
void | Stop () |
Function to stop the handler. More... | |
void | Reset () |
Function to reset the handler. More... | |
auto | SendRoutingActivationRequest (uds_transport::UdsMessageConstPtr routing_activation_request) noexcept -> uds_transport::UdsTransportProtocolMgr::ConnectionResult |
Function to send routing activation request. More... | |
auto | SendDiagnosticRequest (uds_transport::UdsMessageConstPtr diagnostic_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult |
Function to send diagnostic request. More... | |
void | HandleMessage (TcpMessagePtr tcp_rx_message) noexcept |
Function to process the received message. More... | |
auto | IsRoutingActivated () noexcept -> bool |
Check if routing activation is active for this handler. More... | |
Private Member Functions | |
auto | ProcessDoIPHeader (DoipMessage &doip_rx_message, std::uint8_t &nack_code) noexcept -> bool |
Function to process doip header in received response. More... | |
auto | ProcessDoIPPayloadLength (std::uint32_t payload_len, std::uint16_t payload_type) noexcept -> bool |
Function to verify payload length of various payload type. More... | |
void | ProcessDoIPPayload (DoipMessage &doip_payload) noexcept |
Function to process the doip payload. More... | |
Private Attributes | |
RoutingActivationHandler | routing_activation_handler_ |
Handler to process routing activation req/ resp. More... | |
DiagnosticMessageHandler | diagnostic_message_handler_ |
Handler to process diagnostic message req/ resp. More... | |
std::mutex | channel_handler_lock |
Mutex to protect critical section. More... | |
Class to handle tcp received messages from lower layer.
Definition at line 30 of file doip_tcp_channel_handler.h.
using doip_client::channel::tcp_channel::DoipTcpChannelHandler::TcpMessagePtr = sockets::TcpSocketHandler::MessagePtr |
Type alias for Tcp message pointer.
Definition at line 35 of file doip_tcp_channel_handler.h.
doip_client::channel::tcp_channel::DoipTcpChannelHandler::DoipTcpChannelHandler | ( | sockets::TcpSocketHandler & | tcp_socket_handler, |
DoipTcpChannel & | channel | ||
) |
Constructs an instance of DoipTcpChannelHandler.
[in] | tcp_socket_handler | The reference to socket handler |
[in] | channel | The reference to tcp transport handler |
Definition at line 66 of file doip_tcp_channel_handler.cpp.
|
noexcept |
Function to process the received message.
[in] | tcp_rx_message | The message received |
Definition at line 99 of file doip_tcp_channel_handler.cpp.
References doip_client::DoipMessage::kTcp.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::ProcessReceivedTcpMessage().
|
noexcept |
Check if routing activation is active for this handler.
Definition at line 112 of file doip_tcp_channel_handler.cpp.
References doip_client::channel::tcp_channel::RoutingActivationHandler::IsRoutingActivated(), and routing_activation_handler_.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::DisconnectFromHost(), and doip_client::channel::tcp_channel::DoipTcpChannel::Transmit().
|
privatenoexcept |
Function to process doip header in received response.
[in] | doip_rx_message | The received doip rx message |
[in] | nack_code | The negative ack code |
Definition at line 116 of file doip_tcp_channel_handler.cpp.
References doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_AliveCheck_ReqType, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_GenericHeader_IncorrectPattern, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_GenericHeader_InvalidPayloadLen, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_GenericHeader_MessageTooLarge, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_GenericHeader_OutOfMemory, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_GenericHeader_UnknownPayload, doip_client::kDoip_Protocol_MaxPayload, doip_client::kDoip_ProtocolVersion, doip_client::kDoip_ProtocolVersion_Def, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_RoutingActivation_ResType, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessage, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessageNegAck, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessagePosAck, and doip_client::kTcpChannelLength.
|
privatenoexcept |
Function to process the doip payload.
[in] | doip_payload | The reference to received payload |
Definition at line 192 of file doip_tcp_channel_handler.cpp.
References doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_RoutingActivation_ResType, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessage, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessageNegAck, and doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessagePosAck.
|
privatenoexcept |
Function to verify payload length of various payload type.
[in] | payload_len | The length of payload received |
[in] | payload_type | The type of payload |
Definition at line 163 of file doip_tcp_channel_handler.cpp.
References doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_AliveCheck_ReqType, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoip_RoutingActivation_ResType, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessage, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessageAckResMinLen, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessageNegAck, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessagePosAck, doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipDiagMessageReqResMinLen, and doip_client::channel::tcp_channel::anonymous_namespace{doip_tcp_channel_handler.cpp}::kDoipRoutingActivationResMaxLen.
void doip_client::channel::tcp_channel::DoipTcpChannelHandler::Reset | ( | ) |
Function to reset the handler.
This will reset all the internal handler back to default state
Definition at line 81 of file doip_tcp_channel_handler.cpp.
References diagnostic_message_handler_, doip_client::channel::tcp_channel::DiagnosticMessageHandler::Reset(), doip_client::channel::tcp_channel::RoutingActivationHandler::Reset(), and routing_activation_handler_.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::DisconnectFromHost().
|
noexcept |
Function to send diagnostic request.
[in] | diagnostic_request | The diagnostic request |
Definition at line 93 of file doip_tcp_channel_handler.cpp.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::Transmit().
|
noexcept |
Function to send routing activation request.
[in] | routing_activation_request | The routing activation request |
Definition at line 86 of file doip_tcp_channel_handler.cpp.
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::ConnectToHost().
void doip_client::channel::tcp_channel::DoipTcpChannelHandler::Start | ( | ) |
Function to start the handler.
Definition at line 71 of file doip_tcp_channel_handler.cpp.
References diagnostic_message_handler_, routing_activation_handler_, doip_client::channel::tcp_channel::DiagnosticMessageHandler::Start(), and doip_client::channel::tcp_channel::RoutingActivationHandler::Start().
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::Start().
void doip_client::channel::tcp_channel::DoipTcpChannelHandler::Stop | ( | ) |
Function to stop the handler.
This will reset all the internal handler back to default state
Definition at line 76 of file doip_tcp_channel_handler.cpp.
References diagnostic_message_handler_, routing_activation_handler_, doip_client::channel::tcp_channel::DiagnosticMessageHandler::Stop(), and doip_client::channel::tcp_channel::RoutingActivationHandler::Stop().
Referenced by doip_client::channel::tcp_channel::DoipTcpChannel::Stop().
|
private |
Mutex to protect critical section.
Definition at line 137 of file doip_tcp_channel_handler.h.
|
private |
Handler to process diagnostic message req/ resp.
Definition at line 132 of file doip_tcp_channel_handler.h.
|
private |
Handler to process routing activation req/ resp.
Definition at line 127 of file doip_tcp_channel_handler.h.
Referenced by IsRoutingActivated(), Reset(), Start(), and Stop().