doip - Diagnostics Over IP
Overview
Diagnostics over IP (DoIP) serves as a transport protocol for diagnostic services, e. g. for Unified Diagnostics Services (UDS). It is used to transport UDS messages over IP networks in a standardized way. DoIP is specified in ISO 13400-2. This abstracts the actual transport layer and allows the usage of logical diagnostic addresses instead to communicate with different entities. For security, DoIP can be used on top of TLS.
Features
The module currently provides a DoIP server implementing DoIP version 2 as per ISO 13400-2:2012.
Architecture
The module provides a DoIP server implementation for discovery and transport of UDS
messages over IP networks. The server functionality can be found in the
server subdirectory. Functionality that is common across the module is found in the
common subdirectory.
The server implements DoIP discovery by offering classes to receive Vehicle Identification Requests
and send Vehicle Identification Responses back to clients as well as broadcast Vehicle Announcement
Messages. The class handling this is DoIpServerVehicleIdentificationService.
Complete class diagram (DoIP server, identification part):
Complete class diagram (DoIP server, transport part):
Establishing a Server Connection
Details establishment of server connections as seen in the unit test DoIpServerTransportLayerTest.TestSendWithConnection.
Interface to the Transport Router
A DoIpServerTransportConnection inherits from DoIpServerConnectionHandler
in order to process DoIP protocol messages and it owns one (or several)
DoIpServerTransportMessageHandlers. A DoIpServerTransportMessageHandler is
responsible for sending and receiving diagnostic messages, to and from a DoIP
TCP connection and acts as an interface with a TransportRouter. It references
an IDoIpTransportMessageProvidingListener as well as an
ITransportMessageProcessedListener. The TransportRouter only implements the
ITransportMessageProvidingListener. The class
DoIpTransportMessageProvidingListenerHelper implements the
IDoIpTransportMessageProvidingListener interface and helps connecting the
DoIpServerTransportMessageHandler to the TransportRouter and translating
between transport return values and DoIP ACK/NACK codes. Optionally, if there
is a transport router available that can handle the doip specific
IDoIpTransportMessageProvidingListener, this can also be registered in the
Helper and then this class will be used directly without translation of return
codes.
For sending, the DoIpTransportMessageHandler passes the data on to the
DoIpTcpConnection. Once the data is consumed by the TCP stack, the
ITransportMessageProcessedListener::transportMessageProcessed() callback is
called to signal that the transport message is no longer accessed.



![@startuml
participant DoIpTcpConnection as TcpC
participant DoIpServerConnectionHandler as SCH
participant DoIpServerTransportMessageHandler as STMH
participant DoIpTransportMessageProvidingListenerHelper as TMPLH
participant TransportRouter as TR
participant DoIpServerTransportLayer as TL
alt protocol message
TcpC -> SCH ++ : headerReceived()
SCH -> SCH ++ : (handle sending directly)
deactivate SCH
TcpC <-- SCH -- :
else diagnostic message
TcpC -> SCH ++ : headerReceived()
SCH -> STMH ++ : headerReceived()
TcpC <- STMH ++ : [async] receivePayload()
TcpC --> STMH -- :
SCH <-- STMH -- :
TcpC <-- SCH -- :
TcpC -> STMH ++ : diagnosticMessageLogicalAddressInfoReceived()
STMH -> TMPLH ++ : getTransportMessage()
TMPLH -> TR ++ : getTransportMessage()
TMPLH <-- TR -- :
STMH <-- TMPLH -- :
TcpC <- STMH ++ : [async] receivePayload()
TcpC --> STMH -- :
TcpC <-- STMH -- :
TcpC -> STMH ++ : diagnosticMessageUserDataReceived()
STMH -> TMPLH ++ : messageReceived()
TMPLH -> TR ++ : messageReceived()
TMPLH <-- TR -- :
STMH <-- TMPLH -- :
TcpC <-- STMH -- :
end
STMH <- TL ++ : send()
TcpC <- STMH ++ : [async] sendMessage()
TcpC --> STMH -- :
STMH --> TL -- :
TcpC -> TL ++ : ITransportMessageProcessedListener::transportMessageProcessed()
TcpC <-- TL -- :
@enduml](../../../../_images/plantuml-780e8fdb8f0c7be378a58c8b7e0b765c4f1be8a5.png)