Просмотр исходного кода

concatenate the library into single .c/.h file

Julius Pfrommer лет назад: 10
Родитель
Сommit
e82aae299b

+ 103 - 78
CMakeLists.txt

@@ -36,37 +36,48 @@ add_definitions(-std=c99 -pipe -Wall -Wextra -Werror -Wformat
 endif()
 
 # build the main library
-include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
-include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
-file(GLOB_RECURSE exported_headers "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
-file(GLOB generated_headers "${PROJECT_BINARY_DIR}/src_generated/*.h")
-set(lib_sources src/ua_types.c
-                src/ua_types_encoding_binary.c
+set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_types.h
+                     ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
+                     ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_connection.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_log.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_server.h)
+set(internal_headers ${PROJECT_SOURCE_DIR}/src/ua_util.h
+                     ${PROJECT_SOURCE_DIR}/deps/queue.h
+                     ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.h
+                     ${PROJECT_SOURCE_DIR}/src/ua_securechannel.h
+                     ${PROJECT_SOURCE_DIR}/src/ua_session.h
+                     ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_nodes.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_session_manager.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_securechannel_manager.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_server_internal.h
+                     ${PROJECT_SOURCE_DIR}/src/server/ua_services.h)
+set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
+                ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.c
                 ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c
                 ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.c
-                ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
-                src/ua_securechannel.c
-                src/ua_session.c
-                src/server/ua_server.c
-				src/server/ua_server_addressspace.c
-				src/server/ua_server_binary.c
-				src/server/ua_nodes.c
-                src/server/ua_server_worker.c
-                src/server/ua_securechannel_manager.c
-                src/server/ua_session_manager.c
-                src/server/ua_services_discovery.c
-                src/server/ua_services_securechannel.c
-                src/server/ua_services_session.c
-                src/server/ua_services_attribute.c
-                src/server/ua_services_nodemanagement.c
-                src/server/ua_services_view.c
-				${exported_headers}
-				${generated_headers} )
+                ${PROJECT_SOURCE_DIR}/src/ua_securechannel.c
+                ${PROJECT_SOURCE_DIR}/src/ua_session.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_server.c
+				${PROJECT_SOURCE_DIR}/src/server/ua_server_addressspace.c
+				${PROJECT_SOURCE_DIR}/src/server/ua_server_binary.c
+				${PROJECT_SOURCE_DIR}/src/server/ua_nodes.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_server_worker.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_securechannel_manager.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_session_manager.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_discovery.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_securechannel.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_session.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_attribute.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_nodemanagement.c
+                ${PROJECT_SOURCE_DIR}/src/server/ua_services_view.c)
 
 ## generate code from xml definitions
 file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
-include_directories("${PROJECT_BINARY_DIR}/src_generated")
-
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c
                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
                    PRE_BUILD
@@ -99,11 +110,20 @@ option(MULTITHREADING "Enable multithreading" OFF)
 if(MULTITHREADING)
     set(UA_MULTITHREADING ON)
     find_package(Threads REQUIRED)
-    list(APPEND lib_sources src/server/ua_nodestore_concurrent.c)
+    list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_concurrent.c)
 else()
-    list(APPEND lib_sources src/server/ua_nodestore.c)
+    list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.c)
 endif()
 
+## build amalgamated source files
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c
+                   PRE_BUILD
+                   COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${CMAKE_CURRENT_BINARY_DIR}/open62541.h ${exported_headers}
+                   COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${CMAKE_CURRENT_BINARY_DIR}/open62541.c
+                                  ${internal_headers} ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc ${lib_sources}
+                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${exported_headers} ${internal_headers}
+                           ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc ${lib_sources})
+
 ## extensions
 option(EXTENSION_UDP "Enable udp extension" OFF)
 if(EXTENSION_UDP)
@@ -124,12 +144,20 @@ if(DEMO_NODESET)
 	add_definitions(-DDEMO_NODESET)
 endif()
 
-add_library(open62541-objects OBJECT ${lib_sources})
-add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-objects>)
-add_library(open62541-static STATIC $<TARGET_OBJECTS:open62541-objects>)
-SET_TARGET_PROPERTIES(open62541-static PROPERTIES OUTPUT_NAME open62541 CLEAN_DIRECT_OUTPUT 1) # static version that exports all symbols
-target_compile_definitions(open62541-objects PRIVATE UA_DYNAMIC_LINKING)
-target_compile_definitions(open62541-static PRIVATE UA_DYNAMIC_LINKING)
+option(BUILD_AMALGAMATION "Build the single-file distribution" ON)
+if(BUILD_AMALGAMATION)
+    add_custom_target(open62541-amalgamation DEPENDS ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c)
+endif()
+
+option(BUILD_LIBRARY "Build a shared library (.so/.dll)" ON)
+if(BUILD_LIBRARY)
+    add_library(open62541 SHARED ${lib_sources} ${exported_headers} ${internal_headers}) 
+    target_include_directories(open62541 PRIVATE ${PROJECT_SOURCE_DIR}/include)
+    target_include_directories(open62541 PRIVATE ${PROJECT_SOURCE_DIR}/deps)
+    target_include_directories(open62541 PRIVATE ${PROJECT_SOURCE_DIR}/src)
+    target_include_directories(open62541 PRIVATE ${PROJECT_BINARY_DIR}/src_generated)
+    target_compile_definitions(open62541 PRIVATE UA_DYNAMIC_LINKING)
+endif()
 
 # build language bindings for the library
 option(ENABLE_BINDING_LUA "Build Lua bindings" OFF)
@@ -148,42 +176,13 @@ if(ENABLE_COVERAGE)
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
 endif()
 
-# build example client
-option(CLIENT "Build a test client" OFF)
-if(CLIENT)
-	message(STATUS "Extensions: enabling client")
-	add_definitions( -DBENCHMARK=1 )
-    # the client is built directly with the .o files as it currently uses
-    # internal functions that are not exported to the shared lib.
-	add_executable(exampleClient $<TARGET_OBJECTS:open62541-objects> examples/client.c)
-    if(MULTITHREADING)
-        target_link_libraries(exampleClient urcu-cds urcu urcu-common pthread)
-    endif()
-    if ((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
-    	add_custom_command(TARGET exampleClient POST_BUILD
-    		COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleClient>
-		)
-	endif()
-    if(EXTENSION_STATELESS)
-        add_executable(statelessClient $<TARGET_OBJECTS:open62541-objects> examples/client_stateless.c)
-        if(MULTITHREADING)
-            target_link_libraries(statelessClient urcu-cds urcu urcu-common pthread)
-        endif()
-        if ((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
-    	add_custom_command(TARGET statelessClient POST_BUILD
-    		COMMAND ${CMAKE_STRIP} $<TARGET_FILE:statelessClient>
-		)
-		endif()
-    endif()
-endif()
-
 # build example server
-option(EXAMPLESERVER "Build a test server" OFF)
-if(EXAMPLESERVER)
-    add_executable(exampleServer examples/server.c examples/networklayer_tcp.c examples/logger_stdout.c ${exported_headers} ${generated_headers})
-    add_executable(exampleServer_datasource examples/server_datasource.c examples/networklayer_tcp.c examples/logger_stdout.c ${exported_headers} ${generated_headers})
-    target_link_libraries(exampleServer open62541-static)
-    target_link_libraries(exampleServer_datasource open62541-static)
+option(BUILD_EXAMPLESERVER "Build the example server" OFF)
+if(BUILD_EXAMPLESERVER)
+    add_executable(exampleServer examples/server.c ${PROJECT_BINARY_DIR}/open62541.c examples/networklayer_tcp.c examples/logger_stdout.c)
+    add_executable(exampleServer_datasource examples/server_datasource.c ${PROJECT_BINARY_DIR}/open62541.c examples/networklayer_tcp.c examples/logger_stdout.c)
+    target_include_directories(exampleServer PRIVATE ${PROJECT_BINARY_DIR})
+    target_include_directories(exampleServer_datasource PRIVATE ${PROJECT_BINARY_DIR})
     if(WIN32)
         target_link_libraries(exampleServer ws2_32)
         target_link_libraries(exampleServer_datasource ws2_32)
@@ -195,13 +194,9 @@ if(EXAMPLESERVER)
         target_link_libraries(exampleServer urcu-cds urcu urcu-common pthread)
         target_link_libraries(exampleServer_datasource urcu-cds urcu urcu-common pthread)
     endif()
-    if ((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
-    	add_custom_command(TARGET exampleServer POST_BUILD
-    		COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleServer>
-		)
-		add_custom_command(TARGET exampleServer_datasource POST_BUILD
-    		COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleServer_datasource>
-		)
+    if((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
+    	add_custom_command(TARGET exampleServer POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleServer>)
+		add_custom_command(TARGET exampleServer_datasource POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleServer_datasource>)
 	endif()
 endif()
 
@@ -217,9 +212,39 @@ if(GENERATE_SELFSIGNED)
     add_custom_target(selfsigned ALL DEPENDS ${PROJECT_BINARY_DIR}/localhost.der ${PROJECT_BINARY_DIR}/ca.crt)
 endif()
 
+# build example client
+option(BUILD_EXAMPLECLIENT "Build a test client" OFF)
+if(BUILD_EXAMPLECLIENT)
+	message(STATUS "Extensions: enabling client")
+	add_definitions( -DBENCHMARK=1 )
+	add_executable(exampleClient ${PROJECT_BINARY_DIR}/open62541.c examples/client.c)
+    target_include_directories(exampleClient PRIVATE ${PROJECT_BINARY_DIR})
+    if(MULTITHREADING)
+        target_link_libraries(exampleClient urcu-cds urcu urcu-common pthread)
+    endif()
+    if ((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
+    	add_custom_command(TARGET exampleClient POST_BUILD
+    		COMMAND ${CMAKE_STRIP} $<TARGET_FILE:exampleClient>
+		)
+	endif()
+    if(EXTENSION_STATELESS)
+        add_executable(statelessClient ${PROJECT_BINARY_DIR}/open62541.c examples/client_stateless.c)
+        target_include_directories(statelessClient PRIVATE ${PROJECT_BINARY_DIR})
+        if(MULTITHREADING)
+            target_link_libraries(statelessClient urcu-cds urcu urcu-common pthread)
+        endif()
+        if ((CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"))
+    	add_custom_command(TARGET statelessClient POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:statelessClient>)
+		endif()
+    endif()
+endif()
+
 # build unit tests
-option(ENABLE_UNIT_TESTS "Run unit tests after building" OFF)
-if(ENABLE_UNIT_TESTS)
+option(BUILD_UNIT_TESTS "Run unit tests after building" OFF)
+if(BUILD_UNIT_TESTS)
+    if(NOT BUILD_LIBRARY)
+        message(SEND_ERROR "Can't build unit tests without building the library")
+    endif()
     enable_testing()
     add_subdirectory(tests)
 endif()

+ 1 - 3
examples/client.c

@@ -10,9 +10,7 @@
 #include <arpa/inet.h> //inet_addr
 #include <unistd.h> // for close
 #include <stdlib.h> // pulls in declaration of malloc, free
-#include "ua_transport_generated.h"
-#include "ua_types_encoding_binary.h"
-#include "ua_util.h"
+#include "open62541.h"
 
 typedef struct ConnectionInfo {
 	UA_Int32 socket;

+ 0 - 2
examples/logger_stdout.c

@@ -4,9 +4,7 @@
  */
 
 #include <stdio.h>
-
 #include "logger_stdout.h"
-#include "ua_types.h"
 
 static void print_time(void) {
 	UA_DateTime now = UA_DateTime_now();

+ 1 - 1
examples/logger_stdout.h

@@ -6,7 +6,7 @@
 #ifndef LOGGER_STDOUT_H_
 #define LOGGER_STDOUT_H_
 
-#include "ua_log.h"
+#include "open62541.h"
 
 /** Initialises the logger for the current thread. */
 UA_Logger Logger_Stdout_new(void);

+ 1 - 1
examples/networklayer_tcp.h

@@ -10,7 +10,7 @@
 extern "C" {
 #endif
 
-#include "ua_server.h"
+#include "open62541.h"
 
 /** @brief Create the TCP networklayer and listen to the specified port */
 UA_ServerNetworkLayer ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_UInt32 port);

+ 1 - 4
examples/server.c

@@ -3,15 +3,12 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 #include <time.h>
-#include "ua_types.h"
-
 #include <stdio.h>
 #include <stdlib.h> 
 #include <signal.h>
 #include <errno.h> // errno, EINTR
 
-// provided by the open62541 lib
-#include "ua_server.h"
+#include "open62541.h"
 
 // provided by the user, implementations available in the /examples folder
 #include "logger_stdout.h"

+ 1 - 4
examples/server_datasource.c

@@ -3,8 +3,6 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 #include <time.h>
-#include "ua_types.h"
-
 #include <stdio.h>
 #include <stdlib.h> 
 #include <signal.h>
@@ -13,8 +11,7 @@
 #include <pthread.h>
 #endif
 
-// provided by the open62541 lib
-#include "ua_server.h"
+#include "open62541.h"
 
 // provided by the user, implementations available in the /examples folder
 #include "logger_stdout.h"

+ 217 - 220
include/ua_statuscodes.h

@@ -1,227 +1,224 @@
-/* This file shall only be included in ua_types.h */
-#ifdef UA_TYPES_H_
 #ifndef OPCUA_STATUSCODES_H_
 #define OPCUA_STATUSCODES_H_
 
 enum UA_StatusCode {
-	UA_STATUSCODE_GOOD = (UA_Int32) 0x00,
-	UA_STATUSCODE_BADUNEXPECTEDERROR = (UA_Int32) 0x80010000, // An unexpected error occurred.
-	UA_STATUSCODE_BADINTERNALERROR = (UA_Int32) 0x80020000, // An internal error occurred as a result of a programming or configuration error.
-	UA_STATUSCODE_BADOUTOFMEMORY = (UA_Int32) 0x80030000, // Not enough memory to complete the operation.
-	UA_STATUSCODE_BADRESOURCEUNAVAILABLE = (UA_Int32) 0x80040000, // An operating system resource is not available.
-	UA_STATUSCODE_BADCOMMUNICATIONERROR = (UA_Int32) 0x80050000, // A low level communication error occurred.
-	UA_STATUSCODE_BADENCODINGERROR = (UA_Int32) 0x80060000, // Encoding halted because of invalid data in the objects being serialized.
-	UA_STATUSCODE_BADDECODINGERROR = (UA_Int32) 0x80070000, // Decoding halted because of invalid data in the stream.
-	UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED = (UA_Int32) 0x80080000, // The message encoding/decoding limits imposed by the stack have been exceeded.
-	UA_STATUSCODE_BADREQUESTTOOLARGE = (UA_Int32) 0x80b80000, // The request message size exceeds limits set by the server.
-	UA_STATUSCODE_BADRESPONSETOOLARGE = (UA_Int32) 0x80b90000, // The response message size exceeds limits set by the client.
-	UA_STATUSCODE_BADUNKNOWNRESPONSE = (UA_Int32) 0x80090000, // An unrecognized response was received from the server.
-	UA_STATUSCODE_BADTIMEOUT = (UA_Int32) 0x800a0000, // The operation timed out.
-	UA_STATUSCODE_BADSERVICEUNSUPPORTED = (UA_Int32) 0x800b0000, // The server does not support the requested service.
-	UA_STATUSCODE_BADSHUTDOWN = (UA_Int32) 0x800c0000, // The operation was cancelled because the application is shutting down.
-	UA_STATUSCODE_BADSERVERNOTCONNECTED = (UA_Int32) 0x800d0000, // The operation could not complete because the client is not connected to the server.
-	UA_STATUSCODE_BADSERVERHALTED = (UA_Int32) 0x800e0000, // The server has stopped and cannot process any requests.
-	UA_STATUSCODE_BADNOTHINGTODO = (UA_Int32) 0x800f0000, // There was nothing to do because the client passed a list of operations with no elements.
-	UA_STATUSCODE_BADTOOMANYOPERATIONS = (UA_Int32) 0x80100000, // The request could not be processed because it specified too many operations.
-	UA_STATUSCODE_BADTOOMANYMONITOREDITEMS = (UA_Int32) 0x80db0000, // The request could not be processed because there are too many monitored items in the subscription.
-	UA_STATUSCODE_BADDATATYPEIDUNKNOWN = (UA_Int32) 0x80110000, // The extension object cannot be (de)serialized because the data type id is not recognized.
-	UA_STATUSCODE_BADCERTIFICATEINVALID = (UA_Int32) 0x80120000, // The certificate provided as a parameter is not valid.
-	UA_STATUSCODE_BADSECURITYCHECKSFAILED = (UA_Int32) 0x80130000, // An error occurred verifying security.
-	UA_STATUSCODE_BADCERTIFICATETIMEINVALID = (UA_Int32) 0x80140000, // The Certificate has expired or is not yet valid.
-	UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID = (UA_Int32) 0x80150000, // An Issuer Certificate has expired or is not yet valid.
-	UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID = (UA_Int32) 0x80160000, // The HostName used to connect to a Server does not match a HostName in the Certificate.
-	UA_STATUSCODE_BADCERTIFICATEURIINVALID = (UA_Int32) 0x80170000, // The URI specified in the ApplicationDescription does not match the URI in the Certificate.
-	UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED = (UA_Int32) 0x80180000, // The Certificate may not be used for the requested operation.
-	UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED = (UA_Int32) 0x80190000, // The Issuer Certificate may not be used for the requested operation.
-	UA_STATUSCODE_BADCERTIFICATEUNTRUSTED = (UA_Int32) 0x801a0000, // The Certificate is not trusted.
-	UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN = (UA_Int32) 0x801b0000, // It was not possible to determine if the Certificate has been revoked.
-	UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN = (UA_Int32) 0x801c0000, // It was not possible to determine if the Issuer Certificate has been revoked.
-	UA_STATUSCODE_BADCERTIFICATEREVOKED = (UA_Int32) 0x801d0000, // The Certificate has been revoked.
-	UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED = (UA_Int32) 0x801e0000, // The Issuer Certificate has been revoked.
-	UA_STATUSCODE_BADUSERACCESSDENIED = (UA_Int32) 0x801f0000, // User does not have permission to perform the requested operation.
-	UA_STATUSCODE_BADIDENTITYTOKENINVALID = (UA_Int32) 0x80200000, // The user identity token is not valid.
-	UA_STATUSCODE_BADIDENTITYTOKENREJECTED = (UA_Int32) 0x80210000, // The user identity token is valid but the server has rejected it.
-	UA_STATUSCODE_BADSECURECHANNELIDINVALID = (UA_Int32) 0x80220000, // The specified secure channel is no longer valid.
-	UA_STATUSCODE_BADINVALIDTIMESTAMP = (UA_Int32) 0x80230000, // The timestamp is outside the range allowed by the server.
-	UA_STATUSCODE_BADNONCEINVALID = (UA_Int32) 0x80240000, // The nonce does appear to be not a random value or it is not the correct length.
-	UA_STATUSCODE_BADSESSIONIDINVALID = (UA_Int32) 0x80250000, // The session id is not valid.
-	UA_STATUSCODE_BADSESSIONCLOSED = (UA_Int32) 0x80260000, // The session was closed by the client.
-	UA_STATUSCODE_BADSESSIONNOTACTIVATED = (UA_Int32) 0x80270000, // The session cannot be used because ActivateSession has not been called.
-	UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID = (UA_Int32) 0x80280000, // The subscription id is not valid.
-	UA_STATUSCODE_BADREQUESTHEADERINVALID = (UA_Int32) 0x802a0000, // The header for the request is missing or invalid.
-	UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID = (UA_Int32) 0x802b0000, // The timestamps to return parameter is invalid.
-	UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT = (UA_Int32) 0x802c0000, // The request was cancelled by the client.
-	UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED = (UA_Int32) 0x002d0000, // The subscription was transferred to another session.
-	UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY = (UA_Int32) 0x002e0000, // The processing will complete asynchronously.
-	UA_STATUSCODE_GOODOVERLOAD = (UA_Int32) 0x002f0000, // Sampling has slowed down due to resource limitations.
-	UA_STATUSCODE_GOODCLAMPED = (UA_Int32) 0x00300000, // The value written was accepted but was clamped.
-	UA_STATUSCODE_BADNOCOMMUNICATION = (UA_Int32) 0x80310000, // Communication with the data source is defined, but not established, and there is no last known value available.
-	UA_STATUSCODE_BADWAITINGFORINITIALDATA = (UA_Int32) 0x80320000, // Waiting for the server to obtain values from the underlying data source.
-	UA_STATUSCODE_BADNODEIDINVALID = (UA_Int32) 0x80330000, // The syntax of the node id is not valid.
-	UA_STATUSCODE_BADNODEIDUNKNOWN = (UA_Int32) 0x80340000, // The node id refers to a node that does not exist in the server address space.
-	UA_STATUSCODE_BADATTRIBUTEIDINVALID = (UA_Int32) 0x80350000, // The attribute is not supported for the specified Node.
-	UA_STATUSCODE_BADINDEXRANGEINVALID = (UA_Int32) 0x80360000, // The syntax of the index range parameter is invalid.
-	UA_STATUSCODE_BADINDEXRANGENODATA = (UA_Int32) 0x80370000, // No data exists within the range of indexes specified.
-	UA_STATUSCODE_BADDATAENCODINGINVALID = (UA_Int32) 0x80380000, // The data encoding is invalid.
-	UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED = (UA_Int32) 0x80390000, // The server does not support the requested data encoding for the node.
-	UA_STATUSCODE_BADNOTREADABLE = (UA_Int32) 0x803a0000, // The access level does not allow reading or subscribing to the Node.
-	UA_STATUSCODE_BADNOTWRITABLE = (UA_Int32) 0x803b0000, // The access level does not allow writing to the Node.
-	UA_STATUSCODE_BADOUTOFRANGE = (UA_Int32) 0x803c0000, // The value was out of range.
-	UA_STATUSCODE_BADNOTSUPPORTED = (UA_Int32) 0x803d0000, // The requested operation is not supported.
-	UA_STATUSCODE_BADNOTFOUND = (UA_Int32) 0x803e0000, // A requested item was not found or a search operation ended without success.
-	UA_STATUSCODE_BADOBJECTDELETED = (UA_Int32) 0x803f0000, // The object cannot be used because it has been deleted.
-	UA_STATUSCODE_BADNOTIMPLEMENTED = (UA_Int32) 0x80400000, // Requested operation is not implemented.
-	UA_STATUSCODE_BADMONITORINGMODEINVALID = (UA_Int32) 0x80410000, // The monitoring mode is invalid.
-	UA_STATUSCODE_BADMONITOREDITEMIDINVALID = (UA_Int32) 0x80420000, // The monitoring item id does not refer to a valid monitored item.
-	UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID = (UA_Int32) 0x80430000, // The monitored item filter parameter is not valid.
-	UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED = (UA_Int32) 0x80440000, // The server does not support the requested monitored item filter.
-	UA_STATUSCODE_BADFILTERNOTALLOWED = (UA_Int32) 0x80450000, // A monitoring filter cannot be used in combination with the attribute specified.
-	UA_STATUSCODE_BADSTRUCTUREMISSING = (UA_Int32) 0x80460000, // A mandatory structured parameter was missing or null.
-	UA_STATUSCODE_BADEVENTFILTERINVALID = (UA_Int32) 0x80470000, // The event filter is not valid.
-	UA_STATUSCODE_BADCONTENTFILTERINVALID = (UA_Int32) 0x80480000, // The content filter is not valid.
-	UA_STATUSCODE_BADFILTEROPERATORINVALID = (UA_Int32) 0x80c10000, // An unregognized operator was provided in a filter.
-	UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED = (UA_Int32) 0x80c20000, // A valid operator was provided, but the server does not provide support for this filter operator.
-	UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH = (UA_Int32) 0x80c30000, // The number of operands provided for the filter operator was less then expected for the operand provided.
-	UA_STATUSCODE_BADFILTEROPERANDINVALID = (UA_Int32) 0x80490000, // The operand used in a content filter is not valid.
-	UA_STATUSCODE_BADFILTERELEMENTINVALID = (UA_Int32) 0x80c40000, // The referenced element is not a valid element in the content filter.
-	UA_STATUSCODE_BADFILTERLITERALINVALID = (UA_Int32) 0x80c50000, // The referenced literal is not a valid value.
-	UA_STATUSCODE_BADCONTINUATIONPOINTINVALID = (UA_Int32) 0x804a0000, // The continuation point provide is longer valid.
-	UA_STATUSCODE_BADNOCONTINUATIONPOINTS = (UA_Int32) 0x804b0000, // The operation could not be processed because all continuation points have been allocated.
-	UA_STATUSCODE_BADREFERENCETYPEIDINVALID = (UA_Int32) 0x804c0000, // The operation could not be processed because all continuation points have been allocated.
-	UA_STATUSCODE_BADBROWSEDIRECTIONINVALID = (UA_Int32) 0x804d0000, // The browse direction is not valid.
-	UA_STATUSCODE_BADNODENOTINVIEW = (UA_Int32) 0x804e0000, // The node is not part of the view.
-	UA_STATUSCODE_BADSERVERURIINVALID = (UA_Int32) 0x804f0000, // The ServerUri is not a valid URI.
-	UA_STATUSCODE_BADSERVERNAMEMISSING = (UA_Int32) 0x80500000, // No ServerName was specified.
-	UA_STATUSCODE_BADDISCOVERYURLMISSING = (UA_Int32) 0x80510000, // No DiscoveryUrl was specified.
-	UA_STATUSCODE_BADSEMPAHOREFILEMISSING = (UA_Int32) 0x80520000, // The semaphore file specified by the client is not valid.
-	UA_STATUSCODE_BADREQUESTTYPEINVALID = (UA_Int32) 0x80530000, // The security token request type is not valid.
-	UA_STATUSCODE_BADSECURITYMODEREJECTED = (UA_Int32) 0x80540000, // The security mode does not meet the requirements set by the Server.
-	UA_STATUSCODE_BADSECURITYPOLICYREJECTED = (UA_Int32) 0x80550000, // The security policy does not meet the requirements set by the Server.
-	UA_STATUSCODE_BADTOOMANYSESSIONS = (UA_Int32) 0x80560000, // The server has reached its maximum number of sessions.
-	UA_STATUSCODE_BADUSERSIGNATUREINVALID = (UA_Int32) 0x80570000, // The user token signature is missing or invalid.
-	UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID = (UA_Int32) 0x80580000, // The signature generated with the client certificate is missing or invalid.
-	UA_STATUSCODE_BADNOVALIDCERTIFICATES = (UA_Int32) 0x80590000, // The client did not provide at least one software certificate that is valid and meets the profile requirements for the server.
-	UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED = (UA_Int32) 0x80c60000, // The Server does not support changing the user identity assigned to the session.
-	UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST = (UA_Int32) 0x805a0000, // The request was cancelled by the client with the Cancel service.
-	UA_STATUSCODE_BADPARENTNODEIDINVALID = (UA_Int32) 0x805b0000, // The parent node id does not to refer to a valid node.
-	UA_STATUSCODE_BADREFERENCENOTALLOWED = (UA_Int32) 0x805c0000, // The reference could not be created because it violates constraints imposed by the data model.
-	UA_STATUSCODE_BADNODEIDREJECTED = (UA_Int32) 0x805d0000, // The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client.
-	UA_STATUSCODE_BADNODEIDEXISTS = (UA_Int32) 0x805e0000, // The requested node id is already used by another node.
-	UA_STATUSCODE_BADNODECLASSINVALID = (UA_Int32) 0x805f0000, // The node class is not valid.
-	UA_STATUSCODE_BADBROWSENAMEINVALID = (UA_Int32) 0x80600000, // The browse name is invalid.
-	UA_STATUSCODE_BADBROWSENAMEDUPLICATED = (UA_Int32) 0x80610000, // The browse name is not unique among nodes that share the same relationship with the parent.
-	UA_STATUSCODE_BADNODEATTRIBUTESINVALID = (UA_Int32) 0x80620000, // The node attributes are not valid for the node class.
-	UA_STATUSCODE_BADTYPEDEFINITIONINVALID = (UA_Int32) 0x80630000, // The type definition node id does not reference an appropriate type node.
-	UA_STATUSCODE_BADSOURCENODEIDINVALID = (UA_Int32) 0x80640000, // The source node id does not reference a valid node.
-	UA_STATUSCODE_BADTARGETNODEIDINVALID = (UA_Int32) 0x80650000, // The target node id does not reference a valid node.
-	UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED = (UA_Int32) 0x80660000, // The reference type between the nodes is already defined.
-	UA_STATUSCODE_BADINVALIDSELFREFERENCE = (UA_Int32) 0x80670000, // The server does not allow this type of self reference on this node.
-	UA_STATUSCODE_BADREFERENCELOCALONLY = (UA_Int32) 0x80680000, // The reference type is not valid for a reference to a remote server.
-	UA_STATUSCODE_BADNODELETERIGHTS = (UA_Int32) 0x80690000, // The server will not allow the node to be deleted.
-	UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED = (UA_Int32) 0x40bc0000, // The server was not able to delete all target references.
-	UA_STATUSCODE_BADSERVERINDEXINVALID = (UA_Int32) 0x806a0000, // The server index is not valid.
-	UA_STATUSCODE_BADVIEWIDUNKNOWN = (UA_Int32) 0x806b0000, // The view id does not refer to a valid view node.
-	UA_STATUSCODE_BADVIEWTIMESTAMPINVALID = (UA_Int32) 0x80c90000, // The view timestamp is not available or not supported.
-	UA_STATUSCODE_BADVIEWPARAMETERMISMATCH = (UA_Int32) 0x80ca0000, // The view parameters are not consistent with each other.
-	UA_STATUSCODE_BADVIEWVERSIONINVALID = (UA_Int32) 0x80cb0000, // The view version is not available or not supported.
-	UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE = (UA_Int32) 0x40c00000, // The list of references may not be complete because the underlying system is not available.
-	UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE = (UA_Int32) 0x00ba0000, // The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete.
-	UA_STATUSCODE_BADNOTTYPEDEFINITION = (UA_Int32) 0x80c80000, // The provided Nodeid was not a type definition nodeid.
-	UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER = (UA_Int32) 0x406c0000, // One of the references to follow in the relative path references to a node in the address space in another server.
-	UA_STATUSCODE_BADTOOMANYMATCHES = (UA_Int32) 0x806d0000, // The requested operation has too many matches to return.
-	UA_STATUSCODE_BADQUERYTOOCOMPLEX = (UA_Int32) 0x806e0000, // The requested operation requires too many resources in the server.
-	UA_STATUSCODE_BADNOMATCH = (UA_Int32) 0x806f0000, // The requested operation has no match to return.
-	UA_STATUSCODE_BADMAXAGEINVALID = (UA_Int32) 0x80700000, // The max age parameter is invalid.
-	UA_STATUSCODE_BADHISTORYOPERATIONINVALID = (UA_Int32) 0x80710000, // The history details parameter is not valid.
-	UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED = (UA_Int32) 0x80720000, // The server does not support the requested operation.
-	UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT = (UA_Int32) 0x80bd0000, // The defined timestamp to return was invalid.
-	UA_STATUSCODE_BADWRITENOTSUPPORTED = (UA_Int32) 0x80730000, // The server not does support writing the combination of value, status and timestamps provided.
-	UA_STATUSCODE_BADTYPEMISMATCH = (UA_Int32) 0x80740000, // The value supplied for the attribute is not of the same type as the attribute's value.
-	UA_STATUSCODE_BADMETHODINVALID = (UA_Int32) 0x80750000, // The method id does not refer to a method for the specified object.
-	UA_STATUSCODE_BADARGUMENTSMISSING = (UA_Int32) 0x80760000, // The client did not specify all of the input arguments for the method.
-	UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS = (UA_Int32) 0x80770000, // The server has reached its  maximum number of subscriptions.
-	UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS = (UA_Int32) 0x80780000, // The server has reached the maximum number of queued publish requests.
-	UA_STATUSCODE_BADNOSUBSCRIPTION = (UA_Int32) 0x80790000, // There is no subscription available for this session.
-	UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN = (UA_Int32) 0x807a0000, // The sequence number is unknown to the server.
-	UA_STATUSCODE_BADMESSAGENOTAVAILABLE = (UA_Int32) 0x807b0000, // The requested notification message is no longer available.
-	UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE = (UA_Int32) 0x807c0000, // The Client of the current Session does not support one or more Profiles that are necessary for the Subscription.
-	UA_STATUSCODE_BADSTATENOTACTIVE = (UA_Int32) 0x80bf0000, // The sub-state machine is not currently active.
-	UA_STATUSCODE_BADTCPSERVERTOOBUSY = (UA_Int32) 0x807d0000, // The server cannot process the request because it is too busy.
-	UA_STATUSCODE_BADTCPMESSAGETYPEINVALID = (UA_Int32) 0x807e0000, // The type of the message specified in the header invalid.
-	UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN = (UA_Int32) 0x807f0000, // The SecureChannelId and/or TokenId are not currently in use.
-	UA_STATUSCODE_BADTCPMESSAGETOOLARGE = (UA_Int32) 0x80800000, // The size of the message specified in the header is too large.
-	UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES = (UA_Int32) 0x80810000, // There are not enough resources to process the request.
-	UA_STATUSCODE_BADTCPINTERNALERROR = (UA_Int32) 0x80820000, // An internal error occurred.
-	UA_STATUSCODE_BADTCPENDPOINTURLINVALID = (UA_Int32) 0x80830000, // The Server does not recognize the QueryString specified.
-	UA_STATUSCODE_BADREQUESTINTERRUPTED = (UA_Int32) 0x80840000, // The request could not be sent because of a network interruption.
-	UA_STATUSCODE_BADREQUESTTIMEOUT = (UA_Int32) 0x80850000, // Timeout occurred while processing the request.
-	UA_STATUSCODE_BADSECURECHANNELCLOSED = (UA_Int32) 0x80860000, // The secure channel has been closed.
-	UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN = (UA_Int32) 0x80870000, // The token has expired or is not recognized.
-	UA_STATUSCODE_BADSEQUENCENUMBERINVALID = (UA_Int32) 0x80880000, // The sequence number is not valid.
-	UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED = (UA_Int32) 0x80be0000, // The applications do not have compatible protocol versions.
-	UA_STATUSCODE_BADCONFIGURATIONERROR = (UA_Int32) 0x80890000, // There is a problem with the configuration that affects the usefulness of the value.
-	UA_STATUSCODE_BADNOTCONNECTED = (UA_Int32) 0x808a0000, // The variable should receive its value from another variable, but has never been configured to do so.
-	UA_STATUSCODE_BADDEVICEFAILURE = (UA_Int32) 0x808b0000, // There has been a failure in the device/data source that generates the value that has affected the value.
-	UA_STATUSCODE_BADSENSORFAILURE = (UA_Int32) 0x808c0000, // There has been a failure in the sensor from which the value is derived by the device/data source.
-	UA_STATUSCODE_BADOUTOFSERVICE = (UA_Int32) 0x808d0000, // The source of the data is not operational.
-	UA_STATUSCODE_BADDEADBANDFILTERINVALID = (UA_Int32) 0x808e0000, // The deadband filter is not valid.
-	UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE = (UA_Int32) 0x408f0000, // Communication to the data source has failed. The variable value is the last value that had a good quality.
-	UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE = (UA_Int32) 0x40900000, // Whatever was updating this value has stopped doing so.
-	UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE = (UA_Int32) 0x40910000, // The value is an operational value that was manually overwritten.
-	UA_STATUSCODE_UNCERTAININITIALVALUE = (UA_Int32) 0x40920000, // The value is an initial value for a variable that normally receives its value from another variable.
-	UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE = (UA_Int32) 0x40930000, // The value is at one of the sensor limits.
-	UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED = (UA_Int32) 0x40940000, // The value is outside of the range of values defined for this parameter.
-	UA_STATUSCODE_UNCERTAINSUBNORMAL = (UA_Int32) 0x40950000, // The value is derived from multiple sources and has less than the required number of Good sources.
-	UA_STATUSCODE_GOODLOCALOVERRIDE = (UA_Int32) 0x00960000, // The value has been overridden.
-	UA_STATUSCODE_BADREFRESHINPROGRESS = (UA_Int32) 0x80970000, // This Condition refresh failed, a Condition refresh operation is already in progress.
-	UA_STATUSCODE_BADCONDITIONALREADYDISABLED = (UA_Int32) 0x80980000, // This condition has already been disabled.
-	UA_STATUSCODE_BADCONDITIONALREADYENABLED = (UA_Int32) 0x80cc0000, // This condition has already been enabled.
-	UA_STATUSCODE_BADCONDITIONDISABLED = (UA_Int32) 0x80990000, // Property not available, this condition is disabled.
-	UA_STATUSCODE_BADEVENTIDUNKNOWN = (UA_Int32) 0x809a0000, // The specified event id is not recognized.
-	UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE = (UA_Int32) 0x80bb0000, // The event cannot be acknowledged.
-	UA_STATUSCODE_BADDIALOGNOTACTIVE = (UA_Int32) 0x80cd0000, // The dialog condition is not active.
-	UA_STATUSCODE_BADDIALOGRESPONSEINVALID = (UA_Int32) 0x80ce0000, // The response is not valid for the dialog.
-	UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED = (UA_Int32) 0x80cf0000, // The condition branch has already been acknowledged.
-	UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED = (UA_Int32) 0x80d00000, // The condition branch has already been confirmed.
-	UA_STATUSCODE_BADCONDITIONALREADYSHELVED = (UA_Int32) 0x80d10000, // The condition has already been shelved.
-	UA_STATUSCODE_BADCONDITIONNOTSHELVED = (UA_Int32) 0x80d20000, // The condition is not currently shelved.
-	UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE = (UA_Int32) 0x80d30000, // The shelving time not within an acceptable range.
-	UA_STATUSCODE_BADNODATA = (UA_Int32) 0x809b0000, // No data exists for the requested time range or event filter.
-	UA_STATUSCODE_BADBOUNDNOTFOUND = (UA_Int32) 0x80d70000, // No data found to provide upper or lower bound value.
-	UA_STATUSCODE_BADBOUNDNOTSUPPORTED = (UA_Int32) 0x80d80000, // The server cannot retrieve a bound for the variable.
-	UA_STATUSCODE_BADDATALOST = (UA_Int32) 0x809d0000, // Data is missing due to collection started/stopped/lost.
-	UA_STATUSCODE_BADDATAUNAVAILABLE = (UA_Int32) 0x809e0000, // Expected data is unavailable for the requested time range due to an un-mounted volume, an off-line archive or tape, or similar reason for temporary unavailability.
-	UA_STATUSCODE_BADENTRYEXISTS = (UA_Int32) 0x809f0000, // The data or event was not successfully inserted because a matching entry exists.
-	UA_STATUSCODE_BADNOENTRYEXISTS = (UA_Int32) 0x80a00000, // The data or event was not successfully updated because no matching entry exists.
-	UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED = (UA_Int32) 0x80a10000, // The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp).
-	UA_STATUSCODE_GOODENTRYINSERTED = (UA_Int32) 0x00a20000, // The data or event was successfully inserted into the historical database.
-	UA_STATUSCODE_GOODENTRYREPLACED = (UA_Int32) 0x00a30000, // The data or event field was successfully replaced in the historical database.
-	UA_STATUSCODE_UNCERTAINDATASUBNORMAL = (UA_Int32) 0x40a40000, // The value is derived from multiple values and has less than the required number of Good values.
-	UA_STATUSCODE_GOODNODATA = (UA_Int32) 0x00a50000, // No data exists for the requested time range or event filter.
-	UA_STATUSCODE_GOODMOREDATA = (UA_Int32) 0x00a60000, // The data or event field was successfully replaced in the historical database.
-	UA_STATUSCODE_BADAGGREGATELISTMISMATCH = (UA_Int32) 0x80d40000, // The requested number of Aggregates does not match the requested number of NodeIds.
-	UA_STATUSCODE_BADAGGREGATENOTSUPPORTED = (UA_Int32) 0x80d50000, // The requested Aggregate is not support by the server.
-	UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS = (UA_Int32) 0x80d60000, // The aggregate value could not be derived due to invalid data inputs.
-	UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED = (UA_Int32) 0x80da0000, // The aggregate configuration is not valid for specified node.
-	UA_STATUSCODE_GOODDATAIGNORED = (UA_Int32) 0x00d90000, // The request pecifies fields which are not valid for the EventType or cannot be saved by the historian.
-	UA_STATUSCODE_GOODCOMMUNICATIONEVENT = (UA_Int32) 0x00a70000, // The communication layer has raised an event.
-	UA_STATUSCODE_GOODSHUTDOWNEVENT = (UA_Int32) 0x00a80000, // The system is shutting down.
-	UA_STATUSCODE_GOODCALLAGAIN = (UA_Int32) 0x00a90000, // The operation is not finished and needs to be called again.
-	UA_STATUSCODE_GOODNONCRITICALTIMEOUT = (UA_Int32) 0x00aa0000, // A non-critical timeout occurred.
-	UA_STATUSCODE_BADINVALIDARGUMENT = (UA_Int32) 0x80ab0000, // One or more arguments are invalid.
-	UA_STATUSCODE_BADCONNECTIONREJECTED = (UA_Int32) 0x80ac0000, // Could not establish a network connection to remote server.
-	UA_STATUSCODE_BADDISCONNECT = (UA_Int32) 0x80ad0000, // The server has disconnected from the client.
-	UA_STATUSCODE_BADCONNECTIONCLOSED = (UA_Int32) 0x80ae0000, // The network connection has been closed.
-	UA_STATUSCODE_BADINVALIDSTATE = (UA_Int32) 0x80af0000, // The operation cannot be completed because the object is closed, uninitialized or in some other invalid state.
-	UA_STATUSCODE_BADENDOFSTREAM = (UA_Int32) 0x80b00000, // Cannot move beyond end of the stream.
-	UA_STATUSCODE_BADNODATAAVAILABLE = (UA_Int32) 0x80b10000, // No data is currently available for reading from a non-blocking stream.
-	UA_STATUSCODE_BADWAITINGFORRESPONSE = (UA_Int32) 0x80b20000, // The asynchronous operation is waiting for a response.
-	UA_STATUSCODE_BADOPERATIONABANDONED = (UA_Int32) 0x80b30000, // The asynchronous operation was abandoned by the caller.
-	UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK = (UA_Int32) 0x80b40000, // The stream did not return all data requested (possibly because it is a non-blocking stream).
-	UA_STATUSCODE_BADWOULDBLOCK = (UA_Int32) 0x80b50000, // Non blocking behaviour is required and the operation would block.
-	UA_STATUSCODE_BADSYNTAXERROR = (UA_Int32) 0x80b60000, // A value had an invalid syntax.
-	UA_STATUSCODE_BADMAXCONNECTIONSREACHED = (UA_Int32) 0x80b70000 // The operation could not be finished because all available connections are in use.
+	UA_STATUSCODE_GOOD = 0x00,
+	UA_STATUSCODE_BADUNEXPECTEDERROR = 0x80010000, // An unexpected error occurred.
+	UA_STATUSCODE_BADINTERNALERROR = 0x80020000, // An internal error occurred as a result of a programming or configuration error.
+	UA_STATUSCODE_BADOUTOFMEMORY = 0x80030000, // Not enough memory to complete the operation.
+	UA_STATUSCODE_BADRESOURCEUNAVAILABLE = 0x80040000, // An operating system resource is not available.
+	UA_STATUSCODE_BADCOMMUNICATIONERROR = 0x80050000, // A low level communication error occurred.
+	UA_STATUSCODE_BADENCODINGERROR = 0x80060000, // Encoding halted because of invalid data in the objects being serialized.
+	UA_STATUSCODE_BADDECODINGERROR = 0x80070000, // Decoding halted because of invalid data in the stream.
+	UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED = 0x80080000, // The message encoding/decoding limits imposed by the stack have been exceeded.
+	UA_STATUSCODE_BADREQUESTTOOLARGE = 0x80b80000, // The request message size exceeds limits set by the server.
+	UA_STATUSCODE_BADRESPONSETOOLARGE = 0x80b90000, // The response message size exceeds limits set by the client.
+	UA_STATUSCODE_BADUNKNOWNRESPONSE = 0x80090000, // An unrecognized response was received from the server.
+	UA_STATUSCODE_BADTIMEOUT = 0x800a0000, // The operation timed out.
+	UA_STATUSCODE_BADSERVICEUNSUPPORTED = 0x800b0000, // The server does not support the requested service.
+	UA_STATUSCODE_BADSHUTDOWN = 0x800c0000, // The operation was cancelled because the application is shutting down.
+	UA_STATUSCODE_BADSERVERNOTCONNECTED = 0x800d0000, // The operation could not complete because the client is not connected to the server.
+	UA_STATUSCODE_BADSERVERHALTED = 0x800e0000, // The server has stopped and cannot process any requests.
+	UA_STATUSCODE_BADNOTHINGTODO = 0x800f0000, // There was nothing to do because the client passed a list of operations with no elements.
+	UA_STATUSCODE_BADTOOMANYOPERATIONS = 0x80100000, // The request could not be processed because it specified too many operations.
+	UA_STATUSCODE_BADTOOMANYMONITOREDITEMS = 0x80db0000, // The request could not be processed because there are too many monitored items in the subscription.
+	UA_STATUSCODE_BADDATATYPEIDUNKNOWN = 0x80110000, // The extension object cannot be (de)serialized because the data type id is not recognized.
+	UA_STATUSCODE_BADCERTIFICATEINVALID = 0x80120000, // The certificate provided as a parameter is not valid.
+	UA_STATUSCODE_BADSECURITYCHECKSFAILED = 0x80130000, // An error occurred verifying security.
+	UA_STATUSCODE_BADCERTIFICATETIMEINVALID = 0x80140000, // The Certificate has expired or is not yet valid.
+	UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID = 0x80150000, // An Issuer Certificate has expired or is not yet valid.
+	UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID = 0x80160000, // The HostName used to connect to a Server does not match a HostName in the Certificate.
+	UA_STATUSCODE_BADCERTIFICATEURIINVALID = 0x80170000, // The URI specified in the ApplicationDescription does not match the URI in the Certificate.
+	UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED = 0x80180000, // The Certificate may not be used for the requested operation.
+	UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED = 0x80190000, // The Issuer Certificate may not be used for the requested operation.
+	UA_STATUSCODE_BADCERTIFICATEUNTRUSTED = 0x801a0000, // The Certificate is not trusted.
+	UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN = 0x801b0000, // It was not possible to determine if the Certificate has been revoked.
+	UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN = 0x801c0000, // It was not possible to determine if the Issuer Certificate has been revoked.
+	UA_STATUSCODE_BADCERTIFICATEREVOKED = 0x801d0000, // The Certificate has been revoked.
+	UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED = 0x801e0000, // The Issuer Certificate has been revoked.
+	UA_STATUSCODE_BADUSERACCESSDENIED = 0x801f0000, // User does not have permission to perform the requested operation.
+	UA_STATUSCODE_BADIDENTITYTOKENINVALID = 0x80200000, // The user identity token is not valid.
+	UA_STATUSCODE_BADIDENTITYTOKENREJECTED = 0x80210000, // The user identity token is valid but the server has rejected it.
+	UA_STATUSCODE_BADSECURECHANNELIDINVALID = 0x80220000, // The specified secure channel is no longer valid.
+	UA_STATUSCODE_BADINVALIDTIMESTAMP = 0x80230000, // The timestamp is outside the range allowed by the server.
+	UA_STATUSCODE_BADNONCEINVALID = 0x80240000, // The nonce does appear to be not a random value or it is not the correct length.
+	UA_STATUSCODE_BADSESSIONIDINVALID = 0x80250000, // The session id is not valid.
+	UA_STATUSCODE_BADSESSIONCLOSED = 0x80260000, // The session was closed by the client.
+	UA_STATUSCODE_BADSESSIONNOTACTIVATED = 0x80270000, // The session cannot be used because ActivateSession has not been called.
+	UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID = 0x80280000, // The subscription id is not valid.
+	UA_STATUSCODE_BADREQUESTHEADERINVALID = 0x802a0000, // The header for the request is missing or invalid.
+	UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID = 0x802b0000, // The timestamps to return parameter is invalid.
+	UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT = 0x802c0000, // The request was cancelled by the client.
+	UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED = 0x002d0000, // The subscription was transferred to another session.
+	UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY = 0x002e0000, // The processing will complete asynchronously.
+	UA_STATUSCODE_GOODOVERLOAD = 0x002f0000, // Sampling has slowed down due to resource limitations.
+	UA_STATUSCODE_GOODCLAMPED = 0x00300000, // The value written was accepted but was clamped.
+	UA_STATUSCODE_BADNOCOMMUNICATION = 0x80310000, // Communication with the data source is defined, but not established, and there is no last known value available.
+	UA_STATUSCODE_BADWAITINGFORINITIALDATA = 0x80320000, // Waiting for the server to obtain values from the underlying data source.
+	UA_STATUSCODE_BADNODEIDINVALID = 0x80330000, // The syntax of the node id is not valid.
+	UA_STATUSCODE_BADNODEIDUNKNOWN = 0x80340000, // The node id refers to a node that does not exist in the server address space.
+	UA_STATUSCODE_BADATTRIBUTEIDINVALID = 0x80350000, // The attribute is not supported for the specified Node.
+	UA_STATUSCODE_BADINDEXRANGEINVALID = 0x80360000, // The syntax of the index range parameter is invalid.
+	UA_STATUSCODE_BADINDEXRANGENODATA = 0x80370000, // No data exists within the range of indexes specified.
+	UA_STATUSCODE_BADDATAENCODINGINVALID = 0x80380000, // The data encoding is invalid.
+	UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED = 0x80390000, // The server does not support the requested data encoding for the node.
+	UA_STATUSCODE_BADNOTREADABLE = 0x803a0000, // The access level does not allow reading or subscribing to the Node.
+	UA_STATUSCODE_BADNOTWRITABLE = 0x803b0000, // The access level does not allow writing to the Node.
+	UA_STATUSCODE_BADOUTOFRANGE = 0x803c0000, // The value was out of range.
+	UA_STATUSCODE_BADNOTSUPPORTED = 0x803d0000, // The requested operation is not supported.
+	UA_STATUSCODE_BADNOTFOUND = 0x803e0000, // A requested item was not found or a search operation ended without success.
+	UA_STATUSCODE_BADOBJECTDELETED = 0x803f0000, // The object cannot be used because it has been deleted.
+	UA_STATUSCODE_BADNOTIMPLEMENTED = 0x80400000, // Requested operation is not implemented.
+	UA_STATUSCODE_BADMONITORINGMODEINVALID = 0x80410000, // The monitoring mode is invalid.
+	UA_STATUSCODE_BADMONITOREDITEMIDINVALID = 0x80420000, // The monitoring item id does not refer to a valid monitored item.
+	UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID = 0x80430000, // The monitored item filter parameter is not valid.
+	UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED = 0x80440000, // The server does not support the requested monitored item filter.
+	UA_STATUSCODE_BADFILTERNOTALLOWED = 0x80450000, // A monitoring filter cannot be used in combination with the attribute specified.
+	UA_STATUSCODE_BADSTRUCTUREMISSING = 0x80460000, // A mandatory structured parameter was missing or null.
+	UA_STATUSCODE_BADEVENTFILTERINVALID = 0x80470000, // The event filter is not valid.
+	UA_STATUSCODE_BADCONTENTFILTERINVALID = 0x80480000, // The content filter is not valid.
+	UA_STATUSCODE_BADFILTEROPERATORINVALID = 0x80c10000, // An unregognized operator was provided in a filter.
+	UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED = 0x80c20000, // A valid operator was provided, but the server does not provide support for this filter operator.
+	UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH = 0x80c30000, // The number of operands provided for the filter operator was less then expected for the operand provided.
+	UA_STATUSCODE_BADFILTEROPERANDINVALID = 0x80490000, // The operand used in a content filter is not valid.
+	UA_STATUSCODE_BADFILTERELEMENTINVALID = 0x80c40000, // The referenced element is not a valid element in the content filter.
+	UA_STATUSCODE_BADFILTERLITERALINVALID = 0x80c50000, // The referenced literal is not a valid value.
+	UA_STATUSCODE_BADCONTINUATIONPOINTINVALID = 0x804a0000, // The continuation point provide is longer valid.
+	UA_STATUSCODE_BADNOCONTINUATIONPOINTS = 0x804b0000, // The operation could not be processed because all continuation points have been allocated.
+	UA_STATUSCODE_BADREFERENCETYPEIDINVALID = 0x804c0000, // The operation could not be processed because all continuation points have been allocated.
+	UA_STATUSCODE_BADBROWSEDIRECTIONINVALID = 0x804d0000, // The browse direction is not valid.
+	UA_STATUSCODE_BADNODENOTINVIEW = 0x804e0000, // The node is not part of the view.
+	UA_STATUSCODE_BADSERVERURIINVALID = 0x804f0000, // The ServerUri is not a valid URI.
+	UA_STATUSCODE_BADSERVERNAMEMISSING = 0x80500000, // No ServerName was specified.
+	UA_STATUSCODE_BADDISCOVERYURLMISSING = 0x80510000, // No DiscoveryUrl was specified.
+	UA_STATUSCODE_BADSEMPAHOREFILEMISSING = 0x80520000, // The semaphore file specified by the client is not valid.
+	UA_STATUSCODE_BADREQUESTTYPEINVALID = 0x80530000, // The security token request type is not valid.
+	UA_STATUSCODE_BADSECURITYMODEREJECTED = 0x80540000, // The security mode does not meet the requirements set by the Server.
+	UA_STATUSCODE_BADSECURITYPOLICYREJECTED = 0x80550000, // The security policy does not meet the requirements set by the Server.
+	UA_STATUSCODE_BADTOOMANYSESSIONS = 0x80560000, // The server has reached its maximum number of sessions.
+	UA_STATUSCODE_BADUSERSIGNATUREINVALID = 0x80570000, // The user token signature is missing or invalid.
+	UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID = 0x80580000, // The signature generated with the client certificate is missing or invalid.
+	UA_STATUSCODE_BADNOVALIDCERTIFICATES = 0x80590000, // The client did not provide at least one software certificate that is valid and meets the profile requirements for the server.
+	UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED = 0x80c60000, // The Server does not support changing the user identity assigned to the session.
+	UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST = 0x805a0000, // The request was cancelled by the client with the Cancel service.
+	UA_STATUSCODE_BADPARENTNODEIDINVALID = 0x805b0000, // The parent node id does not to refer to a valid node.
+	UA_STATUSCODE_BADREFERENCENOTALLOWED = 0x805c0000, // The reference could not be created because it violates constraints imposed by the data model.
+	UA_STATUSCODE_BADNODEIDREJECTED = 0x805d0000, // The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client.
+	UA_STATUSCODE_BADNODEIDEXISTS = 0x805e0000, // The requested node id is already used by another node.
+	UA_STATUSCODE_BADNODECLASSINVALID = 0x805f0000, // The node class is not valid.
+	UA_STATUSCODE_BADBROWSENAMEINVALID = 0x80600000, // The browse name is invalid.
+	UA_STATUSCODE_BADBROWSENAMEDUPLICATED = 0x80610000, // The browse name is not unique among nodes that share the same relationship with the parent.
+	UA_STATUSCODE_BADNODEATTRIBUTESINVALID = 0x80620000, // The node attributes are not valid for the node class.
+	UA_STATUSCODE_BADTYPEDEFINITIONINVALID = 0x80630000, // The type definition node id does not reference an appropriate type node.
+	UA_STATUSCODE_BADSOURCENODEIDINVALID = 0x80640000, // The source node id does not reference a valid node.
+	UA_STATUSCODE_BADTARGETNODEIDINVALID = 0x80650000, // The target node id does not reference a valid node.
+	UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED = 0x80660000, // The reference type between the nodes is already defined.
+	UA_STATUSCODE_BADINVALIDSELFREFERENCE = 0x80670000, // The server does not allow this type of self reference on this node.
+	UA_STATUSCODE_BADREFERENCELOCALONLY = 0x80680000, // The reference type is not valid for a reference to a remote server.
+	UA_STATUSCODE_BADNODELETERIGHTS = 0x80690000, // The server will not allow the node to be deleted.
+	UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED = 0x40bc0000, // The server was not able to delete all target references.
+	UA_STATUSCODE_BADSERVERINDEXINVALID = 0x806a0000, // The server index is not valid.
+	UA_STATUSCODE_BADVIEWIDUNKNOWN = 0x806b0000, // The view id does not refer to a valid view node.
+	UA_STATUSCODE_BADVIEWTIMESTAMPINVALID = 0x80c90000, // The view timestamp is not available or not supported.
+	UA_STATUSCODE_BADVIEWPARAMETERMISMATCH = 0x80ca0000, // The view parameters are not consistent with each other.
+	UA_STATUSCODE_BADVIEWVERSIONINVALID = 0x80cb0000, // The view version is not available or not supported.
+	UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE = 0x40c00000, // The list of references may not be complete because the underlying system is not available.
+	UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE = 0x00ba0000, // The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete.
+	UA_STATUSCODE_BADNOTTYPEDEFINITION = 0x80c80000, // The provided Nodeid was not a type definition nodeid.
+	UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER = 0x406c0000, // One of the references to follow in the relative path references to a node in the address space in another server.
+	UA_STATUSCODE_BADTOOMANYMATCHES = 0x806d0000, // The requested operation has too many matches to return.
+	UA_STATUSCODE_BADQUERYTOOCOMPLEX = 0x806e0000, // The requested operation requires too many resources in the server.
+	UA_STATUSCODE_BADNOMATCH = 0x806f0000, // The requested operation has no match to return.
+	UA_STATUSCODE_BADMAXAGEINVALID = 0x80700000, // The max age parameter is invalid.
+	UA_STATUSCODE_BADHISTORYOPERATIONINVALID = 0x80710000, // The history details parameter is not valid.
+	UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED = 0x80720000, // The server does not support the requested operation.
+	UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT = 0x80bd0000, // The defined timestamp to return was invalid.
+	UA_STATUSCODE_BADWRITENOTSUPPORTED = 0x80730000, // The server not does support writing the combination of value, status and timestamps provided.
+	UA_STATUSCODE_BADTYPEMISMATCH = 0x80740000, // The value supplied for the attribute is not of the same type as the attribute's value.
+	UA_STATUSCODE_BADMETHODINVALID = 0x80750000, // The method id does not refer to a method for the specified object.
+	UA_STATUSCODE_BADARGUMENTSMISSING = 0x80760000, // The client did not specify all of the input arguments for the method.
+	UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS = 0x80770000, // The server has reached its  maximum number of subscriptions.
+	UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS = 0x80780000, // The server has reached the maximum number of queued publish requests.
+	UA_STATUSCODE_BADNOSUBSCRIPTION = 0x80790000, // There is no subscription available for this session.
+	UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN = 0x807a0000, // The sequence number is unknown to the server.
+	UA_STATUSCODE_BADMESSAGENOTAVAILABLE = 0x807b0000, // The requested notification message is no longer available.
+	UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE = 0x807c0000, // The Client of the current Session does not support one or more Profiles that are necessary for the Subscription.
+	UA_STATUSCODE_BADSTATENOTACTIVE = 0x80bf0000, // The sub-state machine is not currently active.
+	UA_STATUSCODE_BADTCPSERVERTOOBUSY = 0x807d0000, // The server cannot process the request because it is too busy.
+	UA_STATUSCODE_BADTCPMESSAGETYPEINVALID = 0x807e0000, // The type of the message specified in the header invalid.
+	UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN = 0x807f0000, // The SecureChannelId and/or TokenId are not currently in use.
+	UA_STATUSCODE_BADTCPMESSAGETOOLARGE = 0x80800000, // The size of the message specified in the header is too large.
+	UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES = 0x80810000, // There are not enough resources to process the request.
+	UA_STATUSCODE_BADTCPINTERNALERROR = 0x80820000, // An internal error occurred.
+	UA_STATUSCODE_BADTCPENDPOINTURLINVALID = 0x80830000, // The Server does not recognize the QueryString specified.
+	UA_STATUSCODE_BADREQUESTINTERRUPTED = 0x80840000, // The request could not be sent because of a network interruption.
+	UA_STATUSCODE_BADREQUESTTIMEOUT = 0x80850000, // Timeout occurred while processing the request.
+	UA_STATUSCODE_BADSECURECHANNELCLOSED = 0x80860000, // The secure channel has been closed.
+	UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN = 0x80870000, // The token has expired or is not recognized.
+	UA_STATUSCODE_BADSEQUENCENUMBERINVALID = 0x80880000, // The sequence number is not valid.
+	UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED = 0x80be0000, // The applications do not have compatible protocol versions.
+	UA_STATUSCODE_BADCONFIGURATIONERROR = 0x80890000, // There is a problem with the configuration that affects the usefulness of the value.
+	UA_STATUSCODE_BADNOTCONNECTED = 0x808a0000, // The variable should receive its value from another variable, but has never been configured to do so.
+	UA_STATUSCODE_BADDEVICEFAILURE = 0x808b0000, // There has been a failure in the device/data source that generates the value that has affected the value.
+	UA_STATUSCODE_BADSENSORFAILURE = 0x808c0000, // There has been a failure in the sensor from which the value is derived by the device/data source.
+	UA_STATUSCODE_BADOUTOFSERVICE = 0x808d0000, // The source of the data is not operational.
+	UA_STATUSCODE_BADDEADBANDFILTERINVALID = 0x808e0000, // The deadband filter is not valid.
+	UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE = 0x408f0000, // Communication to the data source has failed. The variable value is the last value that had a good quality.
+	UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE = 0x40900000, // Whatever was updating this value has stopped doing so.
+	UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE = 0x40910000, // The value is an operational value that was manually overwritten.
+	UA_STATUSCODE_UNCERTAININITIALVALUE = 0x40920000, // The value is an initial value for a variable that normally receives its value from another variable.
+	UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE = 0x40930000, // The value is at one of the sensor limits.
+	UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED = 0x40940000, // The value is outside of the range of values defined for this parameter.
+	UA_STATUSCODE_UNCERTAINSUBNORMAL = 0x40950000, // The value is derived from multiple sources and has less than the required number of Good sources.
+	UA_STATUSCODE_GOODLOCALOVERRIDE = 0x00960000, // The value has been overridden.
+	UA_STATUSCODE_BADREFRESHINPROGRESS = 0x80970000, // This Condition refresh failed, a Condition refresh operation is already in progress.
+	UA_STATUSCODE_BADCONDITIONALREADYDISABLED = 0x80980000, // This condition has already been disabled.
+	UA_STATUSCODE_BADCONDITIONALREADYENABLED = 0x80cc0000, // This condition has already been enabled.
+	UA_STATUSCODE_BADCONDITIONDISABLED = 0x80990000, // Property not available, this condition is disabled.
+	UA_STATUSCODE_BADEVENTIDUNKNOWN = 0x809a0000, // The specified event id is not recognized.
+	UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE = 0x80bb0000, // The event cannot be acknowledged.
+	UA_STATUSCODE_BADDIALOGNOTACTIVE = 0x80cd0000, // The dialog condition is not active.
+	UA_STATUSCODE_BADDIALOGRESPONSEINVALID = 0x80ce0000, // The response is not valid for the dialog.
+	UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED = 0x80cf0000, // The condition branch has already been acknowledged.
+	UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED = 0x80d00000, // The condition branch has already been confirmed.
+	UA_STATUSCODE_BADCONDITIONALREADYSHELVED = 0x80d10000, // The condition has already been shelved.
+	UA_STATUSCODE_BADCONDITIONNOTSHELVED = 0x80d20000, // The condition is not currently shelved.
+	UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE = 0x80d30000, // The shelving time not within an acceptable range.
+	UA_STATUSCODE_BADNODATA = 0x809b0000, // No data exists for the requested time range or event filter.
+	UA_STATUSCODE_BADBOUNDNOTFOUND = 0x80d70000, // No data found to provide upper or lower bound value.
+	UA_STATUSCODE_BADBOUNDNOTSUPPORTED = 0x80d80000, // The server cannot retrieve a bound for the variable.
+	UA_STATUSCODE_BADDATALOST = 0x809d0000, // Data is missing due to collection started/stopped/lost.
+	UA_STATUSCODE_BADDATAUNAVAILABLE = 0x809e0000, // Expected data is unavailable for the requested time range due to an un-mounted volume, an off-line archive or tape, or similar reason for temporary unavailability.
+	UA_STATUSCODE_BADENTRYEXISTS = 0x809f0000, // The data or event was not successfully inserted because a matching entry exists.
+	UA_STATUSCODE_BADNOENTRYEXISTS = 0x80a00000, // The data or event was not successfully updated because no matching entry exists.
+	UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED = 0x80a10000, // The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp).
+	UA_STATUSCODE_GOODENTRYINSERTED = 0x00a20000, // The data or event was successfully inserted into the historical database.
+	UA_STATUSCODE_GOODENTRYREPLACED = 0x00a30000, // The data or event field was successfully replaced in the historical database.
+	UA_STATUSCODE_UNCERTAINDATASUBNORMAL = 0x40a40000, // The value is derived from multiple values and has less than the required number of Good values.
+	UA_STATUSCODE_GOODNODATA = 0x00a50000, // No data exists for the requested time range or event filter.
+	UA_STATUSCODE_GOODMOREDATA = 0x00a60000, // The data or event field was successfully replaced in the historical database.
+	UA_STATUSCODE_BADAGGREGATELISTMISMATCH = 0x80d40000, // The requested number of Aggregates does not match the requested number of NodeIds.
+	UA_STATUSCODE_BADAGGREGATENOTSUPPORTED = 0x80d50000, // The requested Aggregate is not support by the server.
+	UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS = 0x80d60000, // The aggregate value could not be derived due to invalid data inputs.
+	UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED = 0x80da0000, // The aggregate configuration is not valid for specified node.
+	UA_STATUSCODE_GOODDATAIGNORED = 0x00d90000, // The request pecifies fields which are not valid for the EventType or cannot be saved by the historian.
+	UA_STATUSCODE_GOODCOMMUNICATIONEVENT = 0x00a70000, // The communication layer has raised an event.
+	UA_STATUSCODE_GOODSHUTDOWNEVENT = 0x00a80000, // The system is shutting down.
+	UA_STATUSCODE_GOODCALLAGAIN = 0x00a90000, // The operation is not finished and needs to be called again.
+	UA_STATUSCODE_GOODNONCRITICALTIMEOUT = 0x00aa0000, // A non-critical timeout occurred.
+	UA_STATUSCODE_BADINVALIDARGUMENT = 0x80ab0000, // One or more arguments are invalid.
+	UA_STATUSCODE_BADCONNECTIONREJECTED = 0x80ac0000, // Could not establish a network connection to remote server.
+	UA_STATUSCODE_BADDISCONNECT = 0x80ad0000, // The server has disconnected from the client.
+	UA_STATUSCODE_BADCONNECTIONCLOSED = 0x80ae0000, // The network connection has been closed.
+	UA_STATUSCODE_BADINVALIDSTATE = 0x80af0000, // The operation cannot be completed because the object is closed, uninitialized or in some other invalid state.
+	UA_STATUSCODE_BADENDOFSTREAM = 0x80b00000, // Cannot move beyond end of the stream.
+	UA_STATUSCODE_BADNODATAAVAILABLE = 0x80b10000, // No data is currently available for reading from a non-blocking stream.
+	UA_STATUSCODE_BADWAITINGFORRESPONSE = 0x80b20000, // The asynchronous operation is waiting for a response.
+	UA_STATUSCODE_BADOPERATIONABANDONED = 0x80b30000, // The asynchronous operation was abandoned by the caller.
+	UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK = 0x80b40000, // The stream did not return all data requested (possibly because it is a non-blocking stream).
+	UA_STATUSCODE_BADWOULDBLOCK = 0x80b50000, // Non blocking behaviour is required and the operation would block.
+	UA_STATUSCODE_BADSYNTAXERROR = 0x80b60000, // A value had an invalid syntax.
+	UA_STATUSCODE_BADMAXCONNECTIONSREACHED = 0x80b70000 // The operation could not be finished because all available connections are in use.
 };
 
 #endif /* UA_STATUSCODES_H_ */
-#endif /* UA_TYPES_H_ */

+ 5 - 5
include/ua_types.h

@@ -297,11 +297,11 @@ UA_TYPE_HANDLING_FUNCTIONS(UA_Guid)
 #define UA_XmlElement_copy UA_String_copy
 UA_TYPE_HANDLING_FUNCTIONS(UA_NodeId)
 UA_TYPE_HANDLING_FUNCTIONS(UA_ExpandedNodeId)
-#define UA_StatusCode_new UA_Int32_new
-#define UA_StatusCode_init UA_Int32_init
-#define UA_StatusCode_delete UA_Int32_delete
-#define UA_StatusCode_deleteMembers UA_Int32_deleteMembers
-#define UA_StatusCode_copy UA_Int32_copy
+#define UA_StatusCode_new(p) UA_Int32_new((UA_Int32*)p)
+#define UA_StatusCode_init(p) UA_Int32_init((UA_Int32*)p)
+#define UA_StatusCode_delete(p) UA_Int32_delete((UA_Int32*)p)
+#define UA_StatusCode_deleteMembers(p) UA_Int32_deleteMembers((UA_Int32*)p)
+#define UA_StatusCode_copy(p) UA_Int32_copy((UA_Int32*)p)
 UA_TYPE_HANDLING_FUNCTIONS(UA_QualifiedName)
 UA_TYPE_HANDLING_FUNCTIONS(UA_LocalizedText)
 UA_TYPE_HANDLING_FUNCTIONS(UA_ExtensionObject)

+ 2 - 0
src/server/ua_nodes.h

@@ -53,6 +53,8 @@ typedef struct {
     UA_Boolean historizing;
 } UA_VariableNode;
 UA_TYPE_HANDLING_FUNCTIONS(UA_VariableNode)
+/** Make a copy but leave out the references and the variable */
+UA_StatusCode UA_VariableNode_copyWithoutRefsAndVariable(const UA_VariableNode *src, UA_VariableNode *dst);
 
 typedef struct {
     UA_STANDARD_NODEMEMBERS

+ 1 - 2
src/server/ua_securechannel_manager.h

@@ -1,10 +1,9 @@
 #ifndef UA_CHANNEL_MANAGER_H_
 #define UA_CHANNEL_MANAGER_H_
 
-#include "../deps/queue.h"
+#include "ua_util.h"
 #include "ua_server.h"
 #include "ua_securechannel.h"
-#include "ua_util.h"
 
 typedef struct UA_SecureChannelManager {
     LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels

+ 0 - 9
src/server/ua_server.c

@@ -1,8 +1,3 @@
-#ifdef UA_MULTITHREADING
-#define _LGPL_SOURCE
-#include <urcu.h>
-#endif
-
 #include "ua_types.h"
 #include "ua_server_internal.h"
 #include "ua_securechannel_manager.h"
@@ -11,10 +6,6 @@
 #include "ua_services.h"
 #include "ua_nodeids.h"
 
-#ifdef DEMO_NODESET
-#include <stdio.h> //sprintf
-#endif
-
 const char *UA_LoggerCategoryNames[3] = {"communication", "server", "userland"};
 
 /**********************/

+ 37 - 32
src/server/ua_server_addressspace.c

@@ -1,9 +1,10 @@
 #include "ua_server.h"
 #include "ua_server_internal.h"
 
-UA_StatusCode UA_Server_addVariableNode(UA_Server *server, UA_Variant *value, UA_NodeId *nodeId,
-                                        UA_QualifiedName *browseName, const UA_NodeId *parentNodeId,
-                                        const UA_NodeId *referenceTypeId) {
+UA_StatusCode
+UA_Server_addVariableNode(UA_Server *server, UA_Variant *value, UA_NodeId *nodeId, UA_QualifiedName *browseName,
+                          const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId)
+{
     UA_VariableNode *node = UA_VariableNode_new();
     node->variable.variant = *value; // copy content
     UA_NodeId_copy(nodeId, &node->nodeId);
@@ -12,48 +13,46 @@ UA_StatusCode UA_Server_addVariableNode(UA_Server *server, UA_Variant *value, UA
     UA_ExpandedNodeId parentId; // we need an expandednodeid
     UA_ExpandedNodeId_init(&parentId);
     parentId.nodeId = *parentNodeId;
-    UA_AddNodesResult res = UA_Server_addNodeWithSession(server, &adminSession, (UA_Node*)node,
-                                                         &parentId, referenceTypeId);
+    UA_AddNodesResult res =
+        UA_Server_addNodeWithSession(server, &adminSession, (UA_Node*)node, &parentId, referenceTypeId);
     ADDREFERENCE(res.addedNodeId, UA_NODEID_STATIC(0, UA_NS0ID_HASTYPEDEFINITION),
                  UA_EXPANDEDNODEID_STATIC(0, value->type->typeId.identifier.numeric));
     if(res.statusCode != UA_STATUSCODE_GOOD) {
         UA_Variant_init(&node->variable.variant);
         UA_VariableNode_delete(node);
-    } else {
+    } else
         UA_free(value);
-    }
     return res.statusCode;
 }
 
-UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, UA_DataSource dataSource,
-                                                  UA_NodeId *nodeId, UA_QualifiedName *browseName,
-                                                  const UA_NodeId *parentNodeId,
-                                                  const UA_NodeId *referenceTypeId) {
+UA_StatusCode
+UA_Server_addDataSourceVariableNode(UA_Server *server, UA_DataSource dataSource, UA_NodeId *nodeId,
+                                    UA_QualifiedName *browseName, const UA_NodeId *parentNodeId,
+                                    const UA_NodeId *referenceTypeId)
+{
     UA_VariableNode *node = UA_VariableNode_new();
     node->variableType = UA_VARIABLENODETYPE_DATASOURCE;
     node->variable.dataSource = dataSource;
     UA_NodeId_copy(nodeId, &node->nodeId);
     UA_QualifiedName_copy(browseName, &node->browseName);
     UA_String_copy(&browseName->name, &node->displayName.text);
-    UA_ExpandedNodeId parentId; // we need an expandednodeid
+    UA_ExpandedNodeId parentId; // dummy exapndednodeid
     UA_ExpandedNodeId_init(&parentId);
     parentId.nodeId = *parentNodeId;
-    UA_AddNodesResult res = UA_Server_addNodeWithSession(server, &adminSession, (UA_Node*)node,
-                                                         &parentId, referenceTypeId);
+    UA_AddNodesResult res =
+        UA_Server_addNodeWithSession(server, &adminSession, (UA_Node*)node, &parentId, referenceTypeId);
     ADDREFERENCE(res.addedNodeId, UA_NODEID_STATIC(0, UA_NS0ID_HASTYPEDEFINITION),
                  UA_EXPANDEDNODEID_STATIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
-    if(res.statusCode != UA_STATUSCODE_GOOD) {
+    if(res.statusCode != UA_STATUSCODE_GOOD)
         UA_VariableNode_delete(node);
-    }
     return res.statusCode;
 }
 
 /* Adds a one-way reference to the local nodestore */
-static UA_StatusCode addOneWayReferenceWithSession(UA_Server *server, UA_Session *session,
-                                                   const UA_AddReferencesItem *item) {
-    // use the servers nodestore
+static UA_StatusCode
+addOneWayReferenceWithSession(UA_Server *server, UA_Session *session, const UA_AddReferencesItem *item)
+{
     const UA_Node *node = UA_NodeStore_get(server->nodestore, &item->sourceNodeId);
-    // todo differentiate between error codes
     if(!node)
         return UA_STATUSCODE_BADINTERNALERROR;
 
@@ -138,21 +137,23 @@ static UA_StatusCode addOneWayReferenceWithSession(UA_Server *server, UA_Session
     if(retval != UA_STATUSCODE_BADINTERNALERROR)
         return retval;
     
-    // error presumably because the node was replaced and an old version was updated
-    // just try again
+    // error presumably because the node was replaced and an old version was updated just try again
     deleteNode(newNode);
     return addOneWayReferenceWithSession(server, session, item);
 }
 
-UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_AddReferencesItem *item) {
+/* userland version of addReferenceWithSession */
+UA_StatusCode
+UA_Server_addReference(UA_Server *server, const UA_AddReferencesItem *item)
+{
     return UA_Server_addReferenceWithSession(server, &adminSession, item);
 }
 
-UA_StatusCode UA_Server_addReferenceWithSession(UA_Server *server, UA_Session *session,
-                                                const UA_AddReferencesItem *item) {
-    // todo: we don't support references to other servers (expandednodeid) for now
+UA_StatusCode
+UA_Server_addReferenceWithSession(UA_Server *server, UA_Session *session, const UA_AddReferencesItem *item)
+{
     if(item->targetServerUri.length > 0)
-        return UA_STATUSCODE_BADNOTIMPLEMENTED;
+        return UA_STATUSCODE_BADNOTIMPLEMENTED; // currently no expandednodeids are allowed
     
     // Is this for an external nodestore?
     UA_ExternalNodeStore *ensFirst = UA_NULL;
@@ -186,14 +187,18 @@ UA_StatusCode UA_Server_addReferenceWithSession(UA_Server *server, UA_Session *s
     return retval;
 } 
 
-UA_AddNodesResult UA_Server_addNode(UA_Server *server, UA_Node *node, const UA_ExpandedNodeId *parentNodeId,
-                                    const UA_NodeId *referenceTypeId) {
+/* userland version of addNodeWithSession */
+UA_AddNodesResult
+UA_Server_addNode(UA_Server *server, UA_Node *node, const UA_ExpandedNodeId *parentNodeId,
+                  const UA_NodeId *referenceTypeId)
+{
     return UA_Server_addNodeWithSession(server, &adminSession, node, parentNodeId, referenceTypeId);
 }
 
-UA_AddNodesResult UA_Server_addNodeWithSession(UA_Server *server, UA_Session *session, UA_Node *node,
-                                               const UA_ExpandedNodeId *parentNodeId,
-                                               const UA_NodeId *referenceTypeId) {
+UA_AddNodesResult
+UA_Server_addNodeWithSession(UA_Server *server, UA_Session *session, UA_Node *node,
+                             const UA_ExpandedNodeId *parentNodeId, const UA_NodeId *referenceTypeId)
+{
     UA_AddNodesResult result;
     UA_AddNodesResult_init(&result);
 

+ 4 - 5
src/server/ua_server_binary.c

@@ -1,5 +1,4 @@
-#include <stdio.h>
-
+#include "ua_util.h"
 #include "ua_server_internal.h"
 #include "ua_types_encoding_binary.h"
 #include "ua_transport_generated.h"
@@ -7,7 +6,6 @@
 #include "ua_statuscodes.h"
 #include "ua_securechannel_manager.h"
 #include "ua_session_manager.h"
-#include "ua_util.h"
 #include "ua_nodeids.h"
 
 /** Max size of messages that are allocated on the stack */
@@ -402,9 +400,10 @@ static void processMSG(UA_Connection *connection, UA_Server *server, const UA_By
 static void processCLO(UA_Connection *connection, UA_Server *server, const UA_ByteString *msg,
                        size_t *pos) {
     UA_UInt32 secureChannelId;
-    UA_UInt32_decodeBinary(msg, pos, &secureChannelId);
+    UA_StatusCode retval = UA_UInt32_decodeBinary(msg, pos, &secureChannelId);
 
-    if(!connection->channel || connection->channel->securityToken.channelId != secureChannelId)
+    if(retval != UA_STATUSCODE_GOOD || !connection->channel ||
+       connection->channel->securityToken.channelId != secureChannelId)
         return;
 
     Service_CloseSecureChannel(server, secureChannelId);

+ 0 - 7
src/server/ua_server_internal.h

@@ -3,13 +3,6 @@
 
 #include "ua_config.h"
 
-#ifdef UA_MULTITHREADING
-#define _LGPL_SOURCE
-#include <urcu.h>
-#include <urcu/wfcqueue.h>
-#endif
-
-#include "../deps/queue.h"
 #include "ua_server.h"
 #include "ua_session_manager.h"
 #include "ua_securechannel_manager.h"

+ 0 - 7
src/server/ua_server_worker.c

@@ -1,10 +1,3 @@
-#define __USE_POSIX
-#define _XOPEN_SOURCE 500
-#define __USE_POSIX199309
-#ifndef WIN32
-#include <sys/time.h>
-#endif
-#include <time.h>
 #include "ua_server_internal.h"
 
 /**

+ 0 - 2
src/server/ua_services_attribute.c

@@ -1,5 +1,3 @@
-#include <inttypes.h>
-#include <stdio.h>
 #include "ua_server_internal.h"
 #include "ua_types_generated.h"
 #include "ua_services.h"

+ 2 - 6
src/ua_securechannel.c

@@ -1,11 +1,7 @@
-#include "ua_securechannel.h"
 #include "ua_util.h"
+#include "ua_securechannel.h"
 #include "ua_statuscodes.h"
 
-#ifdef UA_MULTITHREADING
-#include <urcu/uatomic.h>
-#endif
-
 // max message size is 64k
 const UA_ConnectionConfig UA_ConnectionConfig_standard =
     {.protocolVersion = 0, .sendBufferSize = 65536, .recvBufferSize  = 65536,
@@ -58,7 +54,7 @@ UA_StatusCode UA_SecureChannel_updateRequestId(UA_SecureChannel *channel, UA_UIn
     return UA_STATUSCODE_GOOD;
 }
 
-UA_Int32 UA_SecureChannel_updateSequenceNumber(UA_SecureChannel *channel, UA_UInt32 sequenceNumber) {
+UA_StatusCode UA_SecureChannel_updateSequenceNumber(UA_SecureChannel *channel, UA_UInt32 sequenceNumber) {
     //TODO review checking of sequence
     if(channel->sequenceNumber+1  != sequenceNumber)
         return UA_STATUSCODE_BADINTERNALERROR;

+ 2 - 2
src/ua_securechannel.h

@@ -33,8 +33,8 @@ void UA_SecureChannel_delete(UA_SecureChannel *channel);
 UA_Boolean UA_SecureChannel_compare(UA_SecureChannel *sc1, UA_SecureChannel *sc2);
 
 UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce);
-UA_Int32 UA_SecureChannel_updateRequestId(UA_SecureChannel *channel, UA_UInt32 requestId);
-UA_Int32 UA_SecureChannel_updateSequenceNumber(UA_SecureChannel *channel, UA_UInt32 sequenceNumber);
+UA_StatusCode UA_SecureChannel_updateRequestId(UA_SecureChannel *channel, UA_UInt32 requestId);
+UA_StatusCode UA_SecureChannel_updateSequenceNumber(UA_SecureChannel *channel, UA_UInt32 sequenceNumber);
 
 void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel);
 void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session);

+ 1 - 5
src/ua_session.c

@@ -1,11 +1,7 @@
-#include "ua_session.h"
 #include "ua_util.h"
+#include "ua_session.h"
 #include "ua_statuscodes.h"
 
-#ifdef UA_MULTITHREADING
-#include <urcu/uatomic.h>
-#endif
-
 UA_Session anonymousSession = {
     .clientDescription =  {.applicationUri = {-1, UA_NULL},
                            .productUri = {-1, UA_NULL},

+ 1 - 17
src/ua_types.c

@@ -1,20 +1,4 @@
-#include <stdarg.h> // va_start, va_end
-#include <time.h>
-#include <stdio.h> // printf
-#include <string.h> // strlen
-#define __USE_POSIX
-#include <stdlib.h> // malloc, free, rand
-
 #include "ua_util.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#define RAND(SEED) (UA_UInt32)rand()
-#else
-#include <sys/time.h>
-#define RAND(SEED) (UA_UInt32)rand_r(SEED)
-#endif
-
 #include "ua_types.h"
 #include "ua_statuscodes.h"
 #include "ua_types_generated.h"
@@ -120,7 +104,7 @@ UA_StatusCode UA_String_copy(UA_String const *src, UA_String *dst) {
 }
 
 /* The c-string needs to be null-terminated. the string cannot be smaller than zero. */
-UA_Int32 UA_String_copycstring(char const *src, UA_String *dst) {
+UA_StatusCode UA_String_copycstring(char const *src, UA_String *dst) {
     UA_String_init(dst);
     size_t length = (UA_UInt32) strlen(src);
     if(length == 0) {

+ 1 - 6
src/ua_types_encoding_binary.c

@@ -1,10 +1,5 @@
-#ifndef _WIN32
-#define _BSD_SOURCE
-#include <endian.h>
-#endif
-#include <string.h>
-#include "ua_types_encoding_binary.h"
 #include "ua_util.h"
+#include "ua_types_encoding_binary.h"
 #include "ua_statuscodes.h"
 #include "ua_types_generated.h"
 

+ 48 - 3
src/ua_util.h

@@ -1,9 +1,24 @@
 #ifndef UA_UTIL_H_
 #define UA_UTIL_H_
 
+#ifndef UA_AMALGAMATE
+# include "ua_config.h"
+#endif
+
 #ifndef __USE_POSIX
-#define __USE_POSIX
+# define __USE_POSIX
+#endif
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
 #endif
+#ifndef _BSD_SOURCE
+# define _BSD_SOURCE
+#endif
+
+/*********************/
+/* Memory Management */
+/*********************/
+
 #include <stdlib.h> // malloc, free
 #include <string.h> // memcpy
 #include <assert.h> // assert
@@ -14,8 +29,6 @@
 # include <alloca.h>
 #endif
 
-#include "ua_types.h"
-
 #define UA_NULL ((void *)0)
 
 // subtract from nodeids to get from the encoding to the content
@@ -38,4 +51,36 @@
 # define UA_alloca(SIZE) alloca(SIZE)
 #endif
 
+/********************/
+/* System Libraries */
+/********************/
+
+#include <stdarg.h> // va_start, va_end
+#include <time.h>
+#include <stdio.h> // printf
+#include <inttypes.h>
+
+#ifdef _WIN32
+# include <windows.h>
+# define RAND(SEED) (UA_UInt32)rand()
+#else
+# include <endian.h>
+# include <sys/time.h>
+# define RAND(SEED) (UA_UInt32)rand_r(SEED)
+#endif
+
+/*************************/
+/* External Dependencies */
+/*************************/
+
+#ifndef UA_AMALGAMATE
+# include "queue.h"
+#endif
+
+#ifdef UA_MULTITHREADING
+#define _LGPL_SOURCE
+#include <urcu.h>
+#include <urcu/wfcqueue.h>
+#endif
+
 #endif /* UA_UTIL_H_ */

+ 16 - 4
tests/CMakeLists.txt

@@ -1,3 +1,8 @@
+include_directories(${PROJECT_SOURCE_DIR}/include)
+include_directories(${PROJECT_SOURCE_DIR}/deps)
+include_directories(${PROJECT_SOURCE_DIR}/src)
+include_directories(${PROJECT_BINARY_DIR}/src_generated)
+
 find_package(Check REQUIRED)
 find_package(Threads REQUIRED)
 
@@ -12,11 +17,15 @@ endif(MULTITHREADING)
 # the unit test are built directly on the open62541 object files. so they can
 # access symbols that are hidden/not exported to the shared library
 
-add_executable(check_builtin $<TARGET_OBJECTS:open62541-objects> check_builtin.c)
+add_executable(check_builtin check_builtin.c ${PROJECT_SOURCE_DIR}/src/ua_types.c
+                                             ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.c
+                                             ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c)
 target_link_libraries(check_builtin ${LIBS})
 add_test(builtin ${CMAKE_CURRENT_BINARY_DIR}/check_builtin)
 
-add_executable(check_memory $<TARGET_OBJECTS:open62541-objects> check_memory.c)
+add_executable(check_memory check_memory.c ${PROJECT_SOURCE_DIR}/src/ua_types.c
+                                           ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.c
+                                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c)
 target_link_libraries(check_memory ${LIBS})
 add_test(memory ${CMAKE_CURRENT_BINARY_DIR}/check_memory)
 
@@ -28,11 +37,14 @@ add_test(memory ${CMAKE_CURRENT_BINARY_DIR}/check_memory)
 # target_link_libraries(check_base64 ${LIBS})
 # add_test(base64 ${CMAKE_CURRENT_BINARY_DIR}/check_base64)
 
-add_executable(check_services_view $<TARGET_OBJECTS:open62541-objects> check_services_view.c)
+add_executable(check_services_view check_services_view.c)
 target_link_libraries(check_services_view ${LIBS})
 add_test(services_view ${CMAKE_CURRENT_BINARY_DIR}/check_services_view)
 
-add_executable(check_nodestore $<TARGET_OBJECTS:open62541-objects> check_nodestore.c)
+add_executable(check_nodestore check_nodestore.c ${PROJECT_SOURCE_DIR}/src/ua_types.c
+                                                 ${PROJECT_SOURCE_DIR}/src/server/ua_nodes.c
+                                                 ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.c
+                                                 ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c)
 target_link_libraries(check_nodestore ${LIBS})
 add_test(nodestore ${CMAKE_CURRENT_BINARY_DIR}/check_nodestore)
 

+ 89 - 0
tools/amalgamate.py

@@ -0,0 +1,89 @@
+from __future__ import print_function
+import re
+import argparse
+
+parser = argparse.ArgumentParser()
+parser.add_argument('outfile', help='outfile w/o extension')
+parser.add_argument('inputs', nargs='*', action='store', help='input filenames')
+args = parser.parse_args()
+
+outname = args.outfile.split("/")[-1]
+pos = outname.find(".")
+if pos > 0:
+    outname = outname[:pos]
+include_re = re.compile("^#include ([\"<].*[\">]).*$")
+guard_re = re.compile("^#(?:(?:ifndef|define) [A-Z_]+_H_|endif /\* [A-Z_]+_H_ \*/)")
+includes = []
+
+is_c = False
+
+for fname in args.inputs:
+    if("util.h" in fname):
+        is_c = True
+        continue
+    with open(fname) as infile:
+        for line in infile:
+            res = include_re.match(line)
+            if res:
+                inc = res.group(1)
+                if not inc in includes and not inc[0] == '"':
+                    includes.append(inc)
+
+file = open(args.outfile, 'w')
+file.write('''/*
+ * Copyright (C) 2014 the contributors as stated in the AUTHORS file
+ *
+ * This file is part of open62541. open62541 is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU Lesser General
+ * Public License, version 3 (as published by the Free Software Foundation) with
+ * a static linking exception as stated in the LICENSE file provided with
+ * open62541.
+ *
+ * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+/* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES */\n\n''')
+
+if not is_c:
+    file.write('''#ifndef %s
+#define %s
+
+#ifdef __cplusplus
+extern "C" {
+#endif\n\n''' % (outname.upper() + "_H_", outname.upper() + "_H_") )
+
+if not is_c:
+    for inc in includes:
+        file.write("#include " + inc + "\n")
+else:
+    file.write("#define UA_AMALGAMATE\n")
+    file.write('''#ifndef UA_DYNAMIC_LINKING
+# define UA_DYNAMIC_LINKING
+#endif\n\n''')
+    for fname in args.inputs:
+        if "util.h" in fname:
+            with open(fname) as infile:
+                for line in infile:
+                    file.write(line)
+    file.write("#include \"" + outname + ".h\"\n")
+
+for fname in args.inputs:
+    if not "util.h" in fname:
+        with open(fname) as infile:
+            for line in infile:
+                inc_res = include_re.match(line)
+                guard_res = guard_re.match(line)
+                if not inc_res and not guard_res:
+                    file.write(line)
+
+if not is_c:
+    file.write('''
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* %s */''' % (outname.upper() + "_H_"))
+file.close()

+ 1 - 1
tools/generate_datatypes.py

@@ -503,7 +503,7 @@ printh('''
 #ifdef __cplusplus
 } // extern "C"
 #endif\n
-#endif''')
+#endif /* %s_GENERATED_H_ */''' % outname.upper())
 
 printc('''/**
 * @file ''' + outname + '''_generated.c