Skip to content

feat: DoIP (iso 13400) client support#114

Draft
Magolves wants to merge 36 commits intodriftregion:mainfrom
Magolves:main
Draft

feat: DoIP (iso 13400) client support#114
Magolves wants to merge 36 commits intodriftregion:mainfrom
Magolves:main

Conversation

@Magolves
Copy link
Copy Markdown

Add DoIP (ISO 13400) Transport Layer Support

This PR implements DoIP (Diagnostic over IP - ISO 13400) as a new transport layer for UDS, enabling diagnostic communication over TCP/IP networks.

Features

  • DoIP Client Implementation (src/tp/doip/)
    • TCP-based diagnostic message transport (ISO 13400-2)
    • Routing activation and alive check handling
    • Proper DoIP message framing and state management
    • Support for diagnostic message ACK/NACK
    • Non-blocking I/O with configurable timeouts

Implementation Details

  • Protocol Version: DoIP v3 (ISO 13400:2019)
  • Standard Port: TCP 13400
  • Addressing: External test equipment range (0x0E00-0x0FFF)
  • Message Types: Routing activation, diagnostic messages, alive check

Testing

  • Compiles cleanly with -Wall -Wpedantic -Wextra
  • Integration test passes (examples/doip_client/test.sh)
  • Successfully exchanges RDBI/WDBI messages over DoIP (WDBI reports NRC -> intended)

Code Quality

  • Consistent with iso14229 coding style
  • Comprehensive error handling and logging
  • Well-documented with inline comments and function documentation
  • No compiler warnings

Missing Features

  • UDP vehicle discovery
  • DoIP server implementation in src/tp/doip/ (currently only in examples)
  • TLS support (port 3496)
  • Unit tests for DoIP module
  • Multi-client server support

Related Standards

  • ISO 13400-2:2019 - Road vehicles — Diagnostic communication over Internet Protocol (DoIP)
  • ISO 14229 - Unified Diagnostic Services (UDS)

Testing Instructions:

cd examples/doip_client
make
[test.sh](http://_vscodecontentref_/3)  # Automated integration test

Magolves and others added 21 commits December 9, 2025 23:20
chore: Add CMakeList.txt

doc: Add notes on setting up build env

chore: Add option UDS_TP_DOIP

feat: Add DoIP header

chore: Add source files; integrate files into amalgate.py

fix: Begin impl of DoIP transport

fix: Pass tp pointer to all functions, remove global instance

feat: Add test code

fix: Update target address in DoIP client initialization

chore: Ignore example binaries

WIP

WIP: Corrected doip_poll/recv

feat: Add DOIP_DIAG_HEADER_SIZE

fix: Align return values of send/recv/poll to expected values (not finished)

test: Use sequence  from wdbi/rdbi test

test: Use verbose level

chore: Update amalgated code

doc: describe state machine
…ypes

doc: Add poll states

fix: Fix doip_tp_poll  to return proper status

fix: Add doip_store_uds_response

refactor: Simplify DoIP address extraction with macro

test: Rename source files, update Makefile

fix: Fix DOIP_ADDRESS macro

test: Add test script for doip test

style: Rename global vars

fix: Respond properly to keep-alive requests

test: Add option to poll forever to test keep-alive
fix: Fix compiler warnings
style: Code cleanup, adjust style, add README
doc: Add comments and refs to iso13400
doc: Add DoIP client to mainpage
chore: Add DoIP client test to CI
@sonarqubecloud
Copy link
Copy Markdown

@driftregion
Copy link
Copy Markdown
Owner

Thanks @Magolves for this PR!

I have not given this PR the full review it deserves but a few things stick out:

  • __attribute__((packed)) is not cross-platform and must be removed.
  • I see this targets unix. That is a great target, but it complicates testing (unit, fuzz) when the transport logic is coupled to the OS API.
  • Vehicle discovery is required by the standard (https://www.iso.org/standard/74785.html). It seems like this would be a good place to start testing.

Do you intend to merge this PR or is this a demo?

@Magolves
Copy link
Copy Markdown
Author

Magolves commented Jan 19, 2026

Thanks @Magolves for this PR!

Thanks for the hints - I will follow up on this

Do you intend to merge this PR or is this a demo?

My intention was to merge it some day, yes.

@Magolves Magolves marked this pull request as draft January 19, 2026 19:24
@driftregion
Copy link
Copy Markdown
Owner

My intention was to merge it some day, yes.

I am glad to hear. If a DoIP module is to be included in iso14229 in the future, these are my expectations:

Please consider whether these goals are consistent with your own. Thanks!

Magolves and others added 8 commits January 20, 2026 09:31
chore: Fix build of discovery example
- Updated DoIPClient to use function pointers for TCP and UDP transport methods, allowing for easier testing with mock implementations.
- Introduced DoIPTcpTransport and DoIPUdpTransport structures to encapsulate transport-specific data and methods.
- Replaced direct calls to transport functions with calls through the new function pointers.
- Implemented mock transport functions for both TCP and UDP to facilitate unit testing without actual network dependencies.
- Enhanced error handling and logging for transport initialization and operations.
- Updated related functions and headers to reflect the new transport structure and function pointer usage.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 Security Hotspots

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants