Переглянути джерело

cleanup build settings; remove old doxygen documentation

Julius Pfrommer 9 роки тому
батько
коміт
b210b19ae2
48 змінених файлів з 471 додано та 4178 видалено
  1. 209 185
      CMakeLists.txt
  2. 3 3
      appveyor.yml
  3. 0 2311
      doc/Doxyfile.in
  4. 0 194
      doc/DoxygenLayout.xml
  5. 47 59
      doc/building.rst
  6. 3 3
      doc/datatypes.rst
  7. 0 110
      doc/mainpage.dox
  8. 0 336
      doc/style/doxygen.css
  9. 0 20
      doc/style/footer.html
  10. 0 19
      doc/style/header.html
  11. 0 4
      doc/style/jquery-1.11.1.min.js
  12. 0 58
      doc/style/load-style.js
  13. 20 16
      examples/CMakeLists.txt
  14. 4 4
      examples/client.c
  15. 0 696
      examples/client_legacy.c
  16. 3 3
      examples/networklayer_tcp.c
  17. 1 1
      examples/networklayer_udp.c
  18. 8 8
      examples/server.c
  19. 1 1
      include/ua_client.h
  20. 1 1
      include/ua_client_highlevel.h
  21. 11 5
      include/ua_config.h.in
  22. 1 1
      include/ua_server.h
  23. 34 24
      include/ua_types.h
  24. 2 2
      src/client/ua_client.c
  25. 2 2
      src/client/ua_client_internal.h
  26. 3 3
      src/server/ua_nodes.c
  27. 1 1
      src/server/ua_nodes.h
  28. 1 1
      src/server/ua_nodestore.h
  29. 3 3
      src/server/ua_securechannel_manager.c
  30. 13 13
      src/server/ua_server.c
  31. 7 7
      src/server/ua_server_binary.c
  32. 4 4
      src/server/ua_server_internal.h
  33. 12 12
      src/server/ua_server_worker.c
  34. 3 3
      src/server/ua_services.h
  35. 6 6
      src/server/ua_services_attribute.c
  36. 5 5
      src/server/ua_services_nodemanagement.c
  37. 7 7
      src/server/ua_services_view.c
  38. 2 2
      src/ua_connection.c
  39. 2 2
      src/ua_securechannel.c
  40. 2 2
      src/ua_session.c
  41. 2 2
      src/ua_session.h
  42. 2 2
      src/ua_util.h
  43. 3 3
      tests/CMakeLists.txt
  44. 19 19
      tests/check_nodestore.c
  45. 4 4
      tests/check_services_attributes.c
  46. 1 1
      tests/check_services_nodemanagement.c
  47. 16 7
      tools/travis_linux_script.sh
  48. 3 3
      tools/travis_osx_script.sh

+ 209 - 185
CMakeLists.txt

@@ -1,50 +1,63 @@
 cmake_minimum_required(VERSION 2.8.11)
 cmake_minimum_required(VERSION 2.8.11)
-# set(CMAKE_VERBOSE_MAKEFILE ON)
-
 project(open62541 C)
 project(open62541 C)
+# set(CMAKE_VERBOSE_MAKEFILE ON)
 
 
-FIND_PACKAGE(PythonInterp REQUIRED)
+######################
+# Check Dependencies #
+######################
 
 
-# Find Python-lxml
-execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Find Python and Python-lxml
+find_package(PythonInterp REQUIRED)
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
+                OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
+                OUTPUT_STRIP_TRAILING_WHITESPACE)
 if(NOT EXISTS "${PYTHON_SITE_PACKAGES}/lxml")
 if(NOT EXISTS "${PYTHON_SITE_PACKAGES}/lxml")
-    execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))"
+                  OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
+                  OUTPUT_STRIP_TRAILING_WHITESPACE)
     if(NOT EXISTS "${PYTHON_SITE_PACKAGES}/lxml")
     if(NOT EXISTS "${PYTHON_SITE_PACKAGES}/lxml")
-        message( FATAL_ERROR "Python-lxml is not installed.")
+        message(FATAL_ERROR "Python-lxml is not installed.")
     endif()
     endif()
 endif()
 endif()
 
 
+# Check for git
 find_package(Git)
 find_package(Git)
 if(GIT_FOUND)
 if(GIT_FOUND)
-    execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=7 --dirty --always --tags RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COM_ID )
-    if( NOT ${res_var} EQUAL 0 )
-        set( GIT_COMMIT_ID "unknown--git-commit-id-unknown")
-        message( STATUS "Git failed (not a repo, or no tags). Build will not contain git revision info." )
+  execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=7 --dirty --always --tags
+                  RESULT_VARIABLE res_var
+                  OUTPUT_VARIABLE GIT_COM_ID )
+    if(NOT ${res_var} EQUAL 0)
+        set(GIT_COMMIT_ID "unknown--git-commit-id-unknown")
+        message(STATUS "Git failed (not a repo, or no tags). Build will not contain git revision info." )
     else()
     else()
-        string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COM_ID} )
+        string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COM_ID} )
     endif()
     endif()
 else()
 else()
-    set( GIT_COMMIT_ID "unknown--no-git-found")
-    message( STATUS "Git not found. Build will not contain git revision info." )
+    set(GIT_COMMIT_ID "unknown--no-git-found")
+    message(STATUS "Git not found. Build will not contain git revision info." )
 endif()
 endif()
 add_definitions("-DVERSION=${GIT_COMMIT_ID}")
 add_definitions("-DVERSION=${GIT_COMMIT_ID}")
 
 
-MESSAGE (STATUS "Git version: "  ${GIT_COMMIT_ID})
+message(STATUS "Git version: "  ${GIT_COMMIT_ID})
 
 
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 
 
+####################################
+# Build Type and Compiler Settings #
+####################################
+
 # Set default build type.
 # Set default build type.
 if(NOT CMAKE_BUILD_TYPE)
 if(NOT CMAKE_BUILD_TYPE)
-    message(STATUS "CMAKE_BUILD_TYPE not given; setting to 'RelWithDebInfo'.")
-    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
+    message(STATUS "CMAKE_BUILD_TYPE not given; setting to 'Debug'.")
+    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
 endif()
 endif()
 
 
 # compiler flags
 # compiler flags
 if(CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
 if(CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
     add_definitions(-std=c99 -pipe -Wall -Wextra -Werror -Wformat -Wno-unused-parameter
     add_definitions(-std=c99 -pipe -Wall -Wextra -Werror -Wformat -Wno-unused-parameter
-                      -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wreturn-type -Wsign-compare -Wmultichar
-                      -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes #-Wshadow #-Wconversion
-                      -Winit-self -Wuninitialized -Wformat-security -Wformat-nonliteral)
+                    -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wreturn-type -Wsign-compare -Wmultichar
+                    -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes #-Wshadow #-Wconversion
+                    -Winit-self -Wuninitialized -Wformat-security -Wformat-nonliteral)
     # binary size reduction settings
     # binary size reduction settings
     add_definitions(-ffunction-sections -fdata-sections -fno-stack-protector -fno-unwind-tables
     add_definitions(-ffunction-sections -fdata-sections -fno-stack-protector -fno-unwind-tables
                     -fno-asynchronous-unwind-tables -fno-math-errno -fmerge-all-constants -fno-ident)
                     -fno-asynchronous-unwind-tables -fno-math-errno -fmerge-all-constants -fno-ident)
@@ -76,7 +89,66 @@ elseif(MSVC)
     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
 endif()
 endif()
 
 
-# build the main library
+############
+# Settings #
+############
+
+# Options
+set(UA_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported")
+option(UA_ENABLE_SUBSCRIPTIONS "Enable compilation of subscription and monitoring support." OFF)
+option(UA_ENABLE_METHODCALLS "Enable CallMethod/MethodCall service set" OFF)
+option(UA_ENABLE_MULTITHREADING "Enable multithreading" OFF)
+option(UA_ENABLE_NODEMANAGEMENT "Enable dynamic addition and removal of nodes" ON)
+option(UA_ENABLE_AMALGAMATION "Concatenate the library to a single file open62541.h/.c" OFF)
+option(UA_ENABLE_COVERAGE "Enable gcov coverage" OFF)
+if(UA_ENABLE_COVERAGE)
+  set(CMAKE_BUILD_TYPE DEBUG)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+endif()
+
+# Advanced options
+option(UA_ENABLE_TYPENAMES "Add the type and member names to the UA_DataType structure" OFF)
+mark_as_advanced(UA_ENABLE_TYPENAMES)
+
+option(UA_ENABLE_GENERATE_NAMESPACE0 "Generate and load UA XML Namespace 0 definition" OFF)
+mark_as_advanced(UA_ENABLE_GENERATE_NAMESPACE0)
+
+option(UA_ENABLE_EMBEDDED_LIBC "Target has no libc, use internal definitions" OFF)
+mark_as_advanced(UA_ENABLE_EMBEDDED_LIBC)
+
+option(UA_ENABLE_EXTERNAL_NAMESPACES "Enable namespace handling by an external component (experimental)" OFF)
+mark_as_advanced(UA_ENABLE_EXTERNAL_NAMESPACES)
+
+option(UA_ENABLE_NONSTANDARD_STATELESS "Enable stateless extension" OFF)
+mark_as_advanced(UA_ENABLE_NONSTANDARD_STATELESS)
+
+option(UA_ENABLE_NONSTANDARD_UDP "Enable udp extension" OFF)
+mark_as_advanced(UA_ENABLE_NONSTANDARD_UDP)
+if(UA_ENABLE_NONSTANDARD_UDP)
+  set(UA_ENABLE_NONSTANDARD_STATELESS ON)
+endif()
+
+# Build Targets
+option(UA_BUILD_EXAMPLESERVER "Build the example server" OFF)
+option(UA_BUILD_EXAMPLECLIENT "Build a test client" OFF)
+option(UA_BUILD_UNIT_TESTS "Run unit tests after building" OFF)
+option(UA_BUILD_EXAMPLES "Build example servers and clients" OFF)
+option(UA_BUILD_DOCUMENTATION "Generate doxygen/sphinx documentation" OFF)
+
+# Advanced Build Targets
+option(UA_BUILD_SELFSIGNED_CERTIFICATE "Generate self-signed certificate" OFF)
+mark_as_advanced(UA_BUILD_SELFSIGNED_CERTIFICATE)
+
+#########################
+# Generate Main Library #
+#########################
+
+file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
+include_directories(${PROJECT_BINARY_DIR}/src_generated) #needed to locate an include of examples/server_nodeset.c
+configure_file("include/ua_config.h.in" "${PROJECT_BINARY_DIR}/src_generated/ua_config.h")
+
 set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
 set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
                      ${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h
                      ${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h
                      ${PROJECT_SOURCE_DIR}/include/ua_types.h
                      ${PROJECT_SOURCE_DIR}/include/ua_types.h
@@ -133,76 +205,98 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
                 ${PROJECT_SOURCE_DIR}/deps/pcg_basic.c)
                 ${PROJECT_SOURCE_DIR}/deps/pcg_basic.c)
                 ##TODO: make client stuff optional
                 ##TODO: make client stuff optional
 
 
-## generate code from xml definitions
-file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
+if(UA_ENABLE_METHODCALLS)
+  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_services_call.c)
+endif()
 
 
-option(ENABLE_TYPEINTROSPECTION "Add the type and member names to the internal structures" OFF)
-mark_as_advanced(ENABLE_TYPEINTROSPECTION)
-if(ENABLE_TYPEINTROSPECTION)
-  set(generate_typeintrospection "--typeintrospection")
+if(UA_ENABLE_EMBEDDED_LIBC)
+  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/libc_string.c)
+endif()
+
+if(UA_ENABLE_MULTITHREADING)
+  find_package(Threads REQUIRED)
+  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_concurrent.c)
 else()
 else()
-  set(generate_typeintrospection "")
+  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.c)
 endif()
 endif()
 
 
-option(UA_EMBEDDED_LIBC "Target has no libc, use internal definitions" OFF)
-if(UA_EMBEDDED_LIBC)
-  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/libc_string.c)
+set(generate_typeintrospection "")
+if(UA_ENABLE_TYPENAMES)
+  set(generate_typeintrospection "--typeintrospection")
 endif()
 endif()
 
 
-option(ENABLE_SUBSCRIPTIONS "Enable compilation of subscription and monitoring support." OFF)
-if(ENABLE_SUBSCRIPTIONS)
-  set(ENABLE_SUBSCRIPTIONS ON) #to propagate it to the config file
+set(generate_subscriptiontypes "")
+if(UA_ENABLE_SUBSCRIPTIONS)
   list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_services_subscription.c
   list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_services_subscription.c
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.c
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.c
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_manager.c
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_manager.c
                           ${PROJECT_SOURCE_DIR}/src/client/ua_client_highlevel_subscriptions.c)
                           ${PROJECT_SOURCE_DIR}/src/client/ua_client_highlevel_subscriptions.c)
-  ##append subscription headers at before ua_session.
+  #append subscription headers at before ua_session
   list(FIND internal_headers "${PROJECT_SOURCE_DIR}/src/ua_session.h" UaSessionPos)
   list(FIND internal_headers "${PROJECT_SOURCE_DIR}/src/ua_session.h" UaSessionPos)
   list(INSERT internal_headers  ${UaSessionPos} ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.h
   list(INSERT internal_headers  ${UaSessionPos} ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.h
                                                 ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_manager.h)
                                                 ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_manager.h)
+  set(generate_subscriptiontypes "--enable-subscription-types=1")
+endif()
 
 
-  add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c
-                            ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
-                            ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated_encoding_binary.h
-                     PRE_BUILD
-                     COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py --enable-subscription-types=1 ${generate_typeintrospection} --typedescriptions ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv 0 ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd ${PROJECT_BINARY_DIR}/src_generated/ua_types
-                     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_datatypes.py
-                             ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
-                             ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/NodeIds.csv)
-else()
+if(UA_ENABLE_GENERATE_NAMESPACE0)
+  set(GENERATE_NAMESPACE0_FILE "Opc.Ua.NodeSet2.xml" CACHE STRING "Namespace definition XML file")
+  set_property(CACHE GENERATE_NAMESPACE0_FILE PROPERTY STRINGS Opc.Ua.NodeSet2.xml Opc.Ua.NodeSet2.Minimal.xml)
+  list(APPEND internal_headers ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.h)
+  list(APPEND lib_sources ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.c)
+endif()
+
+#########################
+# Generate source files #
+#########################
+
+# standard data types
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.c
                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated_encoding_binary.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated_encoding_binary.h
                    PRE_BUILD
                    PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py ${generate_typeintrospection} --typedescriptions ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv 0 ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd ${PROJECT_BINARY_DIR}/src_generated/ua_types
+                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
+                                                ${generate_subscriptiontypes}
+                                                ${generate_typeintrospection}
+                                                --typedescriptions ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv
+                                                0
+                                                ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
+                                                ${PROJECT_BINARY_DIR}/src_generated/ua_types
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_datatypes.py
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_datatypes.py
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/NodeIds.csv)
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/NodeIds.csv)
-endif()
 
 
+# transport data types
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.c
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.c
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated_encoding_binary.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated_encoding_binary.h
                    PRE_BUILD
                    PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py ${generate_typeintrospection} --ns0-types-xml ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd 1 ${PROJECT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd ${PROJECT_BINARY_DIR}/src_generated/ua_transport
+                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
+                                                ${generate_typeintrospection}
+                                                --ns0-types-xml ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
+                                                1
+                                                ${PROJECT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd
+                                                ${PROJECT_BINARY_DIR}/src_generated/ua_transport
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_datatypes.py
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_datatypes.py
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd)
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd)
 
 
+# nodeids
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
                    PRE_BUILD
                    PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_nodeids.py ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids
+                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_nodeids.py
+                                                ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv
+                                                ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_nodeids.py
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_nodeids.py
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/NodeIds.csv)
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/NodeIds.csv)
 
 
-option(ENABLE_GENERATE_NAMESPACE0 "Generate and load UA XML Namespace 0 definition" OFF)
-if(ENABLE_GENERATE_NAMESPACE0)
-add_definitions(-DENABLE_GENERATE_NAMESPACE0)
-set(GENERATE_NAMESPACE0_FILE "Opc.Ua.NodeSet2.xml" CACHE STRING "Namespace definition XML file")
-set_property(CACHE GENERATE_NAMESPACE0_FILE PROPERTY STRINGS Opc.Ua.NodeSet2.xml Opc.Ua.NodeSet2.Minimal.xml)
+# generated namespace 0
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.c
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.c
                           ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.h
                    PRE_BUILD
                    PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_AssumeExternal.txt -s description -b ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist.txt ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/${GENERATE_NAMESPACE0_FILE} ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated
+                   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+                                                -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_AssumeExternal.txt
+                                                -s description -b ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist.txt
+                                                ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/${GENERATE_NAMESPACE0_FILE}
+                                                ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated
                    DEPENDS ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/${GENERATE_NAMESPACE0_FILE}
                    DEPENDS ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/${GENERATE_NAMESPACE0_FILE}
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
@@ -212,81 +306,35 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_g
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py)
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py)
 
 
-list(APPEND internal_headers ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.h)
-list(APPEND lib_sources ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.c)
-endif()
-
-## logging
-set(UA_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported")
-
-# Enable Methodcall service
-option(ENABLE_METHODCALLS "Enable CallMethod/MethodCall service set" OFF)
-if(ENABLE_METHODCALLS)
-    set(ENABLE_METHODCALLS ON) #to propagate it to the config file
-    list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_services_call.c)
-endif()
-
-## multithreading
-option(ENABLE_MULTITHREADING "Enable multithreading (experimental)" OFF)
-if(ENABLE_MULTITHREADING)
-	set(UA_MULTITHREADING ON) #to propagate it to the config file
-    find_package(Threads REQUIRED)
-    list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_concurrent.c)
-else()
-    list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.c)
-endif()
-
-option(ENABLE_EXTERNAL_NAMESPACES "Enable namespace handling by an external component (experimental)" OFF)
-if(ENABLE_EXTERNAL_NAMESPACES)
-    add_definitions(-DUA_EXTERNAL_NAMESPACES)
-endif()
-
-## enable dynamic nodeset
-option(ENABLE_NODEMANAGEMENT "Enable dynamic addition and removal of nodes" ON)
-if(ENABLE_NODEMANAGEMENT)
-    add_definitions(-DENABLE_NODEMANAGEMENT)
-endif()
-
-## set the precompiler flags
-configure_file("include/ua_config.h.in" "${PROJECT_BINARY_DIR}/src_generated/ua_config.h")
-
-## extensions
-option(EXTENSION_UDP "Enable udp extension" OFF)
-if(EXTENSION_UDP)
-	add_definitions(-DEXTENSION_STATELESS)
-	message(STATUS "Extensions: enabling udp")
-	add_definitions(-DEXTENSION_UDP)
-	add_executable(exampleServerUDP $<TARGET_OBJECTS:open62541-object> examples/networklayer_udp.c examples/server_udp.c)
-  if(ENABLE_MULTITHREADING)
-  	target_link_libraries(exampleServerUDP urcu-cds urcu urcu-common)
-  endif()
-  if (NOT APPLE)
-      target_link_libraries(exampleServerUDP rt)
-  endif()
-endif()
-
-option(ENABLE_LEGACY "Enable LEGACY code" OFF)
-mark_as_advanced(ENABLE_LEGACY)
-
-option(EXTENSION_STATELESS "Enable stateless extension" OFF)
-if(EXTENSION_STATELESS)
-	message(STATUS "Extensions: enabling stateless")
-	add_definitions(-DEXTENSION_STATELESS)
-endif()
-
-option(ENABLE_AMALGAMATION "Concatenate the library to a single file open62541.h/.c" OFF)
+# single-file release
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h
-               PRE_BUILD
-               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${GIT_COMMIT_ID} ${CMAKE_CURRENT_BINARY_DIR}/open62541.h ${exported_headers}
-               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${exported_headers} ${internal_headers})
+                   PRE_BUILD
+                   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                                                ${GIT_COMMIT_ID}
+                                                ${CMAKE_CURRENT_BINARY_DIR}/open62541.h ${exported_headers}
+                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                           ${exported_headers}
+                           ${internal_headers})
 
 
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
-               PRE_BUILD
-               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${GIT_COMMIT_ID} ${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 ${internal_headers} ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc ${lib_sources})
-
-if(ENABLE_AMALGAMATION)
+                   PRE_BUILD
+                   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                                                ${GIT_COMMIT_ID}
+                                                ${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
+                           ${internal_headers}
+                           ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc
+                           ${lib_sources})
+
+#################
+# Build Targets #
+#################
+
+# build shared library
+if(UA_ENABLE_AMALGAMATION)
     add_custom_target(amalgamation ALL DEPENDS ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c)
     add_custom_target(amalgamation ALL DEPENDS ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c)
     add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
     add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
     include_directories(${PROJECT_BINARY_DIR})
     include_directories(${PROJECT_BINARY_DIR})
@@ -297,40 +345,21 @@ else()
     include_directories(${PROJECT_SOURCE_DIR}/deps)
     include_directories(${PROJECT_SOURCE_DIR}/deps)
     include_directories(${PROJECT_SOURCE_DIR}/src)
     include_directories(${PROJECT_SOURCE_DIR}/src)
 endif()
 endif()
-include_directories(${PROJECT_BINARY_DIR}/src_generated) #needed to locate an include of examples/server_nodeset.c
 target_compile_definitions(open62541-object PRIVATE -DUA_DYNAMIC_LINKING)
 target_compile_definitions(open62541-object PRIVATE -DUA_DYNAMIC_LINKING)
-
 add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-object>)
 add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-object>)
 add_library(open62541-static STATIC $<TARGET_OBJECTS:open62541-object>)
 add_library(open62541-static STATIC $<TARGET_OBJECTS:open62541-object>)
 target_compile_definitions(open62541 PRIVATE -DUA_DYNAMIC_LINKING)
 target_compile_definitions(open62541 PRIVATE -DUA_DYNAMIC_LINKING)
 target_compile_definitions(open62541-static PRIVATE -DUA_DYNAMIC_LINKING)
 target_compile_definitions(open62541-static PRIVATE -DUA_DYNAMIC_LINKING)
 if(WIN32)
 if(WIN32)
-    # since networklayer_tcp is linked into the amalgate
-    target_link_libraries(open62541 ws2_32)
-    target_link_libraries(open62541-static ws2_32)
-endif()
-if(ENABLE_MULTITHREADING)
-  target_link_libraries(open62541 urcu-cds urcu urcu-common pthread)
-  target_link_libraries(open62541-static urcu-cds urcu urcu-common pthread)
-endif()
-
-# coverage
-option(ENABLE_COVERAGE "Enable gcov coverage" OFF)
-if(ENABLE_COVERAGE)
-    message(STATUS "Enabling gcov support")
-    set(CMAKE_BUILD_TYPE DEBUG)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
-    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+  target_link_libraries(open62541 ws2_32)
+  target_link_libraries(open62541-static ws2_32)
 endif()
 endif()
 
 
-# build example server
-option(BUILD_EXAMPLESERVER "Build the example server" OFF)
-if(BUILD_EXAMPLESERVER)
+if(UA_BUILD_EXAMPLESERVER)
     set(server_source $<TARGET_OBJECTS:open62541-object>)
     set(server_source $<TARGET_OBJECTS:open62541-object>)
     add_executable(server_static examples/server.c ${server_source})
     add_executable(server_static examples/server.c ${server_source})
     add_executable(server examples/server.c)
     add_executable(server examples/server.c)
-    if(ENABLE_AMALGAMATION)
+    if(UA_ENABLE_AMALGAMATION)
        ADD_DEPENDENCIES(server amalgamation)
        ADD_DEPENDENCIES(server amalgamation)
     endif()
     endif()
     target_link_libraries(server open62541)
     target_link_libraries(server open62541)
@@ -341,15 +370,23 @@ if(BUILD_EXAMPLESERVER)
         target_link_libraries(server_static rt)
         target_link_libraries(server_static rt)
         target_link_libraries(server rt)
         target_link_libraries(server rt)
     endif()
     endif()
-    if(ENABLE_MULTITHREADING)
+    if(UA_ENABLE_MULTITHREADING)
         target_link_libraries(server_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(server_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(server urcu-cds urcu urcu-common pthread)
         target_link_libraries(server urcu-cds urcu urcu-common pthread)
     endif()
     endif()
+
+    if(UA_ENABLE_NONSTANDARD_UDP)
+      add_executable(exampleServerUDP $<TARGET_OBJECTS:open62541-object> examples/networklayer_udp.c examples/server_udp.c)
+      if(UA_ENABLE_MULTITHREADING)
+  	    target_link_libraries(exampleServerUDP urcu-cds urcu urcu-common)
+      endif()
+      if (NOT APPLE)
+        target_link_libraries(exampleServerUDP rt)
+      endif()
+    endif()
 endif()
 endif()
 
 
-## self-signed certificates
-option(GENERATE_SELFSIGNED "Generate self-signed certificates" OFF)
-if(GENERATE_SELFSIGNED)
+if(UA_BUILD_SELFSIGNED_CERTIFICATE)
     message(STATUS "Enabling self-signed certificates")
     message(STATUS "Enabling self-signed certificates")
     find_package(OpenSSL REQUIRED)
     find_package(OpenSSL REQUIRED)
     add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/server_cert.der
     add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/server_cert.der
@@ -360,14 +397,12 @@ if(GENERATE_SELFSIGNED)
     add_custom_target(selfsigned ALL DEPENDS ${PROJECT_BINARY_DIR}/server_cert.der ${PROJECT_BINARY_DIR}/ca.crt)
     add_custom_target(selfsigned ALL DEPENDS ${PROJECT_BINARY_DIR}/server_cert.der ${PROJECT_BINARY_DIR}/ca.crt)
 endif()
 endif()
 
 
-# build example client
-option(BUILD_EXAMPLECLIENT "Build a test client" OFF)
-if(BUILD_EXAMPLECLIENT)
+if(UA_BUILD_EXAMPLECLIENT)
 	add_definitions(-DBENCHMARK)
 	add_definitions(-DBENCHMARK)
     set(client_source $<TARGET_OBJECTS:open62541-object>)
     set(client_source $<TARGET_OBJECTS:open62541-object>)
 	add_executable(client_static examples/client.c ${client_source})
 	add_executable(client_static examples/client.c ${client_source})
     add_executable(client examples/client.c)
     add_executable(client examples/client.c)
-	if(ENABLE_AMALGAMATION)
+	if(UA_ENABLE_AMALGAMATION)
 	   ADD_DEPENDENCIES(client amalgamation)
 	   ADD_DEPENDENCIES(client amalgamation)
 	endif()
 	endif()
 	target_link_libraries(client open62541)
 	target_link_libraries(client open62541)
@@ -378,32 +413,25 @@ if(BUILD_EXAMPLECLIENT)
         target_link_libraries(client_static rt)
         target_link_libraries(client_static rt)
         target_link_libraries(client rt)
         target_link_libraries(client rt)
     endif()
     endif()
-    if(ENABLE_MULTITHREADING)
+    if(UA_ENABLE_MULTITHREADING)
         target_link_libraries(client_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(client_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(client urcu-cds urcu urcu-common pthread)
         target_link_libraries(client urcu-cds urcu urcu-common pthread)
     endif()
     endif()
     if(EXTENSION_STATELESS AND NOT ENABLE_AMALGAMATION)
     if(EXTENSION_STATELESS AND NOT ENABLE_AMALGAMATION)
         add_executable(client_stateless examples/client_stateless.c ${client_source})
         add_executable(client_stateless examples/client_stateless.c ${client_source})
-        if(ENABLE_MULTITHREADING)
+        if(UA_ENABLE_MULTITHREADING)
             target_link_libraries(client_stateless urcu-cds urcu urcu-common pthread)
             target_link_libraries(client_stateless urcu-cds urcu urcu-common pthread)
         endif()
         endif()
     endif()
     endif()
-    if(ENABLE_LEGACY AND NOT ENABLE_AMALGAMATION)
-    	add_executable(client_legacy ${PROJECT_SOURCE_DIR}/examples/client_legacy.c $<TARGET_OBJECTS:open62541-object>)
-		target_link_libraries(client_legacy ${LIBS})
-	endif()
 endif()
 endif()
 
 
-# build unit tests
-option(BUILD_UNIT_TESTS "Run unit tests after building" OFF)
-if(BUILD_UNIT_TESTS)
-	add_definitions(-DBUILD_UNIT_TESTS)
+if(UA_BUILD_UNIT_TESTS)
+	add_definitions(-DUA_BUILD_UNIT_TESTS)
     enable_testing()
     enable_testing()
     add_subdirectory(tests)
     add_subdirectory(tests)
 endif()
 endif()
 
 
-option(BUILD_EXAMPLES "Build example servers and clients" OFF)
-if(BUILD_EXAMPLES)
+if(UA_BUILD_EXAMPLES)
     #add_subdirectory(examples)
     #add_subdirectory(examples)
     #FIXME: we had problem with static linking for msvs, here a quick and dirty workaround
     #FIXME: we had problem with static linking for msvs, here a quick and dirty workaround
     #http://stackoverflow.com/questions/3704374/linking-error-lnk2019-in-msvc-unresolved-symbols-with-imp-prefix-but-shoul
     #http://stackoverflow.com/questions/3704374/linking-error-lnk2019-in-msvc-unresolved-symbols-with-imp-prefix-but-shoul
@@ -416,9 +444,9 @@ if(BUILD_EXAMPLES)
 	else()
 	else()
 		list(APPEND LIBS ws2_32)
 		list(APPEND LIBS ws2_32)
 	endif()
 	endif()
-	if(ENABLE_MULTITHREADING)
+	if(UA_ENABLE_MULTITHREADING)
 		list(APPEND LIBS urcu-cds urcu urcu-common)
 		list(APPEND LIBS urcu-cds urcu urcu-common)
-	endif(ENABLE_MULTITHREADING)
+	endif(UA_ENABLE_MULTITHREADING)
 	
 	
     add_executable(server_variable ${PROJECT_SOURCE_DIR}/examples/server_variable.c $<TARGET_OBJECTS:open62541-object>)
     add_executable(server_variable ${PROJECT_SOURCE_DIR}/examples/server_variable.c $<TARGET_OBJECTS:open62541-object>)
 	target_link_libraries(server_variable ${LIBS})
 	target_link_libraries(server_variable ${LIBS})
@@ -440,7 +468,11 @@ if(BUILD_EXAMPLES)
 
 
 	add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
 	add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
 					   PRE_BUILD
 					   PRE_BUILD
-					   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml ${PROJECT_BINARY_DIR}/src_generated/nodeset
+					   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+                                                    -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
+                                                    ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml
+                                                    ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml
+                                                    ${PROJECT_BINARY_DIR}/src_generated/nodeset
 					   DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
 					   DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
@@ -451,35 +483,27 @@ if(BUILD_EXAMPLES)
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
 					           ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
 					           ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
 					   
 					   
-	add_executable(server_nodeset ${PROJECT_SOURCE_DIR}/examples/server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c $<TARGET_OBJECTS:open62541-object>)
+	add_executable(server_nodeset ${PROJECT_SOURCE_DIR}/examples/server_nodeset.c
+                                  ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
+                                  $<TARGET_OBJECTS:open62541-object>)
 	target_link_libraries(server_nodeset ${LIBS})
 	target_link_libraries(server_nodeset ${LIBS})
 
 
-	if(ENABLE_METHODCALLS)
+	if(UA_ENABLE_METHODCALLS)
 	  add_executable(server_method ${PROJECT_SOURCE_DIR}/examples/server_method.c $<TARGET_OBJECTS:open62541-object>)
 	  add_executable(server_method ${PROJECT_SOURCE_DIR}/examples/server_method.c $<TARGET_OBJECTS:open62541-object>)
 	  target_link_libraries(server_method ${LIBS})
 	  target_link_libraries(server_method ${LIBS})
 	endif()
 	endif()
 endif()
 endif()
 
 
-# build documentation
-option(BUILD_DOCUMENTATION "Generate doxygen/sphinx documentation" OFF)
-if(BUILD_DOCUMENTATION)
-    find_package(Doxygen REQUIRED)
+if(UA_BUILD_DOCUMENTATION)
     find_package(Sphinx REQUIRED)
     find_package(Sphinx REQUIRED)
-    configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY)
     configure_file(${PROJECT_SOURCE_DIR}/doc/conf.py ${PROJECT_BINARY_DIR}/conf.py @ONLY)
     configure_file(${PROJECT_SOURCE_DIR}/doc/conf.py ${PROJECT_BINARY_DIR}/conf.py @ONLY)
-    add_custom_target(doxygen
-                      ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
-                      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
-                      COMMENT "Generating API documentation with Doxygen")
     add_custom_target(latex ${SPHINX_EXECUTABLE}
     add_custom_target(latex ${SPHINX_EXECUTABLE}
       -b latex -c "${PROJECT_BINARY_DIR}"
       -b latex -c "${PROJECT_BINARY_DIR}"
       "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc/sphinx"
       "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc/sphinx"
-      DEPENDS doxygen
       COMMENT "Building LaTeX sources for documentation with Sphinx")
       COMMENT "Building LaTeX sources for documentation with Sphinx")
     add_custom_target(doc ${SPHINX_EXECUTABLE}
     add_custom_target(doc ${SPHINX_EXECUTABLE}
       -b html -c "${PROJECT_BINARY_DIR}"
       -b html -c "${PROJECT_BINARY_DIR}"
       "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc/sphinx"
       "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc/sphinx"
       COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/doc/open62541_html.png" "${PROJECT_BINARY_DIR}/doc/sphinx/_static/"
       COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/doc/open62541_html.png" "${PROJECT_BINARY_DIR}/doc/sphinx/_static/"
-      DEPENDS doxygen
       COMMENT "Building HTML documentation with Sphinx")
       COMMENT "Building HTML documentation with Sphinx")
 endif()
 endif()

+ 3 - 3
appveyor.yml

@@ -7,14 +7,14 @@ build_script:
 - cd c:\projects\open62541
 - cd c:\projects\open62541
 - md build
 - md build
 - cd build
 - cd build
-- cmake -DBUILD_EXAMPLESERVER:BOOL=ON -DBUILD_EXAMPLECLIENT:BOOL=ON -DBUILD_EXAMPLES:BOOL=ON -G"Visual Studio 12 2013" ..
+- cmake -DUA_BUILD_EXAMPLESERVER:BOOL=ON -DUA_BUILD_EXAMPLECLIENT:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -G"Visual Studio 12 2013" ..
 - msbuild open62541.sln
 - msbuild open62541.sln
 - echo "Testing amalgamation"
 - echo "Testing amalgamation"
 - cd ..
 - cd ..
 - rd /s /q build
 - rd /s /q build
 - md build
 - md build
 - cd build
 - cd build
-- cmake -DBUILD_EXAMPLESERVER:BOOL=ON -DBUILD_EXAMPLECLIENT:BOOL=ON -DBUILD_EXAMPLES:BOOL=ON -DENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013" ..
+- cmake -DUA_BUILD_EXAMPLESERVER:BOOL=ON -DUA_BUILD_EXAMPLECLIENT:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013" ..
 - msbuild open62541.sln 
 - msbuild open62541.sln 
 - cp C:\projects\open62541\build\open62541.c C:\projects\open62541\build\Debug\open62541.c
 - cp C:\projects\open62541\build\open62541.c C:\projects\open62541\build\Debug\open62541.c
 - cp C:\projects\open62541\build\open62541.h C:\projects\open62541\build\Debug\open62541.h
 - cp C:\projects\open62541\build\open62541.h C:\projects\open62541\build\Debug\open62541.h
@@ -22,7 +22,7 @@ build_script:
 - echo "Win 64 build"
 - echo "Win 64 build"
 - md build64
 - md build64
 - cd build64
 - cd build64
-- cmake -DBUILD_EXAMPLESERVER:BOOL=ON -DBUILD_EXAMPLECLIENT:BOOL=ON -DBUILD_EXAMPLES:BOOL=ON -DENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013 Win64" ..
+- cmake -DUA_BUILD_EXAMPLESERVER:BOOL=ON -DUA_BUILD_EXAMPLECLIENT:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013 Win64" ..
 - msbuild open62541.sln 
 - msbuild open62541.sln 
 - cp C:\projects\open62541\build64\open62541.c C:\projects\open62541\build64\Debug\open62541.c
 - cp C:\projects\open62541\build64\open62541.c C:\projects\open62541\build64\Debug\open62541.c
 - cp C:\projects\open62541\build64\open62541.h C:\projects\open62541\build64\Debug\open62541.h
 - cp C:\projects\open62541\build64\open62541.h C:\projects\open62541\build64\Debug\open62541.h

Різницю між файлами не показано, бо вона завелика
+ 0 - 2311
doc/Doxyfile.in


+ 0 - 194
doc/DoxygenLayout.xml

@@ -1,194 +0,0 @@
-<doxygenlayout version="1.0">
-  <!-- Generated by doxygen 1.8.6 -->
-  <!-- Navigation index tabs for HTML output -->
-  <navindex>
-    <tab type="mainpage" visible="yes" title=""/>
-    <tab type="pages" visible="yes" title="" intro=""/>
-    <tab type="modules" visible="yes" title="" intro=""/>
-    <tab type="namespaces" visible="no" title="">
-      <tab type="namespacelist" visible="yes" title="" intro=""/>
-      <tab type="namespacemembers" visible="yes" title="" intro=""/>
-    </tab>
-    <tab type="classes" visible="no" title="">
-      <tab type="classlist" visible="yes" title="" intro=""/>
-      <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 
-      <tab type="hierarchy" visible="yes" title="" intro=""/>
-      <tab type="classmembers" visible="yes" title="" intro=""/>
-    </tab>
-    <tab type="files" visible="yes" title="">
-      <tab type="filelist" visible="yes" title="" intro=""/>
-      <tab type="globals" visible="yes" title="" intro=""/>
-    </tab>
-    <tab type="examples" visible="no" title="" intro=""/>  
-  </navindex>
-
-  <!-- Layout definition for a class page -->
-  <class>
-    <briefdescription visible="yes"/>
-    <includes visible="$SHOW_INCLUDE_FILES"/>
-    <inheritancegraph visible="$CLASS_GRAPH"/>
-    <collaborationgraph visible="$COLLABORATION_GRAPH"/>
-    <memberdecl>
-      <nestedclasses visible="yes" title=""/>
-      <publictypes title=""/>
-      <services title=""/>
-      <interfaces title=""/>
-      <publicslots title=""/>
-      <signals title=""/>
-      <publicmethods title=""/>
-      <publicstaticmethods title=""/>
-      <publicattributes title=""/>
-      <publicstaticattributes title=""/>
-      <protectedtypes title=""/>
-      <protectedslots title=""/>
-      <protectedmethods title=""/>
-      <protectedstaticmethods title=""/>
-      <protectedattributes title=""/>
-      <protectedstaticattributes title=""/>
-      <packagetypes title=""/>
-      <packagemethods title=""/>
-      <packagestaticmethods title=""/>
-      <packageattributes title=""/>
-      <packagestaticattributes title=""/>
-      <properties title=""/>
-      <events title=""/>
-      <privatetypes title=""/>
-      <privateslots title=""/>
-      <privatemethods title=""/>
-      <privatestaticmethods title=""/>
-      <privateattributes title=""/>
-      <privatestaticattributes title=""/>
-      <friends title=""/>
-      <related title="" subtitle=""/>
-      <membergroups visible="yes"/>
-    </memberdecl>
-    <detaileddescription title=""/>
-    <memberdef>
-      <inlineclasses title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <services title=""/>
-      <interfaces title=""/>
-      <constructors title=""/>
-      <functions title=""/>
-      <related title=""/>
-      <variables title=""/>
-      <properties title=""/>
-      <events title=""/>
-    </memberdef>
-    <allmemberslink visible="yes"/>
-    <usedfiles visible="$SHOW_USED_FILES"/>
-    <authorsection visible="yes"/>
-  </class>
-
-  <!-- Layout definition for a namespace page -->
-  <namespace>
-    <briefdescription visible="yes"/>
-    <memberdecl>
-      <nestednamespaces visible="yes" title=""/>
-      <constantgroups visible="yes" title=""/>
-      <classes visible="yes" title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <functions title=""/>
-      <variables title=""/>
-      <membergroups visible="yes"/>
-    </memberdecl>
-    <detaileddescription title=""/>
-    <memberdef>
-      <inlineclasses title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <functions title=""/>
-      <variables title=""/>
-    </memberdef>
-    <authorsection visible="yes"/>
-  </namespace>
-
-  <!-- Layout definition for a file page -->
-  <file>
-    <briefdescription visible="yes"/>
-    <includes visible="$SHOW_INCLUDE_FILES"/>
-    <includegraph visible="$INCLUDE_GRAPH"/>
-    <includedbygraph visible="$INCLUDED_BY_GRAPH"/>
-    <sourcelink visible="yes"/>
-    <memberdecl>
-      <classes visible="yes" title=""/>
-      <namespaces visible="yes" title=""/>
-      <constantgroups visible="yes" title=""/>
-      <defines title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <functions title=""/>
-      <variables title=""/>
-      <membergroups visible="yes"/>
-    </memberdecl>
-    <detaileddescription title=""/>
-    <memberdef>
-      <inlineclasses title=""/>
-      <defines title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <functions title=""/>
-      <variables title=""/>
-    </memberdef>
-    <authorsection/>
-  </file>
-
-  <!-- Layout definition for a group page -->
-  <group>
-    <briefdescription visible="no"/>
-    <groupgraph visible="$GROUP_GRAPHS"/>
-    <detaileddescription title=""/>
-    <memberdecl>
-      <nestedgroups visible="yes" title=""/>
-      <dirs visible="yes" title=""/>
-      <files visible="yes" title=""/>
-      <namespaces visible="yes" title=""/>
-      <classes visible="yes" title=""/>
-      <defines title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <enumvalues title=""/>
-      <functions title=""/>
-      <variables title=""/>
-      <signals title=""/>
-      <publicslots title=""/>
-      <protectedslots title=""/>
-      <privateslots title=""/>
-      <events title=""/>
-      <properties title=""/>
-      <friends title=""/>
-      <membergroups visible="yes"/>
-    </memberdecl>
-    <memberdef>
-      <pagedocs/>
-      <inlineclasses title=""/>
-      <defines title=""/>
-      <typedefs title=""/>
-      <enums title=""/>
-      <enumvalues title=""/>
-      <functions title=""/>
-      <variables title=""/>
-      <signals title=""/>
-      <publicslots title=""/>
-      <protectedslots title=""/>
-      <privateslots title=""/>
-      <events title=""/>
-      <properties title=""/>
-      <friends title=""/>
-    </memberdef>
-    <authorsection visible="no"/>
-  </group>
-
-  <!-- Layout definition for a directory page -->
-  <directory>
-    <briefdescription visible="yes"/>
-    <directorygraph visible="yes"/>
-    <memberdecl>
-      <dirs visible="yes"/>
-      <files visible="yes"/>
-    </memberdecl>
-    <detaileddescription title=""/>
-  </directory>
-</doxygenlayout>

+ 47 - 59
doc/building.rst

@@ -87,91 +87,79 @@ Follow Ubuntu instructions without the ``apt-get`` commands as these are taken c
 Build Options
 Build Options
 -------------
 -------------
 
 
-Generic CMake options
-~~~~~~~~~~~~~~~~~~~~~
-
 **CMAKE_BUILD_TYPE**
 **CMAKE_BUILD_TYPE**
   - RelWithDebInfo: -O2 optimization with debug symbols
   - RelWithDebInfo: -O2 optimization with debug symbols
   - Release: -O2 optimization without debug symbols
   - Release: -O2 optimization without debug symbols
   - Debug: -O0 optimization with debug symbols
   - Debug: -O0 optimization with debug symbols
   - MinSizeRel: -Os optimization without debug symbols
   - MinSizeRel: -Os optimization without debug symbols
 
 
-BUILD_* group
+**UA_LOGLEVEL**
+   The level of logging events that are reported
+   - 600: Fatal and all below
+   - 500: Error and all below
+   - 400: Error and all below
+   - 300: Info and all below
+   - 200: Debug and all below
+   - 100: Trace and all below
+
+Further options that are not inherited from the CMake configuration are defined
+in ua_config.h. Usually there is no need to adjust them.
+
+**UA_NON_LITTLEENDIAN_ARCHITECTURE**
+   Big-endian or mixed endian platform
+**UA_MIXED_ENDIAN**
+   Mixed-endian platform (e.g., ARM7TDMI)
+**UA_ALIGNED_MEMORY_ACCESS**
+   Platform with aligned memory access only (some ARM processors, e.g. Cortex M3/M4 ARM7TDMI etc.)
+
+UA_BUILD_* group
 ~~~~~~~~~~~~~
 ~~~~~~~~~~~~~
 
 
 By default only the shared object libopen62541.so or the library open62541.dll
 By default only the shared object libopen62541.so or the library open62541.dll
 and open62541.dll.a resp. open62541.lib are build. Additional artifacts can be
 and open62541.dll.a resp. open62541.lib are build. Additional artifacts can be
 specified by the following options:
 specified by the following options:
 
 
-**BUILD_DOCUMENTATION**
+**UA_BUILD_DOCUMENTATION**
    Generate documentation with doxygen
    Generate documentation with doxygen
-**BUILD_EXAMPLECLIENT**
+**UA_BUILD_EXAMPLECLIENT**
    Compile example clients from client.c. There are a static and a dynamic binary client and client_static, respectively
    Compile example clients from client.c. There are a static and a dynamic binary client and client_static, respectively
-**BUILD_EXAMPLESERVER**
+**UA_BUILD_EXAMPLESERVER**
    Compile example server from server.c There are a static and a dynamic binary server and server_static, respectively
    Compile example server from server.c There are a static and a dynamic binary server and server_static, respectively
-**BUILD_UNIT_TESTS**
+**UA_BUILD_UNIT_TESTS**
    Compile unit tests with Check framework. The tests can be executed with make test
    Compile unit tests with Check framework. The tests can be executed with make test
-**BUILD_EXAMPLES**
+**UA_BUILD_EXAMPLES**
    Compile specific examples from https://github.com/acplt/open62541/blob/master/examples/
    Compile specific examples from https://github.com/acplt/open62541/blob/master/examples/
+**UA_BUILD_SELFIGNED_CERTIFICATE**
+   Generate a self-signed certificate for the server (openSSL required)
 
 
-ENABLE_* group
+UA_ENABLE_* group
 ~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~
 
 
 This group contains build options related to the supported OPC UA features.
 This group contains build options related to the supported OPC UA features.
 
 
-**ENABLE_NODEMANAGEMENT**
-   Node management services (adding and removing nodes and references) in server and client
-**ENABLE_AMALGAMATION**
+**UA_ENABLE_SUBSCRIPTIONS**
+   Enable subscriptions
+**UA_ENABLE_METHODCALLS**
+   Enable method calls in server and client
+**UA_ENABLE_NODEMANAGEMENT**
+   Node management services (adding and removing nodes and references) at runtime in server and client
+**UA_ENABLE_AMALGAMATION**
    Compile a single-file release files open62541.c and open62541.h
    Compile a single-file release files open62541.c and open62541.h
-**ENABLE_COVERAGE**
+**UA_ENABLE_MULTITHREADING**
+   Enable multi-threading support (experimental)
+**UA_ENABLE_COVERAGE**
    Measure the coverage of unit tests
    Measure the coverage of unit tests
-**ENABLE_EXTERNAL_NAMESPACES**
+
+Some options are marked as advanced. The advanced options need to be toggled to
+be visible in the cmake GUIs.
+
+**UA_ENABLE_EXTERNAL_NAMESPACES**
    Enable external namespaces in server
    Enable external namespaces in server
-**ENABLE_GNERATE_NAMESPACE0**
+**UA_ENABLE_GENERATE_NAMESPACE0**
    Enable automatic generation of NS0
    Enable automatic generation of NS0
-**GENERATE_NAMESPACE0_FILE**
+**UA_ENABLE_GENERATE_NAMESPACE0_FILE**
    File for NS0 generation from namespace0 folder. Default value is Opc.Ua.NodeSet2.xml
    File for NS0 generation from namespace0 folder. Default value is Opc.Ua.NodeSet2.xml
-**ENABLE_METHODCALL**
-   Enable method calls in server and client
-**ENABLE_MULTITHREADING**
-   Enable multi-threading support (experimental)
-**ENABLE_SUBSCRIPTIONS**
-   Enable subscriptions
-**GENERATE_SELFSIGNED**
-   Generate a self-signed certificate for the server (openSSL required)
-
-EXTENSION_* group
-~~~~~~~~~~~~~~~~~
-
-Extensions mark experimental extensions that are not compliant with IEC 62541 or
-other OPC UA clients
-
-**EXTENSION_STATELESS**
+**UA_ENABLE_NONSTANDARD_STATELESS**
    Stateless service calls
    Stateless service calls
-**EXTENSION_UDP**
+**UA_ENABLE_NONSTANDARD_UDP**
    UDP network layer
    UDP network layer
-
-UA_* group
-~~~~~~~~~~
-
-**UA_LOGLEVEL**
-   The level of logging events that are reported
-   - 600: Fatal and all below
-   - 500: Error and all below
-   - 400: Error and all below
-   - 300: Info and all below
-   - 200: Debug and all below
-   - 100: Trace and all below
-
-C precompiler configuration options
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Options that are not inherited from the CMake configuration are defined in
-ua_config.h. Usually there is no need to adjust them.
-
-**UA_NON_LITTLEENDIAN_ARCHITECTURE**
-   Big-endian or mixed endian platform
-**UA_MIXED_ENDIAN**
-   Mixed-endian platform (e.g., ARM7TDMI)
-**UA_ALIGNED_MEMORY_ACCESS**
-   Platform with aligned memory access only (some ARM processors, e.g. Cortex M3/M4 ARM7TDMI etc.)

+ 3 - 3
doc/datatypes.rst

@@ -94,7 +94,7 @@ The following functions and definitions are used with UA_UInt32.
 .. code-block:: c
 .. code-block:: c
 
 
   /* do not use for cryptographic entropy */
   /* do not use for cryptographic entropy */
-  UA_EXPORT UA_UInt32 UA_UInt32_random(void);
+  UA_UInt32 UA_UInt32_random(void);
 
 
 UA_Int64
 UA_Int64
 ^^^^^^^^
 ^^^^^^^^
@@ -161,9 +161,9 @@ The following functions and definitions are used with UA_DateTime.
       UA_UInt16 year;
       UA_UInt16 year;
   } UA_DateTimeStruct;
   } UA_DateTimeStruct;
 
 
-  UA_DateTimeStruct UA_EXPORT UA_DateTime_toStruct(UA_DateTime time);
+  UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime time);
 
 
-  UA_String UA_EXPORT UA_DateTime_toString(UA_DateTime time);
+  UA_String UA_DateTime_toString(UA_DateTime time);
 
 
 UA_Guid
 UA_Guid
 ^^^^^^^
 ^^^^^^^

+ 0 - 110
doc/mainpage.dox

@@ -1,110 +0,0 @@
-/**
-\mainpage Open62541 Developer Documentation
-
-<a href="http://en.wikipedia.org/wiki/OPC_Unified_Architecture">OPC UA</a> (short for OPC Unified
-Architecture) is a protocol for industrial communication and has been standardized in the IEC62541.
-At its core, OPC UA defines a set of services to interact with a server-side object-oriented
-information model. Besides the service-calls initiated by the client, push-notification of remote
-events (such as data changes) can be negotiated with the server. The client/server interaction is
-mapped either to a binary encoding and TCP-based transmission or to SOAP-based webservices. As of
-late, OPC UA is marketed as the one standard for non-realtime industrial communication.
-
-We believe that it is best to understand OPC UA <em>from the inside out</em>, building upon conceptually
-simple first principles. After establishing a first understanding, we go on explaining how these
-principles are realized in detail. Examples are given based on the <em>open62541</em> implementation of the
-standard.
-
-<h2>OPC UA, a collection of services</h2>
-
-In OPC UA, all communication is based on service calls, each consisting of a request and a response
-message. Be careful to note the difference between services and methods. Services are pre-defined in
-the standard and cannot be changed. But you can use the <em>Call</em> service to invoke user-defined
-methods on the server.
-
-For completeness, the following tables contain all services defined in the standard. Do not bother
-with their details yet. We will introduce the different services later in the text. In open62541,
-each service is implemented in a single function. See the \ref services section for details.
-
-<b>Establishing communication</b>
-
-<table>
-<tr> <th>Discovery Service Set </th><th>SecureChannel Service Set </th><th>Session Service Set </th></tr>
-<tr> <td>FindServers </td><td>OpenSecureChannel </td><td>CreateSession </td></tr>
-<tr> <td>GetEndpoints </td><td>CloseSecureChannel </td><td>ActivateSession </td></tr>
-<tr> <td>RegisterServer </td><td></td><td>CloseSession </td></tr>
-<tr> <td></td><td></td><td>Cancel </td></tr>
-</table>
-
-<b>Interaction with the information model</b>
-
-<table>
-<tr> <th>NodeManagement Service Set </th><th>View Service Set </th><th>Query Service Set </th><th>Attribute Service Set </th><th>Method Service Set  </th></tr>
-<tr> <td>AddNodes </td><td>Browse </td><td>QueryFirst </td><td>Read </td><td>Call </td></tr>
-<tr> <td>AddReferences </td><td>BrowseNext </td><td>QueryNext </td><td>HistoryRead </td><td></td></tr>
-<tr> <td>DeleteNodes </td><td>TranslateBrowsePathsToNodeIds </td><td></td><td>Write </td><td></td></tr>
-<tr> <td>DeleteReferences </td><td>RegisterNodes </td><td></td><td>HistoryUpdate </td><td></td></tr>
-<tr> <td></td><td>UnregisterNodes </td><td></td><td></td><td></td></tr>
-</table>
-
-<b>Notifications</b>
-
-<table>
-<tr> <th>MonitoredItem Service Set </th><th>Subscription Service Set  </th></tr>
-<tr> <td>CreateMonitoredItems </td><td>CreateSubscription </td></tr>
-<tr> <td>ModifyMonitoredItems </td><td>ModifySubscription </td></tr>
-<tr> <td>SetMonitoringMode </td><td>SetPublishingMode </td></tr>
-<tr> <td>SetTriggering </td><td>Publish </td></tr>
-<tr> <td>DeleteMonitoredItems </td><td>Republish </td></tr>
-<tr> <td></td><td>TransferSubscription </td></tr>
-<tr> <td></td><td>DeleteSubscription </td></tr>
-</table>
-
-<h2>OPC UA, a web of nodes</h2>
-
-The information model in each OPC UA server is a web of interconnected nodes. There are eight
-different types of nodes. Depending on its type, every node contains different attributes. Some
-attributes, such as the <em>NodeId</em> (unique identifier) and the <em>BrowseName</em>, are
-contained in all node types.
-
-<table>
-<tr> <td>ReferenceTypeNode</td> <td>MethodNode</td> </tr>
-<tr> <td>DataTypeNode</td> <td>ObjectTypeNode</td> </tr>
-<tr> <td>VariableTypeNode</td> <td>ObjectNode</td> </tr>
-<tr> <td>VariableNode</td> <td>ViewNode</td> </tr>
-</table>
-                                                                                                            
-Nodes are interconnected by directed reference-triples of the form <dfn>(nodeid, referencetype,
-target-nodeid)</dfn>. Therefore an OPC UA information model is easiest imagined as a <em>web of nodes</em>.
-Reference types can be
-- standard- or user-defined and
-- either non-hierarchical (e.g., indicating the type of a variable-node) or hierarchical (e.g., indicating a parent-child relationship).
-
-<h2>OPC UA, a protocol</h2>
-
-The OPC UA protocol (both binary and XML-based) is based on 25 <em>built-in</em> datatypes. In
-open62541, these are defined in ua_types.h.
-
-<table>
-<tr> <td>Boolean</td> <td>Float</td> <td>StatusCode</td> </tr>
-<tr> <td>SByte</td> <td>Double</td> <td>QualifiedName</td> </tr>
-<tr> <td>Byte</td> <td>String</td> <td>LocalizedText</td> </tr>
-<tr> <td>Int16</td> <td>DateTime</td> <td>ExtensionObject</td> </tr>
-<tr> <td>UInt16</td> <td>Guid</td> <td>DataValue</td> </tr>
-<tr> <td>Int32</td> <td>ByteString</td> <td>Variant</td> </tr>
-<tr> <td>UInt32</td> <td>XmlElement</td> <td>DiagnosticInfo</td> </tr>
-<tr> <td>Int64</td> <td>NodeId</td> <td> </td> </tr>
-<tr> <td>UInt64</td> <td>ExpandedNodeId</td> <td> </td> </tr>
-</table>
-
-The builtin datatypes are combined into more complex structures. When the structure contains an array,
-then the size of the array is stored in an Int32 value just before the array itself. A size of -1
-indicates an undefined array. Positive sizes (and zero) have the usual semantics.
-
-Most importantly, every service has a request and a response message defined as such a data
-structure. The entire OPC UA protocol revolves around the exchange of these request and response
-messages. Their exact definitions can be looked up here:
-https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml. In open62541, we autogenerate the
-C-structs to handle the standard-defined structures automatically. See ua_types_generated.h for
-comparison.
-
-*/

Різницю між файлами не показано, бо вона завелика
+ 0 - 336
doc/style/doxygen.css


+ 0 - 20
doc/style/footer.html

@@ -1,20 +0,0 @@
-<!-- start footer part -->
-<!--BEGIN GENERATE_TREEVIEW-->
-<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
-  <ul>
-    $navpath
-    <li class="footer">$generatedby
-    <a href="http://www.doxygen.org/index.html">
-    <img class="footer" src="doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
-  </ul>
-</div>
-<!--END GENERATE_TREEVIEW-->
-<!--BEGIN !GENERATE_TREEVIEW-->
-<address class="footer"><small>
-$generatedby &#160;<a href="http://www.doxygen.org/index.html">
-<img class="footer" src="doxygen.png" alt="doxygen"/>
-</a> $doxygenversion
-</small></address>
-<!--END !GENERATE_TREEVIEW-->
-</body>
-</html>

+ 0 - 19
doc/style/header.html

@@ -1,19 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
-<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<meta name="generator" content="Doxygen $doxygenversion"/>
-<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
-<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
-<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
-<script type="text/javascript" src="dynsections.js"></script>
-<script type="text/javascript" src="load-style.js"></script>
-$treeview
-$search
-$mathjax
-<link href="doxygen.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
-

Різницю між файлами не показано, бо вона завелика
+ 0 - 4
doc/style/jquery-1.11.1.min.js


+ 0 - 58
doc/style/load-style.js

@@ -1,58 +0,0 @@
-$( document ).ready(function() {
-
-	$('#top > div > ul > li > a').wrapInner("<b></b>");
-
-	$("div.header").prepend("<h2></h2>");
-	$("div.header > h2").text($("div.title").text());
-	$("div.headertitle").remove();
-	$("#nav-path").remove();
-	
-	$("body").wrapInner("<div class='container'><div class='row'><div class='col-md-12'></div></div></div>");
-	$("ul.tablist").addClass("nav nav-pills nav-justified");
-	$("ul.tablist").css("margin-top", "0.5em");
-	$("ul.tablist").css("margin-bottom", "0.5em");
-	$("li.current").addClass("active");
-	$(".contents").wrapInner("<div class='panel panel-default' style='margin-top:1em;'><div class='panel-body'></div></div>");
-	$(".contents").find("h2.groupheader:first").remove();
-
-	$("iframe").attr("scrolling", "yes");
-	
-	$('img[src="ftv2ns.png"]').replaceWith('<span class="label label-danger">N</span> ');
-	$('img[src="ftv2cl.png"]').replaceWith('<span class="label label-danger">C</span> ');
-
-	// dirty workaround since doxygen 1.7 doesn't set table ids
-	$("table").each(function() {
-		if($(this).find("tbody > tr > td.indexkey").length > 0) {
-			$(this).addClass("table table-striped");
-		}
-	});
-	
-	$("table.params").addClass("table");
-	$("div.ingroups").wrapInner("<small></small>");
-	$("div.levels").css("margin", "0.5em");
-	$("div.levels > span").addClass("btn btn-default btn-xs");
-	$("div.levels > span").css("margin-right", "0.25em");
-	
-	$("table.directory").addClass("table table-striped");
-	$("div.summary > a").addClass("btn btn-default btn-xs");
-	$("table.fieldtable").addClass("table");
-	$(".fragment").addClass("well");
-	$(".memitem").addClass("panel panel-default");
-	$(".memproto").addClass("panel-heading");
-	$(".memdoc").addClass("panel-body");
-	$("span.mlabel").addClass("label label-info");
-	
-	$("table.memberdecls").addClass("table");
-	$("[class^=memitem]").addClass("active");
-	$("td.memSeparator").remove()
-	
-	$("div.ah").addClass("btn btn-default");
-	$("span.mlabels").addClass("pull-right");
-	$("table.mlabels").css("width", "100%")
-	$("td.mlabels-right").addClass("pull-right");
-
-	$("div.ttc").addClass("panel panel-info");
-	$("div.ttname").addClass("panel-heading");
-	$("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body");
-});
-

+ 20 - 16
examples/CMakeLists.txt

@@ -10,9 +10,9 @@ if(NOT WIN32)
 else()
 else()
     list(APPEND LIBS ws2_32)
     list(APPEND LIBS ws2_32)
 endif()
 endif()
-if(ENABLE_MULTITHREADING)
+if(UA_ENABLE_MULTITHREADING)
     list(APPEND LIBS urcu-cds urcu urcu-common)
     list(APPEND LIBS urcu-cds urcu urcu-common)
-endif(ENABLE_MULTITHREADING)
+endif()
 
 
 # add_executable(server_readspeed server_readspeed.c)
 # add_executable(server_readspeed server_readspeed.c)
 # target_link_libraries(server_readspeed ${LIBS})
 # target_link_libraries(server_readspeed ${LIBS})
@@ -29,25 +29,29 @@ target_link_libraries(server_firstSteps ${LIBS})
 add_executable(client_firstSteps client_firstSteps.c)
 add_executable(client_firstSteps client_firstSteps.c)
 target_link_libraries(client_firstSteps ${LIBS})
 target_link_libraries(client_firstSteps ${LIBS})
 
 
-if(NOT ENABLE_AMALGAMATION)
+if(NOT UA_ENABLE_AMALGAMATION)
 	add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
 	add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
-		           PRE_BUILD
-		           COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml ${PROJECT_BINARY_DIR}/src_generated/nodeset
-		           DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_builtin_types.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_constants.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py
-		                   ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
-		                   ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
-		           
+		               PRE_BUILD
+		               COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+                                                    -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
+                                                    ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml
+                                                    ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml
+                                                    ${PROJECT_BINARY_DIR}/src_generated/nodeset
+   		                DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_builtin_types.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_constants.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py
+		                        ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
+		                        ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
+		                      
 	add_executable(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
 	add_executable(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
 	target_link_libraries(server_nodeset ${LIBS})
 	target_link_libraries(server_nodeset ${LIBS})
 endif()
 endif()
 
 
-if(ENABLE_METHODCALLS)
+if(UA_ENABLE_METHODCALLS)
   add_executable(server_method server_method.c)
   add_executable(server_method server_method.c)
   target_link_libraries(server_method ${LIBS})
   target_link_libraries(server_method ${LIBS})
 endif()
 endif()

+ 4 - 4
examples/client.c

@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
     UA_BrowseRequest_deleteMembers(&bReq);
     UA_BrowseRequest_deleteMembers(&bReq);
     UA_BrowseResponse_deleteMembers(&bResp);
     UA_BrowseResponse_deleteMembers(&bResp);
     
     
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     // Create a subscription with interval 0 (immediate)...
     // Create a subscription with interval 0 (immediate)...
     UA_UInt32 subId;
     UA_UInt32 subId;
     UA_Client_Subscriptions_new(client, UA_SubscriptionSettings_standard, &subId);
     UA_Client_Subscriptions_new(client, UA_SubscriptionSettings_standard, &subId);
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
     UA_WriteRequest_deleteMembers(&wReq);
     UA_WriteRequest_deleteMembers(&wReq);
     UA_WriteResponse_deleteMembers(&wResp);
     UA_WriteResponse_deleteMembers(&wResp);
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     // Take another look at the.answer... this should call the handler.
     // Take another look at the.answer... this should call the handler.
     UA_Client_Subscriptions_manuallySendPublishRequest(client);
     UA_Client_Subscriptions_manuallySendPublishRequest(client);
     
     
@@ -134,7 +134,7 @@ int main(int argc, char *argv[]) {
         printf("Subscription removed\n");
         printf("Subscription removed\n");
 #endif
 #endif
     
     
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     /* Note:  This example requires Namespace 0 Node 11489 (ServerType -> GetMonitoredItems) 
     /* Note:  This example requires Namespace 0 Node 11489 (ServerType -> GetMonitoredItems) 
        FIXME: Provide a namespace 0 independant example on the server side
        FIXME: Provide a namespace 0 independant example on the server side
      */
      */
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
 
 
 #endif
 #endif
 
 
-#ifdef ENABLE_NODEMANAGEMENT 
+#ifdef UA_ENABLE_NODEMANAGEMENT 
     /* New ReferenceType */
     /* New ReferenceType */
     UA_NodeId ref_id;
     UA_NodeId ref_id;
     UA_ReferenceTypeAttributes ref_attr;
     UA_ReferenceTypeAttributes ref_attr;

+ 0 - 696
examples/client_legacy.c

@@ -1,696 +0,0 @@
-/*
- C ECHO client example using sockets
-
- This is an example client for internal benchmarks. It works, but is not ready
- for serious use. We do not really check any of the returns from the server.
- */
-#include <stdio.h> //printf
-#include <string.h> //strlen
-#include <sys/socket.h> //socket
-#include <arpa/inet.h> //inet_addr
-#include <unistd.h> // for close
-#include <stdlib.h> // pulls in declaration of malloc, free
-
-//this legacy stuff can not be build with amalgamation options, since it need internal APIs
-#include "ua_util.h"
-#include "ua_transport_generated_encoding_binary.h"
-#include "ua_types_generated_encoding_binary.h"
-
-typedef struct ConnectionInfo {
-    UA_Int32 socket;
-    UA_UInt32 channelId;
-    UA_SequenceHeader sequenceHdr;
-    UA_NodeId authenticationToken;
-    UA_UInt32 tokenId;
-    UA_UInt32 reqestHandle;
-} ConnectionInfo;
-
-static UA_Int32 sendHello(UA_Int32 sock, UA_String *endpointURL) {
-
-    UA_TcpMessageHeader messageHeader;
-    messageHeader.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_HELF;
-
-    UA_TcpHelloMessage hello;
-    UA_String_copy(endpointURL, &hello.endpointUrl);
-    hello.maxChunkCount = 1;
-    hello.maxMessageSize = 16777216;
-    hello.protocolVersion = 0;
-    hello.receiveBufferSize = 65536;
-    hello.sendBufferSize = 65536;
-
-    UA_ByteString message;
-    UA_ByteString_newMembers(&message, 1024);
-
-    size_t offset = 0;
-    UA_TcpMessageHeader_encodeBinary((UA_TcpMessageHeader const*) &messageHeader, &message, &offset);
-    UA_TcpHelloMessage_encodeBinary((UA_TcpHelloMessage const*) &hello, &message, &offset);
-    messageHeader.messageSize = offset;
-
-    offset = 0;
-    UA_TcpMessageHeader_encodeBinary((UA_TcpMessageHeader const*) &messageHeader, &message, &offset);
-    UA_TcpHelloMessage_encodeBinary((UA_TcpHelloMessage const*) &hello, &message, &offset);
-
-    UA_Int32 sendret = send(sock, message.data, offset, 0);
-
-    UA_ByteString_deleteMembers(&message);
-    free(hello.endpointUrl.data);
-    if (sendret < 0)
-        return 1;
-    return 0;
-}
-
-static int sendOpenSecureChannel(UA_Int32 sock) {
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_OPNF;
-
-    UA_UInt32 secureChannelId = 0;
-    UA_String securityPolicy;
-    securityPolicy = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
-
-    UA_String senderCert;
-    senderCert.data = NULL;
-    senderCert.length = -1;
-
-    UA_String receiverCertThumb;
-    receiverCertThumb.data = NULL;
-    receiverCertThumb.length = -1;
-
-    UA_UInt32 sequenceNumber = 51;
-
-    UA_UInt32 requestId = 1;
-
-    UA_NodeId type;
-    type.identifier.numeric = 446; // id of opensecurechannelrequest
-    type.identifierType = UA_NODEIDTYPE_NUMERIC;
-    type.namespaceIndex = 0;
-
-    UA_OpenSecureChannelRequest opnSecRq;
-    UA_OpenSecureChannelRequest_init(&opnSecRq);
-    opnSecRq.requestHeader.timestamp = UA_DateTime_now();
-    UA_ByteString_newMembers(&opnSecRq.clientNonce, 1);
-    opnSecRq.clientNonce.data[0] = 0;
-    opnSecRq.clientProtocolVersion = 0;
-    opnSecRq.requestedLifetime = 30000;
-    opnSecRq.securityMode = UA_MESSAGESECURITYMODE_NONE;
-    opnSecRq.requestType = UA_SECURITYTOKENREQUESTTYPE_ISSUE;
-    opnSecRq.requestHeader.authenticationToken.identifier.numeric = 10;
-    opnSecRq.requestHeader.authenticationToken.identifierType = UA_NODEIDTYPE_NUMERIC;
-    opnSecRq.requestHeader.authenticationToken.namespaceIndex = 10;
-
-    msghdr.messageSize = 135; // todo: compute the message size from the actual content
-
-    UA_ByteString message;
-    UA_ByteString_newMembers(&message, 1000);
-    size_t offset = 0;
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_UInt32_encodeBinary(&secureChannelId, &message, &offset);
-    UA_String_encodeBinary(&securityPolicy, &message, &offset);
-    UA_String_encodeBinary(&senderCert, &message, &offset);
-    UA_String_encodeBinary(&receiverCertThumb, &message, &offset);
-    UA_UInt32_encodeBinary(&sequenceNumber, &message, &offset);
-    UA_UInt32_encodeBinary(&requestId, &message, &offset);
-    UA_NodeId_encodeBinary(&type, &message, &offset);
-    UA_OpenSecureChannelRequest_encodeBinary(&opnSecRq, &message, &offset);
-
-    UA_OpenSecureChannelRequest_deleteMembers(&opnSecRq);
-    //UA_String_deleteMembers(&securityPolicy);
-
-    UA_Int32 sendret = send(sock, message.data, offset, 0);
-    UA_ByteString_deleteMembers(&message);
-    if (sendret < 0) {
-        printf("send opensecurechannel failed");
-        return 1;
-    }
-    return 0;
-}
-
-static UA_Int32 sendCreateSession(UA_Int32 sock, UA_UInt32 channelId, UA_UInt32 tokenId, UA_UInt32 sequenceNumber,
-        UA_UInt32 requestId, UA_String *endpointUrl) {
-    UA_ByteString message;
-    UA_ByteString_newMembers(&message, 65536);
-    UA_UInt32 tmpChannelId = channelId;
-    size_t offset = 0;
-
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_MSGF;
-
-    UA_NodeId type;
-    type.identifier.numeric = 461;
-    type.identifierType = UA_NODEIDTYPE_NUMERIC;
-    type.namespaceIndex = 0;
-
-    UA_CreateSessionRequest rq;
-    UA_CreateSessionRequest_init(&rq);
-    rq.requestHeader.requestHandle = 1;
-    rq.requestHeader.timestamp = UA_DateTime_now();
-    rq.requestHeader.timeoutHint = 10000;
-    rq.requestHeader.authenticationToken.identifier.numeric = 10;
-    rq.requestHeader.authenticationToken.identifierType = UA_NODEIDTYPE_NUMERIC;
-    rq.requestHeader.authenticationToken.namespaceIndex = 10;
-    UA_String_copy(endpointUrl, &rq.endpointUrl);
-    rq.sessionName = UA_STRING("mysession");
-    rq.clientCertificate = UA_STRING("abcd");
-    UA_ByteString_newMembers(&rq.clientNonce, 1);
-    rq.clientNonce.data[0] = 0;
-    rq.requestedSessionTimeout = 1200000;
-    rq.maxResponseMessageSize = UA_INT32_MAX;
-
-    //workaround to get length calculated
-    offset = 0;
-    UA_CreateSessionRequest_encodeBinary(&rq, &message, &offset);
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_NodeId_encodeBinary(&type, &message, &offset);
-    msghdr.messageSize = 16 + offset;
-    offset = 0;
-
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_UInt32_encodeBinary(&tmpChannelId, &message, &offset);
-    UA_UInt32_encodeBinary(&tokenId, &message, &offset);
-    UA_UInt32_encodeBinary(&sequenceNumber, &message, &offset);
-    UA_UInt32_encodeBinary(&requestId, &message, &offset);
-    UA_NodeId_encodeBinary(&type, &message, &offset);
-    UA_CreateSessionRequest_encodeBinary(&rq, &message, &offset);
-
-    UA_Int32 sendret = send(sock, message.data, offset, 0);
-    UA_ByteString_deleteMembers(&message);
-    //fixme: potential leak
-    //UA_CreateSessionRequest_deleteMembers(&rq);
-    if (sendret < 0) {
-        printf("send opensecurechannel failed");
-        return 1;
-    }
-    return 0;
-}
-
-static UA_Int32 closeSession(ConnectionInfo *connectionInfo) {
-    size_t offset = 0;
-
-    UA_ByteString message;
-    UA_ByteString_newMembers(&message, 65536);
-
-    UA_CloseSessionRequest rq;
-    UA_CloseSessionRequest_init(&rq);
-
-    rq.requestHeader.requestHandle = connectionInfo->reqestHandle++;
-    rq.requestHeader.timestamp = UA_DateTime_now();
-    rq.requestHeader.timeoutHint = 10000;
-    rq.requestHeader.authenticationToken = connectionInfo->authenticationToken;
-    rq.deleteSubscriptions = UA_TRUE;
-
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_MSGF;
-
-    UA_NodeId type;
-    type.identifier.numeric = 473;
-    type.identifierType = UA_NODEIDTYPE_NUMERIC;
-    type.namespaceIndex = 0;
-
-    //workaround to get length calculated
-    offset = 0;
-    UA_CloseSessionRequest_encodeBinary(&rq, &message, &offset);
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_NodeId_encodeBinary(&type, &message, &offset);
-    msghdr.messageSize = 16 + offset;
-    offset = 0;
-
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_UInt32_encodeBinary(&connectionInfo->channelId, &message, &offset);
-    UA_UInt32_encodeBinary(&connectionInfo->tokenId, &message, &offset);
-    connectionInfo->sequenceHdr.sequenceNumber++;
-    UA_UInt32_encodeBinary(&connectionInfo->sequenceHdr.sequenceNumber, &message, &offset);
-    connectionInfo->sequenceHdr.requestId++;
-    UA_UInt32_encodeBinary(&connectionInfo->sequenceHdr.requestId, &message, &offset);
-    UA_NodeId_encodeBinary(&type, &message, &offset);
-    UA_CloseSessionRequest_encodeBinary(&rq, &message, &offset);
-
-    UA_Int32 sendret = send(connectionInfo->socket, message.data, offset, 0);
-    UA_ByteString_deleteMembers(&message);
-    UA_CloseSessionRequest_deleteMembers(&rq);
-    if(sendret < 0) {
-        printf("send closesessionrequest failed");
-        return 1;
-    }
-
-    return 0;
-}
-
-static UA_Int32 closeSecureChannel(ConnectionInfo *connectionInfo) {
-    size_t offset = 0;
-
-    UA_ByteString message;
-    UA_ByteString_newMembers(&message, 65536);
-
-    UA_CloseSecureChannelRequest rq;
-    UA_CloseSecureChannelRequest_init(&rq);
-
-    rq.requestHeader.requestHandle = 1;
-    rq.requestHeader.timestamp = UA_DateTime_now();
-    rq.requestHeader.timeoutHint = 10000;
-    rq.requestHeader.authenticationToken.identifier.numeric = 10;
-    rq.requestHeader.authenticationToken.identifierType = UA_NODEIDTYPE_NUMERIC;
-    rq.requestHeader.authenticationToken.namespaceIndex = 10;
-
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_CLOF;
-
-    //workaround to get length calculated
-    offset = 0;
-    UA_CloseSecureChannelRequest_encodeBinary(&rq, &message, &offset);
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    msghdr.messageSize = 4 + offset;
-    offset = 0;
-
-    UA_TcpMessageHeader_encodeBinary(&msghdr, &message, &offset);
-    UA_UInt32_encodeBinary(&connectionInfo->channelId, &message, &offset);
-    UA_CloseSecureChannelRequest_encodeBinary(&rq, &message, &offset);
-
-    UA_Int32 sendret = send(connectionInfo->socket, message.data, offset, 0);
-    UA_ByteString_deleteMembers(&message);
-    UA_CloseSecureChannelRequest_deleteMembers(&rq);
-    if(sendret < 0) {
-        printf("send CloseSecureChannelRequest failed");
-        return 1;
-    }
-
-    return 0;
-}
-
-static UA_Int32 sendActivateSession(UA_Int32 sock, UA_UInt32 channelId, UA_UInt32 tokenId, UA_UInt32 sequenceNumber,
-        UA_UInt32 requestId, UA_NodeId authenticationToken) {
-    UA_ByteString *message = UA_ByteString_new();
-    UA_ByteString_newMembers(message, 65536);
-    UA_UInt32 tmpChannelId = channelId;
-    size_t offset = 0;
-
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_MSGF;
-    msghdr.messageSize = 86;
-
-    UA_NodeId type;
-    type.identifier.numeric = 467;
-    type.identifierType = UA_NODEIDTYPE_NUMERIC;
-    type.namespaceIndex = 0;
-
-    UA_ActivateSessionRequest rq;
-    UA_ActivateSessionRequest_init(&rq);
-    rq.requestHeader.requestHandle = 2;
-    rq.requestHeader.authenticationToken = authenticationToken;
-    rq.requestHeader.timestamp = UA_DateTime_now();
-    rq.requestHeader.timeoutHint = 10000;
-
-    //workaround to get length calculated
-    offset = 0;
-    UA_ActivateSessionRequest_encodeBinary(&rq, message, &offset);
-    UA_TcpMessageHeader_encodeBinary(&msghdr, message, &offset);
-    UA_NodeId_encodeBinary(&type, message, &offset);
-    msghdr.messageSize = 16 + offset;
-    offset = 0;
-
-    UA_TcpMessageHeader_encodeBinary(&msghdr, message, &offset);
-    UA_UInt32_encodeBinary(&tmpChannelId, message, &offset);
-    UA_UInt32_encodeBinary(&tokenId, message, &offset);
-    UA_UInt32_encodeBinary(&sequenceNumber, message, &offset);
-    UA_UInt32_encodeBinary(&requestId, message, &offset);
-    UA_NodeId_encodeBinary(&type, message, &offset);
-    UA_ActivateSessionRequest_encodeBinary(&rq, message, &offset);
-
-    UA_Int32 sendret = send(sock, message->data, offset, 0);
-    UA_ByteString_delete(message);
-
-    if (sendret < 0) {
-        printf("send opensecurechannel failed");
-        return 1;
-    }
-    return 0;
-
-}
-
-static UA_Int64 sendReadRequest(ConnectionInfo *connectionInfo, UA_Int32 nodeIds_size,UA_NodeId* nodeIds){
-    /*UA_Int32 sock, UA_UInt32 channelId, UA_UInt32 tokenId, UA_UInt32 sequenceNumber, UA_UInt32 requestId,
-                         UA_NodeId authenticationToken, UA_Int32 nodeIds_size,UA_NodeId* nodeIds) {
-     */
-    UA_ByteString *message = UA_ByteString_new();
-    UA_ByteString_newMembers(message, 65536);
-    UA_UInt32 tmpChannelId = connectionInfo->channelId;
-    size_t offset = 0;
-
-    UA_TcpMessageHeader msghdr;
-    msghdr.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_MSGF;
-
-    UA_NodeId type;
-    type.identifier.numeric = 631;
-    type.identifierType = UA_NODEIDTYPE_NUMERIC;
-    type.namespaceIndex = 0;
-
-    UA_ReadRequest rq;
-    UA_ReadRequest_init(&rq);
-    rq.maxAge = 0;
-    rq.nodesToRead = UA_Array_new(&UA_TYPES[UA_TYPES_READVALUEID], nodeIds_size);
-    rq.nodesToReadSize = 1;
-    for(UA_Int32 i=0;i<nodeIds_size;i++) {
-        UA_ReadValueId_init(&(rq.nodesToRead[i]));
-        rq.nodesToRead[i].attributeId = 6; //WriteMask
-        UA_NodeId_init(&(rq.nodesToRead[i].nodeId));
-        rq.nodesToRead[i].nodeId = nodeIds[i];
-        UA_QualifiedName_init(&(rq.nodesToRead[0].dataEncoding));
-    }
-    rq.requestHeader.timeoutHint = 10000;
-    rq.requestHeader.timestamp = UA_DateTime_now();
-    rq.requestHeader.authenticationToken = connectionInfo->authenticationToken;
-    rq.timestampsToReturn = 0x03;
-    rq.requestHeader.requestHandle = connectionInfo->reqestHandle++;
-
-    //workaround to get length calculated
-    offset = 0;
-    UA_ReadRequest_encodeBinary(&rq, message, &offset);
-    UA_TcpMessageHeader_encodeBinary(&msghdr, message, &offset);
-    UA_NodeId_encodeBinary(&type, message, &offset);
-    msghdr.messageSize = 16 + offset;
-    offset = 0;
-
-    UA_TcpMessageHeader_encodeBinary(&msghdr,message,&offset);
-    UA_UInt32_encodeBinary(&tmpChannelId, message, &offset);
-    UA_UInt32_encodeBinary(&connectionInfo->tokenId, message, &offset);
-    connectionInfo->sequenceHdr.sequenceNumber++;
-    UA_UInt32_encodeBinary(&connectionInfo->sequenceHdr.sequenceNumber, message, &offset);
-    connectionInfo->sequenceHdr.requestId++;
-    UA_UInt32_encodeBinary(&connectionInfo->sequenceHdr.requestId, message, &offset);
-    UA_NodeId_encodeBinary(&type,message,&offset);
-    UA_ReadRequest_encodeBinary(&rq, message, &offset);
-
-    UA_DateTime tic = UA_DateTime_now();
-    UA_Int32 sendret = send(connectionInfo->socket, message->data, offset, 0);
-    UA_Array_delete(rq.nodesToRead, &UA_TYPES[UA_TYPES_READVALUEID], nodeIds_size);
-    UA_ByteString_delete(message);
-
-    if (sendret < 0) {
-        printf("send readrequest failed");
-        return 1;
-    }
-    return tic;
-}
-
-static int ua_client_connectUA(char* ipaddress,int port, UA_String *endpointUrl, ConnectionInfo *connectionInfo,
-        UA_Boolean stateless, UA_Boolean udp) {
-    UA_ByteString reply;
-    UA_ByteString_newMembers(&reply, 65536);
-    int sock;
-    struct sockaddr_in server;
-    //Create socket
-    if(udp==UA_TRUE){
-        sock = socket(AF_INET, SOCK_DGRAM, 0);
-    }else{
-        sock = socket(AF_INET, SOCK_STREAM, 0);
-    }
-    if(sock == -1) {
-        printf("Could not create socket");
-        return 1;
-    }
-    server.sin_addr.s_addr = inet_addr(ipaddress);
-    server.sin_family = AF_INET;
-    server.sin_port = htons(port);
-
-    if(connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) {
-        perror("connect failed. Error");
-        return 1;
-    }
-    connectionInfo->socket = sock;
-
-    if(stateless){
-        UA_NodeId_init(&connectionInfo->authenticationToken);
-        connectionInfo->channelId=0;
-        UA_SequenceHeader_init(&connectionInfo->sequenceHdr);
-        connectionInfo->tokenId=0;
-        connectionInfo->reqestHandle = 1;
-        return 0;
-    }else{
-        sendHello(sock, endpointUrl);
-        recv(sock, reply.data, reply.length, 0);
-        sendOpenSecureChannel(sock);
-        recv(sock, reply.data, reply.length, 0);
-
-        size_t recvOffset = 0;
-        UA_TcpMessageHeader msghdr;
-        UA_TcpMessageHeader_decodeBinary(&reply, &recvOffset, &msghdr);
-
-        UA_AsymmetricAlgorithmSecurityHeader asymHeader;
-        UA_NodeId rspType;
-        UA_OpenSecureChannelResponse openSecChannelRsp;
-        UA_UInt32_decodeBinary(&reply, &recvOffset, &connectionInfo->channelId);
-        UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply,&recvOffset,&asymHeader);
-        UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
-        UA_SequenceHeader_decodeBinary(&reply,&recvOffset,&connectionInfo->sequenceHdr);
-        UA_NodeId_decodeBinary(&reply,&recvOffset,&rspType);
-        UA_OpenSecureChannelResponse_decodeBinary(&reply,&recvOffset,&openSecChannelRsp);
-        connectionInfo->tokenId = openSecChannelRsp.securityToken.tokenId;
-
-        sendCreateSession(sock, connectionInfo->channelId, openSecChannelRsp.securityToken.tokenId, 52, 2, endpointUrl);
-        recv(sock, reply.data, reply.length, 0);
-
-        UA_NodeId messageType;
-        recvOffset = 24;
-        UA_NodeId_decodeBinary(&reply,&recvOffset,&messageType);
-        UA_CreateSessionResponse createSessionResponse;
-        UA_CreateSessionResponse_decodeBinary(&reply,&recvOffset,&createSessionResponse);
-        connectionInfo->authenticationToken = createSessionResponse.authenticationToken;
-        sendActivateSession(sock, connectionInfo->channelId, connectionInfo->tokenId, 53, 3,
-                connectionInfo->authenticationToken);
-        recv(sock, reply.data, reply.length, 0);
-
-        connectionInfo->sequenceHdr.requestId = 3;
-        connectionInfo->sequenceHdr.sequenceNumber = 53;
-        connectionInfo->reqestHandle = 3;
-
-        UA_OpenSecureChannelResponse_deleteMembers(&openSecChannelRsp);
-
-        UA_String_deleteMembers(&reply);
-        UA_CreateSessionResponse_deleteMembers(&createSessionResponse);
-        return 0;
-    }
-}
-
-int main(int argc, char *argv[]) {
-    int defaultParams = argc < 8;
-
-    //start parameters
-    if(defaultParams) {
-        printf("1st parameter: number of nodes to read \n");
-        printf("2nd parameter: number of measured read-tries \n");
-        printf("3rd parameter: name of the file to save measurement data \n");
-        printf("4th parameter: 1 = read same node, 0 = read different nodes \n");
-        printf("5th parameter: ip adress \n");
-        printf("6th parameter: port \n");
-        printf("7th parameter: 0=stateful, 1=stateless\n");
-        printf("8th parameter: 0=tcp, 1=udp (only with stateless calls)\n");
-        printf("9th parameter: number of tries to run in (not measured, added to tries)\n");
-        printf("9th parameter: number of tries to run out (not measured, added to tries)\n");
-        printf("\nUsing default parameters. \n");
-    }
-
-    UA_UInt32 nodesToReadSize;
-    UA_UInt32 tries;
-    UA_Boolean alwaysSameNode;
-    UA_ByteString reply;
-    UA_ByteString_newMembers(&reply, 65536);
-    UA_Boolean stateless;
-    UA_Boolean udp;
-    UA_UInt32 runIn;
-    UA_UInt32 runOut;
-
-    if(defaultParams)
-        nodesToReadSize = 1;
-    else
-        nodesToReadSize = atoi(argv[1]);
-
-    if(defaultParams)
-        tries= 1;
-    else
-        tries = (UA_UInt32) atoi(argv[2]);
-
-    if(defaultParams){
-        alwaysSameNode = UA_TRUE;
-    }else{
-        if(atoi(argv[4]) != 0)
-            alwaysSameNode = UA_TRUE;
-        else
-            alwaysSameNode = UA_FALSE;
-    }
-
-    if(defaultParams){
-        stateless = UA_FALSE;
-    }else{
-        if(atoi(argv[7]) != 0)
-            stateless = UA_TRUE;
-        else
-            stateless = UA_FALSE;
-    }
-
-    if(defaultParams){
-        udp = UA_FALSE;
-    }else{
-        if(atoi(argv[8]) != 0)
-            udp = UA_TRUE;
-        else
-            udp = UA_FALSE;
-    }
-
-    if(defaultParams){
-        runIn = 0;
-    }else{
-        runIn = (UA_UInt32) atoi(argv[9]);
-    }
-
-    if(defaultParams){
-        runOut = 0;
-    }else{
-        runOut = (UA_UInt32) atoi(argv[10]);
-    }
-
-
-
-    //Connect to remote server
-    UA_String endpoint;
-    endpoint = UA_STRING("none");
-    ConnectionInfo connectionInfo;
-
-
-    /* REQUEST START*/
-    UA_NodeId *nodesToRead;
-    nodesToRead = UA_Array_new(&UA_TYPES[UA_TYPES_NODEID], 1);
-
-    for(UA_UInt32 i = 0; i<1; i++) {
-        if(alwaysSameNode)
-            nodesToRead[i].identifier.numeric = 2253; //ask always the same node
-        else
-            nodesToRead[i].identifier.numeric = 19000 +i;
-        nodesToRead[i].identifierType = UA_NODEIDTYPE_NUMERIC;
-        nodesToRead[i].namespaceIndex = 0;
-    }
-
-    UA_DateTime tic, toc;
-    UA_Double *timeDiffs;
-    UA_Int32 received = 0;
-    timeDiffs = UA_Array_new(&UA_TYPES[UA_TYPES_DOUBLE], tries);
-    UA_Double sum = 0;
-
-    tic = UA_DateTime_now();
-
-    /**
-	UA_Double duration;
-
-	UA_UInt32 count = 0;
-	UA_Double start = 0, stop = 0;
-
-	UA_UInt32 timeToRun = 30;
-	UA_UInt32 timeToStart = 8;
-	UA_UInt32 timeToStop = 22;
-
-	do{
-		toc = UA_DateTime_now();
-		duration = ((UA_Double)toc-(UA_Double)tic)/(UA_Double)1e4;
-		if(duration>=timeToStart*1000 && duration <= timeToStop*1000){
-			if(start==0.0){
-				start=UA_DateTime_now();
-			}
-		}
-			//if(stateless || (!stateless && i==0)){
-				if(defaultParams){
-					if(ua_client_connectUA("127.0.0.1",atoi("16664"),&endpoint,&connectionInfo,stateless,udp) != 0){
-						return 0;
-					}
-				}else{
-					if(ua_client_connectUA(argv[5],atoi(argv[6]),&endpoint,&connectionInfo,stateless,udp) != 0){
-						return 0;
-					}
-				}
-			//}
-			sendReadRequest(&connectionInfo,1,nodesToRead);
-			received = recv(connectionInfo.socket, reply.data, 2000, 0);
-			if(duration>=timeToStart*1000 && duration <= timeToStop*1000){
-				count++;
-			}
-
-			if(!stateless){
-			closeSession(&connectionInfo);
-			recv(connectionInfo.socket, reply.data, 2000, 0);
-
-			closeSecureChannel(&connectionInfo);
-			}
-			//if(stateless || (!stateless && i==tries-1)){
-				close(connectionInfo.socket);
-			//}
-		if(duration >= timeToStop*1000 && stop==0){
-			stop=UA_DateTime_now();
-			printf("%i messages in %f secs, rate %f m/s\n", count, (stop-start)/(UA_Double)1e7, (UA_Double)count/((stop-start)/(UA_Double)1e7));
-		}
-
-	}while(duration<timeToRun*1000);
-
-	exit(0);
-     **/
-
-    for(UA_UInt32 i = 0; i < tries + runIn + runOut; i++) {
-        if(i >= runIn && i < runIn+tries)
-            tic = UA_DateTime_now();
-        if(defaultParams){
-            if(ua_client_connectUA("127.0.0.1",atoi("16664"),&endpoint,&connectionInfo,stateless,udp) != 0){
-                return 0;
-            }
-        }else{
-            if(ua_client_connectUA(argv[5],atoi(argv[6]),&endpoint,&connectionInfo,stateless,udp) != 0){
-                return 0;
-            }
-        }
-        for(UA_UInt32 i = 0; i < nodesToReadSize; i++) {
-            sendReadRequest(&connectionInfo,1,nodesToRead);
-            received = recv(connectionInfo.socket, reply.data, 2000, 0);
-        }
-
-        if(!stateless){
-            closeSession(&connectionInfo);
-            recv(connectionInfo.socket, reply.data, 2000, 0);
-            closeSecureChannel(&connectionInfo);
-        }
-        close(connectionInfo.socket);
-        if(i >= runIn && i < runIn+tries){
-            toc = UA_DateTime_now() - tic;
-            timeDiffs[i-runIn] = (UA_Double)toc/(UA_Double)1e4;
-            sum = sum + timeDiffs[i-runIn];
-        }
-    }
-
-    /* REQUEST END*/
-
-    UA_Double mean = sum / tries;
-    printf("total time for requests: %16.10f ms \n",sum);
-    printf("mean time for handling request: %16.10f ms \n",mean);
-
-    if(received>0)
-        printf("received: %i\n",received); // dummy
-
-
-    //save to file
-    char data[100];
-    const char flag = 'a';
-    FILE* fHandle = NULL;
-    if (defaultParams) {
-        fHandle =  fopen("client.log", &flag);
-    }else{
-        fHandle =  fopen(argv[3], &flag);
-    }
-    //header
-
-    UA_Int32 bytesToWrite = 0;//sprintf(data, "measurement %s in ms, nodesToRead %d \n", argv[3], 1);
-    //fwrite(data,1,bytesToWrite,fHandle);
-    for(UA_UInt32 i=0;i<tries;i++) {
-        bytesToWrite = sprintf(data,"%16.10f \n",timeDiffs[i]);
-        fwrite(data,1,bytesToWrite,fHandle);
-    }
-    fclose(fHandle);
-
-    UA_String_deleteMembers(&reply);
-    UA_Array_delete(nodesToRead,&UA_TYPES[UA_TYPES_NODEID], 1);
-    UA_free(timeDiffs);
-
-    return 0;
-}

+ 3 - 3
examples/networklayer_tcp.c

@@ -32,7 +32,7 @@
 # define CLOSESOCKET(S) close(S)
 # define CLOSESOCKET(S) close(S)
 #endif
 #endif
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # include <urcu/uatomic.h>
 # include <urcu/uatomic.h>
 #endif
 #endif
 
 
@@ -234,7 +234,7 @@ static void setFDSet(ServerNetworkLayerTCP *layer) {
 
 
 /* callback triggered from the server */
 /* callback triggered from the server */
 static void ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
 static void ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
     if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
         return;
         return;
 #else
 #else
@@ -481,7 +481,7 @@ ClientNetworkLayerReleaseBuffer(UA_Connection *connection, UA_ByteString *buf) {
 
 
 static void
 static void
 ClientNetworkLayerClose(UA_Connection *connection) {
 ClientNetworkLayerClose(UA_Connection *connection) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
     if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
         return;
         return;
 #else
 #else

+ 1 - 1
examples/networklayer_udp.c

@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h> // memset
 #include <string.h> // memset
 #include "networklayer_udp.h"
 #include "networklayer_udp.h"
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # include <urcu/uatomic.h>
 # include <urcu/uatomic.h>
 #endif
 #endif
 
 

+ 8 - 8
examples/server.c

@@ -27,7 +27,7 @@
 # include <unistd.h> //access
 # include <unistd.h> //access
 #endif
 #endif
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # ifdef UA_NO_AMALGAMATION
 # ifdef UA_NO_AMALGAMATION
 #  ifndef __USE_XOPEN2K
 #  ifndef __USE_XOPEN2K
 #   define __USE_XOPEN2K
 #   define __USE_XOPEN2K
@@ -99,7 +99,7 @@ readTemperature(void *handle, const UA_NodeId nodeId, UA_Boolean sourceTimeStamp
 /*************************/
 /*************************/
 /* Read-write status led */
 /* Read-write status led */
 /*************************/
 /*************************/
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 pthread_rwlock_t writeLock;
 pthread_rwlock_t writeLock;
 #endif
 #endif
 FILE* triggerFile = NULL;
 FILE* triggerFile = NULL;
@@ -132,7 +132,7 @@ writeLedStatus(void *handle, const UA_NodeId nodeid,
     if(range)
     if(range)
         return UA_STATUSCODE_BADINDEXRANGEINVALID;
         return UA_STATUSCODE_BADINDEXRANGEINVALID;
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	pthread_rwlock_wrlock(&writeLock);
 	pthread_rwlock_wrlock(&writeLock);
 #endif
 #endif
 	if(data->data)
 	if(data->data)
@@ -148,13 +148,13 @@ writeLedStatus(void *handle, const UA_NodeId nodeid,
 			fprintf(ledFile, "%s", "0");
 			fprintf(ledFile, "%s", "0");
 		fflush(ledFile);
 		fflush(ledFile);
 	}
 	}
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	pthread_rwlock_unlock(&writeLock);
 	pthread_rwlock_unlock(&writeLock);
 #endif
 #endif
 	return UA_STATUSCODE_GOOD;
 	return UA_STATUSCODE_GOOD;
 }
 }
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 static UA_StatusCode
 static UA_StatusCode
 getMonitoredItems(void *methodHandle, const UA_NodeId objectId,
 getMonitoredItems(void *methodHandle, const UA_NodeId objectId,
                   size_t inputSize, const UA_Variant *input,
                   size_t inputSize, const UA_Variant *input,
@@ -202,7 +202,7 @@ nodeIter(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, voi
 
 
 int main(int argc, char** argv) {
 int main(int argc, char** argv) {
     signal(SIGINT, stopHandler); /* catches ctrl-c */
     signal(SIGINT, stopHandler); /* catches ctrl-c */
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     pthread_rwlock_init(&writeLock, 0);
     pthread_rwlock_init(&writeLock, 0);
 #endif
 #endif
 
 
@@ -374,7 +374,7 @@ int main(int argc, char** argv) {
         UA_Variant_deleteMembers(&attr.value);
         UA_Variant_deleteMembers(&attr.value);
     }
     }
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     UA_Argument inputArguments;
     UA_Argument inputArguments;
     UA_Argument_init(&inputArguments);
     UA_Argument_init(&inputArguments);
     inputArguments.arrayDimensionsSize = 0;
     inputArguments.arrayDimensionsSize = 0;
@@ -435,7 +435,7 @@ int main(int argc, char** argv) {
     if(ledFile)
     if(ledFile)
         fclose(ledFile);
         fclose(ledFile);
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     pthread_rwlock_destroy(&writeLock);
     pthread_rwlock_destroy(&writeLock);
 #endif
 #endif
 
 

+ 1 - 1
include/ua_client.h

@@ -298,7 +298,7 @@ UA_Client_Service_call(UA_Client *client, const UA_CallRequest request) {
                         &response, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
                         &response, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
     return response; }
     return response; }
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 /* MonitoredItem Service Set */
 /* MonitoredItem Service Set */
 
 
 /**
 /**

+ 1 - 1
include/ua_client_highlevel.h

@@ -255,7 +255,7 @@ UA_Client_call(UA_Client *client, const UA_NodeId objectId, const UA_NodeId meth
 /* Subscriptions Handling */
 /* Subscriptions Handling */
 /**************************/
 /**************************/
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 
 
 typedef struct {
 typedef struct {
     UA_Double requestedPublishingInterval;
     UA_Double requestedPublishingInterval;

+ 11 - 5
include/ua_config.h.in

@@ -6,11 +6,17 @@
 #endif
 #endif
 
 
 #define UA_LOGLEVEL ${UA_LOGLEVEL}
 #define UA_LOGLEVEL ${UA_LOGLEVEL}
-#cmakedefine UA_MULTITHREADING
-#cmakedefine ENABLE_METHODCALLS
-#cmakedefine ENABLE_SUBSCRIPTIONS
-#cmakedefine ENABLE_TYPEINTROSPECTION
-#cmakedefine UA_EMBEDDED_LIBC
+#cmakedefine UA_ENABLE_MULTITHREADING
+#cmakedefine UA_ENABLE_METHODCALLS
+#cmakedefine UA_ENABLE_SUBSCRIPTIONS
+#cmakedefine UA_ENABLE_TYPENAMES
+#cmakedefine UA_ENABLE_EMBEDDED_LIBC
+#cmakedefine UA_ENABLE_GENERATE_NAMESPACE0
+#cmakedefine UA_ENABLE_EXTERNAL_NAMESPACES
+#cmakedefine UA_ENABLE_NODEMANAGEMENT
+
+#cmakedefine UA_ENABLE_NONSTANDARD_UDP
+#cmakedefine UA_ENABLE_NONSTANDARD_STATELESS
 
 
 /* Function Export */
 /* Function Export */
 #ifdef _WIN32
 #ifdef _WIN32

+ 1 - 1
include/ua_server.h

@@ -330,7 +330,7 @@ UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requested
                                     const UA_VariableAttributes attr, const UA_DataSource dataSource,
                                     const UA_VariableAttributes attr, const UA_DataSource dataSource,
                                     UA_NodeId *outNewNodeId);
                                     UA_NodeId *outNewNodeId);
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 typedef UA_StatusCode (*UA_MethodCallback)(void *methodHandle, const UA_NodeId objectId,
 typedef UA_StatusCode (*UA_MethodCallback)(void *methodHandle, const UA_NodeId objectId,
                                            size_t inputSize, const UA_Variant *input,
                                            size_t inputSize, const UA_Variant *input,
                                            size_t outputSize, UA_Variant *output);
                                            size_t outputSize, UA_Variant *output);

+ 34 - 24
include/ua_types.h

@@ -157,11 +157,13 @@ UA_Guid UA_EXPORT UA_Guid_random(void);
 /************************************/
 /************************************/
 typedef UA_String UA_ByteString;
 typedef UA_String UA_ByteString;
 
 
-static UA_INLINE UA_Boolean UA_ByteString_equal(const UA_ByteString *string1, const UA_ByteString *string2) {
+static UA_INLINE UA_Boolean
+UA_ByteString_equal(const UA_ByteString *string1, const UA_ByteString *string2) {
     return UA_String_equal((const UA_String*)string1, (const UA_String*)string2); }
     return UA_String_equal((const UA_String*)string1, (const UA_String*)string2); }
 
 
 /* Allocates memory of size length for the bytestring. The content is not set to zero. */
 /* Allocates memory of size length for the bytestring. The content is not set to zero. */
-UA_StatusCode UA_EXPORT UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
+UA_StatusCode UA_EXPORT
+UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
 
 
 UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
 UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
 
 
@@ -346,8 +348,8 @@ typedef struct {
 } UA_Variant;
 } UA_Variant;
 
 
 /**
 /**
- * Returns true if the variant contains a scalar value. Note that empty variants contain an array of
- * length -1 (undefined).
+ * Returns true if the variant contains a scalar value. Note that empty variants
+ * contain an array of length -1 (undefined).
  *
  *
  * @param v The variant
  * @param v The variant
  * @return Does the variant contain a scalar value.
  * @return Does the variant contain a scalar value.
@@ -356,14 +358,15 @@ static UA_INLINE UA_Boolean UA_Variant_isScalar(const UA_Variant *v) {
     return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL); }
     return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL); }
     
     
 /**
 /**
- * Set the variant to a scalar value that already resides in memory. The value takes on the
- * lifecycle of the variant and is deleted with it.
+ * Set the variant to a scalar value that already resides in memory. The value
+ * takes on the lifecycle of the variant and is deleted with it.
  *
  *
  * @param v The variant
  * @param v The variant
  * @param p A pointer to the value data
  * @param p A pointer to the value data
  * @param type The datatype of the value in question
  * @param type The datatype of the value in question
  */
  */
-void UA_EXPORT UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const UA_DataType *type);
+void UA_EXPORT
+UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const UA_DataType *type);
 
 
 /**
 /**
  * Set the variant to a scalar value that is copied from an existing variable.
  * Set the variant to a scalar value that is copied from an existing variable.
@@ -373,11 +376,12 @@ void UA_EXPORT UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const U
  * @param type The datatype of the value
  * @param type The datatype of the value
  * @return Indicates whether the operation succeeded or returns an error code
  * @return Indicates whether the operation succeeded or returns an error code
  */
  */
-UA_StatusCode UA_EXPORT UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type);
+UA_StatusCode UA_EXPORT
+UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type);
 
 
 /**
 /**
- * Set the variant to an array that already resides in memory. The array takes on the lifecycle of
- * the variant and is deleted with it.
+ * Set the variant to an array that already resides in memory. The array takes
+ * on the lifecycle of the variant and is deleted with it.
  *
  *
  * @param v The variant
  * @param v The variant
  * @param array A pointer to the array data
  * @param array A pointer to the array data
@@ -385,7 +389,8 @@ UA_StatusCode UA_EXPORT UA_Variant_setScalarCopy(UA_Variant *v, const void *p, c
  * @param type The datatype of the array
  * @param type The datatype of the array
  */
  */
 void UA_EXPORT
 void UA_EXPORT
-UA_Variant_setArray(UA_Variant *v, void * UA_RESTRICT array, size_t arraySize, const UA_DataType *type);
+UA_Variant_setArray(UA_Variant *v, void * UA_RESTRICT array,
+                    size_t arraySize, const UA_DataType *type);
 
 
 /**
 /**
  * Set the variant to an array that is copied from an existing array.
  * Set the variant to an array that is copied from an existing array.
@@ -397,7 +402,8 @@ UA_Variant_setArray(UA_Variant *v, void * UA_RESTRICT array, size_t arraySize, c
  * @return Indicates whether the operation succeeded or returns an error code
  * @return Indicates whether the operation succeeded or returns an error code
  */
  */
 UA_StatusCode UA_EXPORT
 UA_StatusCode UA_EXPORT
-UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type);
+UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
+                        size_t arraySize, const UA_DataType *type);
 
 
 /* NumericRanges are used to indicate subsets of a (multidimensional) variant
 /* NumericRanges are used to indicate subsets of a (multidimensional) variant
  * array. NumericRange has no official type structure in the standard. On the
  * array. NumericRange has no official type structure in the standard. On the
@@ -436,7 +442,8 @@ UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRan
  * @return Returns UA_STATUSCODE_GOOD or an error code
  * @return Returns UA_STATUSCODE_GOOD or an error code
  */
  */
 UA_StatusCode UA_EXPORT
 UA_StatusCode UA_EXPORT
-UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array, size_t arraySize, const UA_NumericRange range);
+UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array,
+                    size_t arraySize, const UA_NumericRange range);
 
 
 /**
 /**
  * Deep-copy a range of data into an existing variant.
  * Deep-copy a range of data into an existing variant.
@@ -448,7 +455,8 @@ UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array, size_t arraySize, c
  * @return Returns UA_STATUSCODE_GOOD or an error code
  * @return Returns UA_STATUSCODE_GOOD or an error code
  */
  */
 UA_StatusCode UA_EXPORT
 UA_StatusCode UA_EXPORT
-UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range);
+UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
+                        size_t arraySize, const UA_NumericRange range);
 
 
 /**************************************************************************/
 /**************************************************************************/
 /* DataValue: A data value with an associated status code and timestamps. */
 /* DataValue: A data value with an associated status code and timestamps. */
@@ -496,21 +504,23 @@ typedef struct UA_DiagnosticInfo {
 #define UA_MAX_TYPE_MEMBERS 13 // Maximum number of members per structured type
 #define UA_MAX_TYPE_MEMBERS 13 // Maximum number of members per structured type
 
 
 typedef struct {
 typedef struct {
-#ifdef ENABLE_TYPEINTROSPECTION
+#ifdef UA_ENABLE_TYPENAMES
     const char *memberName;
     const char *memberName;
 #endif
 #endif
     UA_UInt16   memberTypeIndex;   ///< Index of the member in the datatypetable
     UA_UInt16   memberTypeIndex;   ///< Index of the member in the datatypetable
-    UA_Byte     padding;           /**< How much padding is there before this member element? For arrays this is
-                                        split into 2 bytes padding before the length index (max 4 bytes) and 3
-                                        bytes padding before the pointer (max 8 bytes) */
-    UA_Boolean  namespaceZero : 1; /**< The type of the member is defined in namespace zero. In this
-                                        implementation, types from custom namespace may contain
-                                        members from the same namespace or ns0 only.*/
+    UA_Byte     padding;           /**< How much padding is there before this member
+                                        element? For arrays this is the padding before the
+                                        size_t lenght member. (No padding between size_t
+                                        and the following ptr.) */
+    UA_Boolean  namespaceZero : 1; /**< The type of the member is defined in namespace
+                                        zero. In this implementation, types from custom
+                                        namespace may contain members from the same
+                                        namespace or ns0 only.*/
     UA_Boolean  isArray       : 1; ///< The member is an array of the given type
     UA_Boolean  isArray       : 1; ///< The member is an array of the given type
 } UA_DataTypeMember;
 } UA_DataTypeMember;
     
     
 struct UA_DataType {
 struct UA_DataType {
-#ifdef ENABLE_TYPEINTROSPECTION
+#ifdef UA_ENABLE_TYPENAMES
     const char *typeName;
     const char *typeName;
 #endif
 #endif
     UA_NodeId   typeId;           ///< The nodeid of the type
     UA_NodeId   typeId;           ///< The nodeid of the type
@@ -651,8 +661,8 @@ typedef enum {
 /***************************/
 /***************************/
 
 
 /**
 /**
- * If UA_MULTITHREADING is enabled, then the seed is stored in thread local storage. The seed is
- * initialized for every thread in the server/client.
+ * If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread local
+ * storage. The seed is initialized for every thread in the server/client.
  */
  */
 UA_EXPORT void UA_random_seed(UA_UInt64 seed);
 UA_EXPORT void UA_random_seed(UA_UInt64 seed);
 
 

+ 2 - 2
src/client/ua_client.c

@@ -35,7 +35,7 @@ static void UA_Client_init(UA_Client* client, UA_ClientConfig config,
     client->config = config;
     client->config = config;
     client->scExpiresAt = 0;
     client->scExpiresAt = 0;
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     client->monitoredItemHandles = 0;
     client->monitoredItemHandles = 0;
     LIST_INIT(&client->pendingNotificationsAcks);
     LIST_INIT(&client->pendingNotificationsAcks);
     LIST_INIT(&client->subscriptions);
     LIST_INIT(&client->subscriptions);
@@ -58,7 +58,7 @@ static void UA_Client_deleteMembers(UA_Client* client) {
     if(client->endpointUrl.data)
     if(client->endpointUrl.data)
         UA_String_deleteMembers(&client->endpointUrl);
         UA_String_deleteMembers(&client->endpointUrl);
     UA_UserTokenPolicy_deleteMembers(&client->token);
     UA_UserTokenPolicy_deleteMembers(&client->token);
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     UA_Client_NotificationsAckNumber *n, *tmp;
     UA_Client_NotificationsAckNumber *n, *tmp;
     LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
     LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
         LIST_REMOVE(n, listEntry);
         LIST_REMOVE(n, listEntry);

+ 2 - 2
src/client/ua_client_internal.h

@@ -8,7 +8,7 @@
 /* Subscriptions Handling */
 /* Subscriptions Handling */
 /**************************/
 /**************************/
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 
 
 typedef struct UA_Client_NotificationsAckNumber_s {
 typedef struct UA_Client_NotificationsAckNumber_s {
     UA_SubscriptionAcknowledgement subAck;
     UA_SubscriptionAcknowledgement subAck;
@@ -67,7 +67,7 @@ struct UA_Client {
     UA_NodeId authenticationToken;
     UA_NodeId authenticationToken;
     UA_UInt32 requestHandle;
     UA_UInt32 requestHandle;
     
     
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     UA_Int32 monitoredItemHandles;
     UA_Int32 monitoredItemHandles;
     LIST_HEAD(UA_ListOfUnacknowledgedNotificationNumbers, UA_Client_NotificationsAckNumber_s) pendingNotificationsAcks;
     LIST_HEAD(UA_ListOfUnacknowledgedNotificationNumbers, UA_Client_NotificationsAckNumber_s) pendingNotificationsAcks;
     LIST_HEAD(UA_ListOfClientSubscriptionItems, UA_Client_Subscription_s) subscriptions;
     LIST_HEAD(UA_ListOfClientSubscriptionItems, UA_Client_Subscription_s) subscriptions;

+ 3 - 3
src/server/ua_nodes.c

@@ -328,7 +328,7 @@ UA_MethodNode * UA_MethodNode_new(void) {
 }
 }
 
 
 void UA_MethodNode_deleteMembers(UA_MethodNode *p) {
 void UA_MethodNode_deleteMembers(UA_MethodNode *p) {
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     p->attachedMethod = NULL;
     p->attachedMethod = NULL;
 #endif
 #endif
     UA_Node_deleteMembers((UA_Node*)p);
     UA_Node_deleteMembers((UA_Node*)p);
@@ -336,7 +336,7 @@ void UA_MethodNode_deleteMembers(UA_MethodNode *p) {
 
 
 void UA_MethodNode_delete(UA_MethodNode *p) {
 void UA_MethodNode_delete(UA_MethodNode *p) {
     UA_MethodNode_deleteMembers(p);
     UA_MethodNode_deleteMembers(p);
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     p->methodHandle   = NULL;
     p->methodHandle   = NULL;
     p->attachedMethod = NULL;
     p->attachedMethod = NULL;
 #endif
 #endif
@@ -349,7 +349,7 @@ UA_StatusCode UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
         return retval;
         return retval;
     dst->executable = src->executable;
     dst->executable = src->executable;
     dst->userExecutable = src->userExecutable;
     dst->userExecutable = src->userExecutable;
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     dst->methodHandle  = src->methodHandle;
     dst->methodHandle  = src->methodHandle;
     dst->attachedMethod = src->attachedMethod;
     dst->attachedMethod = src->attachedMethod;
 #endif
 #endif

+ 1 - 1
src/server/ua_nodes.h

@@ -127,7 +127,7 @@ typedef struct {
     UA_STANDARD_NODEMEMBERS
     UA_STANDARD_NODEMEMBERS
     UA_Boolean executable;
     UA_Boolean executable;
     UA_Boolean userExecutable;
     UA_Boolean userExecutable;
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     void *methodHandle;
     void *methodHandle;
     UA_MethodCallback attachedMethod;
     UA_MethodCallback attachedMethod;
 #endif
 #endif

+ 1 - 1
src/server/ua_nodestore.h

@@ -26,7 +26,7 @@
  */
  */
 
 
 /* For multithreading, nodes in the nodestore are immutable */
 /* For multithreading, nodes in the nodestore are immutable */
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # define UA_MT_CONST const
 # define UA_MT_CONST const
 #else
 #else
 # define UA_MT_CONST
 # define UA_MT_CONST

+ 3 - 3
src/server/ua_securechannel_manager.c

@@ -33,7 +33,7 @@ void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_Dat
         if(timeout < now || !entry->channel.connection) {
         if(timeout < now || !entry->channel.connection) {
             LIST_REMOVE(entry, pointers);
             LIST_REMOVE(entry, pointers);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
             cm->currentChannelCount--;
             cm->currentChannelCount--;
 #else
 #else
             cm->currentChannelCount = uatomic_add_return(
             cm->currentChannelCount = uatomic_add_return(
@@ -57,7 +57,7 @@ UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Connection *conn,
     channel_list_entry *entry = UA_malloc(sizeof(channel_list_entry));
     channel_list_entry *entry = UA_malloc(sizeof(channel_list_entry));
     if(!entry)
     if(!entry)
         return UA_STATUSCODE_BADOUTOFMEMORY;
         return UA_STATUSCODE_BADOUTOFMEMORY;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     cm->currentChannelCount++;
     cm->currentChannelCount++;
 #else
 #else
     cm->currentChannelCount = uatomic_add_return(&cm->currentChannelCount, 1);
     cm->currentChannelCount = uatomic_add_return(&cm->currentChannelCount, 1);
@@ -141,7 +141,7 @@ UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt
             LIST_REMOVE(entry, pointers);
             LIST_REMOVE(entry, pointers);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
             UA_free(entry);
             UA_free(entry);
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
             cm->currentChannelCount--;
             cm->currentChannelCount--;
 #else
 #else
             cm->currentChannelCount = uatomic_add_return(&cm->currentChannelCount, -1);
             cm->currentChannelCount = uatomic_add_return(&cm->currentChannelCount, -1);

+ 13 - 13
src/server/ua_server.c

@@ -6,7 +6,7 @@
 #include "ua_services.h"
 #include "ua_services.h"
 #include "ua_nodeids.h"
 #include "ua_nodeids.h"
 
 
-#ifdef ENABLE_GENERATE_NAMESPACE0
+#ifdef UA_ENABLE_GENERATE_NAMESPACE0
 #include "ua_namespaceinit_generated.h"
 #include "ua_namespaceinit_generated.h"
 #endif
 #endif
 
 
@@ -19,7 +19,7 @@ const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
     .Application_applicationURI = "urn:unconfigured:open62541:open62541Server",
     .Application_applicationURI = "urn:unconfigured:open62541:open62541Server",
     .Application_applicationName = "open62541" };
     .Application_applicationName = "open62541" };
 
 
-#if defined(UA_MULTITHREADING) && !defined(NDEBUG)
+#if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
 UA_THREAD_LOCAL bool rcu_locked = UA_FALSE;
 UA_THREAD_LOCAL bool rcu_locked = UA_FALSE;
 #endif
 #endif
 
 
@@ -44,7 +44,7 @@ static const UA_ExpandedNodeId expandedNodeIdBaseDataVariabletype = {
                .identifier.numeric = UA_NS0ID_BASEDATAVARIABLETYPE},
                .identifier.numeric = UA_NS0ID_BASEDATAVARIABLETYPE},
     .namespaceUri = {.length = -1, .data = NULL}, .serverIndex = 0};
     .namespaceUri = {.length = -1, .data = NULL}, .serverIndex = 0};
 
 
-#ifndef ENABLE_GENERATE_NAMESPACE0
+#ifndef UA_ENABLE_GENERATE_NAMESPACE0
 static const UA_NodeId nodeIdNonHierarchicalReferences = {
 static const UA_NodeId nodeIdNonHierarchicalReferences = {
         .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
         .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
         .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
         .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
@@ -54,7 +54,7 @@ static const UA_NodeId nodeIdNonHierarchicalReferences = {
 /* Namespace Handling */
 /* Namespace Handling */
 /**********************/
 /**********************/
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 static void UA_ExternalNamespace_init(UA_ExternalNamespace *ens) {
 static void UA_ExternalNamespace_init(UA_ExternalNamespace *ens) {
     ens->index = 0;
     ens->index = 0;
     UA_String_init(&ens->url);
     UA_String_init(&ens->url);
@@ -96,7 +96,7 @@ UA_Server_addExternalNamespace(UA_Server *server, UA_UInt16 namespaceIndex,
     server->externalNamespacesSize++;
     server->externalNamespacesSize++;
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
-#endif /* UA_EXTERNAL_NAMESPACES*/
+#endif /* UA_ENABLE_EXTERNAL_NAMESPACES*/
 
 
 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
     server->namespaces = UA_realloc(server->namespaces,
     server->namespaces = UA_realloc(server->namespaces,
@@ -273,7 +273,7 @@ void UA_Server_delete(UA_Server *server) {
     UA_SecureChannelManager_deleteMembers(&server->secureChannelManager);
     UA_SecureChannelManager_deleteMembers(&server->secureChannelManager);
     UA_SessionManager_deleteMembers(&server->sessionManager, server);
     UA_SessionManager_deleteMembers(&server->sessionManager, server);
     UA_NodeStore_delete(server->nodestore);
     UA_NodeStore_delete(server->nodestore);
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Server_deleteExternalNamespaces(server);
     UA_Server_deleteExternalNamespaces(server);
 #endif
 #endif
     UA_ByteString_deleteMembers(&server->serverCertificate);
     UA_ByteString_deleteMembers(&server->serverCertificate);
@@ -290,7 +290,7 @@ void UA_Server_delete(UA_Server *server) {
     UA_free(server->networkLayers);
     UA_free(server->networkLayers);
 
 
     UA_RCU_UNLOCK();
     UA_RCU_UNLOCK();
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* so the workers don't spin if the queue is empty */
     /* so the workers don't spin if the queue is empty */
     pthread_cond_destroy(&server->dispatchQueue_condition);
     pthread_cond_destroy(&server->dispatchQueue_condition);
     rcu_barrier(); // wait for all scheduled call_rcu work to complete
     rcu_barrier(); // wait for all scheduled call_rcu work to complete
@@ -453,7 +453,7 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
     server->config = config;
     server->config = config;
 
 
     LIST_INIT(&server->repeatedJobs);
     LIST_INIT(&server->repeatedJobs);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     rcu_init();
     rcu_init();
    	rcu_register_thread();
    	rcu_register_thread();
     cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
     cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
@@ -584,7 +584,7 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
     /**************/
     /**************/
     /* References */
     /* References */
     /**************/
     /**************/
-#ifndef ENABLE_GENERATE_NAMESPACE0
+#ifndef UA_ENABLE_GENERATE_NAMESPACE0
     /* Bootstrap by manually inserting "references" and "hassubtype" */
     /* Bootstrap by manually inserting "references" and "hassubtype" */
     UA_ReferenceTypeNode *references = UA_ReferenceTypeNode_new();
     UA_ReferenceTypeNode *references = UA_ReferenceTypeNode_new();
     copyNames((UA_Node*)references, "References");
     copyNames((UA_Node*)references, "References");
@@ -916,7 +916,7 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
                                 UA_NS0ID_BASEVARIABLETYPE, UA_FALSE);
                                 UA_NS0ID_BASEVARIABLETYPE, UA_FALSE);
 #endif
 #endif
 
 
-#ifdef ENABLE_GENERATE_NAMESPACE0
+#ifdef UA_ENABLE_GENERATE_NAMESPACE0
     //load the generated namespace
     //load the generated namespace
     ua_namespaceinit_generated(server);
     ua_namespaceinit_generated(server);
 #endif
 #endif
@@ -1000,13 +1000,13 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
     UA_UInt16 profileArraySize = 0;
     UA_UInt16 profileArraySize = 0;
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
 
 
-#ifdef ENABLE_SERVICESET_NODEMANAGEMENT
+#ifdef UA_ENABLE_SERVICESET_NODEMANAGEMENT
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
 #endif
 #endif
-#ifdef ENABLE_SERVICESET_METHOD
+#ifdef UA_ENABLE_SERVICESET_METHOD
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
 #endif
 #endif
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
 #endif
 #endif
 
 

+ 7 - 7
src/server/ua_server_binary.c

@@ -97,7 +97,7 @@ static void processOPN(UA_Connection *connection, UA_Server *server, const UA_By
     }
     }
 
 
     /* send the response with an asymmetric security header */
     /* send the response with an asymmetric security header */
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
 #else
 #else
     seqHeader.sequenceNumber = uatomic_add_return(&channel->sequenceNumber, 1);
     seqHeader.sequenceNumber = uatomic_add_return(&channel->sequenceNumber, 1);
@@ -211,7 +211,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
         *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
         *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
         break;
         break;
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     case UA_NS0ID_CREATESUBSCRIPTIONREQUEST:
     case UA_NS0ID_CREATESUBSCRIPTIONREQUEST:
         *service = (UA_Service)Service_CreateSubscription;
         *service = (UA_Service)Service_CreateSubscription;
         *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
         *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
@@ -249,7 +249,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
         break;
         break;
 #endif
 #endif
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     case UA_NS0ID_CALLREQUEST:
     case UA_NS0ID_CALLREQUEST:
         *service = (UA_Service)Service_Call;
         *service = (UA_Service)Service_Call;
         *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
         *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
@@ -257,7 +257,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
 	break;
 	break;
 #endif
 #endif
 
 
-#ifdef ENABLE_NODEMANAGEMENT
+#ifdef UA_ENABLE_NODEMANAGEMENT
     case UA_NS0ID_ADDNODESREQUEST:
     case UA_NS0ID_ADDNODESREQUEST:
         *service = (UA_Service)Service_AddNodes;
         *service = (UA_Service)Service_AddNodes;
         *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
         *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
@@ -365,7 +365,7 @@ processMSG(UA_Connection *connection, UA_Server *server, const UA_ByteString *ms
     }
     }
 
 
     /* Most services can only be called with a valid securechannel */
     /* Most services can only be called with a valid securechannel */
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
     if(channel == &anonymousChannel &&
     if(channel == &anonymousChannel &&
        requestType->typeIndex > UA_TYPES_OPENSECURECHANNELREQUEST) {
        requestType->typeIndex > UA_TYPES_OPENSECURECHANNELREQUEST) {
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSECURECHANNELIDINVALID);
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSECURECHANNELIDINVALID);
@@ -399,7 +399,7 @@ processMSG(UA_Connection *connection, UA_Server *server, const UA_ByteString *ms
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSESSIONNOTACTIVATED);
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSESSIONNOTACTIVATED);
         return;
         return;
     }
     }
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
     if(session == &anonymousSession &&
     if(session == &anonymousSession &&
        requestType->typeIndex > UA_TYPES_ACTIVATESESSIONREQUEST) {
        requestType->typeIndex > UA_TYPES_ACTIVATESESSIONREQUEST) {
         UA_LOG_INFO(server->logger, UA_LOGCATEGORY_SERVER, "Client tries to call a service without a session");
         UA_LOG_INFO(server->logger, UA_LOGCATEGORY_SERVER, "Client tries to call a service without a session");
@@ -463,7 +463,7 @@ void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection
             processOPN(connection, server, msg, &pos);
             processOPN(connection, server, msg, &pos);
             break;
             break;
         case UA_MESSAGETYPEANDFINAL_MSGF & 0xffffff:
         case UA_MESSAGETYPEANDFINAL_MSGF & 0xffffff:
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
             if(connection->state != UA_CONNECTION_ESTABLISHED) {
             if(connection->state != UA_CONNECTION_ESTABLISHED) {
                 connection->close(connection);
                 connection->close(connection);
                 return;
                 return;

+ 4 - 4
src/server/ua_server_internal.h

@@ -8,7 +8,7 @@
 #include "ua_securechannel_manager.h"
 #include "ua_securechannel_manager.h"
 #include "ua_nodestore.h"
 #include "ua_nodestore.h"
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 #include "ua_subscription_manager.h"
 #include "ua_subscription_manager.h"
 #endif
 #endif
 
 
@@ -16,7 +16,7 @@
 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
 #define USERNAME_POLICY "open62541-username-policy"
 #define USERNAME_POLICY "open62541-username-policy"
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 /** Mapping of namespace-id and url to an external nodestore. For namespaces
 /** Mapping of namespace-id and url to an external nodestore. For namespaces
     that have no mapping defined, the internal nodestore is used by default. */
     that have no mapping defined, the internal nodestore is used by default. */
 typedef struct UA_ExternalNamespace {
 typedef struct UA_ExternalNamespace {
@@ -52,7 +52,7 @@ struct UA_Server {
     size_t namespacesSize;
     size_t namespacesSize;
     UA_String *namespaces;
     UA_String *namespaces;
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     size_t externalNamespacesSize;
     size_t externalNamespacesSize;
     UA_ExternalNamespace *externalNamespaces;
     UA_ExternalNamespace *externalNamespaces;
 #endif
 #endif
@@ -60,7 +60,7 @@ struct UA_Server {
     /* Jobs with a repetition interval */
     /* Jobs with a repetition interval */
     LIST_HEAD(RepeatedJobsList, RepeatedJobs) repeatedJobs;
     LIST_HEAD(RepeatedJobsList, RepeatedJobs) repeatedJobs;
     
     
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
     /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
 	struct cds_wfcq_head dispatchQueue_head;
 	struct cds_wfcq_head dispatchQueue_head;
 
 

+ 12 - 12
src/server/ua_server_worker.c

@@ -82,7 +82,7 @@ static void processJobs(UA_Server *server, UA_Job *jobs, UA_Int32 jobsSize) {
 /* Worker Threads and Dispatch */
 /* Worker Threads and Dispatch */
 /*******************************/
 /*******************************/
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 
 
 struct MainLoopJob {
 struct MainLoopJob {
     struct cds_lfs_node node;
     struct cds_lfs_node node;
@@ -271,7 +271,7 @@ static UA_StatusCode addRepeatedJob(UA_Server *server, struct AddRepeatedJob * U
     matchingTw->jobsSize++;
     matchingTw->jobsSize++;
 
 
  cleanup:
  cleanup:
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_free(arw);
     UA_free(arw);
 #endif
 #endif
     return retval;
     return retval;
@@ -283,7 +283,7 @@ UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32
         return UA_STATUSCODE_BADINTERNALERROR;
         return UA_STATUSCODE_BADINTERNALERROR;
     interval *= 10000; // from ms to 100ns resolution
     interval *= 10000; // from ms to 100ns resolution
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     struct AddRepeatedJob *arw = UA_malloc(sizeof(struct AddRepeatedJob));
     struct AddRepeatedJob *arw = UA_malloc(sizeof(struct AddRepeatedJob));
     if(!arw)
     if(!arw)
         return UA_STATUSCODE_BADOUTOFMEMORY;
         return UA_STATUSCODE_BADOUTOFMEMORY;
@@ -328,7 +328,7 @@ static UA_UInt16 processRepeatedJobs(UA_Server *server) {
         if(tw->nextTime > current)
         if(tw->nextTime > current)
             break;
             break;
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
         // copy the entry and insert at the new location
         // copy the entry and insert at the new location
         UA_Job *jobsCopy = UA_malloc(sizeof(UA_Job) * tw->jobsSize);
         UA_Job *jobsCopy = UA_malloc(sizeof(UA_Job) * tw->jobsSize);
         if(!jobsCopy) {
         if(!jobsCopy) {
@@ -393,14 +393,14 @@ static void removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
         }
         }
     }
     }
  finish:
  finish:
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_free(jobId);
     UA_free(jobId);
 #endif
 #endif
     return;
     return;
 }
 }
 
 
 UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
 UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
     UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
     if(!idptr)
     if(!idptr)
         return UA_STATUSCODE_BADOUTOFMEMORY;
         return UA_STATUSCODE_BADOUTOFMEMORY;
@@ -429,7 +429,7 @@ void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
 /* Delayed Jobs */
 /* Delayed Jobs */
 /****************/
 /****************/
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 
 
 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
 
 
@@ -537,7 +537,7 @@ static void dispatchDelayedJobs(UA_Server *server, void *data /* not used, but n
 /* Main Server Loop */
 /* Main Server Loop */
 /********************/
 /********************/
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 static void processMainLoopJobs(UA_Server *server) {
 static void processMainLoopJobs(UA_Server *server) {
     /* no synchronization required if we only use push and pop_all */
     /* no synchronization required if we only use push and pop_all */
     struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
     struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
@@ -557,7 +557,7 @@ static void processMainLoopJobs(UA_Server *server) {
 UA_StatusCode UA_Server_run_startup(UA_Server *server, UA_UInt16 nThreads, UA_Boolean *running) {
 UA_StatusCode UA_Server_run_startup(UA_Server *server, UA_UInt16 nThreads, UA_Boolean *running) {
 UA_StatusCode result = UA_STATUSCODE_GOOD;
 UA_StatusCode result = UA_STATUSCODE_GOOD;
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Prepare the worker threads */
     /* Prepare the worker threads */
     server->running = running; // the threads need to access the variable
     server->running = running; // the threads need to access the variable
     server->nThreads = nThreads;
     server->nThreads = nThreads;
@@ -585,7 +585,7 @@ UA_StatusCode result = UA_STATUSCODE_GOOD;
 }
 }
 
 
 UA_StatusCode UA_Server_run_mainloop(UA_Server *server, UA_Boolean *running) {
 UA_StatusCode UA_Server_run_mainloop(UA_Server *server, UA_Boolean *running) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Run Work in the main loop */
     /* Run Work in the main loop */
     processMainLoopJobs(server);
     processMainLoopJobs(server);
 #endif
 #endif
@@ -605,7 +605,7 @@ UA_StatusCode UA_Server_run_mainloop(UA_Server *server, UA_Boolean *running) {
         } else
         } else
             jobsSize = server->networkLayers[i]->stop(nl, &jobs);
             jobsSize = server->networkLayers[i]->stop(nl, &jobs);
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
         /* Filter out delayed work */
         /* Filter out delayed work */
         for(UA_Int32 k=0;k<jobsSize;k++) {
         for(UA_Int32 k=0;k<jobsSize;k++) {
             if(jobs[k].type != UA_JOBTYPE_METHODCALL_DELAYED)
             if(jobs[k].type != UA_JOBTYPE_METHODCALL_DELAYED)
@@ -636,7 +636,7 @@ UA_StatusCode UA_Server_run_shutdown(UA_Server *server, UA_UInt16 nThreads){
         processJobs(server, stopJobs, stopJobsSize);
         processJobs(server, stopJobs, stopJobsSize);
         UA_free(stopJobs);
         UA_free(stopJobs);
     }
     }
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Wait for all worker threads to finish */
     /* Wait for all worker threads to finish */
     for(UA_UInt32 i=0;i<nThreads;i++) {
     for(UA_UInt32 i=0;i<nThreads;i++) {
         pthread_join(server->thr[i], NULL);
         pthread_join(server->thr[i], NULL);

+ 3 - 3
src/server/ua_services.h

@@ -216,7 +216,7 @@ void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
  */
  */
 
 
 /* Mock-Up of the function signature for Unit Tests */
 /* Mock-Up of the function signature for Unit Tests */
-#ifdef BUILD_UNIT_TESTS
+#ifdef UA_BUILD_UNIT_TESTS
 UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range);
 UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range);
 #endif
 #endif
 
 
@@ -262,7 +262,7 @@ Service_Write_single(UA_Server *server, UA_Session *session, const UA_WriteValue
  *
  *
  * @{
  * @{
  */
  */
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 void
 void
 Service_Call(UA_Server *server, UA_Session *session,
 Service_Call(UA_Server *server, UA_Session *session,
              const UA_CallRequest *request,
              const UA_CallRequest *request,
@@ -270,7 +270,7 @@ Service_Call(UA_Server *server, UA_Session *session,
 #endif
 #endif
 /** @} */
 /** @} */
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 /**
 /**
  * @name MonitoredItem Service Set
  * @name MonitoredItem Service Set
  *
  *

+ 6 - 6
src/server/ua_services_attribute.c

@@ -39,7 +39,7 @@ static size_t readDimension(UA_Byte *buf, UA_Int32 buflen, struct UA_NumericRang
     return progress + progress2 + 1;
     return progress + progress2 + 1;
 }
 }
 
 
-#ifndef BUILD_UNIT_TESTS
+#ifndef UA_BUILD_UNIT_TESTS
 static
 static
 #endif
 #endif
 UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range) {
 UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range) {
@@ -353,7 +353,7 @@ void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *
         return;
         return;
     }
     }
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Boolean isExternal[size];
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     UA_UInt32 indices[size];
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean) * size);
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean) * size);
@@ -375,7 +375,7 @@ void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *
 #endif
 #endif
 
 
     for(size_t i = 0;i < size;i++) {
     for(size_t i = 0;i < size;i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
         if(!isExternal[i])
 #endif
 #endif
             Service_Read_single(server, session, request->timestampsToReturn,
             Service_Read_single(server, session, request->timestampsToReturn,
@@ -428,7 +428,7 @@ UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const U
         UA_MT_CONST UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
         UA_MT_CONST UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
         if(!node)
         if(!node)
             return UA_STATUSCODE_BADNODEIDUNKNOWN;
             return UA_STATUSCODE_BADNODEIDUNKNOWN;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
         retval = callback(server, session, node, data);
         retval = callback(server, session, node, data);
         return retval;
         return retval;
 #else
 #else
@@ -703,7 +703,7 @@ void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest
         return;
         return;
     }
     }
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Boolean isExternal[request->nodesToWriteSize];
     UA_Boolean isExternal[request->nodesToWriteSize];
     UA_UInt32 indices[request->nodesToWriteSize];
     UA_UInt32 indices[request->nodesToWriteSize];
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean)*request->nodesToWriteSize);
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean)*request->nodesToWriteSize);
@@ -727,7 +727,7 @@ void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest
     
     
     response->resultsSize = request->nodesToWriteSize;
     response->resultsSize = request->nodesToWriteSize;
     for(size_t i = 0;i < request->nodesToWriteSize;i++) {
     for(size_t i = 0;i < request->nodesToWriteSize;i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
         if(!isExternal[i])
 #endif
 #endif
 		  response->results[i] = Service_Write_single(server, session, &request->nodesToWrite[i]);
 		  response->results[i] = Service_Write_single(server, session, &request->nodesToWrite[i]);

+ 5 - 5
src/server/ua_services_nodemanagement.c

@@ -542,7 +542,7 @@ void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesR
         return;
         return;
     }
     }
     
     
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef _MSVC_VER
 #ifdef _MSVC_VER
     UA_Boolean *isExternal = UA_alloca(size);
     UA_Boolean *isExternal = UA_alloca(size);
     UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32)*size);
     UA_UInt32 *indices = UA_alloca(sizeof(UA_UInt32)*size);
@@ -571,7 +571,7 @@ void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesR
     
     
     response->resultsSize = size;
     response->resultsSize = size;
     for(size_t i = 0; i < size; i++) {
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
         if(!isExternal[i])
 #endif
 #endif
             Service_AddNodes_single(server, session, &request->nodesToAdd[i], &response->results[i]);
             Service_AddNodes_single(server, session, &request->nodesToAdd[i], &response->results[i]);
@@ -639,7 +639,7 @@ UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requested
     return result.statusCode;
     return result.statusCode;
 }
 }
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 UA_StatusCode UA_EXPORT
 UA_StatusCode UA_EXPORT
 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
                         const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
                         const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
@@ -795,7 +795,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddR
 	}
 	}
 	response->resultsSize = size;
 	response->resultsSize = size;
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     UA_UInt32 indices[size];
@@ -824,7 +824,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddR
 
 
 	response->resultsSize = size;
 	response->resultsSize = size;
 	for(size_t i = 0; i < response->resultsSize; i++) {
 	for(size_t i = 0; i < response->resultsSize; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 		if(!isExternal[i])
 		if(!isExternal[i])
 #endif
 #endif
             Service_AddReferences_single(server, session, &request->referencesToAdd[i]);
             Service_AddReferences_single(server, session, &request->referencesToAdd[i]);

+ 7 - 7
src/server/ua_services_view.c

@@ -33,7 +33,7 @@ fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode
     return retval;
     return retval;
 }
 }
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 static const UA_Node *
 static const UA_Node *
 returnRelevantNodeExternal(UA_ExternalNodeStore *ens, const UA_BrowseDescription *descr,
 returnRelevantNodeExternal(UA_ExternalNodeStore *ens, const UA_BrowseDescription *descr,
                            const UA_ReferenceNode *reference) {
                            const UA_ReferenceNode *reference) {
@@ -109,7 +109,7 @@ returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Bool
             return NULL;
             return NULL;
     }
     }
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     /* return the node from an external namespace*/
     /* return the node from an external namespace*/
 	for(size_t nsIndex = 0; nsIndex < server->externalNamespacesSize; nsIndex++) {
 	for(size_t nsIndex = 0; nsIndex < server->externalNamespacesSize; nsIndex++) {
 		if(reference->targetId.nodeId.namespaceIndex != server->externalNamespaces[nsIndex].index)
 		if(reference->targetId.nodeId.namespaceIndex != server->externalNamespaces[nsIndex].index)
@@ -302,7 +302,7 @@ Service_Browse_single(UA_Server *server, UA_Session *session, struct Continuatio
                                                descr->resultMask, &result->references[referencesCount]);
                                                descr->resultMask, &result->references[referencesCount]);
             referencesCount++;
             referencesCount++;
         }
         }
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         /* relevant_node returns a node malloced with UA_ObjectNode_new
         /* relevant_node returns a node malloced with UA_ObjectNode_new
            if it is external (there is no UA_Node_new function) */
            if it is external (there is no UA_Node_new function) */
         if(isExternal == UA_TRUE)
         if(isExternal == UA_TRUE)
@@ -384,7 +384,7 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
     }
     }
     response->resultsSize = size;
     response->resultsSize = size;
     
     
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     UA_UInt32 indices[size];
@@ -411,7 +411,7 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
 #endif
 #endif
 
 
     for(size_t i = 0; i < size; i++) {
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
         if(!isExternal[i])
 #endif
 #endif
             Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
             Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
@@ -578,7 +578,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
         return;
         return;
     }
     }
 
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     UA_UInt32 indices[size];
@@ -606,7 +606,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
 
 
     response->resultsSize = size;
     response->resultsSize = size;
     for(size_t i = 0; i < size; i++) {
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     	if(!isExternal[i])
     	if(!isExternal[i])
 #endif
 #endif
     		Service_TranslateBrowsePathsToNodeIds_single(server, session, &request->browsePaths[i],
     		Service_TranslateBrowsePathsToNodeIds_single(server, session, &request->browsePaths[i],

+ 2 - 2
src/ua_connection.c

@@ -130,7 +130,7 @@ UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString * UA_RES
 }
 }
 
 
 void UA_Connection_detachSecureChannel(UA_Connection *connection) {
 void UA_Connection_detachSecureChannel(UA_Connection *connection) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_SecureChannel *channel = connection->channel;
     UA_SecureChannel *channel = connection->channel;
     if(channel)
     if(channel)
         uatomic_cmpxchg(&channel->connection, connection, NULL);
         uatomic_cmpxchg(&channel->connection, connection, NULL);
@@ -143,7 +143,7 @@ void UA_Connection_detachSecureChannel(UA_Connection *connection) {
 }
 }
 
 
 void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel) {
 void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_cmpxchg(&channel->connection, NULL, connection) == NULL)
     if(uatomic_cmpxchg(&channel->connection, NULL, connection) == NULL)
         uatomic_set(&connection->channel, channel);
         uatomic_set(&connection->channel, channel);
 #else
 #else

+ 2 - 2
src/ua_securechannel.c

@@ -55,7 +55,7 @@ void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *sessi
     if(!se)
     if(!se)
         return;
         return;
     se->session = session;
     se->session = session;
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_cmpxchg(&session->channel, NULL, channel) != NULL) {
     if(uatomic_cmpxchg(&session->channel, NULL, channel) != NULL) {
         UA_free(se);
         UA_free(se);
         return;
         return;
@@ -144,7 +144,7 @@ UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_U
 
 
     /* now write the header with the size */
     /* now write the header with the size */
     respHeader.messageHeader.messageSize = messagePos;
     respHeader.messageHeader.messageSize = messagePos;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
 #else
 #else
     seqHeader.sequenceNumber = uatomic_add_return(&channel->sequenceNumber, 1);
     seqHeader.sequenceNumber = uatomic_add_return(&channel->sequenceNumber, 1);

+ 2 - 2
src/ua_session.c

@@ -41,7 +41,7 @@ void UA_Session_init(UA_Session *session) {
     session->timeout = 0;
     session->timeout = 0;
     UA_DateTime_init(&session->validTill);
     UA_DateTime_init(&session->validTill);
     session->channel = NULL;
     session->channel = NULL;
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     SubscriptionManager_init(session);
     SubscriptionManager_init(session);
 #endif
 #endif
     session->availableContinuationPoints = MAXCONTINUATIONPOINTS;
     session->availableContinuationPoints = MAXCONTINUATIONPOINTS;
@@ -62,7 +62,7 @@ void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
     }
     }
     if(session->channel)
     if(session->channel)
         UA_SecureChannel_detachSession(session->channel, session);
         UA_SecureChannel_detachSession(session->channel, session);
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     SubscriptionManager_deleteMembers(session, server);
     SubscriptionManager_deleteMembers(session, server);
 #endif
 #endif
 }
 }

+ 2 - 2
src/ua_session.h

@@ -8,7 +8,7 @@
 
 
 #define MAXCONTINUATIONPOINTS 5
 #define MAXCONTINUATIONPOINTS 5
 
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 #include "server/ua_subscription_manager.h"
 #include "server/ua_subscription_manager.h"
 #endif
 #endif
 
 
@@ -36,7 +36,7 @@ struct UA_Session {
     UA_UInt32         maxResponseMessageSize;
     UA_UInt32         maxResponseMessageSize;
     UA_Int64          timeout; // [ms]
     UA_Int64          timeout; // [ms]
     UA_DateTime       validTill;
     UA_DateTime       validTill;
-    #ifdef ENABLE_SUBSCRIPTIONS
+    #ifdef UA_ENABLE_SUBSCRIPTIONS
         UA_SubscriptionManager subscriptionManager;
         UA_SubscriptionManager subscriptionManager;
     #endif
     #endif
     UA_SecureChannel *channel;
     UA_SecureChannel *channel;

+ 2 - 2
src/ua_util.h

@@ -48,7 +48,7 @@
 /* Thread Local Storage */
 /* Thread Local Storage */
 /************************/
 /************************/
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # ifdef __GNUC__
 # ifdef __GNUC__
 #  define UA_THREAD_LOCAL __thread
 #  define UA_THREAD_LOCAL __thread
 # elif defined(_MSC_VER)
 # elif defined(_MSC_VER)
@@ -79,7 +79,7 @@
 
 
 #include "queue.h"
 #include "queue.h"
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # define _LGPL_SOURCE
 # define _LGPL_SOURCE
 # include <urcu.h>
 # include <urcu.h>
 # include <urcu/wfcqueue.h>
 # include <urcu/wfcqueue.h>

+ 3 - 3
tests/CMakeLists.txt

@@ -15,9 +15,9 @@ if(NOT WIN32)
 else()
 else()
     list(APPEND LIBS ws2_32)
     list(APPEND LIBS ws2_32)
 endif()
 endif()
-if(ENABLE_MULTITHREADING)
+if(UA_ENABLE_MULTITHREADING)
     list(APPEND LIBS urcu-cds urcu urcu-common)
     list(APPEND LIBS urcu-cds urcu urcu-common)
-endif(ENABLE_MULTITHREADING)
+endif()
 
 
 # the unit test are built directly on the open62541 object files. so they can
 # 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
 # access symbols that are hidden/not exported to the shared library
@@ -68,7 +68,7 @@ add_test(session ${CMAKE_CURRENT_BINARY_DIR}/check_session)
 #                           ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex)
 #                           ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex)
 
 
 #set(check_fileinput_source check_server_interaction_fileinput.c testing_networklayers.c $<TARGET_OBJECTS:open62541-object>)
 #set(check_fileinput_source check_server_interaction_fileinput.c testing_networklayers.c $<TARGET_OBJECTS:open62541-object>)
-#if(NOT ENABLE_AMALGAMATION)
+#if(NOT UA_ENABLE_AMALGAMATION)
 #    list(APPEND check_fileinput_source ${PROJECT_SOURCE_DIR}/examples/logger_stdout.c)
 #    list(APPEND check_fileinput_source ${PROJECT_SOURCE_DIR}/examples/logger_stdout.c)
 #endif()
 #endif()
 #add_executable(check_server_interaction_fileinput ${check_fileinput_source})
 #add_executable(check_server_interaction_fileinput ${check_fileinput_source})

+ 19 - 19
tests/check_nodestore.c

@@ -7,7 +7,7 @@
 #include "ua_util.h"
 #include "ua_util.h"
 #include "check.h"
 #include "check.h"
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 #include <pthread.h>
 #include <pthread.h>
 #include <urcu.h>
 #include <urcu.h>
 #endif
 #endif
@@ -61,7 +61,7 @@ START_TEST(replaceNonExistingNode) {
 END_TEST
 END_TEST
 
 
 START_TEST(findNodeInUA_NodeStoreWithSingleEntry) {
 START_TEST(findNodeInUA_NodeStoreWithSingleEntry) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -74,14 +74,14 @@ START_TEST(findNodeInUA_NodeStoreWithSingleEntry) {
 	ck_assert_int_eq((uintptr_t)inserted, (uintptr_t)nr);
 	ck_assert_int_eq((uintptr_t)inserted, (uintptr_t)nr);
 	// finally
 	// finally
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(failToFindNodeInOtherUA_NodeStore) {
 START_TEST(failToFindNodeInOtherUA_NodeStore) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -98,14 +98,14 @@ START_TEST(failToFindNodeInOtherUA_NodeStore) {
 	// finally
 	// finally
 	UA_VariableNode_delete((UA_VariableNode*)n);
 	UA_VariableNode_delete((UA_VariableNode*)n);
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(findNodeInUA_NodeStoreWithSeveralEntries) {
 START_TEST(findNodeInUA_NodeStoreWithSeveralEntries) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -130,14 +130,14 @@ START_TEST(findNodeInUA_NodeStoreWithSeveralEntries) {
 	ck_assert_int_eq((uintptr_t)nr, (uintptr_t)inserted);
 	ck_assert_int_eq((uintptr_t)nr, (uintptr_t)inserted);
 	// finally
 	// finally
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(iterateOverUA_NodeStoreShallNotVisitEmptyNodes) {
 START_TEST(iterateOverUA_NodeStoreShallNotVisitEmptyNodes) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -164,14 +164,14 @@ START_TEST(iterateOverUA_NodeStoreShallNotVisitEmptyNodes) {
 	ck_assert_int_eq(visitCnt, 6);
 	ck_assert_int_eq(visitCnt, 6);
 	// finally
 	// finally
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(findNodeInExpandedNamespace) {
 START_TEST(findNodeInExpandedNamespace) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -190,14 +190,14 @@ START_TEST(findNodeInExpandedNamespace) {
 	// finally
 	// finally
 	UA_free((void*)n2);
 	UA_free((void*)n2);
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(iterateOverExpandedNamespaceShallNotVisitEmptyNodes) {
 START_TEST(iterateOverExpandedNamespaceShallNotVisitEmptyNodes) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -217,14 +217,14 @@ START_TEST(iterateOverExpandedNamespaceShallNotVisitEmptyNodes) {
 	ck_assert_int_eq(visitCnt, 200);
 	ck_assert_int_eq(visitCnt, 200);
 	// finally
 	// finally
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
 END_TEST
 END_TEST
 
 
 START_TEST(failToFindNonExistantNodeInUA_NodeStoreWithSeveralEntries) {
 START_TEST(failToFindNonExistantNodeInUA_NodeStoreWithSeveralEntries) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 	// given
 	// given
@@ -248,7 +248,7 @@ START_TEST(failToFindNonExistantNodeInUA_NodeStoreWithSeveralEntries) {
 	// finally
 	// finally
 	UA_free((void *)n6);
 	UA_free((void *)n6);
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }
@@ -258,7 +258,7 @@ END_TEST
 /* Performance Profiling Test Cases */
 /* Performance Profiling Test Cases */
 /************************************/
 /************************************/
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 struct UA_NodeStoreProfileTest {
 struct UA_NodeStoreProfileTest {
 	UA_NodeStore *ns;
 	UA_NodeStore *ns;
 	UA_Int32 min_val;
 	UA_Int32 min_val;
@@ -286,7 +286,7 @@ static void *profileGetThread(void *arg) {
 #endif
 #endif
 
 
 START_TEST(profileGetDelete) {
 START_TEST(profileGetDelete) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
    	rcu_register_thread();
    	rcu_register_thread();
 #endif
 #endif
 
 
@@ -299,7 +299,7 @@ START_TEST(profileGetDelete) {
 	}
 	}
 	clock_t begin, end;
 	clock_t begin, end;
 	begin = clock();
 	begin = clock();
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 #define THREADS 4
 #define THREADS 4
     pthread_t t[THREADS];
     pthread_t t[THREADS];
 	struct UA_NodeStoreProfileTest p[THREADS];
 	struct UA_NodeStoreProfileTest p[THREADS];
@@ -326,7 +326,7 @@ START_TEST(profileGetDelete) {
 
 
 	UA_NodeStore_delete(ns);
 	UA_NodeStore_delete(ns);
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 	rcu_unregister_thread();
 	rcu_unregister_thread();
 #endif
 #endif
 }
 }

+ 4 - 4
tests/check_services_attributes.c

@@ -12,7 +12,7 @@
 #include "ua_util.h"
 #include "ua_util.h"
 #include "server/ua_server_internal.h"
 #include "server/ua_server_internal.h"
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 #include <pthread.h>
 #include <pthread.h>
 #include <urcu.h>
 #include <urcu.h>
 #endif
 #endif
@@ -74,7 +74,7 @@ static UA_Server* makeTestSequence(void) {
                           UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
                           UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
                           UA_QUALIFIEDNAME(0, "Viewtest"), view_attr, NULL);
                           UA_QUALIFIEDNAME(0, "Viewtest"), view_attr, NULL);
 
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 	/* MethodNode */
 	/* MethodNode */
     UA_MethodAttributes ma;
     UA_MethodAttributes ma;
     UA_MethodAttributes_init(&ma);
     UA_MethodAttributes_init(&ma);
@@ -538,7 +538,7 @@ START_TEST(ReadSingleAttributeHistorizingWithoutTimestamp) {
 } END_TEST
 } END_TEST
 
 
 START_TEST(ReadSingleAttributeExecutableWithoutTimestamp) {
 START_TEST(ReadSingleAttributeExecutableWithoutTimestamp) {
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     UA_Server *server = makeTestSequence();
     UA_Server *server = makeTestSequence();
     UA_DataValue resp;
     UA_DataValue resp;
     UA_DataValue_init(&resp);
     UA_DataValue_init(&resp);
@@ -559,7 +559,7 @@ START_TEST(ReadSingleAttributeExecutableWithoutTimestamp) {
 } END_TEST
 } END_TEST
 
 
 START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp) {
 START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp) {
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     UA_Server *server = makeTestSequence();
     UA_Server *server = makeTestSequence();
     UA_DataValue resp;
     UA_DataValue resp;
     UA_DataValue_init(&resp);
     UA_DataValue_init(&resp);

+ 1 - 1
tests/check_services_nodemanagement.c

@@ -12,7 +12,7 @@
 #include "ua_util.h"
 #include "ua_util.h"
 #include "server/ua_server_internal.h"
 #include "server/ua_server_internal.h"
 
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 #include <pthread.h>
 #include <pthread.h>
 #include <urcu.h>
 #include <urcu.h>
 #endif
 #endif

+ 16 - 7
tools/travis_linux_script.sh

@@ -1,19 +1,21 @@
 #!/bin/bash
 #!/bin/bash
 set -ev
 set -ev
+
 echo "Checking the applicability of patches"
 echo "Checking the applicability of patches"
 # ./tools/.checkPorts.sh
 # ./tools/.checkPorts.sh
 echo "Documentation and certificate build"
 echo "Documentation and certificate build"
 mkdir -p build
 mkdir -p build
 cd build
 cd build
-cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_DOCUMENTATION=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE=ON ..
 make doc
 make doc
 make selfsigned
 make selfsigned
 cp -r doc ..
 cp -r doc ..
 cp server_cert.der ..
 cp server_cert.der ..
+
 echo "Testing builds"
 echo "Testing builds"
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
 echo "Cross compile release build for MinGW 32 bit"
 echo "Cross compile release build for MinGW 32 bit"
-cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
+cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON ..
 make
 make
 cp ../README.md .
 cp ../README.md .
 cp ../LICENSE .
 cp ../LICENSE .
@@ -23,8 +25,9 @@ cp ../server_cert.der .
 zip -r open62541-win32.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 zip -r open62541-win32.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 cp open62541-win32.zip ..
 cp open62541-win32.zip ..
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
+
 echo "Cross compile release build for MinGW 64 bit"
 echo "Cross compile release build for MinGW 64 bit"
-cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
+cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON ..
 make
 make
 cp ../README.md .
 cp ../README.md .
 cp ../LICENSE .
 cp ../LICENSE .
@@ -34,35 +37,41 @@ cp ../server_cert.der .
 zip -r open62541-win64.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 zip -r open62541-win64.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 cp open62541-win64.zip ..
 cp open62541-win64.zip ..
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
+
 echo "Cross compile release build for 32-bit linux"
 echo "Cross compile release build for 32-bit linux"
-cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-m32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
+cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-m32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON ..
 make
 make
 tar -pczf open62541-linux32.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 tar -pczf open62541-linux32.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 cp open62541-linux32.tar.gz ..
 cp open62541-linux32.tar.gz ..
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
+
 echo "Compile release build for 64-bit linux"
 echo "Compile release build for 64-bit linux"
-cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON ..
 make
 make
 tar -pczf open62541-linux64.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 tar -pczf open62541-linux64.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 cp open62541-linux64.tar.gz ..
 cp open62541-linux64.tar.gz ..
 cp open62541.h .. #copy single file-release
 cp open62541.h .. #copy single file-release
 cp open62541.c .. #copy single file-release
 cp open62541.c .. #copy single file-release
+
 echo "Upgrade to gcc 4.8"
 echo "Upgrade to gcc 4.8"
 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
 sudo apt-get update -qq
 sudo apt-get update -qq
 sudo apt-get install -qq gcc-4.8 g++-4.8 valgrind
 sudo apt-get install -qq gcc-4.8 g++-4.8 valgrind
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
 sudo update-alternatives --config gcc
 sudo update-alternatives --config gcc
+
 echo "Building the C++ example"
 echo "Building the C++ example"
 gcc -std=c99 -c open62541.c
 gcc -std=c99 -c open62541.c
 g++-4.8 ../examples/server.cpp -I./ open62541.o -o cpp-server
 g++-4.8 ../examples/server.cpp -I./ open62541.o -o cpp-server
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
+
 echo "Compile multithreaded version"
 echo "Compile multithreaded version"
-cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
+cmake -DUA_ENABLE_MULTITHREADING=ON -DUA_BUILD_EXAMPLESERVER=ON ..
 make
 make
 cd .. && rm build -rf && mkdir -p build && cd build
 cd .. && rm build -rf && mkdir -p build && cd build
+
 echo "Debug build and unit tests (64 bit)"
 echo "Debug build and unit tests (64 bit)"
-cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMO_NODESET=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLESERVER=ON -DENABLE_COVERAGE=ON ..
+cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_UNIT_TESTS=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_ENABLE_COVERAGE=ON ..
 make && make test ARGS="-V"
 make && make test ARGS="-V"
 echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
 echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
 if [[ ! ( ${TRAVIS_OS_NAME} == "linux" && ${CC} == "clang") ]]; then
 if [[ ! ( ${TRAVIS_OS_NAME} == "linux" && ${CC} == "clang") ]]; then

+ 3 - 3
tools/travis_osx_script.sh

@@ -3,7 +3,7 @@ set -ev
 echo "Documentation and certificate build"
 echo "Documentation and certificate build"
 mkdir -p build
 mkdir -p build
 cd build
 cd build
-cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_DOCUMENTATION=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE=ON ..
 make doc
 make doc
 make selfsigned
 make selfsigned
 cp -r doc ..
 cp -r doc ..
@@ -11,7 +11,7 @@ cp server_cert.der ..
 echo "Testing builds"
 echo "Testing builds"
 cd .. && rm -rf build && mkdir -p build && cd build
 cd .. && rm -rf build && mkdir -p build && cd build
 echo "Compile release build for OS X"
 echo "Compile release build for OS X"
-cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON ..
 make
 make
 tar -pczf open62541-osx.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.dylib open62541.h open62541.c
 tar -pczf open62541-osx.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.dylib open62541.h open62541.c
 cp open62541-osx.tar.gz ..
 cp open62541-osx.tar.gz ..
@@ -23,7 +23,7 @@ cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
 make
 make
 cd .. && rm -rf build && mkdir -p build && cd build
 cd .. && rm -rf build && mkdir -p build && cd build
 echo "Debug build and unit tests (64 bit)"
 echo "Debug build and unit tests (64 bit)"
-cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMO_NODESET=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLESERVER=ON -DENABLE_COVERAGE=ON ..
+cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_UNIT_TESTS=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_ENABLE_COVERAGE=ON ..
 make && make test
 make && make test
 echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
 echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
 (valgrind --error-exitcode=3 ./server & export pid=$!; sleep 2; kill -INT $pid; wait $pid);
 (valgrind --error-exitcode=3 ./server & export pid=$!; sleep 2; kill -INT $pid; wait $pid);