浏览代码

rename MonitoredItem_queuedValue to UA_Notification and itemId to monitoredItemId

StalderT 6 年之前
父节点
当前提交
c4eae725c9

+ 1 - 1
src/server/ua_server_ns0.c

@@ -509,7 +509,7 @@ readMonitoredItems(UA_Server *server, const UA_NodeId *sessionId, void *sessionC
     UA_UInt32 i = 0;
     LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
         clientHandles[i] = monitoredItem->clientHandle;
-        serverHandles[i] = monitoredItem->itemId;
+        serverHandles[i] = monitoredItem->monitoredItemId;
         ++i;
     }
     UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);

+ 7 - 7
src/server/ua_services_subscription.c

@@ -274,7 +274,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, struct cre
     newMon->subscription = cmc->sub;
     newMon->attributeId = request->itemToMonitor.attributeId;
     UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange);
-    newMon->itemId = ++(cmc->sub->lastMonitoredItemId);
+    newMon->monitoredItemId = ++(cmc->sub->lastMonitoredItemId);
     newMon->timestampsToReturn = cmc->timestampsToReturn;
     setMonitoredItemSettings(server, newMon, request->monitoringMode,
                              &request->requestedParameters);
@@ -288,7 +288,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, struct cre
     /* Prepare the response */
     result->revisedSamplingInterval = newMon->samplingInterval;
     result->revisedQueueSize = newMon->maxQueueSize;
-    result->monitoredItemId = newMon->itemId;
+    result->monitoredItemId = newMon->monitoredItemId;
 }
 
 void
@@ -416,11 +416,11 @@ Operation_SetMonitoringMode(UA_Server *server, UA_Session *session,
     } else {
         // TODO correctly implement SAMPLING
         /*  Setting the mode to DISABLED or SAMPLING causes all queued Notifications to be delete */
-        MonitoredItem_queuedValue *val, *val_tmp;
-        TAILQ_FOREACH_SAFE(val, &mon->queue, listEntry, val_tmp) {
-            TAILQ_REMOVE(&mon->queue, val, listEntry);
-            UA_DataValue_deleteMembers(&val->data.value);
-            UA_free(val);
+        UA_Notification *notification, *notification_tmp;
+        TAILQ_FOREACH_SAFE(notification, &mon->queue, listEntry, notification_tmp) {
+            TAILQ_REMOVE(&mon->queue, notification, listEntry);
+            UA_DataValue_deleteMembers(&notification->data.value);
+            UA_free(notification);
         }
         mon->currentQueueSize = 0;
 

+ 11 - 11
src/server/ua_subscription.c

@@ -71,7 +71,7 @@ UA_Subscription_getMonitoredItem(UA_Subscription *sub,
                                  UA_UInt32 monitoredItemId) {
     UA_MonitoredItem *mon;
     LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
-        if(mon->itemId == monitoredItemId)
+        if(mon->monitoredItemId == monitoredItemId)
             break;
     }
     return mon;
@@ -83,7 +83,7 @@ UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub,
     /* Find the MonitoredItem */
     UA_MonitoredItem *mon;
     LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
-        if(mon->itemId == monitoredItemId)
+        if(mon->monitoredItemId == monitoredItemId)
             break;
     }
     if(!mon)
@@ -151,21 +151,21 @@ static void
 moveNotificationsFromMonitoredItems(UA_Subscription *sub, UA_MonitoredItemNotification *mins,
                                     size_t minsSize) {
     size_t pos = 0;
-    MonitoredItem_queuedValue *qv, *qv_tmp;
-    TAILQ_FOREACH_SAFE(qv, &sub->notificationQueue, globalEntry, qv_tmp) {
+    UA_Notification *notification, *notification_tmp;
+    TAILQ_FOREACH_SAFE(notification, &sub->notificationQueue, globalEntry, notification_tmp) {
         if(pos >= minsSize)
             return;
         UA_MonitoredItemNotification *min = &mins[pos];
-        min->clientHandle = qv->clientHandle;
-        if(qv->mon->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
-            min->value = qv->data.value;
+        min->clientHandle = notification->clientHandle;
+        if(notification->mon->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
+            min->value = notification->data.value;
         } else {
             /* TODO implementation for events */
         }
-        TAILQ_REMOVE(&sub->notificationQueue, qv, globalEntry);
-        TAILQ_REMOVE(&qv->mon->queue, qv, listEntry);
-        --(qv->mon->currentQueueSize);
-        UA_free(qv);
+        TAILQ_REMOVE(&sub->notificationQueue, notification, globalEntry);
+        TAILQ_REMOVE(&notification->mon->queue, notification, listEntry);
+        --(notification->mon->currentQueueSize);
+        UA_free(notification);
         --sub->readyNotifications;
         ++pos;
     }

+ 25 - 22
src/server/ua_subscription.h

@@ -29,20 +29,35 @@ typedef enum {
     UA_MONITOREDITEMTYPE_EVENTNOTIFY = 4
 } UA_MonitoredItemType;
 
-
-/* not used yet, placeholder for event implementation */
+/* Not used yet. Placeholder for a future event implementation. */
 typedef struct UA_Event {
    UA_Int32 eventId;
 } UA_Event;
 
-typedef TAILQ_HEAD(QueuedValueQueue, MonitoredItem_queuedValue) QueuedValueQueue;
+struct UA_MonitoredItem;
+typedef struct UA_MonitoredItem UA_MonitoredItem;
+
+typedef struct UA_Notification {
+    TAILQ_ENTRY(UA_Notification) listEntry;
+    TAILQ_ENTRY(UA_Notification) globalEntry;
+
+    UA_MonitoredItem *mon;
+
+    UA_UInt32 clientHandle;
+    union {
+        UA_Event event;
+        UA_DataValue value;
+    } data;
+} UA_Notification;
+
+typedef TAILQ_HEAD(NotificationQueue, UA_Notification) NotificationQueue;
 
-typedef struct UA_MonitoredItem {
+struct UA_MonitoredItem {
     LIST_ENTRY(UA_MonitoredItem) listEntry;
 
     /* Settings */
     UA_Subscription *subscription;
-    UA_UInt32 itemId;
+    UA_UInt32 monitoredItemId;
     UA_MonitoredItemType monitoredItemType;
     UA_TimestampsToReturn timestampsToReturn;
     UA_MonitoringMode monitoringMode;
@@ -63,21 +78,8 @@ typedef struct UA_MonitoredItem {
 
     /* Sample Queue */
     UA_ByteString lastSampledValue;
-    QueuedValueQueue queue;
-} UA_MonitoredItem;
-
-typedef struct MonitoredItem_queuedValue {
-    TAILQ_ENTRY(MonitoredItem_queuedValue) listEntry;
-    TAILQ_ENTRY(MonitoredItem_queuedValue) globalEntry;
-
-    UA_MonitoredItem *mon;
-
-    UA_UInt32 clientHandle;
-    union {
-        UA_Event event;
-        UA_DataValue value;
-    } data;
-} MonitoredItem_queuedValue;
+    NotificationQueue queue;
+};
 
 UA_MonitoredItem * UA_MonitoredItem_new(UA_MonitoredItemType);
 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem);
@@ -88,7 +90,8 @@ UA_StatusCode MonitoredItem_unregisterSampleCallback(UA_Server *server, UA_Monit
 /* Remove entries until mon->maxQueueSize is reached. Sets infobits for lost
  * data if required. Insert newQueuedItem in global list if non NULL */
 void
-MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon, MonitoredItem_queuedValue *newQueuedItem);
+MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon,
+                               UA_Notification *newNotification);
 
 /****************/
 /* Subscription */
@@ -138,7 +141,7 @@ struct UA_Subscription {
     /* MonitoredItems */
     LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems;
 
-    QueuedValueQueue notificationQueue;
+    NotificationQueue notificationQueue;
 
     /* count number of notifications present before last repeated publish callback */
     UA_UInt32 readyNotifications;

+ 48 - 48
src/server/ua_subscription_datachange.c

@@ -36,21 +36,21 @@ MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
     UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
                            "Subscription %u | MonitoredItem %i | "
                            "Delete the MonitoredItem",
-                           sub->subscriptionId, monitoredItem->itemId);
+                           sub->subscriptionId, monitoredItem->monitoredItemId);
 
     if(monitoredItem->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
         /* Remove the sampling callback */
         MonitoredItem_unregisterSampleCallback(server, monitoredItem);
 
         /* Clear the queued samples */
-        MonitoredItem_queuedValue *val, *val_tmp;
-        TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) {
-            TAILQ_REMOVE(&monitoredItem->queue, val, listEntry);
+        UA_Notification *notification, *notification_tmp;
+        TAILQ_FOREACH_SAFE(notification, &monitoredItem->queue, listEntry, notification_tmp) {
+            TAILQ_REMOVE(&monitoredItem->queue, notification, listEntry);
 
             /* Remove the item in the global queue */
-            TAILQ_REMOVE(&sub->notificationQueue, val, globalEntry);
-            UA_DataValue_deleteMembers(&val->data.value);
-            UA_free(val);
+            TAILQ_REMOVE(&sub->notificationQueue, notification, globalEntry);
+            UA_DataValue_deleteMembers(&notification->data.value);
+            UA_free(notification);
 
             if (sub->pendingNotifications)
                 sub->pendingNotifications--;
@@ -73,9 +73,10 @@ MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
 }
 
 void
-MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon, MonitoredItem_queuedValue *newQueuedItem) {
+MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon,
+                               UA_Notification *newNotification) {
     UA_Boolean valueDiscarded = false;
-    MonitoredItem_queuedValue *queueItem;
+    UA_Notification *notification;
 #ifndef __clang_analyzer__
     while(mon->currentQueueSize > mon->maxQueueSize) {
         /* maxQueuesize is at least 1 */
@@ -84,31 +85,31 @@ MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon, Moni
         /* Get the item to remove. New items are added to the end */
         if(mon->discardOldest) {
             /* Remove the oldest */
-            queueItem = TAILQ_FIRST(&mon->queue);
+            notification = TAILQ_FIRST(&mon->queue);
         } else {
             /* Keep the newest, remove the second-newest */
-            queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-            queueItem = TAILQ_PREV(queueItem, QueuedValueQueue, listEntry);
+            notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+            notification = TAILQ_PREV(notification, NotificationQueue, listEntry);
         }
-        UA_assert(queueItem);
+        UA_assert(notification);
 
         /* Remove the item */
-        TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
+        TAILQ_REMOVE(&mon->queue, notification, listEntry);
         if(mon->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
-            UA_DataValue_deleteMembers(&queueItem->data.value);
+            UA_DataValue_deleteMembers(&notification->data.value);
         } else {
             //TODO: event implemantation
         }
 
-        MonitoredItem_queuedValue *nextGlobalQueueItem = TAILQ_NEXT(queueItem, globalEntry);
-        TAILQ_REMOVE(&sub->notificationQueue, queueItem, globalEntry);
+        UA_Notification *nextGlobalNotification = TAILQ_NEXT(notification, globalEntry);
+        TAILQ_REMOVE(&sub->notificationQueue, notification, globalEntry);
 
-        if(newQueuedItem) {
-            if(nextGlobalQueueItem)
-                TAILQ_INSERT_BEFORE(nextGlobalQueueItem, newQueuedItem, globalEntry);
+        if(newNotification) {
+            if(nextGlobalNotification)
+                TAILQ_INSERT_BEFORE(nextGlobalNotification, newNotification, globalEntry);
             else
-                TAILQ_INSERT_TAIL(&sub->notificationQueue, newQueuedItem, globalEntry);
-            newQueuedItem = NULL;
+                TAILQ_INSERT_TAIL(&sub->notificationQueue, newNotification, globalEntry);
+            newNotification = NULL;
         } else { 
             if (sub->pendingNotifications)
                 --sub->pendingNotifications;
@@ -116,7 +117,7 @@ MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon, Moni
                 --sub->readyNotifications;
         }
 
-        UA_free(queueItem);
+        UA_free(notification);
         --mon->currentQueueSize;
         valueDiscarded = true;
     }
@@ -128,26 +129,26 @@ MonitoredItem_ensureQueueSpace(UA_Subscription *sub, UA_MonitoredItem *mon, Moni
     if(mon->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
         /* Get the element that carries the infobits */
         if(mon->discardOldest)
-            queueItem = TAILQ_FIRST(&mon->queue);
+            notification = TAILQ_FIRST(&mon->queue);
         else
-            queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-        UA_assert(queueItem);
+            notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+        UA_assert(notification);
 
         /* If the queue size is reduced to one, remove the infobits */
         if(mon->maxQueueSize == 1) {
-            queueItem->data.value.status &= ~(UA_StatusCode) (UA_STATUSCODE_INFOTYPE_DATAVALUE |
+            notification->data.value.status &= ~(UA_StatusCode) (UA_STATUSCODE_INFOTYPE_DATAVALUE |
                                                               UA_STATUSCODE_INFOBITS_OVERFLOW);
 
             goto end;
         }
 
         /* Add the infobits either to the newest or the new last entry */
-        queueItem->data.value.hasStatus = true;
-        queueItem->data.value.status |= (UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
+        notification->data.value.hasStatus = true;
+        notification->data.value.status |= (UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
     }
 end:
-    if(newQueuedItem) {
-        TAILQ_INSERT_TAIL(&sub->notificationQueue, newQueuedItem, globalEntry);
+    if(newNotification) {
+        TAILQ_INSERT_TAIL(&sub->notificationQueue, newNotification, globalEntry);
         ++sub->pendingNotifications;
     }
 }
@@ -229,13 +230,13 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
         return false;
 
     /* Allocate the entry for the publish queue */
-    MonitoredItem_queuedValue *newQueueItem =
-        (MonitoredItem_queuedValue *)UA_malloc(sizeof(MonitoredItem_queuedValue));
-    if(!newQueueItem) {
+    UA_Notification *newNotification =
+        (UA_Notification *)UA_malloc(sizeof(UA_Notification));
+    if(!newNotification) {
         UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
                                "Subscription %u | MonitoredItem %i | "
                                "Item for the publishing queue could not be allocated",
-                               sub->subscriptionId, monitoredItem->itemId);
+                               sub->subscriptionId, monitoredItem->monitoredItemId);
         return false;
     }
 
@@ -246,8 +247,8 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
             UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
                                    "Subscription %u | MonitoredItem %i | "
                                    "ByteString to compare values could not be created",
-                                   sub->subscriptionId, monitoredItem->itemId);
-            UA_free(newQueueItem);
+                                   sub->subscriptionId, monitoredItem->monitoredItemId);
+            UA_free(newNotification);
             return false;
         }
         *valueEncoding = cbs;
@@ -256,39 +257,38 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
     /* Prepare the newQueueItem */
     if(value->hasValue && value->value.storageType == UA_VARIANT_DATA_NODELETE) {
         /* Make a deep copy of the value */
-        UA_StatusCode retval = UA_DataValue_copy(value, &newQueueItem->data.value);
+        UA_StatusCode retval = UA_DataValue_copy(value, &newNotification->data.value);
         if(retval != UA_STATUSCODE_GOOD) {
             UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
                                    "Subscription %u | MonitoredItem %i | "
                                    "Item for the publishing queue could not be prepared",
-                                   sub->subscriptionId, monitoredItem->itemId);
-            UA_free(newQueueItem);
+                                   sub->subscriptionId, monitoredItem->monitoredItemId);
+            UA_free(newNotification);
             return false;
         }
     } else {
-        newQueueItem->data.value = *value; /* Just copy the value and do not release it */
+        newNotification->data.value = *value; /* Just copy the value and do not release it */
     }
-    newQueueItem->clientHandle = monitoredItem->clientHandle;
+    newNotification->clientHandle = monitoredItem->clientHandle;
 
     /* <-- Point of no return --> */
 
     UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
                          "Subscription %u | MonitoredItem %u | Sampled a new value",
-                         sub->subscriptionId, monitoredItem->itemId);
+                         sub->subscriptionId, monitoredItem->monitoredItemId);
 
     /* Replace the encoding for comparison */
     UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
     monitoredItem->lastSampledValue = *valueEncoding;
 
     /* Add the sample to the queue for publication */
-    TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
+    TAILQ_INSERT_TAIL(&monitoredItem->queue, newNotification, listEntry);
     ++monitoredItem->currentQueueSize;
 
-
-    newQueueItem->mon = monitoredItem;
+    newNotification->mon = monitoredItem;
 
     /* Remove entries from the queue if required and add the sample to the global queue */
-    MonitoredItem_ensureQueueSpace(sub, monitoredItem, newQueueItem);
+    MonitoredItem_ensureQueueSpace(sub, monitoredItem, newNotification);
 
     return true;
 }
@@ -301,7 +301,7 @@ UA_MonitoredItem_SampleCallback(UA_Server *server,
         UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
                              "Subscription %u | MonitoredItem %i | "
                              "Not a data change notification",
-                             sub->subscriptionId, monitoredItem->itemId);
+                             sub->subscriptionId, monitoredItem->monitoredItemId);
         return;
     }
 

+ 27 - 23
tests/server/check_services_subscriptions.c

@@ -329,35 +329,36 @@ START_TEST(Server_overflow) {
     UA_assert(mon);
     ck_assert_uint_eq(mon->currentQueueSize, 1); 
     ck_assert_uint_eq(mon->maxQueueSize, 3); 
-    MonitoredItem_queuedValue *queueItem;
-    queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, false);
+    UA_Notification *notification;
+    notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, false);
 
     UA_ByteString_deleteMembers(&mon->lastSampledValue);
     UA_MonitoredItem_SampleCallback(server, mon);
     ck_assert_uint_eq(mon->currentQueueSize, 2); 
     ck_assert_uint_eq(mon->maxQueueSize, 3); 
-    queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, false);
+    notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, false);
 
     UA_ByteString_deleteMembers(&mon->lastSampledValue);
     UA_MonitoredItem_SampleCallback(server, mon);
     ck_assert_uint_eq(mon->currentQueueSize, 3); 
     ck_assert_uint_eq(mon->maxQueueSize, 3); 
-    queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, false);
+    notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, false);
 
     UA_ByteString_deleteMembers(&mon->lastSampledValue);
     UA_MonitoredItem_SampleCallback(server, mon);
     ck_assert_uint_eq(mon->currentQueueSize, 3); 
     ck_assert_uint_eq(mon->maxQueueSize, 3); 
-    queueItem = TAILQ_FIRST(&mon->queue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, true);
-    ck_assert_uint_eq(queueItem->data.value.status, UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
+    notification = TAILQ_FIRST(&mon->queue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, true);
+    ck_assert_uint_eq(notification->data.value.status,
+                      UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
 
     /* Remove status for next test */
-    queueItem->data.value.hasStatus = false;
-    queueItem->data.value.status = 0;
+    notification->data.value.hasStatus = false;
+    notification->data.value.status = 0;
 
     /* Modify the MonitoredItem */
     UA_ModifyMonitoredItemsRequest modifyMonitoredItemsRequest;
@@ -377,7 +378,8 @@ START_TEST(Server_overflow) {
     UA_ModifyMonitoredItemsResponse modifyMonitoredItemsResponse;
     UA_ModifyMonitoredItemsResponse_init(&modifyMonitoredItemsResponse);
 
-    Service_ModifyMonitoredItems(server, &adminSession, &modifyMonitoredItemsRequest, &modifyMonitoredItemsResponse);
+    Service_ModifyMonitoredItems(server, &adminSession, &modifyMonitoredItemsRequest,
+                                 &modifyMonitoredItemsResponse);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.responseHeader.serviceResult, UA_STATUSCODE_GOOD);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.resultsSize, 1);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.results[0].statusCode, UA_STATUSCODE_GOOD);
@@ -387,9 +389,10 @@ START_TEST(Server_overflow) {
 
     ck_assert_uint_eq(mon->currentQueueSize, 2); 
     ck_assert_uint_eq(mon->maxQueueSize, 2); 
-    queueItem = TAILQ_FIRST(&mon->queue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, true);
-    ck_assert_uint_eq(queueItem->data.value.status, UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
+    notification = TAILQ_FIRST(&mon->queue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, true);
+    ck_assert_uint_eq(notification->data.value.status,
+                      UA_STATUSCODE_INFOTYPE_DATAVALUE | UA_STATUSCODE_INFOBITS_OVERFLOW);
 
     /* Modify the MonitoredItem */
     UA_ModifyMonitoredItemsRequest_init(&modifyMonitoredItemsRequest);
@@ -405,7 +408,8 @@ START_TEST(Server_overflow) {
 
     UA_ModifyMonitoredItemsResponse_init(&modifyMonitoredItemsResponse);
 
-    Service_ModifyMonitoredItems(server, &adminSession, &modifyMonitoredItemsRequest, &modifyMonitoredItemsResponse);
+    Service_ModifyMonitoredItems(server, &adminSession, &modifyMonitoredItemsRequest,
+                                 &modifyMonitoredItemsResponse);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.responseHeader.serviceResult, UA_STATUSCODE_GOOD);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.resultsSize, 1);
     ck_assert_uint_eq(modifyMonitoredItemsResponse.results[0].statusCode, UA_STATUSCODE_GOOD);
@@ -415,8 +419,8 @@ START_TEST(Server_overflow) {
 
     ck_assert_uint_eq(mon->currentQueueSize, 1); 
     ck_assert_uint_eq(mon->maxQueueSize, 1); 
-    queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, false);
+    notification = TAILQ_LAST(&mon->queue, NotificationQueue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, false);
 
     /* Modify the MonitoredItem */
     UA_ModifyMonitoredItemsRequest_init(&modifyMonitoredItemsRequest);
@@ -445,8 +449,8 @@ START_TEST(Server_overflow) {
     UA_MonitoredItem_SampleCallback(server, mon);
     ck_assert_uint_eq(mon->currentQueueSize, 1); 
     ck_assert_uint_eq(mon->maxQueueSize, 1); 
-    queueItem = TAILQ_FIRST(&mon->queue);
-    ck_assert_uint_eq(queueItem->data.value.hasStatus, false); /* the infobit is only set if the queue is larger than one */
+    notification = TAILQ_FIRST(&mon->queue);
+    ck_assert_uint_eq(notification->data.value.hasStatus, false); /* the infobit is only set if the queue is larger than one */
 
     /* Remove the subscriptions */
     UA_DeleteSubscriptionsRequest deleteSubscriptionsRequest;
@@ -458,7 +462,8 @@ START_TEST(Server_overflow) {
     UA_DeleteSubscriptionsResponse deleteSubscriptionsResponse;
     UA_DeleteSubscriptionsResponse_init(&deleteSubscriptionsResponse);
 
-    Service_DeleteSubscriptions(server, &adminSession, &deleteSubscriptionsRequest, &deleteSubscriptionsResponse);
+    Service_DeleteSubscriptions(server, &adminSession, &deleteSubscriptionsRequest,
+                                &deleteSubscriptionsResponse);
     ck_assert_uint_eq(deleteSubscriptionsResponse.responseHeader.serviceResult, UA_STATUSCODE_GOOD);
     ck_assert_uint_eq(deleteSubscriptionsResponse.resultsSize, 1);
     ck_assert_uint_eq(deleteSubscriptionsResponse.results[0], UA_STATUSCODE_GOOD);
@@ -504,7 +509,6 @@ START_TEST(Server_deleteMonitoredItems) {
     ck_assert_uint_eq(response.results[0], UA_STATUSCODE_GOOD);
 
     UA_DeleteMonitoredItemsResponse_deleteMembers(&response);
-
 }
 END_TEST