Skip to content

[POC]Doip server 0.1 - #29

Open
VinaykumarRS1995 wants to merge 26 commits into
eclipse-opensovd:experimental/doipfrom
VinaykumarRS1995:doip-server-1.0
Open

[POC]Doip server 0.1#29
VinaykumarRS1995 wants to merge 26 commits into
eclipse-opensovd:experimental/doipfrom
VinaykumarRS1995:doip-server-1.0

Conversation

@VinaykumarRS1995

Copy link
Copy Markdown

Summary

This PR adds a DoIP server (ISO 13400-2) that sits between a UDS diagnostic tester and a SOVD backend. It handles vehicle discovery over UDP and diagnostic sessions over TCP, parsing the DoIP wire format and dispatching to per-message-type handlers.

The SOVD proxy layer is stubbed for now — it returns NRC 0x11 (serviceNotSupported). The idea is that once the real SOVD backend is available, we just swap in a concrete implementation of the SovdProxy trait without touching any protocol or transport code.

README.md has the full architecture diagram, message type table, and build/run instructions.

Checklist

  • I have tested my changes locally
  • I have added or updated documentation
  • I have linked related issues or discussions
  • I have added or updated tests

Related

Future Improvement #9

Notes for Reviewers

I've structured the commits to be reviewable layer by layer. If you follow the commit order, each one builds on the previous without jumping between concerns:

  1. README + sequence diagrams — start here for the big picture
  2. Cargo project setup
  3. Configuration module (ConfigProvider trait, TOML + in-memory)
  4. DoIP wire format, header parsing, message type enums
  5. PayloadHandler trait + Dispatcher (routes messages to handlers)
  6. SovdProxy trait + stub/mock
    7a. UDP handlers (vehicle identification, entity status)
    7b. Stateless TCP handlers (alive check, routing activation)
    7c. DiagnosticsHandler + dispatcher factory wiring
    8a. Async TCP/UDP transport with DoIP framing
    8b. Session manager (atomic counter + RAII guard)
    8c. Server struct tying both transports together
  7. main.rs entry point + doip_tester example

Document DoIP server block diagram, supported message types,
and build instructions. Include PlantUML diagrams for startup,
TCP connection, UDP request, and graceful shutdown flows.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Define crate as library and binary. Add tokio, serde, toml,
tracing, and thiserror dependencies. Declare top-level modules.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Introduce ServerConfig for TCP, UDP, and ECU identity settings.
Provide InMemoryProvider for defaults and TomlProvider for
file-based configuration loading.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Implement 8-byte header parsing with version validation. Define
TcpPayloadType and UdpPayloadType enums for all supported
message types (0x0001-0x8003) per ISO 13400-2.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Introduce PayloadHandler<PayloadType, Request> trait for handler
implementations. Build Dispatcher with HashMap-based routing
from payload type to handler, generic over transport.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Define SovdProxy trait with forward() for UDS byte translation.
StubProxy returns NRC 0x11 pending real backend integration.
MockProxy echoes input for unit testing.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Add handlers for VehicleIdentification (0x0001-0x0003), VIN
request (0x0004), and EntityStatus (0x4001). Vehicle ID handlers
share common announcement-building logic.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Add AliveCheck (0x0007) responding to keep-alive pings.
RoutingActivation (0x0005) returns 0x10 as placeholder
until full state-machine logic is implemented.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Add DiagnosticsHandler (0x8001) forwarding UDS bytes via SovdProxy
and returning DiagnosticMessagePositiveAck. Wire all handlers into
build_tcp_dispatcher() and build_udp_dispatcher().

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Add TCP listener with per-connection task spawning. DoIP framer
reconstructs complete messages from partial reads. UDP uses
simple recv-parse-dispatch loop with no framing needed.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Enforce max concurrent TCP connections using atomic counter.
SessionSlot acts as RAII guard that auto-releases on drop,
ensuring cleanup on disconnection or task cancellation.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Add Server struct that starts both listeners concurrently
and coordinates graceful shutdown via cancellation token.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Wire all layers in main(): load config, build dispatchers,
start transports, handle SIGINT shutdown. Include DoIP tester
for manual integration testing against a running server.

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Comment thread docs/Graceful Shutdown.svg Outdated
Comment thread docs/04-graceful-shutdown.puml Outdated
Comment thread docs/01-startup.puml Outdated
Comment thread docs/02-tcp-connection.puml Outdated
Comment thread docs/03-udp-request.puml Outdated

@bharatGoswami8 bharatGoswami8 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should consider providing users with greater flexibility to build each component independently. By components, I am referring to the server application, DoIP library, and client example application.
Additionally, I request the following improvements:

  • Please update the README to clearly reflect the intended usage and component structure.
  • Review the codebase to identify areas where naming conventions and error handling can be improved for better clarity and consistency.
  • Ensure that types defined within a crate are not unnecessarily exposed using pub unless required.

Comment thread Cargo.toml
Comment thread Cargo.toml Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread src/doip/constants.rs Outdated
Comment thread src/config/provider/mod.rs
Comment thread src/config/defaults.rs Outdated
Comment thread src/doip/handlers/vehicle_identification/common.rs Outdated
Comment thread examples/doip_tester.rs

@rpreddyhv rpreddyhv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed my initial review.

Comment thread app/main.rs Outdated
Comment thread app/main.rs
Comment thread docs/sequence/tcp_connection.puml
Comment thread docs/sequence/udp_request.puml
Comment thread docs/04-graceful-shutdown.puml Outdated
Comment thread src/doip/handlers/entity_status.rs Outdated
Comment thread src/doip/constants.rs Outdated
Comment thread src/doip/dispatch.rs
Comment thread src/doip/dispatch.rs
Comment thread .gitignore

@VinaykumarRS1995 VinaykumarRS1995 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have incorporated the review feedback and pushed the updates. Thanks for taking the time to review the changes.

Comment thread docs/01-startup.puml Outdated
Comment thread docs/02-tcp-connection.puml Outdated
Comment thread docs/03-udp-request.puml Outdated
Comment thread docs/04-graceful-shutdown.puml Outdated
Comment thread docs/Graceful Shutdown.svg Outdated
Comment thread Cargo.toml Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated

@rpreddyhv rpreddyhv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-review findings

Comment thread docs/sequence/startup.puml
Comment thread src/doip/handlers/diagnostics.rs Outdated
Comment thread docs/01-startup.puml Outdated
Comment thread docs/04-graceful-shutdown.puml Outdated
Comment thread src/doip/handlers/vehicle_identification/utils.rs
Comment thread src/doip/handlers/vehicle_identification/utils.rs
Comment thread src/doip/handlers/vehicle_identification/request.rs Outdated
Comment thread src/doip/handlers/vehicle_identification/request_by_eid.rs Outdated
Comment thread app/main.rs Outdated
Comment thread docs/Architecture_module_structure.svg Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread CONTRIBUTORS
Comment thread docs/detailed_design.md
Comment thread src/lib.rs Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/Limitation.md Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/High_level_design_detail.md Outdated
Comment thread docs/Usage.md Outdated
Comment thread app/main.rs
Comment thread docs/modules.svg Outdated
Comment thread tools/doip-tester/Cargo.toml Outdated

@bharatGoswami8 bharatGoswami8 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few minor comments otherwise documents look fine to me.

@bharatGoswami8

Copy link
Copy Markdown

@rpreddyhv ,
I feel better to create a separate PR with clean git history as most of the documentation part is completed.

@bharatGoswami8 bharatGoswami8 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering PoC Level code changes, it looks fine to me.

@rpreddyhv

Copy link
Copy Markdown

I will consider rebase with fixup and/or squash once all reviews are done.

@rpreddyhv

Copy link
Copy Markdown

@VinaykumarRS1995 please change the target branch to experimental/doip

@VinaykumarRS1995
VinaykumarRS1995 changed the base branch from main to experimental/doip July 17, 2026 05:23
VinaykumarRS1995 and others added 10 commits July 23, 2026 12:07
- Convert to Cargo workspace (lib + app + client)
- Narrow tokio features to specific set
- Refactor handlers to accept EcuConfig directly
- Tighten visibility (pub(super), pub(in crate::...))
- Remove DEFAULT_ prefix in defaults module
- Add compile_fail doc test for transport segregation
- Add TODO comments for future improvements
- Update README (headings, commands, abbreviations)
- Add sample-doip-server.toml
- Regenerate SVGs from updated puml sources

Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Rename common.rs to utils.rs in vehicle identification handlers
- Rename InMemoryConfigProvider to DefaultConfigProvider
- Fix Toml_provider casing to toml_provider
- Move sample-doip-server.toml into app/
- Add ISO references, design decisions, and validation TODOs across codebase

Signed-off-by: VinaykumarRS1995 <Vinaykumarrs1995@gmail.com>
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Add initial DoIP sequence diagrams
- Add rustdoc documentation and design rationale for config module
- Reorganize architecture and sequence diagrams
- Add architecture, usage, and project documentation
- Add rustdoc comments throughout the codebase
- Rename rustdoc/diagram files to lowercase naming convention
- Fix broken doc links and architecture reference paths
- Add Limitations and Future work links to README table
- Add correct relative links to uds2sovd_proxy and example crates
- Fix Quick Start example with actual API usage patterns
- Update backend implementation example with proper error handling
- Rename high_level_design_detail.md -> detailed_design.md for clarity
- Expand handler table and consolidate protocol flow examples
- Update limitation.md/todo.md links to detailed_design.md

Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Rename doipserver-lib → uds2sovd-proxy-lib (main library)
- Rename doip-server → uds2sovd-proxy (binary)
- Update workspace members: Example → example
- Update all cargo metadata references
- Update workspace documentation comments
- Update default-target in workspace.metadata.docs.rs

Co-authored-by: GitHub Copilot
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Move Example/ → example/ following Rust naming conventions
- Update app/Cargo.toml to reference example crate
- Update app/main.rs to use new crate names
- Add app/config.toml (replaces sample-doip-server.toml)
- Remove old Example/ directory and sample config

Co-authored-by: GitHub Copilot
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Update handler documentation examples and rustdoc comments
  with new crate names (doipserver_lib -> uds2sovd_proxy_lib)
- Remove old Limitation.md, Todo.md, Usage.md, modules.puml
  (replaced by lowercase-named equivalents)
- Update modules.svg with latest architecture
- Update tcp_connection.puml/svg sequence diagrams
- Update CODESTYLE.md references to new crate names
- Add new SVG diagram files (components, doip_server architecture)

Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Add components.puml/svg (system component architecture)
- Add doip_server.puml/svg (DoIP server module structure)
- Add modules_copy.puml (module diagram variant)
- Add example/ crate with restructured diagnostic test client
- New diagram files improve documentation clarity

Co-authored-by: GitHub Copilot
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
- Normalize crate naming in rustdoc comments
- Refine design doc flow, terminology, and limitations list
- Replace AI-produced em dashes with hyphens throughout
- Reword application description
- Integrate review comments; update app docs, remove unused module.svg

Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
Re-add the CONTRIBUTORS file that was accidentally removed during
the rustdoc/documentation cleanup pass.

Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
Signed-off-by: Rajendra Prasad Reddy H V <rajendraprasad.reddy@bti.bmwgroup.com>
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.

5 participants