[POC]Doip server 0.1 - #29
Conversation
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>
bharatGoswami8
left a comment
There was a problem hiding this comment.
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.
VinaykumarRS1995
left a comment
There was a problem hiding this comment.
I have incorporated the review feedback and pushed the updates. Thanks for taking the time to review the changes.
14f01bf to
c89333a
Compare
bharatGoswami8
left a comment
There was a problem hiding this comment.
few minor comments otherwise documents look fine to me.
|
@rpreddyhv , |
bharatGoswami8
left a comment
There was a problem hiding this comment.
Considering PoC Level code changes, it looks fine to me.
|
I will consider rebase with fixup and/or squash once all reviews are done. |
|
@VinaykumarRS1995 please change the target branch to |
- 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>
1b12827 to
76f3083
Compare
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>
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
SovdProxytrait without touching any protocol or transport code.README.md has the full architecture diagram, message type table, and build/run instructions.
Checklist
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:
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