ANSI C Based OPC UA Client/Server SDK
OpcUa_ExtensionObject Struct Reference

A container for any structured DataTypes which cannot be represented as one of the other built-in data types. More...

#include <opcua_builtintypes.h>

Data Fields

OpcUa_ExpandedNodeId TypeId
 The identifier for the DataTypeEncoding node in the Server's AddressSpace.
OpcUa_ExtensionObjectEncoding Encoding
 The encoding used for the body.
 The body of a OpcUa_ExtensionObject as in Encoding. More...
OpcUa_Int32 BodySize
 The length of the encoded body in bytes (updated automatically when GetSize is called).

Detailed Description

A container for any structured DataTypes which cannot be represented as one of the other built-in data types.

The ExtensionObject contains a complex value serialized as a sequence of bytes, as an XML element or not encoded as an Encodeable. It also contains an identifier which indicates what data it contains and how it is encoded.

Structured DataTypes are represented in a Server address space as subtypes of the Structure DataType. The DataEncodings available for any given structured DataTypes are represented as a DataTypeEncoding object in the Server address space. The NodeId for the DataTypeEncoding Object is the identifier stored in the ExtensionObject. Part 3 of the OPC UA Specification describes how DataTypeEncoding Nodes are related to other Nodes of the address space. Server implementers should use namespace qualified numeric NodeIds for any DataTypeEncoding objects they define. This will minimize the overhead introduced by packing structured DataType values into an ExtensionObject.

ExtensionObjects and Variants allow unlimited nesting which could result in stack overflow errors even if the message size is less than the maximum allowed. Decoders shall support at least 100 nesting levels. Decoders shall report an error if the number of nesting levels exceeds what it supports.

An ExtensionObject is encoded as sequence of bytes prefixed by the NodeId of its DataTypeEncoding and the number of bytes encoded.

An ExtensionObject may be encoded by the Application which means it is passed as a ByteString or an XmlElement to the encoder. In this case, the encoder will be able to write the number of bytes in the object before it encodes the bytes. However, an ExtensionObject may know how to encode/decode itself which means the encoder shall calculate the number of bytes before it encodes the object or it shall be able to seek backwards in the stream and update the length after encoding the body.

When a decoder encounters an ExtensionObject it shall check if it recognizes the DataTypeEncoding identifier. If it does then it can call the appropriate function to decode the object body. If the decoder does not recognize the type it shall use the Encoding to determine if the body is a ByteString or an XmlElement and then decode the object body or treat it as opaque data and skip over it.

The documentation for this struct was generated from the following file: