Quellcode durchsuchen

Added compiletime switch to enable loading the generated namespace0 definition in UA_Server_New(). Default is to use the old/reduced namespace.

ichrispa vor 10 Jahren
Ursprung
Commit
4fa89f2fcd
1 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. 7 3
      src/server/ua_server.c

+ 7 - 3
src/server/ua_server.c

@@ -292,7 +292,7 @@ UA_Server * UA_Server_new(void) {
 
         server->endpointDescriptions = endpoint;
         server->endpointDescriptionsSize = 1;
-    } 
+    }
 
 #define MAXCHANNELCOUNT 100
 #define STARTCHANNELID 1
@@ -347,10 +347,11 @@ UA_Server * UA_Server_new(void) {
 #define HUNDRED_NANOSEC_PER_SEC (HUNDRED_NANOSEC_PER_USEC * 1000000LL)
     server->buildDate = (mktime(&ct) + UNIX_EPOCH_BIAS_SEC) * HUNDRED_NANOSEC_PER_SEC;
 
+#ifndef LOADGENERATEDNS
     /**************/
     /* References */
     /**************/
-    
+
     /* bootstrap by manually inserting "references" and "hassubtype" */
     UA_ReferenceTypeNode *references = UA_ReferenceTypeNode_new();
     copyNames((UA_Node*)references, "References");
@@ -559,7 +560,7 @@ UA_Server * UA_Server_new(void) {
     UA_Server_addNode(server, (UA_Node*)hascause,
                       &UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_NONHIERARCHICALREFERENCES),
                       &UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE));
-    
+
     UA_ReferenceTypeNode *haseffect = UA_ReferenceTypeNode_new();
     copyNames((UA_Node*)haseffect, "HasEffect");
     haseffect->inverseName = UA_LOCALIZEDTEXT_ALLOC("", "MayBeEffectedBy");
@@ -847,6 +848,9 @@ UA_Server * UA_Server_new(void) {
                                   UA_NODEID_NUMERIC(1, ARRAYID), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES));
    }
 #endif
+#else
+  #include "ua_namespaceinit_generated.h"
+#endif
 
    return server;
 }