open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_subscription.h File Reference

Go to the source code of this file.

Data Structures

struct  UA_Notification
 
struct  UA_NotificationMessageEntry
 
struct  UA_MonitoredItem
 
struct  UA_Subscription
 

Macros

#define UA_SUBSCRIPTION_QUEUE_SENTINEL   ((UA_Notification*)0x01)
 
#define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST)
 
#define UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, LEVEL, SUB, MSG, ...)
 
#define UA_LOG_TRACE_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, TRACE, SUB, __VA_ARGS__, ""))
 
#define UA_LOG_DEBUG_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, DEBUG, SUB, __VA_ARGS__, ""))
 
#define UA_LOG_INFO_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, INFO, SUB, __VA_ARGS__, ""))
 
#define UA_LOG_WARNING_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, WARNING, SUB, __VA_ARGS__, ""))
 
#define UA_LOG_ERROR_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, ERROR, SUB, __VA_ARGS__, ""))
 
#define UA_LOG_FATAL_SUBSCRIPTION(LOGGER, SUB, ...)    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, FATAL, SUB, __VA_ARGS__, ""))
 

Typedefs

typedef struct UA_Notification UA_Notification
 
typedef struct UA_NotificationMessageEntry UA_NotificationMessageEntry
 
typedef struct UA_ConditionSource UA_ConditionSource
 

Enumerations

enum  UA_MonitoredItemSamplingType
 
enum  UA_SubscriptionState
 

Functions

UA_NotificationUA_Notification_new (void)
 
void UA_Notification_enqueueAndTrigger (UA_Server *server, UA_Notification *n)
 
void UA_Notification_delete (UA_Notification *n)
 
typedef TAILQ_HEAD (NotificationQueue, UA_Notification) NotificationQueue
 
typedef TAILQ_HEAD (NotificationMessageQueue, UA_NotificationMessageEntry) NotificationMessageQueue
 
void UA_MonitoredItem_init (UA_MonitoredItem *mon)
 
void UA_MonitoredItem_delete (UA_Server *server, UA_MonitoredItem *monitoredItem)
 
void UA_MonitoredItem_removeOverflowInfoBits (UA_MonitoredItem *mon)
 
void UA_Server_registerMonitoredItem (UA_Server *server, UA_MonitoredItem *mon)
 
UA_StatusCode UA_MonitoredItem_registerSampling (UA_Server *server, UA_MonitoredItem *mon)
 
void UA_MonitoredItem_unregisterSampling (UA_Server *server, UA_MonitoredItem *mon)
 
UA_StatusCode UA_MonitoredItem_setMonitoringMode (UA_Server *server, UA_MonitoredItem *mon, UA_MonitoringMode monitoringMode)
 
void UA_MonitoredItem_sampleCallback (UA_Server *server, UA_MonitoredItem *monitoredItem)
 
UA_StatusCode sampleCallbackWithValue (UA_Server *server, UA_Subscription *sub, UA_MonitoredItem *mon, UA_DataValue *value)
 
UA_StatusCode UA_MonitoredItem_removeLink (UA_Subscription *sub, UA_MonitoredItem *mon, UA_UInt32 linkId)
 
UA_StatusCode UA_MonitoredItem_addLink (UA_Subscription *sub, UA_MonitoredItem *mon, UA_UInt32 linkId)
 
UA_StatusCode UA_MonitoredItem_createDataChangeNotification (UA_Server *server, UA_Subscription *sub, UA_MonitoredItem *mon, const UA_DataValue *value)
 
UA_StatusCode UA_Event_addEventToMonitoredItem (UA_Server *server, const UA_NodeId *event, UA_MonitoredItem *mon)
 
UA_StatusCode UA_Event_generateEventId (UA_ByteString *generatedId)
 
void UA_Event_staticSelectClauseValidation (UA_Server *server, const UA_EventFilter *eventFilter, UA_StatusCode *result)
 
UA_StatusCode UA_Event_staticWhereClauseValidation (UA_Server *server, const UA_ContentFilter *filter, UA_ContentFilterResult *)
 
void UA_MonitoredItem_ensureQueueSpace (UA_Server *server, UA_MonitoredItem *mon)
 
UA_SubscriptionUA_Subscription_new (void)
 
void UA_Subscription_delete (UA_Server *server, UA_Subscription *sub)
 
UA_StatusCode Subscription_registerPublishCallback (UA_Server *server, UA_Subscription *sub)
 
void Subscription_unregisterPublishCallback (UA_Server *server, UA_Subscription *sub)
 
UA_MonitoredItemUA_Subscription_getMonitoredItem (UA_Subscription *sub, UA_UInt32 monitoredItemId)
 
void UA_Subscription_sampleAndPublish (UA_Server *server, UA_Subscription *sub)
 
UA_Boolean UA_Subscription_publishOnce (UA_Server *server, UA_Subscription *sub)
 
void UA_Subscription_publish (UA_Server *server, UA_Subscription *sub)
 
UA_StatusCode UA_Subscription_removeRetransmissionMessage (UA_Subscription *sub, UA_UInt32 sequenceNumber)
 
UA_Boolean UA_Session_reachedPublishReqLimit (UA_Server *server, UA_Session *session)
 
UA_StatusCode UA_Server_evaluateWhereClauseContentFilter (UA_Server *server, UA_Session *session, const UA_NodeId *eventNode, const UA_ContentFilter *contentFilter, UA_ContentFilterResult *contentFilterResult)
 

Macro Definition Documentation

◆ UA_SUBSCRIPTION_QUEUE_SENTINEL

#define UA_SUBSCRIPTION_QUEUE_SENTINEL   ((UA_Notification*)0x01)

This Source Code Form is subject to the terms of the Mozilla Public License, v.

2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 2015-2018, 2021-2022 (c) Fraunhofer IOSB (Author: Julius Pfrommer) Copyright 2015 (c) Chris Iatrou Copyright 2015-2016 (c) Sten GrĂ¼ner Copyright 2015 (c) Oleksiy Vasylyev Copyright 2017 (c) Florian Palm Copyright 2017 (c) Stefan Profanter, fortiss GmbH Copyright 2017 (c) Mattias Bornhager Copyright 2019 (c) HMS Industrial Networks AB (Author: Jonas Green) Copyright 2020 (c) Christian von Arnim, ISW University of Stuttgart (for VDW and umati) Copyright 2021 (c) Fraunhofer IOSB (Author: Andreas Ebner) MonitoredItems create Notifications. Subscriptions collect Notifications from (several) MonitoredItems and publish them to the client.

Notifications are put into two queues at the same time. One for the MonitoredItem that generated the notification. Here we can remove it if the space reserved for the MonitoredItem runs full. The second queue is the "global" queue for all Notifications generated in a Subscription. For publication, the notifications are taken out of the "global" queue in the order of their creation. Notifications Set to the TAILQ_NEXT pointer of a notification, the sentinel that the notification was not added to the global queue

Definition at line 48 of file ua_subscription.h.

◆ UA_BOUNDEDVALUE_SETWBOUNDS

#define UA_BOUNDEDVALUE_SETWBOUNDS ( BOUNDS,
SRC,
DST )
Value:
{ \
if(SRC > BOUNDS.max) DST = BOUNDS.max; \
else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
else DST = SRC; \
}

Setting an integer value within bounds.

Definition at line 379 of file ua_subscription.h.

◆ UA_LOG_SUBSCRIPTION_INTERNAL

#define UA_LOG_SUBSCRIPTION_INTERNAL ( LOGGER,
LEVEL,
SUB,
MSG,
... )
Value:
do { \
if((SUB) && (SUB)->session) { \
UA_LOG_##LEVEL##_SESSION(LOGGER, (SUB)->session, \
"Subscription %" PRIu32 " | " MSG "%.0s", \
(SUB)->subscriptionId, __VA_ARGS__); \
} else { \
UA_LOG_##LEVEL(LOGGER, UA_LOGCATEGORY_SERVER, \
"Subscription %" PRIu32 " | " MSG "%.0s", \
(SUB) ? (SUB)->subscriptionId : 0, __VA_ARGS__); \
} \
} while(0)
@ UA_LOGCATEGORY_SERVER
Definition log.h:33

Logging See a description of the tricks used in ua_session.h.

Definition at line 387 of file ua_subscription.h.

◆ UA_LOG_TRACE_SUBSCRIPTION

#define UA_LOG_TRACE_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, TRACE, SUB, __VA_ARGS__, ""))

Definition at line 401 of file ua_subscription.h.

◆ UA_LOG_DEBUG_SUBSCRIPTION

#define UA_LOG_DEBUG_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, DEBUG, SUB, __VA_ARGS__, ""))

Definition at line 408 of file ua_subscription.h.

◆ UA_LOG_INFO_SUBSCRIPTION

#define UA_LOG_INFO_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, INFO, SUB, __VA_ARGS__, ""))

Definition at line 415 of file ua_subscription.h.

◆ UA_LOG_WARNING_SUBSCRIPTION

#define UA_LOG_WARNING_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, WARNING, SUB, __VA_ARGS__, ""))

Definition at line 422 of file ua_subscription.h.

◆ UA_LOG_ERROR_SUBSCRIPTION

#define UA_LOG_ERROR_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, ERROR, SUB, __VA_ARGS__, ""))

Definition at line 429 of file ua_subscription.h.

◆ UA_LOG_FATAL_SUBSCRIPTION

#define UA_LOG_FATAL_SUBSCRIPTION ( LOGGER,
SUB,
... )    UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, FATAL, SUB, __VA_ARGS__, ""))

Definition at line 436 of file ua_subscription.h.

Typedef Documentation

◆ UA_Notification

typedef struct UA_Notification UA_Notification

◆ UA_NotificationMessageEntry

typedef struct UA_NotificationMessageEntry UA_NotificationMessageEntry

A NotificationMessage contains an array of notifications.

Sent NotificationMessages are stored for the republish service.

◆ UA_ConditionSource

Definition at line 363 of file ua_subscription.h.

Enumeration Type Documentation

◆ UA_MonitoredItemSamplingType

MonitoredItem.

The type of sampling for MonitoredItems depends on the sampling interval.

>0: Cyclic callback =0: Attached to the node. Sampling is triggered after every "write". <0: Attached to the subscription. Triggered just before every "publish".

Enumerator
UA_MONITOREDITEMSAMPLINGTYPE_NONE 
UA_MONITOREDITEMSAMPLINGTYPE_CYCLIC 
UA_MONITOREDITEMSAMPLINGTYPE_EVENT 
UA_MONITOREDITEMSAMPLINGTYPE_PUBLISH 

Definition at line 108 of file ua_subscription.h.

◆ UA_SubscriptionState

Subscription.

We use only a subset of the states defined in the standard

Enumerator
UA_SUBSCRIPTIONSTATE_NORMAL 
UA_SUBSCRIPTIONSTATE_LATE 
UA_SUBSCRIPTIONSTATE_KEEPALIVE 

Definition at line 245 of file ua_subscription.h.

Function Documentation

◆ UA_Notification_new()

UA_Notification * UA_Notification_new ( void )

Initializes and sets the sentinel pointers.

◆ UA_Notification_enqueueAndTrigger()

void UA_Notification_enqueueAndTrigger ( UA_Server * server,
UA_Notification * n )

Notifications are always added to the queue of the MonitoredItem.

That queue can overflow. If Notifications are reported, they are also added to the global queue of the Subscription. There they are picked up by the publishing callback.

There are two ways Notifications can be put into the global queue of the Subscription: They are added because the MonitoringMode of the MonitoredItem is "reporting". Or the MonitoringMode is "sampling" and a link is trigered that puts the last Notification into the global queue.

◆ UA_Notification_delete()

void UA_Notification_delete ( UA_Notification * n)

Dequeue and delete the notification.

◆ TAILQ_HEAD() [1/2]

typedef TAILQ_HEAD ( NotificationQueue ,
UA_Notification  )

Queue Definitions.

◆ TAILQ_HEAD() [2/2]

typedef TAILQ_HEAD ( NotificationMessageQueue ,
UA_NotificationMessageEntry  )

◆ UA_MonitoredItem_init()

void UA_MonitoredItem_init ( UA_MonitoredItem * mon)

◆ UA_MonitoredItem_delete()

void UA_MonitoredItem_delete ( UA_Server * server,
UA_MonitoredItem * monitoredItem )

◆ UA_MonitoredItem_removeOverflowInfoBits()

void UA_MonitoredItem_removeOverflowInfoBits ( UA_MonitoredItem * mon)

◆ UA_Server_registerMonitoredItem()

void UA_Server_registerMonitoredItem ( UA_Server * server,
UA_MonitoredItem * mon )

◆ UA_MonitoredItem_registerSampling()

UA_StatusCode UA_MonitoredItem_registerSampling ( UA_Server * server,
UA_MonitoredItem * mon )

Register sampling.

Either by adding a repeated callback or by adding the MonitoredItem to a linked list in the node.

◆ UA_MonitoredItem_unregisterSampling()

void UA_MonitoredItem_unregisterSampling ( UA_Server * server,
UA_MonitoredItem * mon )

◆ UA_MonitoredItem_setMonitoringMode()

UA_StatusCode UA_MonitoredItem_setMonitoringMode ( UA_Server * server,
UA_MonitoredItem * mon,
UA_MonitoringMode monitoringMode )

◆ UA_MonitoredItem_sampleCallback()

void UA_MonitoredItem_sampleCallback ( UA_Server * server,
UA_MonitoredItem * monitoredItem )

◆ sampleCallbackWithValue()

UA_StatusCode sampleCallbackWithValue ( UA_Server * server,
UA_Subscription * sub,
UA_MonitoredItem * mon,
UA_DataValue * value )

◆ UA_MonitoredItem_removeLink()

UA_StatusCode UA_MonitoredItem_removeLink ( UA_Subscription * sub,
UA_MonitoredItem * mon,
UA_UInt32 linkId )

◆ UA_MonitoredItem_addLink()

UA_StatusCode UA_MonitoredItem_addLink ( UA_Subscription * sub,
UA_MonitoredItem * mon,
UA_UInt32 linkId )

◆ UA_MonitoredItem_createDataChangeNotification()

UA_StatusCode UA_MonitoredItem_createDataChangeNotification ( UA_Server * server,
UA_Subscription * sub,
UA_MonitoredItem * mon,
const UA_DataValue * value )

◆ UA_Event_addEventToMonitoredItem()

UA_StatusCode UA_Event_addEventToMonitoredItem ( UA_Server * server,
const UA_NodeId * event,
UA_MonitoredItem * mon )

◆ UA_Event_generateEventId()

UA_StatusCode UA_Event_generateEventId ( UA_ByteString * generatedId)

◆ UA_Event_staticSelectClauseValidation()

void UA_Event_staticSelectClauseValidation ( UA_Server * server,
const UA_EventFilter * eventFilter,
UA_StatusCode * result )

◆ UA_Event_staticWhereClauseValidation()

UA_StatusCode UA_Event_staticWhereClauseValidation ( UA_Server * server,
const UA_ContentFilter * filter,
UA_ContentFilterResult *  )

◆ UA_MonitoredItem_ensureQueueSpace()

void UA_MonitoredItem_ensureQueueSpace ( UA_Server * server,
UA_MonitoredItem * mon )

Remove entries until mon->maxQueueSize is reached.

Sets infobits for lost data if required.

◆ UA_Subscription_new()

UA_Subscription * UA_Subscription_new ( void )

◆ UA_Subscription_delete()

void UA_Subscription_delete ( UA_Server * server,
UA_Subscription * sub )

◆ Subscription_registerPublishCallback()

UA_StatusCode Subscription_registerPublishCallback ( UA_Server * server,
UA_Subscription * sub )

◆ Subscription_unregisterPublishCallback()

void Subscription_unregisterPublishCallback ( UA_Server * server,
UA_Subscription * sub )

◆ UA_Subscription_getMonitoredItem()

UA_MonitoredItem * UA_Subscription_getMonitoredItem ( UA_Subscription * sub,
UA_UInt32 monitoredItemId )

◆ UA_Subscription_sampleAndPublish()

void UA_Subscription_sampleAndPublish ( UA_Server * server,
UA_Subscription * sub )

◆ UA_Subscription_publishOnce()

UA_Boolean UA_Subscription_publishOnce ( UA_Server * server,
UA_Subscription * sub )

◆ UA_Subscription_publish()

void UA_Subscription_publish ( UA_Server * server,
UA_Subscription * sub )

◆ UA_Subscription_removeRetransmissionMessage()

UA_StatusCode UA_Subscription_removeRetransmissionMessage ( UA_Subscription * sub,
UA_UInt32 sequenceNumber )

◆ UA_Session_reachedPublishReqLimit()

UA_Boolean UA_Session_reachedPublishReqLimit ( UA_Server * server,
UA_Session * session )

◆ UA_Server_evaluateWhereClauseContentFilter()

UA_StatusCode UA_Server_evaluateWhereClauseContentFilter ( UA_Server * server,
UA_Session * session,
const UA_NodeId * eventNode,
const UA_ContentFilter * contentFilter,
UA_ContentFilterResult * contentFilterResult )

Helpers.

Evaluate content filter, Only for unit testing