Diag-Client-Lib
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
doip_client::channel::udp_channel::DoipUdpChannel Class Referencefinal

Class to manage a udp channel as per DoIP protocol. More...

#include <doip_udp_channel.h>

Collaboration diagram for doip_client::channel::udp_channel::DoipUdpChannel:
Collaboration graph
[legend]

Public Types

using UdpMessagePtr = sockets::UdpSocketHandler::UdpMessagePtr
 Type alias for Udp message pointer. More...
 

Public Member Functions

 DoipUdpChannel (std::string_view udp_ip_address, std::uint16_t port_num, uds_transport::Connection &connection)
 Constructs an instance of UdpChannel. More...
 
 ~DoipUdpChannel ()=default
 Destruct an instance of UdpChannel. More...
 
void Start ()
 Function to start the channel. More...
 
void Stop ()
 Function to stop the channel. More...
 
std::pair< uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtrIndicateMessage (uds_transport::UdsMessage::Address source_addr, uds_transport::UdsMessage::Address target_addr, uds_transport::UdsMessage::TargetAddressType type, uds_transport::ChannelID channel_id, std::size_t size, uds_transport::Priority priority, uds_transport::ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info)
 Function to indicate a start of reception of message. More...
 
void HandleMessage (uds_transport::UdsMessagePtr message)
 Function to Hands over a valid received Uds message to upper layer. More...
 
void ProcessReceivedUdpBroadcast (UdpMessagePtr udp_rx_message)
 Function to process the received Udp broadcast message from socket layer. More...
 
void ProcessReceivedUdpUnicast (UdpMessagePtr udp_rx_message)
 Function to process the received Udp unicast message from socket layer. More...
 
uds_transport::UdsTransportProtocolMgr::TransmissionResult Transmit (uds_transport::UdsMessageConstPtr message)
 Function to transmit a Vehicle Identification request. More...
 

Private Types

using UdpSocketHandler = sockets::UdpSocketHandler
 Type alias for Udp socket handler. More...
 

Private Attributes

UdpSocketHandler udp_socket_handler_broadcast_
 Store the udp socket handler for broadcast messages. More...
 
UdpSocketHandler udp_socket_handler_unicast_
 Store the udp socket handler for unicast messages. More...
 
DoipUdpChannelHandler udp_channel_handler_
 Store the doip channel handler. More...
 
uds_transport::Connectionconnection_
 Store the reference to doip connection. More...
 

Detailed Description

Class to manage a udp channel as per DoIP protocol.

Definition at line 26 of file doip_udp_channel.h.

Member Typedef Documentation

◆ UdpMessagePtr

Type alias for Udp message pointer.

Definition at line 31 of file doip_udp_channel.h.

◆ UdpSocketHandler

Type alias for Udp socket handler.

Definition at line 125 of file doip_udp_channel.h.

Constructor & Destructor Documentation

◆ DoipUdpChannel()

doip_client::channel::udp_channel::DoipUdpChannel::DoipUdpChannel ( std::string_view  udp_ip_address,
std::uint16_t  port_num,
uds_transport::Connection connection 
)

Constructs an instance of UdpChannel.

Parameters
[in]udp_ip_addressThe local ip address
[in]port_numThe reference to tcp transport handler
[in]connectionThe reference to tcp transport handler

Definition at line 15 of file doip_udp_channel.cpp.

20  connection_{connection} {}
UdpSocketHandler udp_socket_handler_broadcast_
Store the udp socket handler for broadcast messages.
UdpSocketHandler udp_socket_handler_unicast_
Store the udp socket handler for unicast messages.
uds_transport::Connection & connection_
Store the reference to doip connection.
DoipUdpChannelHandler udp_channel_handler_
Store the doip channel handler.

◆ ~DoipUdpChannel()

doip_client::channel::udp_channel::DoipUdpChannel::~DoipUdpChannel ( )
default

Destruct an instance of UdpChannel.

Member Function Documentation

◆ HandleMessage()

void doip_client::channel::udp_channel::DoipUdpChannel::HandleMessage ( uds_transport::UdsMessagePtr  message)

Function to Hands over a valid received Uds message to upper layer.

Parameters
[in]messageThe Uds message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the conversation here

Definition at line 55 of file doip_udp_channel.cpp.

55  {
56  connection_.HandleMessage(std::move(message));
57 }
virtual void HandleMessage(UdsMessagePtr message)=0
Function to Hands over a valid received Uds message.

References connection_, and uds_transport::Connection::HandleMessage().

Here is the call graph for this function:

◆ IndicateMessage()

std::pair< uds_transport::UdsTransportProtocolMgr::IndicationResult, uds_transport::UdsMessagePtr > doip_client::channel::udp_channel::DoipUdpChannel::IndicateMessage ( uds_transport::UdsMessage::Address  source_addr,
uds_transport::UdsMessage::Address  target_addr,
uds_transport::UdsMessage::TargetAddressType  type,
uds_transport::ChannelID  channel_id,
std::size_t  size,
uds_transport::Priority  priority,
uds_transport::ProtocolKind  protocol_kind,
core_type::Span< std::uint8_t >  payload_info 
)

Function to indicate a start of reception of message.

This is called to indicate the reception of new message by underlying transport protocol handler

Parameters
[in]source_addrThe UDS source address of message
[in]target_addrThe UDS target address of message
[in]typeThe indication whether its is phys/func request
[in]channel_idThe transport protocol channel on which message start happened
[in]sizeThe size in bytes of the UdsMessage starting from SID
[in]priorityThe priority of the given message, used for prioritization of conversations
[in]protocol_kindThe identifier of protocol kind associated to message
[in]payload_infoThe view onto the first received payload bytes, if any. This view shall be used only within this function call. It is recommended that the TP provides at least the first two bytes of the request message, so the DM can identify a functional TesterPresent
Returns
std::pair< IndicationResult, UdsMessagePtr > The pair of IndicationResult and a pointer to UdsMessage owned/created by DM core and returned to the handler to get filled

Definition at line 46 of file doip_udp_channel.cpp.

50  {
51  return connection_.IndicateMessage(source_addr, target_addr, type, channel_id, size, priority, protocol_kind,
52  payload_info);
53 }
virtual std::pair< UdsTransportProtocolMgr::IndicationResult, UdsMessagePtr > IndicateMessage(UdsMessage::Address source_addr, UdsMessage::Address target_addr, UdsMessage::TargetAddressType type, ChannelID channel_id, std::size_t size, Priority priority, ProtocolKind protocol_kind, core_type::Span< std::uint8_t > payload_info)=0
Function to indicate a start of reception of message.

References connection_, and uds_transport::Connection::IndicateMessage().

Here is the call graph for this function:

◆ ProcessReceivedUdpBroadcast()

void doip_client::channel::udp_channel::DoipUdpChannel::ProcessReceivedUdpBroadcast ( DoipUdpChannel::UdpMessagePtr  udp_rx_message)

Function to process the received Udp broadcast message from socket layer.

Parameters
[in]udp_rx_messageThe Udp message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the channel here

Definition at line 32 of file doip_udp_channel.cpp.

32  {
33  udp_channel_handler_.HandleMessageBroadcast(std::move(udp_rx_message));
34 }
void HandleMessageBroadcast(UdpMessagePtr udp_rx_message) noexcept
Function to process the received broadcast udp message.

References doip_client::channel::udp_channel::DoipUdpChannelHandler::HandleMessageBroadcast(), and udp_channel_handler_.

Referenced by doip_client::sockets::UdpSocketHandler::UdpSocketHandler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessReceivedUdpUnicast()

void doip_client::channel::udp_channel::DoipUdpChannel::ProcessReceivedUdpUnicast ( DoipUdpChannel::UdpMessagePtr  udp_rx_message)

Function to process the received Udp unicast message from socket layer.

Parameters
[in]udp_rx_messageThe Udp message ptr (unique_ptr semantics) with the request. Ownership of the UdsMessage is given back to the channel here

Definition at line 36 of file doip_udp_channel.cpp.

36  {
37  udp_channel_handler_.HandleMessageUnicast(std::move(udp_rx_message));
38 }
void HandleMessageUnicast(UdpMessagePtr udp_rx_message) noexcept
Function to process the received unicast udp message.

References doip_client::channel::udp_channel::DoipUdpChannelHandler::HandleMessageUnicast(), and udp_channel_handler_.

Referenced by doip_client::sockets::UdpSocketHandler::UdpSocketHandler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Start()

void doip_client::channel::udp_channel::DoipUdpChannel::Start ( )

Function to start the channel.

Definition at line 22 of file doip_udp_channel.cpp.

22  {
25 }
void Start()
Function to start the socket handler.

References doip_client::sockets::UdpSocketHandler::Start(), udp_socket_handler_broadcast_, and udp_socket_handler_unicast_.

Referenced by doip_client::connection::DoipUdpConnection::Start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stop()

void doip_client::channel::udp_channel::DoipUdpChannel::Stop ( )

Function to stop the channel.

Definition at line 27 of file doip_udp_channel.cpp.

27  {
30 }
void Stop()
Function to stop the socket handler.

References doip_client::sockets::UdpSocketHandler::Stop(), udp_socket_handler_broadcast_, and udp_socket_handler_unicast_.

Referenced by doip_client::connection::DoipUdpConnection::Stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Transmit()

uds_transport::UdsTransportProtocolMgr::TransmissionResult doip_client::channel::udp_channel::DoipUdpChannel::Transmit ( uds_transport::UdsMessageConstPtr  message)

Function to transmit a Vehicle Identification request.

Parameters
[in]messageThe vehicle identification message

Definition at line 40 of file doip_udp_channel.cpp.

41  {
42  return udp_channel_handler_.SendVehicleIdentificationRequest(std::move(message));
43 }
auto SendVehicleIdentificationRequest(uds_transport::UdsMessageConstPtr vehicle_identification_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to vehicle identification request to the connected network.

References doip_client::channel::udp_channel::DoipUdpChannelHandler::SendVehicleIdentificationRequest(), and udp_channel_handler_.

Referenced by doip_client::connection::DoipUdpConnection::Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ connection_

uds_transport::Connection& doip_client::channel::udp_channel::DoipUdpChannel::connection_
private

Store the reference to doip connection.

Definition at line 145 of file doip_udp_channel.h.

Referenced by HandleMessage(), and IndicateMessage().

◆ udp_channel_handler_

DoipUdpChannelHandler doip_client::channel::udp_channel::DoipUdpChannel::udp_channel_handler_
private

Store the doip channel handler.

Definition at line 140 of file doip_udp_channel.h.

Referenced by ProcessReceivedUdpBroadcast(), ProcessReceivedUdpUnicast(), and Transmit().

◆ udp_socket_handler_broadcast_

UdpSocketHandler doip_client::channel::udp_channel::DoipUdpChannel::udp_socket_handler_broadcast_
private

Store the udp socket handler for broadcast messages.

Definition at line 130 of file doip_udp_channel.h.

Referenced by Start(), and Stop().

◆ udp_socket_handler_unicast_

UdpSocketHandler doip_client::channel::udp_channel::DoipUdpChannel::udp_socket_handler_unicast_
private

Store the udp socket handler for unicast messages.

Definition at line 135 of file doip_udp_channel.h.

Referenced by Start(), and Stop().


The documentation for this class was generated from the following files: