Message mappings specify a specific structure and encoding for NetworkMessages. Such a structure represents the payload for transport protocol mappings like UDP, MQTT or AMQP.

Different mappings are defined for different use cases.

The UADP message mapping uses optimized UA Binary encoding and provides message security for OPC UA PubSub. The available protocol mappings are defined in 7.3.

The UADP message mapping defines different optional header fields, variations of field settings and different message types and data encodings.

A Publishershall support all variations it allows through configuration. The required set of features is defined through profiles in OPC 10000-7.

A Subscribershall be able to process all possible NetworkMessagesand shall be able to skip information the Subscriberis not interested in. The Subscribermay not support all security policies. The capabilities related to processing different DataSetencodings is defined in OPC 10000-7.

The UADP NetworkMessageheader and other parts of the NetworkMessage are shown in Figure 27.

When using security, the payload and the Paddingfield are encrypted and after that, the whole NetworkMessageis signed if signing and encryption is active. The NetworkMessageshall be signed without being encrypted if only the signing is active.

image030.png

Figure 27– UADP NetworkMessage

The encoding of the UADP NetworkMessageis specified in Table 73.

The NetworkMessageContentMasksetting of the Publishercontrols the flags in the fields UADPFlagsand ExtendedFlags1. The SecurityModesetting of the Publishercontrols the security enabled flag of the ExtendedFlags1. The setting of the flags shall not change until the configuration of the Publisheris changed.

Table 73– UADP NetworkMessage

Name

Type

Description

UADPVersion

Bit[0-3]

Bit range 0-3: Version of the UADP NetworkMessage.

The UADPVersionfor this specification version is 1.

UADPFlags

Bit[4-7]

Bit 4: PublisherIdenabled

If the PublisherId is enabled, the type of PublisherId is indicated in the ExtendedFlags1 field.

Bit 5: GroupHeaderenabled

Bit 6: PayloadHeaderenabled

Bit 7: ExtendedFlags1 enabledThe bit shall be false, if ExtendedFlags1 is 0.

ExtendedFlags1

Byte

The ExtendedFlags1shall be omitted if bit 7 of the UADPFlagsis false.

If the field is omitted, the Subscribershall handle the related bits as false.

Bit range 0-2: PublisherIdType

000 The PublisherIdis of DataType Byte This is the default value if ExtendedFlags1is omitted

001 The PublisherIdis of DataType UInt16

010 The PublisherIdis of DataType UInt32

011 The PublisherIdis of DataType UInt64

100 The PublisherIdis of DataType String

101 Reserved

11x Reserved

111 Reserved

Bit 3: DataSetClassIdenabled

Bit 4: Security enabled

If the SecurityModeis SIGN_1 or SIGNANDENCRYPT_2, this flag is set, message security is enabled and the SecurityHeaderis contained in the NetworkMessage header.

If this flag is not set, the SecurityHeaderis omitted.

Bit 5: Timestampenabled

Bit 6: PicoSeconds enabled

Bit 7: ExtendedFlags2 enabled

The bit shall be false, if ExtendedFlags2 is 0.

ExtendedFlags2

Byte

The ExtendedFlags2shall be omitted if bit 7 of the ExtendedFlags1is false.

If the field is omitted, the Subscribershall handle the related bits as false.

Bit 0: Chunk message defined in in 7.2.2.2.4.

Bit 1: PromotedFieldsenabled

Promoted fields can only be sent if the NetworkMessagecontains only one DataSetMessage.

Bit range 2-4: UADP NetworkMessagetype

000 NetworkMessagewith DataSetMessagepayload defined in 7.2.2.2.4. If the ExtendedFlags2field is not provided, this is the default NetworkMessagetype.

001 NetworkMessagewith discovery request payload defined in 7.2.2.3.4.

010 NetworkMessagewith discovery response payload defined in 7.2.2.4.2.

011 Reserved

1xxReserved

Bit 5: Reserved

Bit 6: Reserved

Bit 7: Reserved for further extended flag fields

PublisherId

Byte[*]

The PublisherIdshall be omitted if bit 4 of the UADPFlagsis false.

The Id of the Publisherthat sent the data. Valid DataTypesare UIntegerand String.

The DataType is indicated by bits 0-2 of the ExtendedFlags1.

A Subscribercan skip NetworkMessagesfrom Publishersit does not expect NetworkMessagesfrom.

DataSetClassId

Guid

The DataSetClassIdassociated with the DataSetsin the NetworkMessage.

All DataSetMessages in the NetworkMessage shall have the same DataSetClassId.

The DataSetClassIdshall be omitted if bit 3 of the ExtendedFlags1is false.

GroupHeader

The group header shall be omitted if bit 5 of the UADPFlagsis false.

GroupFlags

Byte

Bit 0: WriterGroupIdenabled

Bit 1: GroupVersionenabled

Bit 2: NetworkMessageNumberenabled

Bit 3: SequenceNumberenabled

Bits 4-6: Reserved

Bit 7: Reserved for further extended flag fields

WriterGroupId

UInt16

Unique id for the WriterGroupin the Publisher.

A Subscribercan skip NetworkMessagesfrom WriterGroupsit does not expect NetworkMessagesfrom.

This field shall be omitted if bit 0 of the GroupFlagsis false.

GroupVersion

VersionTime

Version of the header and payload layout configuration of the NetworkMessagessent for the group.

This field shall be omitted if bit 1 of the GroupFlagsis false.

NetworkMessage Number

UInt16

Unique number of a NetworkMessageacross the combination of PublisherIdand WriterGroupIdwithin one PublishingInterval.

The number is needed if the DataSetMessagesfor one group are split into more than one NetworkMessagein a PublishingInterval.

The value 0 is invalid.

This field shall be omitted if bit 2 of the GroupFlagsis false.

SequenceNumber

UInt16

Sequence number for the NetworkMessage.

This field shall be omitted if bit 3 of the GroupFlagsis false.

PayloadHeader

Byte [*]

The payload header depends on the UADP NetworkMessageType flags defined in the ExtendedFlags2bit range 0-3. The default is DataSetMessageif the ExtendedFlags2field is not enabled.

The PayloadHeader shall be omitted if bit 6 of the UADPFlagsis false.

The PayloadHeaderis not contained in the payload but it is contained in the unencrypted NetworkMessageheader since it contains information necessary to filter DataSetMessageson the Subscriberside.

Timestamp

DateTime

The time the NetworkMessage was created.

The Timestampshall be omitted if bit 5 of ExtendedFlags1is false.

The PublishingInterval, the SamplingOffsetthe PublishingOffsetand the Timestampand PicoSecondsin the NetworkMessageheader shall use the same time base.

PicoSeconds

UInt16

Specifies the number of 10 picoseconds (1,0 e-11 seconds) intervals which shall be added to the Timestamp.

The PicoSecondsshall be omitted if bit 6 of ExtendedFlags1is false.

PromotedFields

The PromotedFieldsshall be omitted if bit 4 of the ExtendedFlags2is false.

If the PromotedFieldsare provided, the number of DataSetMessagesin the NetworkMessage shall be one.

Size

UInt16

Total size in Bytesof the Fieldscontained in the PromotedFields.

Fields

BaseDataType[ ]

Array of promoted fields. The size, order and DataTypesof the fields depend on the settings in the FieldMetaDataof the DataSetMetaDataassociated with the DataSetMessagecontained in the NetworkMessage.

SecurityHeader

The security header shall be omitted if bit 4 of the ExtendedFlags1is false.

SecurityFlags

Byte

Bit 0: NetworkMessageSigned

Bit 1: NetworkMessageEncrypted

Bit 2: SecurityFooter enabled

Bit 3: Force key reset

This bit is set if all keys will be made invalid. It is set until the new key is used. The publisher must give subscribers a reasonable time to request new keys. The minimum time is five times the KeepAliveTimeconfigured for the corresponding PubSub group.

This flag is typically set if all keys are invalidated to exclude Subscribers, that no longer have access to the keys.

Bit range 4-7: Reserved

SecurityTokenId

IntegerId

The ID of the security token that identifies the security key in a SecurityGroup. The relation to the SecurityGroupis done through DataSetWriterIdscontained in the NetworkMessage.

NonceLength

Byte

The length of the Nonce used to initialize the encryption algorithm.

MessageNonce

Byte [NonceLength]

A number used exactly once for a given security key. For a given security key a unique nonce shall be generated for every NetworkMessage. The rules for constructing the MessageNonceare defined for the UADP Message Security in 7.2.2.2.3.

SecurityFooterSize

UInt16

The size of the SecurityFooter.

The security footer size shall be omitted if bit 2 of the SecurityFlagsis false.

Payload

Byte [*]

The payload depends on the UADP NetworkMessageType flags defined in the ExtendedFlags2bit range 2-5.

SecurityFooter

Byte [*]

Optional security footer shall be omitted if bit 2 of the SecurityFlagsis false.

The content of the security footer is defined by the SecurityPolicy.

Signature

Byte [*]

The signature of the NetworkMessage.

The algorithm and nonce length used of the UADP NetworkMessagesecurity depend on the selected SecurityPolicy. They are defined by SymmetricPubSubEncryptionAlgorithmand SymmetricPubSubNonceLength.

The keys used to encrypt and sign messages are returned from the GetSecurityKeysmethod (see 8.4). This Methodreturns a sequence of random data with a length that depends on the SecurityPolicyUri, which is also returned by the Method. The layout of the random data is defined in Table 74.

Table 74– Layout of the key data for UADP message security

Name

Type

Description

SigningKey

Byte [SymmetricSignatureAlgorithm Key Length]

Signing key part of the key data returned from GetSecurityKeys. The SymmetricSignatureAlgorithm is defined in the SecurityPolicy.

EncryptingKey

Byte [SymmetricEncryptionAlgorithm KeyLength]

Encryption key part of the key data returned from GetSecurityKeys. The SymmetricEncryptionAlgorithm is defined in the SecurityPolicy.

KeyNonce

Byte [SymmetricPubSubNonceLength]

Nonce part of the key data returned from GetSecurityKeys.

The layout of the MessageNonce for AES-CTR mode is defined in Table 75.

Table 75– Layout of the MessageNonce for AES-CTR

Name

Type

Description

Random

Byte [4]

The random part of the MessageNonce. This number does not need to be a cryptographically random number, it can be pseudo-random.

SequenceNumber

UInt32

A strictly monotonically increasing sequence number assigned by the publisher to each NetworkMessagesent for a SecurityTokenIdand PublisherIdcombination.

The sequence number is reset to 1 after the key and SecurityTokenIdare updated in the Publisher.

A receiver should ignore older NetworkMessagesthan the last sequence processed if it does not handle reordering of NetworkMessages. Receivers need to be aware of sequence numbers roll over (change from 4294967295 to 0).

To determine whether a received NetworkMessagesis newer than the last processed NetworkMessagesthe following formula shall be used:

(4294967295 + received sequence number – last processed sequence number) modulo 4294967296.

Results below 1073741824 indicate that the received NetworkMessagesis newer than the last processed NetworkMessagesand the received NetworkMessagesis processed.

Results above 3221225472 indicate that the received message is older (or same) than the last processed NetworkMessagesand the received NetworkMessagesshould be ignored if reordering of NetworkMessagesis not necessary.

Other results are invalid and the NetworkMessagesshall be ignored.

The key lifetime should be selected in a way that a new key is used before a rollover for the SequenceNumberhappens.

Subscribers shall reset the records they keep for sequence numbers if they do not receive messages for two times the keep alive time to deal with Publishers that are out of service and were not able to continue from the last used SequenceNumber.

The message encryption and decryption with AES-CTR mode uses a secret and a counter block. The secret is the EncryptingKeyfrom the key data defined in Table 74. The layout and content of the counter block is defined in Table 76.

Table 76– Layout of the counter block for UADP message security

Name

Type

Description

KeyNonce

Byte [4]

The KeyNonce portion of the key data returned from GetSecurityKeys.

MessageNonce

Byte [8]

The first 8 bytes of the Noncein the SecurityHeaderof the NetworkMessage.

For AES-CTR mode the length of the SecurityHeader Nonceshall be 8 Bytes.

BlockCounter

Byte [4]

The counter for each encrypted block of the NetworkMessage.

The counter is a 32-bit big endian integer (the opposite of the normal encoding for UInt32 values in OPC UA. This convention comes from the AES-CTR RFC).

The counter starts with 0 at the first block. The counter is incremented by 1 for each block.

AES-CTR mode takes the counter block and encrypts it using the encrypting key. The encrypted key stream is then logically XORed with the data to encrypt or decrypt. The process is repeated for each block in the plain text. No padding is added to the end of the plain text. AES-CTR does not change the size of the plain text data and can be applied directly to a memory buffer containing the message.

The signature is calculated on the entire NetworkMessageincluding any encrypted data. The signature algorithm is specified by the SecurityPolicyUriin OPC 10000-7.

When a Subscriber receives a NetworkMessage, it shall verify the signature first. If verification fails, it drops the NetworkMessage.

Other SecurityPolicymay specify different key lengths or cryptography algorithms.

If a NetworkMessagepayload like a DataSetMessageor a discovery response message has to be split across multiple NetworkMessagesthe chunks are sent with the payload header defined in Table 77and the payload defined in Table 78. A chunk NetworkMessagecan only contain chunked payload of one DataSetMessage.

Table 77– Chunked NetworkMessage Payload Header

Name

Type

Description

DataSetWriterId

UInt16

DataSetWriterId contained in the NetworkMessage.

The DataSetWriterIdidentifies the PublishedDataSetand the DataSetWriterresponsible for sending Messages for the DataSet.

A Subscribercan skip DataSetMessagesfrom DataSetWritersit does not expect DataSetMessagesfrom.

The DataSetWriterIdshall be set to 0 for discovery response messages.

Table 78– Chunked NetworkMessage Payload Fields

Name

Type

Description

MessageSequenceNumber

UInt16

Sequence number of the payload as defined for the NetworkMessagetype like DataSetMessageSequenceNumberin a DataSetMessage.

NetworkMessagesmay be received out of order. In this case, a chunk for the next payload can be received before the last chunk of the previous payload was received.

If the next sequence number is received by a Subscribersthat can handle only one payload, the chunks of the previous payload are skipped if they are not completely received yet.

ChunkOffset

UInt32

The byte offset position of the chunk in the complete NetworkMessagepayload. The last chunk is received if ChunkOffsetplus the size of the current chunk equals TotalSize.

The reassembled NetworkMessagepayload can be processed after all chunks are received.

TotalSize

UInt32

Total size of the NetworkMessagepayload in bytes.

ChunkData

ByteString

The pieces of the original DataSetMessage, are copied into the chunk until the maximum size allowed for a single NetworkMessageis reached minus space for the signature. The data copied into next chunk starts with the byte after the last byte copied into current chunk.

A DataSetMessageis completely received when all chunks are received and the DataSetMessagecan be processed completely.

The UADP DataSetpayload header and other parts of the NetworkMessage are shown in Figure 28.

Different types of DataSetMessagecan be combined in on NetworkMessage.

image031.png

Figure 28– UADP DataSet Payload

The encoding of the UADP DataSet payload header is specified in Table 79. The payload header is unencrypted. This header shall be omitted if bit 6 of the UADPFlagsis false.

Table 79– UADP DataSet Payload Header

Name

Type

Description

Count

Byte

Number of DataSetMessagescontained in the NetworkMessage. The NetworkMessageshall contain at least one DataSetMessagesif the NetworkMessagetype is DataSetMessagepayload.

DataSetWriterIds

UInt16 [Count]

List of DataSetWriterIdscontained in the NetworkMessage. The size of the list is defined by the Count.

The DataSetWriterIdidentifies the PublishedDataSetand the DataSetWriterresponsible for sending Messages for the DataSet.

A Subscribercan skip DataSetMessagesfrom DataSetWritersit does not expect DataSetMessagesfrom.

The DataSetpayload is defined in Table 80. The payload is encrypted.

Table 80– UADP DataSet Payload

Name

Type

Description

Sizes

UInt16 [Count]

List of byte sizes of the DataSetMessages.

The size of the list is defined by the Countin the DataSetpayload header.

If the payload size exceeds 65535, the DataSetMessagesshall be allocated to separate NetworkMessages. If a single DataSetMessageexceeds the payload size it shall be split into Chunk NetworkMessages.

This field shall be omitted if count is one or if bit 6 of the UADPFlagsis false.

DataSetMessages

DataSetMessage [Count]

DataSetMessagescontained in the NetworkMessage. The size of the list is defined by the Countin the DataSetpayload header.

The type of encoding used for the DataSetMessagesis defined by the DataSetWriter.

The encodings for the DataSetMessageare defined in 7.2.2.3.4.

The DataSetMessage header structure and the relation to other parts in a NetworkMessageis shown in Figure 29.

image032.png

Figure 29– DataSetMessageHeader Structure

The encoding of the DataSetMessage header structure is specified in Table 81.

The DataSetFieldContentMaskand the DataSetMessageContentMasksettings of the DataSetWritercontrol the flags in the fields DataSetFlags1and DataSetFlags2. The setting of the flags shall not change until the configuration of the DataSetWriteris changed.

Table 81– DataSetMessageHeader Structure

Name

Type

Description

DataSetFlags1

Byte

Bit 0: DataSetMessage is valid.

If this bit is set to false, the rest of this DataSetMessage is considered invalid, and shall not be processed by the Subscriber.

Bit range 1-2: Field Encoding

00 The DataSetfields are encoded as Variant The Variantcan contain a StatusCodeinstead of the expected DataTypeif the status of the field is Bad. The Variantcan contain a DataValue with the value and the statusCode if the status of the field is Uncertain.

01 RawData Field Encoding

The DataSetfields are encoded in the DataTypes specified in the DataSetMetaDatafor the DataSet.

The encoding is handled like a Structure DataTypewhere the DataSet fields are handled like Structurefields and fields with Structure DataType are handled like nested structures.

All restrictions for the encoding of Structure DataTypesalso apply to the RawData Field Encoding.

10 DataValue Field Encoding

The DataSetfields are encoded as DataValue. This option is set if the DataSetis configured to send more than the Value.

11 Reserved

Bit 3: DataSetMessageSequenceNumberenabled

Bit 4: Statusenabled

Bit 5: ConfigurationVersionMajorVersionenabled

Bit 6: ConfigurationVersionMinorVersionenabled

Bit 7: DataSetFlags2 enabled

The bit shall be false, if DataSetFlags2 is 0.

DataSetFlags2

Byte

The DataSetFlags2 shall be omitted if bit 7 of the DataSetFlags1 is false.

If the field is omitted, the Subscribershall handle the related bits as false.

Bit range 0-3: UADP DataSetMessage type

0000Data Key Frame (see 7.2.2.3.5)

If the DataSetFlags2field is not provided, this is the default DataSetMessage type.

0001Data Delta Frame (see 7.2.2.3.6)

0010Event (see 7.2.2.3.7)

0011Keep Alive (see 7.2.2.3.8)

01xxReserved

1xxxReserved

Bit 4: Timestampenabled

Bit 5: PicoSecondsincluded in the DataSetMessageheader

Bit 6: Reserved

Bit 7: Reserved for further extended flag fields

DataSetMessage‌SequenceNumber

UInt16

A strictly monotonically increasing sequence number assigned by the publisher to each DataSetMessagesent.

A receiver should ignore older DataSetMessagethan the last sequence processed if it does not handle reordering of DataSetMessages. Receivers need to be aware of sequence numbers roll over (change from 65535 to 0).

To determine whether a received DataSetMessageis newer than the last processed DataSetMessagethe following formula shall be used:

(65535 + received sequence number – last processed sequence number) modulo 65536

Results below 16384 indicate that the received DataSetMessageis newer than the last processed DataSetMessageand the received DataSetMessageis processed.

Results above 49162 indicate that the received message is older (or same) than the last processed DataSetMessageand the received DataSetMessageshould be ignored if reordering of DataSetMessagesis not necessary.

Other results are invalid and the DataSetMessageshall be ignored.

The field shall be omitted if Bit 2 of DataSetFlags1is false.

Timestamp

UtcTime

The time the Data was collected.

The Timestampshall be omitted if Bit 3 of DataSetFlags1is false.

PicoSeconds

UInt16

Specifies the number of 10 picoseconds (1,0 e-11 seconds) intervals which shall be added to the Timestamp.

The field shall be omitted if Bit 4 of DataSetFlags2is false.

Status

UInt16

The overall status of the DataSet.

This is the high order 16 bits of the StatusCode DataTyperepresenting the numeric value of the Severityand SubCodeof the StatusCode DataType.

The field shall be omitted if Bit 4 of DataSetFlags1is false.

ConfigurationVersion

MajorVersion

VersionTime

The major version of the configuration version of the DataSet used as consistency check with the DataSetMetaDataavailable on the Subscriberside.

The field shall be omitted if Bit 5 of DataSetFlags1is false.

ConfigurationVersion

MinorVersion

VersionTime

The minor version of the configuration version of the DataSet used as consistency check with the DataSetMetaDataavailable on the Subscriberside.

The field shall be omitted if Bit 6 of DataSetFlags1is false.

The data key frame DataSetMessage data and related headers are shown in Figure 30.

image033.png

Figure 30– Data Key Frame DataSetMessageData

The encoding of the data key DataSetMessage structure is specified in Table 82.

Table 82– Data Key Frame DataSetMessageStructure

Name

Type

Description

FieldCount

UInt16

Number of fields of the DataSetcontained in the DataSetMessage.

The FieldCountshall be omitted if RawDatafield encoding is set in the EncodingFlagsdefined in 7.2.2.3.4.

DataSetFields

BaseDataType[]

The field values of the DataSet.

The field encoding depends on the EncodingFlagsof the DataSetMessageHeader defined in 7.2.2.3.4. The default encoding is Variantif bit 0 and 1 are not set.

The data delta frame DataSetMessage data and the related headers are shown in Figure 31.

image034.png

Figure 31– Data Delta Frame DataSetMessage

The information for a single value in delta frame messages is larger because of the additional index necessary for sending just changed data. The Publishershall send a key frame message if the delta frame message is larger than a key frame message.

The encoding of the data delta frame DataSetMessage structure is specified in Table 83.

Table 83– Data Delta Frame DataSetMessageStructure

Name

Type

Description

FieldCount

UInt16

Number of fields of the DataSet contained in the DataSetMessage.

DeltaFrameFields

Structure[]

The subset of field values of the DataSet contained in the delta frame.

FieldIndex

UInt16

The index of the Field in the DataSet. The index is based on the field position in the DataSetMetaDatawith the configuration version defined in the ConfigurationVersionfield.

FieldValue

BaseDataType

The field values of the DataSet.

The field encoding depends on the EncodingFlags of the DataSetMessageHeader defined in 7.2.2.3.4. The default encoding is Variant if bit 2 and 3 are not set.

The Event DataSetMessage data and the related headers are shown in Figure 32.

image035.png

Figure 32– Event DataSetMessage

The encoding of the Event DataSetMessage structure is specified in Table 84.

Table 84– Event DataSetMessage Structure

Name

Type

Description

FieldCount

UInt16

Number of fields of the DataSetcontained in the DataSetMessage.

DataSetFields

BaseDataType[]

The field values of the DataSet.

The fields of Event DataSetMessagesshall be encoded as Variant.

The Field Encoding DataSetFlags1of the DataSetMessageheader (bit 1 and 2) defined in 7.2.2.3.4shall be set to false.

The keep alive message does not add any additional fields. The message and the related headers are shown in Figure 33.

image036.png

Figure 33– KeepAlive Message

The sequence number contains the next expected sequence number for the DataSetWriter.

The NetworkMessage flags used with the discovery request messages shall use the following bit values.

  • UADPFlagsbits 5 and 6 shall be false, bits 4 and 7 shall be true
  • ExtendedFlags1bits 3, 5 and 6 shall be false, bits 4 and 7 shall be true
  • ExtendedFlags2bit 2 shall be true, all other bits shall be false

The setting of the flags ensures a known value for the first five fields in the NetworkMessageon the Publisheras receiver. The actual security settings for the NetworkMessageare indicated by the SecurityHeader.

A variety of rules are used to reduce the amount of traffic on the network in the case of multicast or broadcast communication.

A Subscribershould cache configuration information for PublisherIdand DataSetWriterIdsof interest.

If a Subscriberrequires information from Publishersafter a startup or version change detection, discovery requests shall be randomly delayed in the range of 100-500 ms. The request shall be skipped if the information is already received during this time or another Subscribersent already a request and the response to this request is used.

Discovery requests for different DataSetWritersin one WriterGroupshall be aggregated into one discovery response.

A Publishershall delay subsequent responses for a combination of request type and identifier like the DataSetWriterIdfor at least 500 ms. Duplicate requests, that have not yet been responded to, shall be discarded by the Publisher.

A Subscribershall wait for a response at least 500 ms. As long as not all responses are received, the Subscriber requests the missing information. It shall double the time period between follwing requests until all needed response are received or denied.

The encoding of the discovery requestheader structure is specified in Table 85.

Table 85– Discovery RequestHeader Structure

Name

Type

Description

RequestType

Byte

The following types of discovery request messages are defined.

0Reserved

1 Publisherinformation request message (see 7.2.2.4.1.4)

The encoding of the Publisher information request message structure is specified in Table 86.

Table 86– Publisher Information Request Message Structure

Name

Type

Description

InformationType

Byte

The following types of Publisher information requests are defined.

0Reserved

1 Publisher Server Endpoints

2 DataSetMetaData

3 DataSetWriterconfiguration

DataSetWriterIds

UInt16[]

List of DataSetWriterIdsthe information is requested for.

If the request is not related to DataSet, the array shall be null.

The NetworkMessage flags used with the discovery response messages shall use the following bit values.

The setting of the flags ensures a known value for the first five fields in the NetworkMessagefor Publishersexpected by the Subscriber. The actual security settings for the NetworkMessageare indicated by the SecurityHeader.

The encoding of the discovery responseheader structure is specified in Table 87.

Table 87– Discovery ResponseHeader Structure

Name

Type

Description

ResponseType

Byte

The following types of discovery response messages are defined.

0Reserved

1Publisher Endpoint message (see 7.2.2.4.2.3)

2DataSet Metadata message (see 7.2.2.4.2.4)

3DataSetWriter configuration message (see 7.2.2.4.2.5)

SequenceNumber

UInt16

A strictly monotonically increasing sequence number assigned to each discovery response sent in the scope of a PublisherId.

The encoding of the available Endpointsof a Publisheris specified in Table 88.

Table 88– Publisher Endpoints Message Structure

Name

Type

Description

Endpoints

EndpointDescription[]

The OPC UA Server Endpointsof the Publisher. The EndpointDescriptionis defined in OPC 10000-4.

statusCode

StatusCode

Status code indicating the capability of the Publisherto provide Endpoints.

The encoding of the DataSetmetadata message structure is specified in Table 89. It contains the current layout and DataSetMetaDatafor the DataSet.

The ConfigurationVersionin the DataSetMessage header shall match the ConfigurationVersionin the DataSetMetaData.

The Publishershall send this message without a corresponding discovery request if the DataSetMetaDatachanged for the DataSet.

Table 89– DataSetMetaData Message Structure

Name

Type

Description

DataSetWriterId

UInt16

DataSetWriterIdof the DataSetdescribed with the MetaData.

MetaData

DataSetMetaDataType

The current DataSetmetadata for the DataSetrelated to the DataSetWriterId. The DataSetMetaDataTypeis defined in 6.2.2.1.2.

statusCode

StatusCode

Status code indicating the capability of the Publisherto provide MetaDatafor the DataSetWriterId.

The encoding of the DataSetWriterconfiguration data message structure is specified in Table 90. It contains the current configuration of the WriterGroupand the DataSetWriterfor the DataSet.

The Publishershall send this message without a corresponding discovery request if the configuration of the WriterGroup changed.

Table 90– DataSetWriter Configuration Message Structure

Name

Type

Description

DataSetWriterIds

UInt16[]

DataSetWriterIdscontained in the configuration information.

DataSetWriterConfig

WriterGroupDataType

The current WriterGroupand DataSetWritersettings for the DataSetrelated to the DataSetWriterId. The WriterGroupDataTypeis defined in 6.2.5.6.

The field DataSetWritersof the WriterGroupDataTypeshall contain only the entry for the requested or changed DataSetWritersin the WriterGroup.

statusCodes

StatusCode[]

Status codes indicating the capability of the Publisherto provide configuration information for the DataSetWriterIds. The size of the array shall match the size of the DataSetWriterIdsarray.

JSON is a format that uses human readable text. It is defined in RFC 7159.

The JSON based message mapping allows OPC UA Applicationsto interoperate with web and enterprise software that use this format.

Each JSON NetworkMessagecontains one or more JSON DataSetMessages. The JSON NetworkMessageis a JSON object with the fields defined in Table 91.

Table 91– JSON NetworkMessage Definition

Name

Type

Description

MessageId

String

A globally unique identifier for the message.

This value is mandatory.

MessageType

String

This value shall be “ua-data”.

This value is mandatory.

PublisherId

String

A unique identifier for the Publisher. It identifies the source of the message.

This value is optional. The presence of the value depends on the setting in the JsonNetworkMessageContentMask.

The source is the PublisherIdon a PubSubConnection(see 6.2.6.1).

DataSetClassId

String

The DataSetClassIdassociated with the DataSetsin the NetworkMessage.

This value is optional. The presence of the value depends on the setting in the JsonNetworkMessageContentMask.

If specified, all DataSetMessagesin the NetworkMessageshall have the same DataSetClassId.

The source is the DataSetClassIdon the PublishedDataSet(see 6.2.2.2) associated with the DataSetWritersthat produced the DataSetMessages.

Messages

*

A JSON array of JSON DataSetMessages (see 7.2.3.3).

This value is mandatory.

All fields with a concrete DataTypedefined are encoded using reversible OPC UA JSON Data Encodingdefined in OPC 10000-6.

The fields in the JSON NetworkMessageare controlled by the NetworkMessageContentMaskof the JSON NetworkMessagemapping(see 6.3.2.1.1).

If the NetworkMessageHeaderbit of the NetworkMessageContentMaskis not set, the NetworkMessageis the contents of the Messagesfield (e.g. a JSON array of DataSetMessages).

If the DataSetMessageHeaderbit of the NetworkMessageContentMaskis not set, the content of the Messagesfield is an array of content from the Payloadfield for each DataSetMessage(see 7.2.3.3).

If the SingleDataSetMessagebit of the NetworkMessageContentMaskis set, the content of the Messagesfield is a JSON object containing a single DataSetMessage.

If theNetworkMessageHeaderand theDataSetMessageHeaderbits are not setandSingleDataSetMessage bit is set, the NetworkMessageis a JSON object containing the set of name/value pairs defined for a single DataSet.

If the JSON encoded NetworkMessagesize exceeds the Brokerlimits the message is dropped and a PubSubTransportLimitsExceeded Eventis reported.

A DataSetMessageis produced by a DataSetWriterand contains list of name/value pairs which are specified by the PublishedDataSet associated with theDataSetWriter. The contents of the DataSetMessageare formally described by a DataSetMetData Objects. A DataSetMessageis a JSON object with the fields defined in Table 92.

DataSetWriters may periodically provide keep-alive messages which are DataSetMessages without any Payloadfield.

Table 92– JSON DataSetMessage Definition

Name

Type

Description

DataSetWriterId

String

An identifier for DataSetWriterwhich created the DataSetMessage.

This value is mandatory.

It is unique within the scope of a Publisher.

SequenceNumber

UInt32

A strictly monotonically increasing sequence number assigned to the DataSetMessage by the DataSetWriter.

This value is optional. The presence of the value depends on the setting in the JsonDataSetMessageContentMask.

MetaDataVersion

ConfigurationVersionDataType

The version of the DataSetMetaData which describes the contents of the Payload.

This value is optional. The presence of the value depends on the setting in the JsonDataSetMessageContentMask.

Timestamp

DateTime

A timestamp which applies to all values contained in the DataSetMessage.

This value is optional. The presence of the value depends on the setting in the JsonDataSetMessageContentMask.

Status

StatusCode

A status code which applies to all values contained in the DataSetMessage.

This value is optional. The presence of the value depends on the setting in the JsonDataSetMessageContentMask.

Payload

Object

A JSON object containing the name-value pairs specified by the PublishedDataSet.

The format of the value depends on the DataTypeof the field and the flags specified by the DataSetMessageContentMask.

All fields with a concrete DataTypeare encoded using reversible OPC UA JSON Data Encodingdefined in OPC 10000-6.

The fields in the DataSetMessageare specified by the DataSetFieldContentMaskin the DataSetWriterparameters.

DataSetFieldContentMaskspecifies the format of the field values in the Payloadaccording to the following rules:

The JSON message mapping defines only one optional discovery message for the exchange of the DataSetMetaData. The main purpose is the exchange of additional information not contained in the DataSetMessageslike Propertiesfor the DataSetfields.

DataSetMetaDatadescribe the content a DataSetpublished by a DataSetWriter. More specifically, it specifies the names and data types of the values that shall appear in the Payloadof a DataSetMessage.

When the DataSetMetaData of a DataSet changes the, DataSetWriter may be configured to publish the updated value through the mechanism defined by the transport protocol mapping.

The DataSetWriterIdand Versionfields in a DataSetMessage are used to correlate a DataSetMessagewith a DataSetMetaData.

A DataSetMetaDatais a JSON object with the fields defined in Table 93.

Table 93– JSON DataSetMetaData Definition

Name

Type

Description

MessageId

String

A globally unique identifier for the message.

This value is mandatory.

MessageType

String

This value shall be “ua-metadata”.

This value is mandatory.

PublisherId

String

A unique identifier for the Publisher. It identifies the source of the message.

This value is mandatory.

DataSetWriterId

UInt16

An identifier for DataSetWriterwhich published the DataSetMetaData.

This value is mandatory.

It is unique within the scope of a Publisher.

MetaData

DataSetMetaDataType

The metadata as defined in 6.2.2.1.2.

This value is mandatory.

All fields with a concrete DataTypeare encoded using reversible OPC UA JSON Data Encodingdefined in OPC 10000-6.