High Performance OPC UA Server SDK  1.4.2.279
SDK Migration Guide

This section contains instructions for migrating existing applications to a new SDK release.

Migration from 1.3.x to 1.4.0

The 1.4.0 required to introduce some breaking changes that can be easily fixed by following this instructions.

AppConfig Changes

Applications that use hardcoded appconfig structures need to change the following settings. If you are using configuration files skip this section and read the next section about settings files.

Certificate Configuration

To make client security configuration possible independent from server endpoints the certificate configuration has been moved from the server's endpoint settings into the separate certificate_config structure. Both client and server configuration refer to this certificate configuration by using a certificate index.

To fix this, move existing certificate configurations from g_appconfig.endpoint to g_appconfig.certificates.

Certificate Key Usage

Certificate entries now have a new field key_usage which allow to set either server_auth, client_auth, or client_and_server_auth.

You need to add this new field to each configured certificate.

Maximum Queue Size for Event Monitored Items

Monitored items which are monitoring objects for alarms & conditions typically use a much larger queue size then for monitoring data. For this reason a separate configuration option was necessary to allow a different maximum queue size for event monitoring items.

To fix this add the new setting g_appconfig.subscription.max_monitoreditem_event_queue_size.

Method Calltable Size

A new mechanism for registering method callbacks was introduced, which allows a better way of finding method callbacks, based on ObjectId and MethodId combinations. This mechanism allows to register methods simply on ObjectTypes and when calling methods on instances of this type, the according method is still found by following the MethodDelarationId. Still it is possible to override the method callbacks for certain instances if necessary. Inheritance is also supported by this new mechanism.

The method registration table requires the new setting g_appconfig.server.num_methods, which is the maximum number of callbacks that can be registered using uaserver_call_table_register.

See Lesson 3: Creating Methods for more information on registering methods at the method call table.

Settings File Changes

Applications that load the configuration from a settings file need to update their configurations files.

Certificate Configuration

To make client security configuration possible independent from server endpoints the certificate configuration has been moved from the server's endpoint settings into the separate [certificates] section. Both client and server configuration refer to this certificate configuration by using a certificate index.

To fix this, move existing certificate entries from the [endpoint] section to a new [certificates] section.

Certificate Key Usage

Certificate entries now have a new field key_usage which allow to set either server_auth, client_auth, or client_and_server_auth. If this field is missing it will default to client_and_server_auth.

Example:

[certificates]
certificates/size = 1
certificates/0/store = 0
certificates/0/certificate = store://
certificates/0/key = store://
certificates/0/create = true
certificates/0/days_valid = 365
certificates/0/algorithm = sha256
certificates/0/key_length = 4096
certificates/0/key_usage = "server_auth"
certificates/0/issuer_index = 0

Maximum Queue Size for Event Monitored Items

Monitored items which are monitoring objects for alarms & conditions typically use a much larger queue size then for monitoring data. For this reason a separate configuration option was necessary to allow a different maximum queue size for event monitoring items.

To fix this add the new setting max_monitoreditem_event_queue_size to the [subscription] section.

Example:

[subscription]
...
# Maximum queue size of events for one monitoreditem
max_monitoreditem_event_queue_size = 50
...

Method Calltable Size

A new mechanism for registering method callbacks was introduced, which allows a better way of finding method callbacks, based on ObjectId and MethodId combinations. This mechanism allows to register methods simply on ObjectTypes and when calling methods on instances of this type, the according method is still found by following the MethodDelarationId. Still it is possible to override the method callbacks for certain instances if necessary. Inheritance is also supported by this new mechanism.

The method registration table requires the new setting g_appconfig.server.num_methods, which is the maximum number of callbacks that can be registered using uaserver_call_table_register.

To fix this add the new setting num_methods to the [server] section.

Example:

[server]
...
# Maximum number of methods that can be registerd at the call table */
num_methods = 20
...

See Lesson 3: Creating Methods for more information on registering methods at the method call table.

New SetMonitoringMode Callback

This is only relevant when you have implemented your own data sampling at provider interface level and don't use the default provider implementation.

The provider interface contained three callbacks for managing monitored items, that should be sampled at the underlying data source: add_item, remove_item, and modify_item. A new callback set_item_mode must now be implemented, which allows to disable sampling without removing the items. This callback is called when a UA client changes the ua_monitoringmode.

If you override the default implementation of the three existing callbacks, you now also need to implement the new set_item_mode callback. The SDK will detect inconsistent configurations and will stop the server to avoid crashes.

Users of the default provider implementation don't need any changes, as the default provider implementation has been updated accordingly.

New Default Groups

The example groups configuration file, that is used by our example servers has been updated and now contains new default groups as defined in the OPC specification.

  • Observer
  • Operator
  • Engineer
  • Supervisor
  • ConfigureAdmin
  • SecurityAdmin

When building the server with UASERVER_SUPPORT_DIAGNOSTICS=ON, which will enable server diagnostic via the OPC UA information model, the security relevant nodes will get assigned to the SecurityAdmin group. This means only users of this group will be able to read this information.

You need to ensure that this group exists in your groups configuration as well, if using user authorization. The group is found by its name so this works also with custom authorization backends as long as this group does exist.