How opcfoundation/ua-.netstandard works
Purpose and entry points
This is the OPC Foundation’s cross-platform .NET 2.0 reference implementation of OPC UA. It ships composable NuGet libraries rather than one application: applications host servers or clients through DI/fluent builders, or run supplied samples/tools. The solution root is UA.slnx; representative runnable entry points are samples/Reference/ConsoleReferenceServer/Program.cs, samples/Reference/ConsoleReferenceClient/Program.cs, and the MCP executable tools/Opc.Ua.Mcp/Program.cs.
Type system, encoding, and information models
Opc.Ua.Types is the foundational protocol model: built-in UA values, NodeIds, node tables/state objects, and binary/JSON/XML encoders. Opc.Ua.Core.Types adds common service contracts and canonical UA node states; Opc.Ua.Core supplies stack-level implementation and security. Model NodeSets are first-class inputs/assets and can be consumed at runtime or used for generated code.
• src/Opc.Ua.Types/Encoders/BinaryEncoder.cs
• src/Opc.Ua.Types/State/NodeState.cs
• src/Opc.Ua.Core.Types/State/BaseEventState.cs
Transport and secure service pipeline
The core stack maps UA service requests through transport bindings, secure channels, endpoint dispatch, and server request queues. UA-TCP is implemented directly; HTTPS/WebSocket and Web API hosting integrate with ASP.NET Core/Kestrel. Transport abstractions isolate wire protocol implementations from client/session and server logic.
• src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs
• src/Opc.Ua.Core/Stack/Server/EndpointBase.cs
• src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs
Server runtime and address space
Opc.Ua.Server hosts StandardServer, sessions, subscriptions, diagnostics, security/role services, and pluggable NodeManagers. MasterNodeManager is the central boundary between OPC UA service dispatch and application address spaces; custom, fluent, generated, or runtime-NodeSet managers supply nodes, read/write behavior, methods, events, and monitoring. Historian providers and file-system services are optional server capabilities.
• src/Opc.Ua.Server/Hosting/OpcUaServerHostedService.cs
• src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs
• src/Opc.Ua.Server/Server/StandardServer.cs
Client runtime
Opc.Ua.Client provides discovery, sessions, browse/read/write/call operations, node caching, subscriptions, alarms, history, and managed reconnect/failover. Managed sessions sit above channel management and session service clients; subscription engines convert Publish responses into monitored-item notifications and recovery state.
• src/Opc.Ua.Client/Session/ManagedSession.cs
• src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs
• src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs
Security, identity, discovery, and resilience
Security spans X.509 certificate lifecycle/trust lists, cryptographic policy/provider selection, username/X.509/JWT-issued-token identities, and authorization. GDS/LDS packages provide certificate/application registration and local/global discovery. Redundancy packages add shared-state, Raft/lease leadership, peer discovery, replicated sessions/address space, and Kubernetes integration.
• src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs
• src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs
• src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs
PubSub and external integrations
Opc.Ua.PubSub builds scheduled publisher/subscriber runtimes from validated configuration: data-set sources → writer groups → JSON/UADP encoding/security → transport; inbound frames reverse into reader groups and sinks. Transport packages support UDP/DTLS, Ethernet, MQTT, and Kafka. Companion-model libraries layer DI/client/server façades for Device Integration, ISA-95, robotics, vision, AI, OpenUSD, positioning, WoT Connectivity, and registries.
• src/Opc.Ua.PubSub/Application/PubSubApplication.cs
• src/Opc.Ua.PubSub/Connections/PubSubConnection.cs
• src/Opc.Ua.PubSub/Transcoding/PubSubTranscodingBridge.cs
Build-time tooling and operations
Roslyn source generators turn model designs/NodeSets into types, NodeManagers, client/server APIs, and resource bindings; migration analyzers/code fixes support 1.x-to-2.0 adoption. The MCP host exposes controlled OPC UA client, PubSub, diagnostics, robotics, and vision operations to MCP-capable agents. CI runs Azure Pipelines and GitHub workflows; Docker/Kubernetes manifests are primarily for samples and integration deployment.
• tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs
• tools/Opc.Ua.MigrationAnalyzer/Analyzers/UA0001UtilsTraceToILoggerAnalyzer.cs
• tools/Opc.Ua.Mcp/McpHostBuilder.cs
Main entry points: UaSCBinaryChannel.cs Core stack & security · StandardServer.cs Server runtime · ManagedSession.cs Client runtime · CertificateManager.cs Certificate & identity services
Components 21
Protocol Foundation
- UA types & encoders · Protocol values, node state primitives, and binary/JSON/XML encoding.
src/Opc.Ua.Types/Encoders/BinaryEncoder.cs - Core service types · Service contracts and canonical UA node states.
src/Opc.Ua.Core.Types/State/BaseEventState.cs - Model NodeSets · Runtime address-space inputs and source-generation inputs.
Service Stack
- Core stack & security · Stack implementation, transport abstractions, and security services.
src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs - UA-TCP secure channel
src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs - HTTPS / WebSocket binding · ASP.NET Core/Kestrel transport hosting.
src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs - Endpoint dispatch · Maps secured requests to server service handling.
src/Opc.Ua.Core/Stack/Server/EndpointBase.cs - Client channel manager
src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs - Certificate & identity services · Certificate lifecycle, trust, cryptographic policy, and token identities.
src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs
Runtime Libraries
- Hosted applications · Applications compose the NuGet libraries through DI and fluent builders.
samples/Reference/ConsoleReferenceServer/Program.cs - Server runtime · StandardServer hosts sessions, subscriptions, diagnostics, and role services.
src/Opc.Ua.Server/Server/StandardServer.cs - Master NodeManager · Bridges UA service dispatch to application address spaces.
src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs - Application NodeManagers · Custom, fluent, generated, or NodeSet-backed nodes and behavior.
- Client runtime · Discovery, service operations, caching, alarms, and history.
src/Opc.Ua.Client/Session/ManagedSession.cs - Subscription engine · Converts Publish responses into monitored-item notifications and recovery state.
src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs
Integration & Operations
- PubSub runtime · Scheduled publisher/subscriber pipelines configured from validated PubSub configuration.
src/Opc.Ua.PubSub/Application/PubSubApplication.cs - PubSub transports · Frames flow through writer/reader groups, UADP or JSON encoding, and transport connections.
src/Opc.Ua.PubSub/Connections/PubSubConnection.cs - GDS / LDS · Application registration, certificate, and local/global discovery services.
src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs - Redundancy runtime · Raft/lease leadership, peer discovery, and replicated state.
src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs - Model source generator · Generates types, NodeManagers, APIs, and resource bindings from models.
tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs - MCP host · Controlled OPC UA client, PubSub, diagnostics, robotics, and vision operations.
tools/Opc.Ua.Mcp/McpHostBuilder.cs
Connections 27
- UA types & encoders → Core service types: underpins
- Core service types → Core stack & security: contracts for
- UA types & encoders → Core stack & security: encoding and node primitives
- Core stack & security → UA-TCP secure channel: implements
- Core stack & security → HTTPS / WebSocket binding: supports
- UA-TCP secure channel → Endpoint dispatch: secured requests
- HTTPS / WebSocket binding → Endpoint dispatch: secured requests
- Endpoint dispatch → Server runtime: dispatches services
- Server runtime → Master NodeManager: routes address-space services
- Master NodeManager → Application NodeManagers: delegates nodes and behavior
- Model NodeSets → Application NodeManagers: runtime model input
- Core stack & security → Client channel manager: transport abstraction
- Client channel manager → Client runtime: connectivity and sessions
- Client runtime → Subscription engine: Publish processing
- Certificate & identity services → Core stack & security: secures channels and services
- Certificate & identity services → Server runtime: identities and authorization
- Certificate & identity services → Client runtime: application trust
- Model NodeSets → Model source generator: generation input
- Model source generator → Application NodeManagers: generates
- PubSub runtime → PubSub transports: publishes and consumes frames
- GDS / LDS → Certificate & identity services: registration and certificates
- Redundancy runtime → Server runtime: replicates runtime state
- Hosted applications → Server runtime: hosts
- Hosted applications → Client runtime: uses
- Hosted applications → PubSub runtime: configures
- MCP host → Client runtime: controlled client operations
- MCP host → PubSub runtime: controlled PubSub operations