17#ifndef UA_SUBSCRIPTION_H_
18#define UA_SUBSCRIPTION_H_
30#ifdef UA_ENABLE_SUBSCRIPTIONS
48#define UA_SUBSCRIPTION_QUEUE_SENTINEL ((UA_Notification*)0x01)
58#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
63#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
97 NotificationMessageQueue;
308#ifdef UA_ENABLE_DIAGNOSTICS
370#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
379#define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
380 if(SRC > BOUNDS.max) DST = BOUNDS.max; \
381 else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
387#define UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, LEVEL, SUB, MSG, ...) \
389 if((SUB) && (SUB)->session) { \
390 UA_LOG_##LEVEL##_SESSION(LOGGER, (SUB)->session, \
391 "Subscription %" PRIu32 " | " MSG "%.0s", \
392 (SUB)->subscriptionId, __VA_ARGS__); \
394 UA_LOG_##LEVEL(LOGGER, UA_LOGCATEGORY_SERVER, \
395 "Subscription %" PRIu32 " | " MSG "%.0s", \
396 (SUB) ? (SUB)->subscriptionId : 0, __VA_ARGS__); \
400#if UA_LOGLEVEL <= 100
401# define UA_LOG_TRACE_SUBSCRIPTION(LOGGER, SUB, ...) \
402 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, TRACE, SUB, __VA_ARGS__, ""))
404# define UA_LOG_TRACE_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
407#if UA_LOGLEVEL <= 200
408# define UA_LOG_DEBUG_SUBSCRIPTION(LOGGER, SUB, ...) \
409 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, DEBUG, SUB, __VA_ARGS__, ""))
411# define UA_LOG_DEBUG_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
414#if UA_LOGLEVEL <= 300
415# define UA_LOG_INFO_SUBSCRIPTION(LOGGER, SUB, ...) \
416 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, INFO, SUB, __VA_ARGS__, ""))
418# define UA_LOG_INFO_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
421#if UA_LOGLEVEL <= 400
422# define UA_LOG_WARNING_SUBSCRIPTION(LOGGER, SUB, ...) \
423 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, WARNING, SUB, __VA_ARGS__, ""))
425# define UA_LOG_WARNING_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
428#if UA_LOGLEVEL <= 500
429# define UA_LOG_ERROR_SUBSCRIPTION(LOGGER, SUB, ...) \
430 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, ERROR, SUB, __VA_ARGS__, ""))
432# define UA_LOG_ERROR_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
435#if UA_LOGLEVEL <= 600
436# define UA_LOG_FATAL_SUBSCRIPTION(LOGGER, SUB, ...) \
437 UA_MACRO_EXPAND(UA_LOG_SUBSCRIPTION_INTERNAL(LOGGER, FATAL, SUB, __VA_ARGS__, ""))
439# define UA_LOG_FATAL_SUBSCRIPTION(LOGGER, SUB, ...) do {} while(0)
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
#define TAILQ_HEAD(name, type)
LIST_ENTRY(UA_MonitoredItem) listEntry
size_t triggeringLinksSize
UA_MonitoringMode monitoringMode
UA_ReadValueId itemToMonitor
union UA_MonitoredItem::@45 sampling
UA_Subscription * subscription
UA_MonitoringParameters parameters
UA_TimestampsToReturn timestampsToReturn
UA_MonitoredItem * nodeListNext
UA_TimerEntry delayedFreePointers
UA_UInt32 * triggeringLinks
UA_DateTime triggeredUntil
UA_MonitoredItemSamplingType samplingType
UA_UInt32 monitoredItemId
A NotificationMessage contains an array of notifications.
TAILQ_ENTRY(UA_NotificationMessageEntry) listEntry
UA_NotificationMessage message
TAILQ_ENTRY(UA_Notification) globalEntry
TAILQ_ENTRY(UA_Notification) localEntry
UA_EventFilterResult result
UA_Boolean isOverflowEvent
union UA_Notification::@44 data
UA_MonitoredItemNotification dataChange
Subscriptions are managed in a server-wide linked list.
UA_UInt32 currentLifetimeCount
UA_UInt32 notificationsPerPublish
size_t retransmissionQueueSize
LIST_HEAD(, UA_MonitoredItem) monitoredItems
UA_UInt32 lastMonitoredItemId
UA_UInt32 monitoredItemsSize
UA_UInt32 notificationQueueSize
UA_Boolean publishingEnabled
UA_UInt32 dataChangeNotifications
UA_UInt32 currentKeepAliveCount
UA_Double publishingInterval
TAILQ_HEAD(, UA_Notification) notificationQueue
UA_UInt32 eventNotifications
UA_SubscriptionState state
UA_UInt32 nextSequenceNumber
UA_UInt64 publishCallbackId
LIST_HEAD(, UA_MonitoredItem) samplingMonitoredItems
UA_TimerEntry delayedFreePointers
NotificationMessageQueue retransmissionQueue
UA_StatusCode statusChange
LIST_ENTRY(UA_Subscription) serverListEntry
UA_UInt32 maxKeepAliveCount
TAILQ_ENTRY(UA_Subscription) sessionListEntry
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_StatusCode UA_MonitoredItem_registerSampling(UA_Server *server, UA_MonitoredItem *mon)
Register sampling.
UA_StatusCode UA_MonitoredItem_createDataChangeNotification(UA_Server *server, UA_Subscription *sub, UA_MonitoredItem *mon, const UA_DataValue *value)
void UA_Event_staticSelectClauseValidation(UA_Server *server, const UA_EventFilter *eventFilter, UA_StatusCode *result)
struct UA_NotificationMessageEntry UA_NotificationMessageEntry
A NotificationMessage contains an array of notifications.
UA_SubscriptionState
Subscription.
@ UA_SUBSCRIPTIONSTATE_KEEPALIVE
@ UA_SUBSCRIPTIONSTATE_LATE
@ UA_SUBSCRIPTIONSTATE_NORMAL
void UA_MonitoredItem_removeOverflowInfoBits(UA_MonitoredItem *mon)
UA_Boolean UA_Subscription_publishOnce(UA_Server *server, UA_Subscription *sub)
void UA_Notification_delete(UA_Notification *n)
Dequeue and delete the notification.
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)
void UA_Subscription_delete(UA_Server *server, UA_Subscription *sub)
UA_StatusCode UA_Server_evaluateWhereClauseContentFilter(UA_Server *server, UA_Session *session, const UA_NodeId *eventNode, const UA_ContentFilter *contentFilter, UA_ContentFilterResult *contentFilterResult)
Helpers.
UA_StatusCode UA_Event_addEventToMonitoredItem(UA_Server *server, const UA_NodeId *event, UA_MonitoredItem *mon)
void UA_Notification_enqueueAndTrigger(UA_Server *server, UA_Notification *n)
Notifications are always added to the queue of the MonitoredItem.
void UA_MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem)
struct UA_Notification UA_Notification
UA_StatusCode UA_Event_generateEventId(UA_ByteString *generatedId)
UA_MonitoredItem * UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemId)
UA_StatusCode UA_MonitoredItem_setMonitoringMode(UA_Server *server, UA_MonitoredItem *mon, UA_MonitoringMode monitoringMode)
UA_Notification * UA_Notification_new(void)
Initializes and sets the sentinel pointers.
void UA_MonitoredItem_ensureQueueSpace(UA_Server *server, UA_MonitoredItem *mon)
Remove entries until mon->maxQueueSize is reached.
void UA_Server_registerMonitoredItem(UA_Server *server, UA_MonitoredItem *mon)
UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber)
void Subscription_unregisterPublishCallback(UA_Server *server, UA_Subscription *sub)
struct UA_ConditionSource UA_ConditionSource
void UA_Subscription_sampleAndPublish(UA_Server *server, UA_Subscription *sub)
UA_MonitoredItemSamplingType
MonitoredItem.
@ UA_MONITOREDITEMSAMPLINGTYPE_CYCLIC
@ UA_MONITOREDITEMSAMPLINGTYPE_EVENT
@ UA_MONITOREDITEMSAMPLINGTYPE_PUBLISH
@ UA_MONITOREDITEMSAMPLINGTYPE_NONE
void UA_MonitoredItem_init(UA_MonitoredItem *mon)
void UA_MonitoredItem_unregisterSampling(UA_Server *server, UA_MonitoredItem *mon)
UA_Subscription * UA_Subscription_new(void)
UA_StatusCode UA_Event_staticWhereClauseValidation(UA_Server *server, const UA_ContentFilter *filter, UA_ContentFilterResult *)
void UA_Subscription_publish(UA_Server *server, UA_Subscription *sub)
UA_StatusCode Subscription_registerPublishCallback(UA_Server *server, UA_Subscription *sub)
UA_Boolean UA_Session_reachedPublishReqLimit(UA_Server *server, UA_Session *session)
UA_StatusCode UA_MonitoredItem_addLink(UA_Subscription *sub, UA_MonitoredItem *mon, UA_UInt32 linkId)