1029 Commits

Author SHA1 Message Date
Martin Regen 3b233c6f55 Bug fixes in ref server and more tests cases (#1590)
- fix the complex types of the test nodeset (requires https://github.com/OPCFoundation/UA-ModelCompiler/pull/96)
- improve some client / server tests
- add tests for complex types datatype definition integrity on ref server, validate bsd and xml dictionaries in the test server (open issue:  https://mantis.opcfoundation.org/view.php?id=7393, xml validation always failing)
- improve server fixture, to allow for custom config changes 
- fix an issue that caused kestrel not start on windows/.NET Core 3.1 and above, when a new certificate was issued, thereby ignoring all https client tests.
2021-11-11 06:39:23 +01:00
Martin Regen 860c9686c9 fix uncontrolled format string and clear text storage of sensitive information (#1591)
- fix uncontrolled format string and clear text storage of sensitive information issues flagged by CodeQL
2021-11-10 13:06:59 +01:00
Martin Regen e61594eff5 CI support for .NET 6.0 builds, tests and Nuget (#1580)
- Add pipeline steps with VS2022 hosted images and .NET 6 install on linux/mac
- Nuget build with net6.0 binaries
Co-authored-by: mrsuciu <Mircea-Adrian.Suciu@softing.com>
2021-11-09 07:56:45 +01:00
Suciu Mircea Adrian 372449b222 Definition is enumeration if at least a field is not default value -1, since there is a very small probability for an enumeration to contain one field only (#1579) 2021-11-08 07:57:04 +02:00
Alin Moldovean ea3444b9c4 Performance update - Add IEquatable interface for DataValue (#1577)
* Add IEquatable interface for DataValue, StatusCode and NumericRange types

- Performance update

Implement strongly typed Equals() method and IEquatable for DataValue, StatusCode and NumericRange types so no boxing is required.
This brings a performance improvement for servers with high number of dynamic nodes and monitored items created where the compare method of DataValue is called intensively (100k -200k/sec)
2021-11-05 11:03:17 +01:00
Martin Regen 7acddc0923 Fix binary export of surplus typedefinition (#1576)
- HasTypeDefinition and TypeDefinitionId should only exist for Object/Variable in .uanodes
- fix binary export for .uanodes
- #1574 missed the binary output case, only fixed xml export
- fixes #1532 
- fixes https://github.com/OPCFoundation/UA-ModelCompiler/issues/94
- fix the default and sample models in this repo

note --> ModelCompiler needs to use the updated core lib to produce the same output
2021-11-04 08:37:22 +01:00
Suciu Mircea Adrian f090f618aa Added null check to structureType.DefaultEncodingId (#1571)
Added null check to structureType.DefaultEncodingId in the ReadNonValueAttribute method
2021-11-02 13:02:18 +01:00
opcfoundation-org 0915063175 on node export only output TypeId for vars/objects (#1574)
only output the DataTypeDefinitionId and ReferenceTypeId vor var/objects
fixes nodeset output of #1532 
fixes OPCFoundation/UA-ModelCompiler#94
2021-11-02 13:00:53 +01:00
Martin Regen 49b7f93302 Fix VS2022 build (#1566)
- add build targets for net6.0
- fix new warnings in VS2022 compiler
2021-11-02 08:03:44 +01:00
Martin Regen 96eb6c8a27 fix subcode mask (#1563) 2021-11-01 16:26:45 +02:00
dependabot[bot] e72417eb92 Bump System.Text.Encodings.Web from 4.5.1 to 5.0.1 (#1569)
Bumps [System.Text.Encodings.Web](https://github.com/dotnet/runtime) from 4.5.1 to 5.0.1.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/commits/v5.0.1)

---
updated-dependencies:
- dependency-name: System.Text.Encodings.Web
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 15:40:57 +02:00
dependabot[bot] 1e5c63b7d6 Bump System.Io.Pipelines from 4.5.4 to 5.0.1 (#1570)
Bumps [System.Io.Pipelines](https://github.com/dotnet/runtime) from 4.5.4 to 5.0.1.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/commits/v5.0.1)

---
updated-dependencies:
- dependency-name: System.Io.Pipelines
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 13:37:21 +02:00
Martin Regen 53ec78f1bc IOP workshop 2021 fixes and build improvements (#1562)
-fixes for complex types:
  - a structure which contains an enum from namespace 0 can not be created. fixes #1561.
  - a structure with multidimensional array may lead to a endless loop in `ComplexTypeSystem.Load`
  - a malformed namespace Uri which contains a space character prevents creation of type system.
  - select endpoint doesn't pick the right scheme if the default endpoint must be picked
-prep for net472 or greater and net5.0 or greater build, only build #ifdef
2021-10-29 16:21:43 +02:00
bdovaz c53807a201 Remove unnecessary Nuget dependencies in Opc.Ua.Core (#1551) 2021-10-22 11:45:46 +02:00
Martin Regen 14e7c67a5c Add sample node managers to ref server (#1535)
- add boiler, data and memory buffer sample node managers to reference server
- exclude Quickstarts.Servers from code coverage
2021-10-15 21:12:04 +02:00
Suciu Mircea Adrian beede4728f Switched to LTS Kestrel version 2.1.3 (#1538)
* Switched to LTS Kestrel version 2.1.3
* bump up / fix other nuget dependencies
2021-10-10 07:38:49 +02:00
Randy Armstrong bdde7636c4 Ua 1.04.10 2021 09 15 (#1529)
Final merge with the ModelCompiler codebase.
2021-10-01 10:31:24 +02:00
Martin Regen 27f5757995 UA Nodeset output should omit ArrayDimension with size 0 (#1528)
- Modelcompiler output contained unnecessary ArrayDimension fields which can be omitted
Co-authored-by: randy-armstrong
2021-09-30 19:30:48 +02:00
Martin Regen e5baad9c2c Application config improvements for cert recreation (#1525)
- do not silent recreate a certificate if a matching cert subject is available, enforce manual deletion or replacement
- allow the application cert to be used when expired or not yet valid
- warn in trace if an app cert is loaded without loading the private key 
fixes #1162 , fixes #1102
2021-09-28 13:53:28 +02:00
Suciu Mircea Adrian 75744e27dd Support Metadata frames in PubSub (#1518)
Refactored WriterGroupPublishState out of IPubSubConnection file
    JSON Discovery messages for DataSetMetaData
    UADP Discovery messages for DataSetMetaData (Request + response)
    Refactored the UaPublisher, extracted IntervalRunner and reused it in UdpDiscoveryPublisher & UdpDiscoverySubscriber
    Proposal: automatic setting of ConfigurationVersion based on the rules in 6.2.2.1.5 (part 14)in new class Opc.Ua.PubSub.Configuration.ConfigurationVersionUtils
    New events added to UaPubSubApplication
    Implemented support for UADP Data Key Frame DataSetMessages

    Unit tests were updated to cover the new functionality
2021-09-28 11:54:37 +03:00
Martin Regen 33ae8bbec5 Set DefaultEncodingId in DataTypeDefinition, was always null NodeId (#1523)
- DefaultEncodingId is always set to binary encoding id. Helper added to StructureDefinition for other use cases (e.g. PubSub)
- the default encoding id is derived for the encodeable factory, since the typetree does not contain sufficent information to find the proper binary encoding id
- add a few helper functions in core for an upcoming PR that was used for testing with custom types, will simplify to add more nodemanagers to servers with custom types
2021-09-24 16:25:21 +02:00
Cristian Pogacean 7d310d57bd Fix NodeSet import/export of ArrayDimensions in StructureField #1115 (#1517)
Fix NodeSet import/export of ArrayDimensions in StructureField #1115
2021-09-20 14:36:38 +02:00
Suciu Mircea Adrian 33cbddb49b Enable the coexistence of a Server and Client sessions in the same process, which consume custom data types. (#1514)
Called ServerBase::CreateMessageContext(true) to use a clone of EncodeableFactory.GlobalFactory
2021-09-20 11:56:14 +03:00
Cristian Pogacean 5048189195 fix bug - nodeset2 export of namespace index #689 (#1510)
* fix bug - nodeset2 export of namespace index #689

* the actual fix for #689
2021-09-16 22:30:29 +03:00
Martin Regen 2b54136969 Add missing vars in session less message (#1505)
**Type of Issue**
[X] Bug [ ] Enhancement [ ] Compliance [ ] Question [ ] Help wanted

The `SessionLessServiceMessage` misses the urisVersion field and localeIds

https://reference.opcfoundation.org/v104/Core/docs/Part4/6.3.2/

The urisVersion field is a VersionTime.
The urisVersion was misspelled in the Nodeset as an array. Nodeset was fixed in errata 1.04.8
2021-09-13 15:53:20 +02:00
Martin Regen 76afe829b4 Add async versions of subscription API to session client (#1498)
fixes #919 and #921

- enable async client stubs in core
- add async versions for subscription management
- APM versions will not be included...

based on PR #919 from @mibos-kremer

Co-authored-by: Michiel <m.bos@kremer.nl>
2021-09-07 16:23:00 +02:00
opcfoundation-org 9b89bd070f Modelcompiler 1.04.10 (#1492)
* Changes needed for model compiler needed for Errata 1.04.10. 
* Errata 1.04.10.
2021-09-03 19:38:31 +02:00
Martin Regen 4a2f13efaf Improve https clien/server support (#1490)
- add support for security header in client/server libs
fixes #1118
2021-08-20 16:07:10 +02:00
Suciu Mircea Adrian 198cec64bf Enhance GetBuiltintype to support simple datatypes (#1488)
* Return the correct BuiltInType for Simple numeric type ids in nanespace 0

* Added unit test BuiltInTypeOfSimpleDataTypes
2021-08-19 16:36:18 +03:00
Dmitry Tikhonov c37f66cfeb Fix the behavior in case of the server is reachable only via an alternate address (#1480)
Fix the behavior in case of the server is reachable only via an alternate address - this alternate address matching the address, the client provides, is added to the list of accessible addresses so that the TranslateApplicationDescription method works correctly and the client gets back appropriate endpoints with the corresponding alternate address within them (#1480)
2021-08-19 08:10:01 +02:00
Martin Regen 73e0e59f98 macOS mono build fix, Https tests, bench improvements (#1486)
- on VS2019 for mac the https lib doesn't build, now get the properties at runtime to set server validation callback
- add client tests for https
- fix an issue with SslProtocol selection, where tools recommend None it only works on all platform combinations if Tls12 is used
- use the benchmark .NET command line parser 
- benchmarks for StreamWriter buffer size
- StreamWriter default buffer size reduced to 1k, according to bench results best compromise
fixes #1443
2021-08-18 11:01:04 +02:00
Suciu Mircea Adrian 98634b1cc7 Fixes issue #1462 (#1465)
* Added default switch case for the CreateStore method; reported in issue #1462
2021-07-23 13:41:05 +03:00
Martin Regen c435e5844d Improve JsonDecoder StreamWriter dispose (#1448)
- only dispose StreamWriter if owned by JsonEncoder
- only dispose if dispose is called
- on external stream writer, return text by using reflection on basestream, if memorystream is used
- improve benchmark common code
- fixes #1444
2021-07-09 07:44:54 +02:00
Martin Regen 0236d082b1 Create client and server test projects, increase test coverage (#1434)
- Add Operation limit parameter and fix server. Fixes #1363 
- Add client/server test projects
- Add client and server fixture for test runs
- Server tests can test services without client connection
- Client tests can use common services to write tests which can run directly on server on via client server connection
- Increase code coverage > 50%
- Code coverage excludes the generated code
- Improve codecoverage local tests with report (see Tests/codecoverage scripts)
- Add a benchmark framework to client server tests
2021-07-06 18:01:54 +02:00
Martin Regen 96ecb4dd9c Add a no file fluent API for application configuration. (#1422)
* Add no file configuration fluent API
* ensure secure settings are produced by default
* most if not all settings can be reached by .Set/.Add functions
* switched gds tests to use no file config (also good as starter)
2021-06-15 19:14:09 +02:00
Martin Regen 24f90c410a Add interfaces IServiceMessageContext, IEncodeableFactory (#1407)
* use IServiceMessageContext instead of ServiceMessageContext across the board.
* same for IEncodeableFactory
2021-06-11 16:35:46 +02:00
Martin Regen 9923141e70 Enable .NET analyzers for all projects (#1414)
* Enable .NET analyzers for all projects
* fix all new warnings, mostly security and perf
2021-06-05 07:58:38 +02:00
Alin Moldovean 8406716bf9 Fixes #1302. Use value from OnReadUserAccessLevel at Read/WriteNonValueAttribute if handler exists. (#1413) 2021-05-31 09:15:41 +03:00
Alin Moldovean 923597eac2 improve encode/decode for array/matrix of Iencodeable (#1398)
Add tests for encode/decode of array/matrix of all IEncodeable
2021-05-12 15:10:11 +03:00
Alin Moldovean a5e1f4c8cd PubSub fixes (#1394) 2021-05-12 13:33:29 +03:00
Nyphus 244b26e22f Port thread scheduler and servicehost from UA .NET legacy. (#1389)
* Add minThreadCount and maxThreadCount setting for ThreadPool
* Port thread based scheduler back from UA.NET legacy. 
* The UA Expert perf test shows better response times than Task.Run implementation. 
* Old implementation to compare against is ifdefed,
* Port servicehost from UA.NET legacy
* a few minor backports in serverbase e.g. alias names for hostname
* fix editorconfig, as it caused false positives in ref server

Co-Authored-By: macheronte <79026457+macheronte@users.noreply.github.com>
2021-05-04 15:39:17 +02:00
Martin Regen 7e736d22fc Improve auto accept in cert validation handler, add tests (#1386)
- if a cert validator is enabled, use it and ignore auto accept flag.
- trace auto accept message, if used
- make all config flags public, otherwise they can only be configured using a SecurityConfiguration. Once a config flag is set using a property, it is protected from modification by a SecurityConfiguration. This way apps can consistently override.
- add tests for the SHA1 and AutoAccept configuration flags
- add a method to reset the validated list of certificates. The list of certs should be revalidated from time to time to catch expired or revoked certificates. Applications can call `ResetValidatedCertificates` to clear the list with a daily timer.
2021-04-30 10:27:02 +02:00
Martin Regen 631e729787 Fix warnings, improve complex type exception handler (#1384)
- catch exception in complex type system not only for ServiceResultException
- add fast path for single type loader if type already exists
- fix many warnings, no function change
- fix template for legacy nuget packages to include cert lib
2021-04-28 18:34:43 +02:00
Sebastian Baeumler e8df315193 ComplexTypes Improvements (#1383)
- Fixed typo in StructureDefinitionAttribute
- Adapt using of fixed StructureDefinitionAttribute
- Resolve method internal name conflict
- Enable TypeInfo.GetSystemType to support ExpandedNodeId
- Redirect request with absolute NodeIds an directly use the EncodableFactory.GetSystemType method
2021-04-28 15:08:14 +02:00
Alin Moldovean 7a4a22201b MQTT support in PubSub library (#1376)
Implementation of MQTT support in PubSub library
2021-04-28 15:31:06 +03:00
Alin Moldovean f0c467410e Implement AutoAcceptUntrustedCertificates flag for Client side also. Fixes #1228 (#1380) 2021-04-26 17:00:23 +03:00
Martin Regen e34eb9b512 Fix Perf warnings (#1372)
- use Array.Empty
- improve StringBuilder, Where
- use .Equals instead Compare
- use ConfigureAwait
2021-04-21 09:28:25 +02:00
Alin Moldovean 087415be1b Complex data types fix for passing TypeId to IComplexTypeInstance (#1371) 2021-04-20 18:44:58 +03:00
Martin Regen 77a3da8ecd Prohibit Xml Dtd processing (#1370)
- enable CA3075 as warning (on windows)
- Dtd processing is by default not prohibited, only limited to 10000000 chars.
- ensure to only use safe defaults for all xml processing
2021-04-20 10:45:50 +02:00
Martin Regen c996e7933d Add ifdef to support Net5.0 build with ECC support (#1367)
- for dev only ifdefs,  but not added to target props
2021-04-19 10:42:26 +02:00