Files
mxaccess/rust/crates/mxaccess/Cargo.toml
T
Joseph Doherty 2fc327a8d5 [F55 Path A] DCOM-managed INmxSvcCallback sink
Replace the hand-rolled CallbackExporter (TCP listener + custom
OBJREF) with a real `windows-rs` `#[implement]` COM class for
INmxSvcCallback, marshalled via CoMarshalInterface. NmxSvc validates
the callback OBJREF by calling IObjectExporter::ResolveOxid against
the local RPCSS at 127.0.0.1:135; hand-rolled OXIDs aren't registered
there, which is why RegisterEngine2 returned RPC_S_SERVER_UNAVAILABLE
(1722) on every live attempt. CoMarshalInterface registers the OXID
with RPCSS automatically, so the SCM-side resolution succeeds.

Mirrors MxNativeSession.CreateRegisteredService (cs:624), which is
the .NET reference's working path:
  ComObjRefProvider.MarshalInterfaceObjRef(callback,
    INmxSvcCallback, DifferentMachine)

Layout:
- mxaccess-callback::dcom_sink — INmxSvcCallback + DcomCallbackSink
  + create_dcom_callback_sink_objref. Forwards inbound calls into
  the same CallbackEvent::CallbackInvoked { opnum, body } shape the
  legacy exporter produces, so callback_router stays path-agnostic.
- Session::from_nmx_client — branched on `windows-com`. Real DCOM
  sink when on; legacy CallbackExporter when off (kept for unit
  tests that run against an in-process fake NMX peer).
- SessionInner.dcom_sink_holder: Option<IUnknownHolder> — keeps the
  COM ref alive for the session's lifetime; shutdown_nmx drops it.
- mxaccess-rpc + mxaccess-callback: windows-rs 0.59 → 0.62. The 0.59
  #[implement] macro generates code that doesn't compile under
  edition 2024; 0.62 is fixed.

Live result: cargo test -p mxaccess-compat --features
live-windows-com --test lmx_write_complete_live -- --ignored
--nocapture passes end-to-end. RegisterEngine2 OK, write
round-trips, OnWriteComplete fires with the captured MxStatus shape.

Unblocks F49 step 5; F55 marked Resolved in design/followups.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 09:25:44 -04:00

52 lines
2.1 KiB
TOML

[package]
name = "mxaccess"
description = "Async Tokio façade for AVEVA / Wonderware MXAccess. Exposes Session, Subscription, Transport trait, and the public Error model."
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
authors.workspace = true
[dependencies]
mxaccess-codec = { path = "../mxaccess-codec", version = "0.0.0" }
mxaccess-callback = { path = "../mxaccess-callback", version = "0.0.0" }
mxaccess-galaxy = { path = "../mxaccess-galaxy", version = "0.0.0" }
mxaccess-nmx = { path = "../mxaccess-nmx", version = "0.0.0" }
mxaccess-rpc = { path = "../mxaccess-rpc", version = "0.0.0" }
mxaccess-asb = { path = "../mxaccess-asb", version = "0.0.0" }
mxaccess-asb-nettcp = { path = "../mxaccess-asb-nettcp", version = "0.0.0" }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
futures-util = { workspace = true }
tokio-stream = { version = "0.1", features = ["sync"] }
rand = "0.8"
# F40 — optional `metrics` feature. Default build does NOT depend on
# this crate; enable via `--features metrics` to wire counters and
# histograms into a downstream `metrics::Recorder`.
metrics = { workspace = true, optional = true }
[dev-dependencies]
async-trait = { workspace = true }
[features]
default = []
# Transport feature gates land in M2-M5.
nmx = []
asb = []
# F40 — wire counters / histograms / gauges via the `metrics` crate.
# Default build is allocation-neutral: no `metrics` dep, no runtime cost.
# See `src/metrics.rs` for the emitted metric inventory.
metrics = ["dep:metrics"]
serde = ["mxaccess-codec/serde"]
# `live` gates integration tests that hit a running AVEVA install. Driven by
# the `MX_LIVE` env var via `tools/Setup-LiveProbeEnv.ps1`.
live = []
# Pulls F12's `Session::connect_nmx_auto` constructor — the auto-resolving
# COM-activation path. Propagates to `mxaccess-nmx/windows-com`.
windows-com = ["mxaccess-nmx/windows-com", "mxaccess-callback/windows-com"]
[lints]
workspace = true