Skip to content

marcschier/opc-classic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Opc - "A modern classic"

Build Docker test fleet .NET 10 License: MIT

A cross-platform, NativeAOT-compatible .NET 10 implementation of OPC Classic for clients and servers. Managed DCOM/MSRPC with no Windows COM runtime interop, an XML-DA client over HTTP, source-generated proxies and dispatchers, and self-contained NTLMv2 / Kerberos / SPNEGO authentication.

Status — alpha preview.

What you get

  • Cross-platform OPC Classic — DA (1.0 / 2.05a / 3.0), AE 1.10, HDA 1.20, Batch 2.00, Commands, Complex Data, DX, Security, and an XML-DA client over HTTP. Runs on Windows, Linux, and macOS (.NET 10). No call to native OS code other than what .net provides.
  • Managed DCOM/MSRPC stack — full MS-DCOM PDU framing, NDR marshaling, OBJREF/ORPC, packet integrity + privacy, channel binding (RFC 5056/5929). No [ComImport], no Windows COM runtime dependency.
  • Mechanism-neutral authentication — NTLMv2, direct Kerberos, and Kerberos-first SPNEGO clients and managed-listener acceptors, with explicit NTLM fallback policy, mechListMIC, packet integrity/privacy, channel binding, keytab/password credential providers, and principal mapping.
  • Source-generated proxies and dispatchers — Roslyn IIncrementalGenerator emits client proxies and server dispatchers for the 253 audited production method shapes. The strict migration manifest contains zero unsupported diagnostics, suppressions, or hand-written wire fallbacks.
  • Windows COM-callable wrappers — when running on Windows, SCM-activated servers are exposed through raw-vtable CCWs (also [ComImport]-free). Full release-scope vtables cover DA server/group/item/sync/async I/O/connection-point paths, AE server/subscription array-heavy methods, and HDA server/read/update/advise/playback paths.
  • DA group enumeration — all six OPCENUMSCOPE values use immutable private/public snapshots; name scopes return IEnumString, connection scopes return IEnumUnknown, and both managed DCOM and Windows CCW paths implement Next, Skip, Reset, and cursor-preserving Clone.
  • Capture and replay tooling — target-aware discovery/activation narrows live BPF filters, while bounded cursors, advisory notifications, pcap/pcapng file decode/replay, TCP reassembly, and opt-in NTLM auth-trailer unwrap support diagnostics without making capture delivery unbounded.
  • NativeAOT + trimming compatible across every runtime project, enforced by IsAotCompatible, EnableTrimAnalyzer, EnableAotAnalyzer, and an explicit BannedSymbols.txt.
  • Validation baseline — 0 build warnings, 0 build errors, and all test projects green, including DA, AE, HDA, DCOM, crypto, Kerberos, SMB, integration, MCP, discovery, generators, property-based, snapshot, XML-DA, and more.

Quick start

Install the Opc.Classic SDK package (it bundles the full cross-platform runtime — client and managed server), then consume the managed contracts from the Opc.Classic.* namespaces:

dotnet add package Opc.Classic --prerelease

On Windows, also add Opc.Classic.Windows to host a server through DCOM. The full granular per-spec packages (Opc.Classic.Da, Opc.Classic.Ae, …) remain available on the GitHub Packages feed — see docs/RELEASE_PROCESS.md.

using Opc.Classic.Da;

static async Task ReadOneAsync(IDaServer server, CancellationToken cancellationToken = default)
{
    IReadOnlyList<ItemValueResult> values = await server.ReadAsync(
    [
        new Item("Random.Int1") { ClientHandle = 1 },
    ], cancellationToken);

    ItemValueResult value = values[0];
    Console.WriteLine($"{value.ItemName} = {value.Value} ({value.Quality}) @ {value.Timestamp:O}");
}

Walk through the first DA client tutorial for an end-to-end example, or browse the adoption guide for hosting + deployment patterns.

Repository layout

Path What's inside
src Runtime assemblies, source generators, shared build props, central package versions, and the AOT/trim ban list.
tests TUnit projects on Microsoft.Testing.Platform: primitives, transports, auth, generators, codecs, hosting, discovery, integration matrices, MCP integration (Opc.Classic.Mcp.Integration.Tests), property-based, snapshot, and crypto.
samples/ Runnable apps — DA/AE/HDA servers and clients, paired managed CPX server/client samples, a loopback demo, an additional managed DA sample (CttServer), the OPC Security sample server, a full-feature simulation server (all specs + MCP, DA/AE/HDA TCP hosting, and SimulationActivationServer/SimulationActivationHost cold activation returning OBJREF_STANDARD), and a NativeAOT canary.
docs/ Documentation hub: architecture, adoption, tutorials, cookbook, migration analyzer, security, conformance, roadmap, and architecture diagrams.
Docker test fleet Windows Docker test fleet — managed-server image, C-built native server/client images, OPC Foundation TestServer/TestClient images, and the docker-compose.
interop/ OPC Foundation conformance assets: vendored IDL headers, CMake-built native sample servers/test apps, and helper scripts.
.github Build, Docker test fleet, and release workflows.

Samples

The runnable apps under samples/ include DA/AE/HDA managed servers and clients, paired managed CPX server/client samples, an in-process loopback, an additional managed DA sample (CttServer), the OPC Security sample server, a full-feature simulation server (every OPC Classic spec behind one MCP server, with DA/AE/HDA over TCP and SimulationActivationServer/SimulationActivationHost cold activation returning OBJREF_STANDARD), and a NativeAOT canary. See the samples README for the map, run instructions, env-var conventions, and sample-container deployment.

Documentation

Start with the documentation hub. Common entry points:

  • Architecture overview — the managed DCOM stack from the listener through dispatchers.
  • Adoption guide — host a server, consume a client, deploy on Windows/Linux.
  • Tutorials — step-by-step walkthroughs for DA, AE, HDA, AOT, troubleshooting.
  • Cookbook — task-flavored recipes (Linux to Matrikon, Kerberos in AD, DCOM hardening, OPC Security, etc.).
  • Spec coverage — what's implemented per OPC sub-spec.
  • Security — STRIDE threat model, channel binding, NTLMSSP audit guide.
  • Migration analyzer — diagnostics for porting from the legacy .NET Framework OPC API.
  • MCP integration — using Opc.Classic from VS Code Copilot, Cursor, Claude Desktop, Copilot CLI.
  • Capture tool reference — live target discovery, filter transitions, cursors, notifications, file decoding, replay, and auth unwrap.
  • Docker test fleet — the multi-container Windows interop test setup.
  • Roadmap — forward-looking gates and gaps.
  • Changelog — release-by-release detail.

Build from source

Requires the .NET 10 SDK pinned by global.json:

dotnet restore Opc.Classic.slnx
dotnet build Opc.Classic.slnx
dotnet test Opc.Classic.slnx

Targeted test subsets:

# DA only
dotnet test tests\Opc.Classic.Da.Tests --no-build

# Solution-wide minus Windows-only and platform-blocked categories
dotnet test Opc.Classic.slnx --filter "Category!=NativeConformance&Category!=MatrikonConformance"

NativeAOT publish (used by CI to verify trim + AOT cleanliness):

dotnet publish samples\Opc.Classic.Samples.AotCanary -c Release -p:PublishAot=true -p:TreatWarningsAsErrors=true

The expected baseline at every commit on master: 0 build warnings, 0 build errors, every test project green.

Contributing and license

Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request, and report security issues through SECURITY.md.

Opc.Classic is licensed under the MIT License. The interop/ tree retains upstream OPC Foundation sample, redistributable, and reference-asset license terms; see THIRD-PARTY-NOTICES.md for the full attribution list.

Opc.Classic is an independent implementation. It is not endorsed by, affiliated with, or certified by the OPC Foundation. OPC, OPC Classic, OPC DA, OPC AE, OPC HDA, OPC UA and related marks are trademarks of the OPC Foundation. Use of those marks here refers only to the published specifications this codebase implements.

About

Experimental platform independent OPC Classic implementation using modern .net (supports Native AOT)

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages