Server OPC UA events: provide a way to define an Event instance NodeId
Description
In some use cases, the possibility for the Event to provide its NodeId is necessary.
In particular this is used in the context of the OPC UA Specification Part 9 ConditionId to have access to the event/node NodeId using subscription EventFilter mechanism. The request to obtain this NodeId is described and use a SimpleAttributeOperand with an empty browsePath and the NodeId as attributeId.
Note that it should be accessible both in cases the event is a node in address space or not, as stated by Part 9 extract:
Each Condition instance has a ConditionId as an identifier which uniquely identifies it within the Server. A Condition instance may be an Object that appears in the Server Address Space. If this is the case the ConditionId shall be the NodeId for the Object.
Code version identification
commit 9b828abd
Current behavior
Current implementation of events in server does not provide a way to define an event NodeId that will be returned using EventFilter described above. Thus in case of such request it will return a BadAttributeIdInvalid as a result.
Expected behavior
Server API should provide a way to define an event NodeId that will be returned using EventFilter described above. Thus in case of such request it will return a NodeId result.
Security impact
N.A.
Implementation
Add server API SOPC_Event_SetNodeId in sopc_event.h to define an Event instance NodeId and consider it as a base event property that could be set.
Internally, the empty browse path is reserved to store a variable that contains the event instance NodeId and a conversion is automatically done from empty browse path and the constant placeholder path "OwnNodeId" (not visible).
Due to the exceptional treatment necessary to introduce this notion required by OPC UA specification part 9, some specific behavior is introduced:
- The "OwnNodeId" value is always returned if the dedicated EventFilter request is provided, if not set the "NULL" NodeId is returned (ns=0;i=0).
-
SOPC_Event_ForEachVar_Fctis not called for this specific "OwnNodeId" value as it empty browse path does not refer to a valid Value without the NodeId attribute parameter (all other browse paths are for Value attribute) Note that even if SimpleAttributeOperand evokes a possible empty browsePath to refer to the instance of the typeDefinitionId it does not clearly apply to events in part 4.