Skip to content

[POC] feat: add proxy-core crate with shared types, MDD service resolver, and workspace setup#11

Open
arvindr19 wants to merge 12 commits into
eclipse-opensovd:mainfrom
arvindr19:service_parsing
Open

[POC] feat: add proxy-core crate with shared types, MDD service resolver, and workspace setup#11
arvindr19 wants to merge 12 commits into
eclipse-opensovd:mainfrom
arvindr19:service_parsing

Conversation

@arvindr19
Copy link
Copy Markdown
Contributor

@arvindr19 arvindr19 commented Apr 22, 2026

Summary

Restructures the repository into a Cargo workspace and introduces the proxy-core foundation crate.

Changes

  • Workspace migration: Converts the single-crate layout to a multi-crate workspace with proxy-core, proxy-doip, proxy-sovd, proxy-main members (follow up PRs [POC] feat: add proxy-sovd crate with SOVD REST client and UDS <->SOVD mapper #12 , [POC] feat: add proxy-doip crate — DoIP transport layer (temporary, RDBI/WDBI only) #13 & [POC] feat: add proxy-main binary, FLXC1000 test client #14 ). CDA dependencies pinned to eclipse-opensovd/classic-diagnostic-adapter@cf7fd9c1.

  • proxy-core:

    • Config / ServerConfig / SovdConfig / EcuConfig --> TOML-driven configuration

    • ProxyError / UdsError / SovdError / Nrc --> structured error hierarchy with ISO 14229-1 NRC codes

    • ServiceResolver exposes three composable components:

      1. DidResolver - DID-to-service resolution

        • Resolves DID values to MDD service names using prefix matching
        • Returns ResolvedService with matched service name and decoded request parameters
        • resolve_read_service() / resolve_write_service() methods for READ/WRITE services
        • Integrates with CDA's EcuManager for MDD lookups
      2. ResponseEncoder - UDS response encoding

        • Encodes MDD service responses into raw UDS bytes
        • Handles CodedConst, PhysConst, and Value parameter types
        • MUX-aware encoding for multiplexed services
      3. MetadataProvider - MDD parameter metadata queries

        • Exposes service parameter metadata from the MDD
        • Enables inspection of parameter types, ranges, and encoding rules without resolving requests

      Implementation Details

      • resolve.rs - DID resolution logic with prefix lookup and request parameter extraction
      • response.rs - Response encoding with support for computed/physical/value parameters
      • metadata.rs - Parameter metadata queries and inspection
      • uds_helpers.rs - Low-level UDS byte manipulation and matching utilities
  • config.toml: Default proxy configuration

  • testcontainer/mdd/FLXC1000.mdd: Open-source sample MDD for testing

Scope

Parse and validate UDS requests and responses using MDD structures.
Current implementation covers ReadDataByIdentifier (0x22) and WriteDataByIdentifier (0x2E) services only.

Current Approach

  • proxy-sovd and proxy-doip act as placeholder/temporary logic providers.
  • proxy-sovd
    • Creates dummy REST API requests and triggers mocked response generation APIs.
  • proxy-doip
    • A minimal DoIP server that connects to the client and processes read/write services.
    • Will be replaced once the full DoIP server implementation is merged and ready for use.

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

Notes for Reviewers

…nd workspace setup

Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
@arvindr19 arvindr19 requested a review from a team as a code owner April 22, 2026 07:39
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs
Comment thread proxy-core/src/config.rs
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
Copy link
Copy Markdown

@darkwisebear darkwisebear left a comment

Choose a reason for hiding this comment

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

The service_resolver.rs file is just too big. Please split this into smaller units and add a reference to some class diagram or the like so that I as a human being do not have to reverse engineer what it does.

Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/diag_handler.rs Outdated
Comment thread proxy-core/src/config.rs
Comment thread config.toml Outdated
Comment thread proxy-core/src/service_resolver.rs Outdated
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
Copy link
Copy Markdown

@darkwisebear darkwisebear left a comment

Choose a reason for hiding this comment

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

Haven't been able to finish the review, but there is already some material to work on.

Comment thread Cargo.toml Outdated
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/resolve.rs Outdated
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/resolve.rs Outdated
Comment thread proxy-core/src/service_resolver/resolve.rs Outdated
Comment thread proxy-core/src/service_resolver/resolve.rs
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request Apr 27, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
Comment thread README.md Outdated
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs Outdated
Comment thread proxy-core/src/config.rs
Comment thread proxy-core/src/error.rs
Comment thread proxy-core/src/service_resolver/response.rs
Comment thread proxy-core/src/service_resolver/response.rs
Comment thread proxy-core/src/service_resolver/uds_helpers.rs Outdated
Copy link
Copy Markdown

@bharatGoswami8 bharatGoswami8 left a comment

Choose a reason for hiding this comment

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

@arvindr19 , I’ve reviewed service_resolver and suggest refactoring it into feature-specific types.
For example, we could move metadata into its own type and then used as a component of the primary ServiceResolver or as a specialized internal type. This approach would significantly improve the code's modularity and structural clarity.

Also please add justification for clippy supresseion.

Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
@arvindr19
Copy link
Copy Markdown
Contributor Author

@arvindr19 , I’ve reviewed service_resolver and suggest refactoring it into feature-specific types. For example, we could move metadata into its own type and then used as a component of the primary ServiceResolver or as a specialized internal type. This approach would significantly improve the code's modularity and structural clarity.

Also please add justification for clippy supresseion.

Thank you for the review,
service_resolver neeeds a lot of refactoring. Created #23 and I'll pick it up next.
added justification for clippy attributes.

Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
Copy link
Copy Markdown

@rpreddyhv rpreddyhv left a comment

Choose a reason for hiding this comment

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

minor comment

Comment thread proxy-core/src/error.rs
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
Comment thread proxy-core/src/service_resolver/mod.rs Outdated

/// Return a [`DidResolver`] for DID-to-service resolution.
#[must_use]
pub fn did_resolver(&self) -> DidResolver {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

do we want to give different type to user?
How about ServiceResolver will work as centralize or user consumer instance and it will maintain all this type as a private internally, so with that all the public APIs can be called with ServiceResolver instance.

Copy link
Copy Markdown
Contributor Author

@arvindr19 arvindr19 Apr 30, 2026

Choose a reason for hiding this comment

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

updated, now ServiceResolver has 3 sub components and only necessary APIs made pub.

arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request Apr 29, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request Apr 30, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
Comment thread proxy-core/src/service_resolver/mod.rs Outdated
Comment thread proxy-core/src/service_resolver/metadata.rs
Comment thread proxy-core/src/service_resolver/resolve.rs
Comment thread proxy-core/src/service_resolver/resolve.rs
Comment thread proxy-core/src/service_resolver/response.rs
arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request May 7, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question: So this is more a general question than it is with this particular change. Would it help to exrtact the testing utils, like the ECU sim, testcontainer, odx generation etc. into a separate repo cda and proxy can just use as submodule?

@arvindr19 arvindr19 changed the title feat: add proxy-core crate with shared types, MDD service resolver, and workspace setup [POC] feat: add proxy-core crate with shared types, MDD service resolver, and workspace setup May 11, 2026
Signed-off-by: Arvind Rathod <Arvind.RA.Rathod@bti.bmwgroup.com>
arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request May 12, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
arvindr19 added a commit to arvindr19/uds2sovd-proxy that referenced this pull request May 12, 2026
- Add UdsResponse<'a> wrapper with sid()/is_negative()/nrc() accessors
- is_negative_response/get_nrc delegate to UdsResponse — no more raw byte indexing
- Add ResolvedService { name, params } struct; replace (String, Map) tuple in
  resolve_read_service / resolve_write_service return types
- Split resolve_service_did into build_did_candidates + match_candidate_did
- or_else + match pattern in activate_base_variant (replaces nested if/else)
- Add RwLock doc comment explaining write-reservation intent
- Remove redundant HashSet alongside Vec in candidate dedup
- Add #[cfg(test)] modules to resolve.rs, metadata.rs, response.rs
  (6 + 9 + 12 new unit tests; 63 total in proxy-core)
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