Procházet zdrojové kódy

Browse continuation points are mostly green. Two remaining cases could be bugs in the CTT (behavior inconsistent with the UA spec)

Julius Pfrommer před 10 roky
rodič
revize
a44c6b33fb
2 změnil soubory, kde provedl 21 přidání a 3 odebrání
  1. 15 0
      src/server/ua_server.c
  2. 6 3
      src/server/ua_services_view.c

+ 15 - 0
src/server/ua_server.c

@@ -847,6 +847,21 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
    ADDREFERENCE(UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY), UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION),
            UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
 
+   UA_VariableNode *maxBrowseContinuationPoints = UA_VariableNode_new();
+   copyNames((UA_Node*)maxBrowseContinuationPoints, "MaxBrowseContinuationPoints");
+   maxBrowseContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS;
+   UA_UInt16 *maxBrowseContinuationPointsValue = UA_UInt16_new();
+   *maxBrowseContinuationPointsValue = 0;
+   maxBrowseContinuationPoints->value.variant.data = maxBrowseContinuationPointsValue;
+   maxBrowseContinuationPoints->value.variant.arrayLength = -1;
+   maxBrowseContinuationPoints->value.variant.type = &UA_TYPES[UA_TYPES_UINT16];
+   UA_Server_addNode(server, (UA_Node*)maxBrowseContinuationPoints,
+       &UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
+       &UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY));
+   ADDREFERENCE(UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS),
+       UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION),
+       UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
+
    UA_ObjectNode *serverdiagnostics = UA_ObjectNode_new();
    copyNames((UA_Node*)serverdiagnostics, "ServerDiagnostics");
    serverdiagnostics->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS;

+ 6 - 3
src/server/ua_services_view.c

@@ -209,7 +209,8 @@ static void browse(UA_NodeStore *ns, struct ContinuationPointEntry **cp, const U
 
     size_t count = 0;
     size_t skipped = 0;
-    for(UA_Int32 i = 0; i < node->referencesSize && count < real_maxrefs; i++) {
+    UA_Int32 i = 0;
+    for(; i < node->referencesSize && count < real_maxrefs; i++) {
         const UA_Node *current = relevant_node(ns, descr, all_refs, &node->references[i],
                                                relevant_refs, relevant_refs_size);
         if(!current)
@@ -234,13 +235,15 @@ static void browse(UA_NodeStore *ns, struct ContinuationPointEntry **cp, const U
 
     if(*cp) {
         (*cp)->continuationIndex += count;
-        if((*cp)->continuationIndex == node->referencesSize) {
-            /* remove a finished continuationPoint */
+        if(i == node->referencesSize) {
+            /* all references done, remove a finished continuationPoint */
             UA_ByteString_deleteMembers(&(*cp)->identifier);
             UA_BrowseDescription_deleteMembers(&(*cp)->browseDescription);
             LIST_REMOVE(*cp, pointers);
             UA_free(*cp);
             *cp = UA_NULL;
+        } else {
+            UA_ByteString_copy(&(*cp)->identifier, &result->continuationPoint);
         }
     } else if(maxrefs != 0 && count >= maxrefs) {
         /* create a continuationPoint */