open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_pubsub.h
Go to the documentation of this file.
1/** This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 *
5 * Copyright (c) 2017-2018 Fraunhofer IOSB (Author: Andreas Ebner)
6 * Copyright (c) 2019 Kalycito Infotech Private Limited
7 * Copyright (c) 2020 Yannick Wallerer, Siemens AG
8 * Copyright (c) 2020 Thomas Fischer, Siemens AG
9 * Copyright (c) 2021 Fraunhofer IOSB (Author: Jan Hermes)
10 */
11
12#ifndef UA_PUBSUB_H_
13#define UA_PUBSUB_H_
14
16#include <open62541/server.h>
18
19#include "open62541_queue.h"
21
22/** The public configuration structs are defined in include/ua_plugin_pubsub.h */
23
25
26#ifdef UA_ENABLE_PUBSUB
27
28struct UA_WriterGroup;
30
31struct UA_ReaderGroup;
33
34
35/** PublishedDataSet */
36
37
49
53
56
57void
59 UA_PublishedDataSet *publishedDataSet);
60
61
62/** Connection */
63
64
79
83
86 UA_NodeId connectionIdentifier);
87
88void
90
91void
93
94/** Register channel for given connectionIdentifier */
96UA_PubSubConnection_regist(UA_Server *server, UA_NodeId *connectionIdentifier);
97
98/** Process Network Message for a ReaderGroup. But we the ReaderGroup needs to be
99 * identified first. */
102 UA_PubSubConnection *connection,
104
105
106/** DataSetWriter */
107
108
109#ifdef UA_ENABLE_PUBSUB_DELTAFRAMES
110typedef struct UA_DataSetWriterSample {
111 UA_Boolean valueChanged;
112 UA_DataValue value;
113} UA_DataSetWriterSample;
114#endif
115
116typedef struct UA_DataSetWriter {
123 UA_ConfigurationVersionDataType connectedDataSetVersion;
124 UA_PubSubState state;
125#ifdef UA_ENABLE_PUBSUB_DELTAFRAMES
126 UA_UInt16 deltaFrameCounter; /* count of sent deltaFrames */
127 size_t lastSamplesCount;
128 UA_DataSetWriterSample *lastSamples;
129#endif
133
137
140
142UA_DataSetWriter_setPubSubState(UA_Server *server, UA_PubSubState state,
143 UA_DataSetWriter *dataSetWriter);
144
147 UA_DataSetMessage *dataSetMessage,
148 UA_DataSetWriter *dataSetWriter);
149
152 UA_DataSetWriter *dataSetWriter);
153
154
155/** WriterGroup */
156
157
164 LIST_HEAD(UA_ListOfDataSetWriter, UA_DataSetWriter) writers;
168 UA_PubSubState state;
170 UA_UInt16 sequenceNumber; /* Increased after every succressuly sent message */
172
173#ifdef UA_ENABLE_PUBSUB_ENCRYPTION
174 UA_UInt32 securityTokenId;
175 UA_UInt32 nonceSequenceNumber; /* To be part of the MessageNonce */
176 void *securityPolicyContext;
177#endif
178};
179
183
186
188UA_WriterGroup_setPubSubState(UA_Server *server, UA_PubSubState state,
189 UA_WriterGroup *writerGroup);
190
191
192/** DataSetField */
193
194
205
209
212
213
214/** DataSetReader */
215
216
217/** DataSetReader Type definition */
218typedef struct UA_DataSetReader {
224
225 UA_PubSubState state; /* non std */
228
229#ifdef UA_ENABLE_PUBSUB_MONITORING
230 /* MessageReceiveTimeout handling */
231 UA_ServerCallback msgRcvTimeoutTimerCallback;
232 UA_UInt64 msgRcvTimeoutTimerId;
233 UA_Boolean msgRcvTimeoutTimerRunning;
234#endif
236
237/** Process Network Message using DataSetReader */
238void
240 UA_ReaderGroup *readerGroup,
241 UA_DataSetReader *dataSetReader,
242 UA_DataSetMessage *dataSetMsg);
243
244/** Copy the configuration of DataSetReader */
247
248/** Clear the configuration of a DataSetReader */
250
251/** Copy the configuration of Target Variables */
253 UA_TargetVariables *dst);
254
255/** Clear the Target Variables configuration */
256void UA_TargetVariables_clear(UA_TargetVariables *subscribedDataSetTarget);
257
258/** Copy the configuration of Field Target Variables */
261
263UA_DataSetReader_setPubSubState(UA_Server *server, UA_PubSubState state,
264 UA_DataSetReader *dataSetReader);
265
266#ifdef UA_ENABLE_PUBSUB_MONITORING
267/** Check if DataSetReader has a message receive timeout */
268void
269UA_DataSetReader_checkMessageReceiveTimeout(UA_Server *server,
270 UA_DataSetReader *dataSetReader);
271
272/** DataSetReader MessageReceiveTimeout callback for generic PubSub component
273 * timeout handling */
274void
275UA_DataSetReader_handleMessageReceiveTimeout(UA_Server *server,
276 void *dataSetReader);
277#endif /* UA_ENABLE_PUBSUB_MONITORING */
278
281 UA_DataSetReader *dataSetReader,
282 UA_DataSetMessage *dsm, UA_UInt16 *writerId,
283 UA_Byte dsmCount, UA_NetworkMessage *nm);
284
287 UA_DataSetMessage *dataSetMessage,
288 UA_DataSetReader *dataSetReader);
289
290
291/** ReaderGroup */
292
293
300 LIST_HEAD(UA_ListOfPubSubDataSetReader, UA_DataSetReader) readers;
301 /* for simplified information access */
304 UA_PubSubState state;
306
307#ifdef UA_ENABLE_PUBSUB_ENCRYPTION
308 UA_UInt32 securityTokenId;
309 UA_UInt32 nonceSequenceNumber; /* To be part of the MessageNonce */
310 void *securityPolicyContext;
311#endif
312};
313
317
318/** Prototypes for internal util functions - some functions maybe removed later
319 * (currently moved from public to internal) */
322
325
327UA_ReaderGroup_setPubSubState(UA_Server *server, UA_PubSubState state,
328 UA_ReaderGroup *readerGroup);
329
330
331/** PublishValues handling */
332
333
336
337void
339
340
341/** SubscribeValues handling */
342
343
346
347void
349
350void
352
353
354/** Reading Message handling */
355
356
357#ifdef UA_ENABLE_PUBSUB_ENCRYPTION
359verifyAndDecrypt(const UA_Logger *logger, UA_ByteString *buffer,
360 const size_t *currentPosition, const UA_NetworkMessage *nm,
361 UA_Boolean doValidate, UA_Boolean doDecrypt,
362 void *channelContext, UA_PubSubSecurityPolicy *securityPolicy);
363
365verifyAndDecryptNetworkMessage(const UA_Logger *logger, UA_ByteString *buffer,
366 size_t *currentPosition, UA_NetworkMessage *nm,
367 UA_ReaderGroup *readerGroup);
368#endif
369
370/** Takes a value (and not a pointer) to the buffer. The original buffer is
371 const. Internally we may adjust the length during decryption. */
373decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos,
374 UA_NetworkMessage *nm, UA_PubSubConnection *connection);
375
378 UA_PubSubConnection *connection);
379
380#endif /* UA_ENABLE_PUBSUB */
381
383
384#endif /* UA_PUBSUB_H_ */
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
static UA_LogCategory const char * msg
Definition log.h:53
UA_PubSubComponentEnumType
This Source Code Form is subject to the terms of the Mozilla Public License, v.
DataSetField
Definition ua_pubsub.h:195
UA_Boolean configurationFrozen
Definition ua_pubsub.h:203
UA_NodeId publishedDataSet
Definition ua_pubsub.h:199
UA_NodeId identifier
Definition ua_pubsub.h:198
UA_Boolean sampleCallbackIsRegistered
Definition ua_pubsub.h:202
TAILQ_ENTRY(UA_DataSetField) listEntry
UA_DataSetFieldConfig config
Definition ua_pubsub.h:196
UA_UInt64 sampleCallbackId
Definition ua_pubsub.h:201
UA_FieldMetaData fieldMetaData
Definition ua_pubsub.h:200
Parameters for PubSub DataSetReader Configuration.
DataSetReader
Definition ua_pubsub.h:218
UA_NodeId linkedReaderGroup
Definition ua_pubsub.h:222
LIST_ENTRY(UA_DataSetReader) listEntry
UA_PubSubState state
Definition ua_pubsub.h:225
UA_DataSetReaderConfig config
Definition ua_pubsub.h:220
UA_Boolean configurationFrozen
Definition ua_pubsub.h:226
UA_NetworkMessageOffsetBuffer bufferedMessage
Definition ua_pubsub.h:227
UA_NodeId identifier
Definition ua_pubsub.h:221
UA_PubSubComponentEnumType componentType
Definition ua_pubsub.h:219
DataSetWriter
Definition ua_pubsub.h:116
UA_PubSubState state
Definition ua_pubsub.h:124
UA_Boolean configurationFrozen
Definition ua_pubsub.h:131
UA_NodeId connectedDataSet
Definition ua_pubsub.h:122
UA_ConfigurationVersionDataType connectedDataSetVersion
Definition ua_pubsub.h:123
LIST_ENTRY(UA_DataSetWriter) listEntry
UA_UInt16 actualDataSetMessageSequenceCount
Definition ua_pubsub.h:130
UA_NodeId linkedWriterGroup
Definition ua_pubsub.h:121
UA_DataSetWriterConfig config
Definition ua_pubsub.h:118
UA_PubSubComponentEnumType componentType
Definition ua_pubsub.h:117
UA_NodeId identifier
Definition ua_pubsub.h:120
Interface structure between network plugin and internal implementation.
Definition pubsub.h:41
UA_NodeId identifier
Definition ua_pubsub.h:69
size_t readerGroupsSize
Definition ua_pubsub.h:73
UA_PubSubConnectionConfig * config
Definition ua_pubsub.h:67
UA_UInt16 configurationFreezeCounter
Definition ua_pubsub.h:75
LIST_HEAD(UA_ListOfPubSubReaderGroup, UA_ReaderGroup) readerGroups
LIST_HEAD(UA_ListOfWriterGroup, UA_WriterGroup) writerGroups
size_t writerGroupsSize
Definition ua_pubsub.h:71
UA_PubSubChannel * channel
Definition ua_pubsub.h:68
UA_Boolean isRegistered
Definition ua_pubsub.h:76
TAILQ_ENTRY(UA_PubSubConnection) listEntry
UA_Boolean configurationFrozen
Definition ua_pubsub.h:77
UA_PubSubComponentEnumType componentType
Definition ua_pubsub.h:66
Configuration structure for PublishedDataSet.
PublishedDataSet
Definition ua_pubsub.h:38
UA_Boolean configurationFrozen
Definition ua_pubsub.h:47
UA_UInt16 configurationFreezeCounter
Definition ua_pubsub.h:45
UA_UInt16 fieldSize
Definition ua_pubsub.h:43
UA_DataSetMetaDataType dataSetMetaData
Definition ua_pubsub.h:40
UA_NodeId identifier
Definition ua_pubsub.h:42
TAILQ_ENTRY(UA_PublishedDataSet) listEntry
UA_PublishedDataSetConfig config
Definition ua_pubsub.h:39
UA_UInt16 promotedFieldsCount
Definition ua_pubsub.h:44
TAILQ_HEAD(UA_ListOfDataSetField, UA_DataSetField) fields
ReaderGroup configuration.
ReaderGroup
Definition ua_pubsub.h:294
UA_Boolean configurationFrozen
Definition ua_pubsub.h:305
UA_NodeId identifier
Definition ua_pubsub.h:297
UA_PubSubComponentEnumType componentType
Definition ua_pubsub.h:295
UA_UInt32 readersCount
Definition ua_pubsub.h:302
UA_ReaderGroupConfig config
Definition ua_pubsub.h:296
UA_UInt64 subscribeCallbackId
Definition ua_pubsub.h:303
LIST_HEAD(UA_ListOfPubSubDataSetReader, UA_DataSetReader) readers
UA_PubSubState state
Definition ua_pubsub.h:304
LIST_ENTRY(UA_ReaderGroup) listEntry
UA_NodeId linkedConnection
Definition ua_pubsub.h:298
WriterGroup
Definition ua_pubsub.h:158
LIST_HEAD(UA_ListOfDataSetWriter, UA_DataSetWriter) writers
UA_WriterGroupConfig config
Definition ua_pubsub.h:160
UA_Boolean publishCallbackIsRegistered
Definition ua_pubsub.h:167
UA_PubSubState state
Definition ua_pubsub.h:168
UA_NodeId identifier
Definition ua_pubsub.h:162
UA_NetworkMessageOffsetBuffer bufferedMessage
Definition ua_pubsub.h:169
UA_Boolean configurationFrozen
Definition ua_pubsub.h:171
UA_UInt64 publishCallbackId
Definition ua_pubsub.h:166
UA_PubSubConnection * linkedConnection
Definition ua_pubsub.h:163
UA_UInt32 writersCount
Definition ua_pubsub.h:165
UA_UInt16 sequenceNumber
Definition ua_pubsub.h:170
LIST_ENTRY(UA_WriterGroup) listEntry
UA_PubSubComponentEnumType componentType
Definition ua_pubsub.h:159
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition types.h:26
uint16_t UA_UInt16
Definition types.h:46
uint32_t UA_UInt32
Definition types.h:56
uint32_t UA_StatusCode
Definition types.h:77
uint8_t UA_Byte
Definition types.h:36
uint64_t UA_UInt64
Definition types.h:66
UA_StatusCode UA_FieldTargetVariable_copy(const UA_FieldTargetVariable *src, UA_FieldTargetVariable *dst)
Copy the configuration of Field Target Variables.
void UA_PubSubConnectionConfig_clear(UA_PubSubConnectionConfig *connectionConfig)
UA_StatusCode UA_WriterGroup_setPubSubState(UA_Server *server, UA_PubSubState state, UA_WriterGroup *writerGroup)
UA_StatusCode UA_PublishedDataSetConfig_copy(const UA_PublishedDataSetConfig *src, UA_PublishedDataSetConfig *dst)
UA_StatusCode UA_DataSetReaderConfig_copy(const UA_DataSetReaderConfig *src, UA_DataSetReaderConfig *dst)
Copy the configuration of DataSetReader.
UA_PubSubConnection * UA_PubSubConnection_findConnectionbyId(UA_Server *server, UA_NodeId connectionIdentifier)
UA_StatusCode UA_DataSetWriter_remove(UA_Server *server, UA_WriterGroup *linkedWriterGroup, UA_DataSetWriter *dataSetWriter)
UA_StatusCode UA_WriterGroupConfig_copy(const UA_WriterGroupConfig *src, UA_WriterGroupConfig *dst)
void UA_PublishedDataSet_clear(UA_Server *server, UA_PublishedDataSet *publishedDataSet)
UA_PublishedDataSet * UA_PublishedDataSet_findPDSbyId(UA_Server *server, UA_NodeId identifier)
void UA_ReaderGroup_removeSubscribeCallback(UA_Server *server, UA_ReaderGroup *readerGroup)
UA_ReaderGroup * UA_ReaderGroup_findRGbyId(UA_Server *server, UA_NodeId identifier)
Prototypes for internal util functions - some functions maybe removed later (currently moved from pub...
void UA_ReaderGroup_subscribeCallback(UA_Server *server, UA_ReaderGroup *readerGroup)
void UA_DataSetReaderConfig_clear(UA_DataSetReaderConfig *cfg)
Clear the configuration of a DataSetReader.
UA_StatusCode UA_PubSubConnection_regist(UA_Server *server, UA_NodeId *connectionIdentifier)
Register channel for given connectionIdentifier.
struct UA_DataSetField UA_DataSetField
DataSetField
UA_StatusCode UA_DataSetReader_generateDataSetMessage(UA_Server *server, UA_DataSetMessage *dataSetMessage, UA_DataSetReader *dataSetReader)
UA_StatusCode UA_DataSetFieldConfig_copy(const UA_DataSetFieldConfig *src, UA_DataSetFieldConfig *dst)
struct UA_PublishedDataSet UA_PublishedDataSet
PublishedDataSet
UA_StatusCode decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos, UA_NetworkMessage *nm, UA_PubSubConnection *connection)
Reading Message handling
UA_StatusCode UA_DataSetReader_generateNetworkMessage(UA_PubSubConnection *pubSubConnection, UA_DataSetReader *dataSetReader, UA_DataSetMessage *dsm, UA_UInt16 *writerId, UA_Byte dsmCount, UA_NetworkMessage *nm)
UA_StatusCode UA_WriterGroup_addPublishCallback(UA_Server *server, UA_WriterGroup *writerGroup)
PublishValues handling
struct UA_DataSetReader UA_DataSetReader
DataSetReader
void UA_TargetVariables_clear(UA_TargetVariables *subscribedDataSetTarget)
Clear the Target Variables configuration.
UA_StatusCode UA_DataSetWriter_generateDataSetMessage(UA_Server *server, UA_DataSetMessage *dataSetMessage, UA_DataSetWriter *dataSetWriter)
UA_StatusCode UA_Server_processNetworkMessage(UA_Server *server, UA_PubSubConnection *connection, UA_NetworkMessage *msg)
Process Network Message for a ReaderGroup.
UA_StatusCode UA_TargetVariables_copy(const UA_TargetVariables *src, UA_TargetVariables *dst)
Copy the configuration of Target Variables.
UA_DataSetField * UA_DataSetField_findDSFbyId(UA_Server *server, UA_NodeId identifier)
void UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *readerGroup, UA_DataSetReader *dataSetReader, UA_DataSetMessage *dataSetMsg)
Process Network Message using DataSetReader.
UA_StatusCode UA_ReaderGroupConfig_copy(const UA_ReaderGroupConfig *src, UA_ReaderGroupConfig *dst)
UA_StatusCode UA_DataSetWriter_setPubSubState(UA_Server *server, UA_PubSubState state, UA_DataSetWriter *dataSetWriter)
struct UA_PubSubConnection UA_PubSubConnection
Connection
UA_DataSetWriter * UA_DataSetWriter_findDSWbyId(UA_Server *server, UA_NodeId identifier)
void UA_WriterGroup_publishCallback(UA_Server *server, UA_WriterGroup *writerGroup)
struct UA_DataSetWriter UA_DataSetWriter
DataSetWriter
UA_WriterGroup * UA_WriterGroup_findWGbyId(UA_Server *server, UA_NodeId identifier)
UA_StatusCode UA_ReaderGroup_addSubscribeCallback(UA_Server *server, UA_ReaderGroup *readerGroup)
SubscribeValues handling
void UA_PubSubConnection_clear(UA_Server *server, UA_PubSubConnection *connection)
UA_StatusCode UA_DataSetWriterConfig_copy(const UA_DataSetWriterConfig *src, UA_DataSetWriterConfig *dst)
UA_DataSetReader * UA_ReaderGroup_findDSRbyId(UA_Server *server, UA_NodeId identifier)
UA_StatusCode UA_DataSetReader_setPubSubState(UA_Server *server, UA_PubSubState state, UA_DataSetReader *dataSetReader)
UA_StatusCode UA_PubSubConnectionConfig_copy(const UA_PubSubConnectionConfig *src, UA_PubSubConnectionConfig *dst)
UA_StatusCode UA_ReaderGroup_setPubSubState(UA_Server *server, UA_PubSubState state, UA_ReaderGroup *readerGroup)
UA_StatusCode receiveBufferedNetworkMessage(UA_Server *server, UA_ReaderGroup *readerGroup, UA_PubSubConnection *connection)
void(* UA_ServerCallback)(UA_Server *server, void *data)
Definition util.h:25