Commit Graph

850 Commits

Author SHA1 Message Date
Marc Schier d58d6849f5 Fix #3209 (#3211) 2025-09-18 10:11:58 +03:00
romanett fc6230f7a1 Make IAsyncNodeManager experimental / Remove deprecated ICertificateStoreMembers / Rename IApplicationConfigurationBuilderCreate.Create to CreateAsync (#3187)
* Make IAsyncNodeManager experimental
* Remove deprecated ICertificateStore Members
* rename IApplicationConfigurationBuilderCreate Create method to CreateAsync
* Add obsolete create
2025-09-15 16:20:10 +03:00
Marc Schier 6d5254745d Move newly introduced AsyncNodeTable and AsyncTypeTree interfaces to core (#3182)
* Move new interfaces to core

* Add extension methods to convert from async to sync tables
2025-09-03 14:48:34 +02:00
Marc Schier 520351ccfc Optimize reflection-based lookups using caches (#3179)
* Optimize lookups using reflection using caches,  Cleanup code.
2025-08-28 18:39:16 -07:00
Marc Schier 25ba2a2d08 Make sync client api obsolete (#3174) 2025-08-27 06:05:36 -07:00
romanett a86077ac38 Make GDS Tests use ECC for connection. Update Certificate wait check to use polling mechanism. (#3167)
* Update GDS Client to use async Client API
* Make GDS Tests use ECC for connection. Update Certifiacte wait check to use polling mechanism
* Use Async Server Methods
* Add specialized ECC Test procdure
* Add Exception handling to allow errors during server application certificate exchange

---------

Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
2025-08-22 16:55:25 +02:00
Marc Schier 954f2ba063 Fix nuget and official build and additional smaller analzyer fixes (#3166)
* Add strong namer
* Add suppression files
* Fix 462 build
2025-08-19 16:42:03 +02:00
Marc Schier 9830e5d53e Enable roslynizer and fix all analyzer issues (#3157)
* Fix warnings and suggestions
* Enable roslynator
2025-08-16 04:10:24 -07:00
romanett 62aa1fa053 Remove exception in ServiceResult Call() (#3155)
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-08-12 14:52:51 +02:00
romanett cae5fb25da [Server] Implement Support for Async Method Calls (#3090)
* Implement support for async method Call in the server
* Implement Cancellation
* Add new generated async supported Endpoints & Server Methods
* Make SecureChannelContext AsyncLocal
* Implement SubscriptionAsync
* Add Async Request Queue
* Implement sync calls for async NodeManagers. Add Warning
* Use second file for Async Interface
2025-08-12 10:44:57 +02:00
romanett 751d614dc6 make ICertificateStore use Async suffixes (#3148) 2025-08-08 12:24:03 +02:00
romanett d4e44c6311 Add async suffix to methods returning a Task (#3145)
* Add async suffix to asnyc methods
2025-08-07 13:55:15 +02:00
romanett f460736582 remove all obsolete methods from the stack (#3139) 2025-08-06 21:27:10 +02:00
romanett 92c3cb674d Extend Existing Server Interfaces (ISessionManager, ISubscriptionManager, IServerInternal) (#3099)
* Extend Existing Server Interfaces

* Update GDS

* cleanup

* Add Store / Restore Methods to ISubscriptionManager

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-06 21:24:36 +02:00
romanett fb5d6edc62 Fix Analyzer warnings (#3143) 2025-08-06 19:14:00 +02:00
romanett 1f6ad6b531 [Server] Handle unsent requests on closed SecureChannel to be sent on new channel of the same session (#3132)
* Extend the TcpTransportListener to catch requests that failed to get sent by a TcpServerChannel because the channel was closed. The TcpTransportListener asks the ServerCallback for the new ChannelID of the Session. The Session is identitfied by the AuthenticationToken

* throw if no channel could be found

* dont send request again over the same channel
2025-07-31 20:42:33 +02:00
Marc Schier 876cf28c32 Fix subscription leaking due to not completed PublishResponseMessageWorkerAsync tasks (#3133) 2025-07-31 17:31:21 +02:00
Marc Schier 5eb9ed8918 Backporting changes in preparation of adding additional fuzz tests (in separate PR) (#3125)
- Replaced `IList<INode>` with `List<INode>` in
  `ComplexTypeSystem.cs` and `BaseComplexType.cs` for
  better type safety.
- Updated string comparison in `ReverseConnectManager.cs`
  to `StringComparison.Ordinal` for improved performance.
- Added a method to `ISession.cs`, `Session.cs`, and
  `SessionAsync.cs` to trigger reloading instance certificates.
- Minor fixes in error handling in `Subscription.cs` and using pattern matching for type checks in several locations to improve code readability.
- Made minor adjustments to comments and documentation
  for clarity and improved code quality.
- Updated `Variant` handling in preparation for immutable struct.
- Changed return types in `BaseObjectState.cs` and `BaseVariableTypeState.cs` to use `ObjectTypeIds` for iperf
- Cleaned up `ExpandedNodeId`
- Enhanced memory management  error handling and readabilityand error handling in encoders
2025-07-31 15:54:42 +02:00
opcfoundation-org b823127c61 Update for 1.5.5 release with Async Service Calls (#3116)
* Update for 1.5.5 release with Async Service Calls

* Fix Async Method Handlers.

---------

Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-07-29 14:42:24 +03:00
romanett 40b9dbb29e Implement Support for PEM Public Keys in Directory Certificate Store (#3088)
* Implement search of certificates in PEM files on net 6 in directory store

* Implement using Custom Certificate Store

* Cleanup

* Implement Support for PEM Public Keys in Directory Store

* Throw exception if test file is  not found

* Skip Tests on Mac OS & Net < 8.0

* Add delay for slow CI Agents

* Add more delay

* Make test file with explicit message

* Address review Feedback

* fix test

* Throw ex to show possible error in test

* next try

* Only throw on full load

* Manually set LastWriteTimeUtc

* make private key encrypted, use two separate tests instead of one

---------

Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
2025-07-25 12:36:38 +03:00
romanett bd6c91d6df Use Central Package Management for Nuget Packages (#3122)
* Use Central Package Management

* Add Directory.Packages.props to solution files

* remove sourcelink version from common.props

* remove old entry from signlist
2025-07-18 10:53:26 +03:00
romanett c32c55446d Remove net6 / Label Pubsub Package as Release / Update Nuget Packages (#3121)
* remove .net 6 target
remove conditional packages
remove debug flag from pubsub

* Remove net 6 from azp

* Update Nuget Packages

* Update missed pipeline

* Add net 8 App Target framework

* fix asn1 package reference

* remove more net 6 references from AZP

* move main pipeline to net 8

* install net 8 in runners

* install net 8 in CC yml pipeline
2025-07-17 07:20:20 +03:00
Suciu Mircea Adrian ac05ef679d Update to latest dependencies. (#3095)
* Update to latest dependencies.

* Revert AppTargetFrameworks to net6.0
2025-06-24 17:31:18 +03:00
opcfoundation-org dcc02f179d Update to 1.05.04 nodeset (#3091)
* Update version.json (#3050)

* Fix XML Encoding and decoding of Matrix Element in Variant to conform to spec (#3053) (#3054)

* Fix XML Encoding and decoding to conform to spec

* fix test on linux

* fix typo

* Add missing DataValue & DiagnosticInfo Array Types

Co-authored-by: romanett <romanett98@gmail.com>

* Return NodeSet to 1.05.04.

* Remove OptionalPlaceholders on instances.

* Fix duplicate pragas.

* Fix glitches in generated files.

---------

Co-authored-by: Suciu Mircea Adrian <Mircea-Adrian.Suciu@softing.com>
Co-authored-by: romanett <romanett98@gmail.com>
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-06-23 13:44:42 +03:00
romanett 23a02fc1fe Implement support for "mul" locale in LocalizedText Class & ResourceManager (#3076)
* Implement support for "mul" locale in LocalizedText Class

* Use ReadOnly Dictionary to ensure correct texts are generated

* Implement Support for client requested Mul locale and handle mul locales provieded to Resource Manager (return only requested locales)

* fix bug

* Add Tests for ResouceManager

* Add more Tests & additional constructor to LocalizedText

* return null if mul locale parsing fails instead of partial dictionary

* avoid unecessary cast

* revert to working version

* Implement perf fix for new SDKS
2025-06-05 10:24:32 +03:00
romanett a6efccb21f Allow to define a custom StringComparsion for Equals Operator (#3048)
* Add string comparison enhancements to ContentFilter.

- Introduce static `EqualsOperatorDefaultStringComparison` Property in the `ContentFilter` class for customizable string comparison.
- Update `IsEqual` method in the `Utils` class to accept an optional `StringComparison` parameter.

* Add Test

* fix default stringComparsion Operator to be Ordinal

* Remove obsolete DBNull check

* Add Comment
2025-05-27 12:14:14 +03:00
romanett 2a7de7d1d1 Make RelativePath.Parse throw SRE if NamespaceIndexes cannot be found. (#3071)
* Make RelativePath.Parse throw SRE if NamespaceIndexes cannot be found.
Add Tests to verify functionality

* Extend test coverage

* Add Test Case
2025-05-23 16:38:22 +03:00
romanett 2446ce8987 Fix XML Encoding of Null Variant to conform to spec (#3062)
* fix XML Encoding of Null Variant to conform to spec

* fix XmlEncodedValue for null variants values to be the null (same behaviour as ExtensionObject)

* Update Encoder to Produce <uax:Value xsi:nil=\"true\" /> output
2025-05-23 16:34:13 +03:00
Suciu Mircea Adrian e4c6c3b735 Update to latest nuget packages (#3069)
* Update to latest nuget packages

* Include System.Net.NetworkInformation once
2025-05-06 12:47:24 +03:00
Suciu Mircea Adrian d5fd96b7c1 Add version System.Diagnostics.DiagnosticSource to match Microsoft.Extensions.Logging.Abstractions version (#3061) 2025-04-20 14:33:59 +03:00
romanett 6a1b269887 Fix XML Encoding and decoding of Matrix Element in Variant to conform to spec (#3053)
* Fix XML Encoding and decoding to conform to spec

* fix test on linux

* fix typo

* Add missing DataValue & DiagnosticInfo Array Types
2025-04-15 16:31:28 +03:00
Suciu Mircea Adrian dbb9acba6c Allow setting the context in a temporary using scope for IEncoder instances (#3044)
* Allow setting the context in a temporary using scope for IEncoder instances

* make the setter of Current property private
2025-04-11 13:26:18 +03:00
Suciu Mircea Adrian 95d162ea76 Set default value for the ValueRank attribute of BaseVariableState and BaseVariableTypeState to ValueRanks.Any as in the specification (#3049)
* Set default value for the ValueRank attribute of BaseVariableState and BaseVariableTypeState to ValueRanks.Any as in the spec

* Removed unnecessary project reference
2025-04-10 16:59:40 +03:00
romanett 66ba504751 Make UserIdentityToken internally use byte Array instead of string for storing unencrypted password. (#3035)
* Make UserIdentity Token internally use byte Array instead of password.

* Add missing null check

* fix uninitialized array

* use Encoding.UTF8 instead of new Utf8Encoding()

* zero out array before setting the password
2025-04-03 16:20:31 +03:00
romanett 7f037ef23e Enforce Valid Certificate Store configuration (#3023)
* fix Null Reference Exceptions on nonconfigured certificate stores

* try to fix gds tests

* Use explicit null check

* Validate Certificate Store configuration on startup in SecurityConfiguration.Validate.
Remove Obsolete CertificateStore Properties.

* remove unecessary fields

* fix tests

* fix client config

* Validate Stores by opening them

* fix typo

* check stores instead of storepath

* fix ClientTest

* Add Tests for Validate Mehtod of SecurityConfiguration

* Update ApplicationConfiguration xsd to respect stricter validation
2025-03-28 16:07:48 +02:00
romanett 2f0770c569 [Server] Restore durable subscriptions on Server Restart (#3025)
* Enable Durable Subscriptions (#9)

* [Server] Durable Subscriptions (#2683)

* Implement a system test for DurableSubscriptions (#2839)
* Client Side
Co-authored-by: ALTERNATE-DEV\Archie <archie@dreamsandadventures.ca>

* make a static Method CalculateRevisedQueueSize

* Adress review feedback

* fix FilterRetainTests

* Add MonitoredItem Id to Queues
Use NodeIdDictionary where possible

* first proto

* fix reference server

* implement store

* initialize early

* fix issues

* Move to Reference Server & start implementing queue restore

* Persist queues

* Register queues in factory after restore

* Add Docs

* minor fixes

* Test Subscription Restore & Transfer

* fix Durable Subscription Test Browse

* Fix conversion of extension objects

* use CustomConverter for NumericRange

* Adress review Feedback

* Documentation improvements

* Update Readme

* update sampling group manager to work without session

* remove launch settings
2025-03-24 11:45:09 +02:00
opcfoundation-org fe0aec4969 1.05.04 final release fixes (#2893)
* Add missing constants for JSON encoding.

* Update generated files to 1.05.04.

* Update NuGets

* Fix compile errors due to abstract types.

* Update nodesets.

* Update JSON Encoder/Decoder.

* Update with JSON encoder.

* Change prefix char.

* Change prefix to uppercase.

* Fix JsonEncoder

* Fix null pointer.

* Update encoders to suppress artifacts.

* JSON encoding fixes.

* Fix JSON RawEncoding

* Update JSON encoders.

* Revert changes for Matrix in Variant.

* Update NodeSet.

* Resolve name conflict with new Opc.Ua types.

* Fix failing Tests

* Fix unit tests after change to Verbose/Compact encoding.

* Add final 1.05.04 generated classes and unit test fixes.

* Fix more unit tests.

* Update NodeSet to released version.

* Remove unintended changes to UANodeSet.xsd

* Update Schema/UANodeSet.xsd

* Merge breaking changes to JsonEncoder.cs from develop/main374

* Allow JObject in ExtensionObjects.

* fix version json

* Update generated files to UA-1.05.04-2025-01-08

* Some cleanup of the new APIs and Union implementation. (#2927)

* Some cleanup of the new APIs and Union implementation.

* fix build

* Handle status code Uncertain according to the specification (#2898)

* #2896: Write output arguments for good and uncertain status code

When a method state's call method is invoked the output arguments should be written in case the status code is good or uncertain. This behavior would be conform with the current specification.

* #2896: The service result corresponds the method call result

The result of the Call method in the CustomNodeManager2 class represents the status of the CallMethodResult. It does not correspond to the ServiceResult of the CallResponse, thus returning Good as a general response is incorrect behavior.

* Add SetHiResClockDisabled  & fix Rejected Store Creation in ApplicationConfigurationBuilder (#2909)

Add the method SetHiResClockDisabled to IApplicationConfigurationBuilder
Fix the type of RejectedStore Created by the Builder to: CertificateStoreIdentifier

* revert based on feedback

* move some logic from class code to encoder/decoder

* Fix race condition on Nuget build (#2930)

- nodeset xmlzip is created in obj folders if multiple targets are built in parallel

* update common comments

* Update NodeSet files.

* Fix ReadSwitchField Implementation.

* Make UserIdentity.DisplayName writeable.

* Fix merge failures.

* Fix XmlElement encoding and bad NamespaceIndex fallback logic.

* Fix 2D array raw encoding.

* Add support for DesignToolOnly.

---------

Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
Co-authored-by: Martin Regen <mregen@microsoft.com>
Co-authored-by: Martin Regen <7962757+mregen@users.noreply.github.com>
2025-03-07 15:25:33 +02:00
romanett ef9387b525 Enable Durable Subscriptions (#2978)
* Enable Durable Subscriptions (#9)

* [Server] Durable Subscriptions (#2683)

* Implement a system test for DurableSubscriptions (#2839)
* Client Side
Co-authored-by: ALTERNATE-DEV\Archie <archie@dreamsandadventures.ca>

* make a static Method CalculateRevisedQueueSize

* Adress review feedback

* fix FilterRetainTests

* Add MonitoredItem Id to Queues
Use NodeIdDictionary where possible
2025-02-28 13:46:49 +02:00
Suciu Mircea Adrian 28d2227fc4 Revert "Enable Nullability for important Certificate Handling classes (#2989)" (#3007)
This reverts commit 23d167abb7.
2025-02-20 10:24:51 +02:00
Martin Regen c75c8a0153 By default set NoDelay and Lingerstate to 5 sec (#3000)
Set NoDelay=true to disable the Nagle algorithm and set Lingerstate to 5 seconds by default.

After careful evaluation of the PR provided by @sxleixer in #2882 we found that the default setting of the socket with NoDelay=false can not only cause issues on the client side, but also on the server side.

Due to the nature of Nagle's implementation the issue only occurs when many small service requests or responses are sent over the network. In that case, when packets are still in flight, the secondary small packets are delayed and combined until the MTU is exceeded or the previous packages are acknoledged.

The expectation in the UA protocol is to not add additional latency in the client-server communication.

As a conclusion defaulting to NoDelay=true appears to be the better default option which works for all use cases.
If there are new bandwidth issues related to more and larger packets imposed by this change, they should be solved at the UA application level by combining service requests of the same type.

Setting Lingerstate to 5 seconds should help to finish communications when sockets are closed.

Co-authored-by: @sxleixer <mail@ralfschleicher.de>
2025-02-18 05:20:57 +01:00
Archie Miller 37cebe33be [Server] Add support for SupportsFilteredRetain (#2913)
* Work In Progress

* Working Implementation of SupportsFilteredRetain

* Potential solution

Contains test debug messages that should be cleaned up

* Update comments showing discussion required

* Address Comments

* Use the NodeId from the ConditionState for the ConditionId.

Existing case was not guaranteed to be correct.
2025-02-17 13:42:24 +02:00
romanett 23d167abb7 Enable Nullability for important Certificate Handling classes (#2989)
* enable nrts for CertificatIdentifier&CertificateStoreIdentifier&CertificateTrustList

* make RSA Utils and  Certificate Stores nullable

* Make Certificate validator nullable

* fix nullability of CertificateTypeParameter
2025-02-13 16:53:06 +02:00
Martin Regen cbf789d41e Fix a case where NodeId.Null is modified (#2995)
* Add tests to catch if NodeId.Null is modified in DEBUG, fix an issue where NodeId.Null was overwritten

* add (C)

* only enable immutable NodeId to catch issues

* typos and comments
2025-02-13 10:54:41 +02:00
romanett 703b52da13 Make FiniteStateMachine DoTransition virtual (#2988)
* Add Lock to finiteStateMachineDoTransition

* assign lock

* Revert "assign lock"

This reverts commit f8d2b9392c.

* Revert "Add Lock to finiteStateMachineDoTransition"

This reverts commit 2449006ac1.

* make DoTransitionVirtual

* make CauseProcessingCompleted virtual
2025-02-12 10:44:54 +02:00
Suciu Mircea Adrian d540baf10f Remove oldest channel if not used by session, when number of channels reaches MaxChannelCount - 1 (#2986)
* Remove older channel if not used by session, when number of channels reaches MaxChannelCount - 1

* Corrected channelCount and renamings

* Operate on snapshot

* Snapshot the entire concurentdictionary
2025-02-11 17:13:26 +02:00
romanett 8e408dba3e fix Token renewal (#2990) 2025-02-11 17:05:08 +02:00
romanett 7cbeee7155 [Test] Add ECC Certificates to various tests (#2961)
* Generate ECC Certificates in Client Tests

* Add more tests

* reenable check of certificate

* fix tests

* Dont use random in test

* fix unsupported certificate types

* fix Hash algorithm for nistP384 curve on linux as the friendly name is ECDSA_P384 instead of nistP384

* use friendly name by default and add special case only for linux while taking care of nullability

* disable special casing for finding correct certificates

* fix tests on net 462

* update Certificate Identifier
2025-02-11 14:20:21 +02:00
Suciu Mircea Adrian 14d78caf21 Set default value for NonceLength to 32 (#2970) 2025-01-28 16:41:08 +02:00
Suciu Mircea Adrian 7c0e806736 Set initial value of LastActiveTickCount (#2953) 2025-01-23 15:25:17 +02:00
mrsuciu f4c852a61d Merged develop/main374 into master 2025-01-22 15:31:50 +02:00