Browse Source

Merge pull request #478 from open62541/cleanup_build

Consistent cmake option naming
Julius Pfrommer 9 years ago
parent
commit
b1826a4b73

+ 253 - 195
CMakeLists.txt

@@ -1,82 +1,172 @@
 cmake_minimum_required(VERSION 2.8.11)
-# set(CMAKE_VERBOSE_MAKEFILE ON)
-
 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")
-    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")
-        message( FATAL_ERROR "Python-lxml is not installed.")
+        message(FATAL_ERROR "Python-lxml is not installed.")
     endif()
 endif()
 
+# Check for git
 find_package(Git)
 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()
-        string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COM_ID} )
+        string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COM_ID} )
     endif()
 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()
 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")
 
+####################################
+# Build Type and Compiler Settings #
+####################################
+
 # Set default 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()
 
+# Collect libraries
+list(APPEND open62541_LIBRARIES "")
+
 # compiler flags
 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
-                      -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
+                    -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)
+
+  # library linking
+  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
+  if(NOT WIN32 AND NOT CYGWIN)
+	add_definitions(-fvisibility=hidden -fPIC)
+    if(NOT APPLE)
+      set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none")
+    endif()
+  endif()
+
+  # Debug
+  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+	#add_definitions(-fsanitize=address)
+    #list(APPEND open62541_LIBRARIES asan)
+
+	#add_definitions(-fsanitize=undefined)
+    #list(APPEND open62541_LIBRARIES ubsan)
+
+  elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR
+         CMAKE_BUILD_TYPE STREQUAL "Release")
     add_definitions(-ffunction-sections -fdata-sections -fno-stack-protector -fno-unwind-tables
                     -fno-asynchronous-unwind-tables -fno-math-errno -fmerge-all-constants -fno-ident)
-  if(APPLE)
+    set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s")
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
+    if(APPLE)
       set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-dead_strip")
       set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
-  else()
+    else()
       set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--gc-sections")
       set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
-  endif()
-  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
-	if(NOT WIN32 AND NOT CYGWIN)
-	    add_definitions(-fvisibility=hidden -fPIC)
-      if(NOT APPLE)
+      if(NOT WIN32 AND NOT CYGWIN)
         # these settings reduce the binary size by ~2kb
         set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none")
       endif()
-	endif()
-    if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release")
-        set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s")
-        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
-    endif()
-    if(APPLE)
-        set(CMAKE_MACOSX_RPATH 1)
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DARWIN_C_SOURCE=1")
     endif()
+  endif()
+  
+  if(APPLE)
+    set(CMAKE_MACOSX_RPATH 1)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DARWIN_C_SOURCE=1")
+  endif()
 elseif(MSVC)
     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
 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
                      ${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h
                      ${PROJECT_SOURCE_DIR}/include/ua_types.h
@@ -133,76 +223,98 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
                 ${PROJECT_SOURCE_DIR}/deps/pcg_basic.c)
                 ##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()
-  set(generate_typeintrospection "")
+  list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.c)
 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()
 
-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
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.c
                           ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_manager.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(INSERT internal_headers  ${UaSessionPos} ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.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
                           ${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 ${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
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd
                            ${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
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated.h
                           ${PROJECT_BINARY_DIR}/src_generated/ua_transport_generated_encoding_binary.h
                    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
                            ${CMAKE_CURRENT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd)
 
+# nodeids
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
                    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
                            ${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
                           ${PROJECT_BINARY_DIR}/src_generated/ua_namespaceinit_generated.h
                    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}
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/logger.py
@@ -212,81 +324,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_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
-               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
-               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_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
     include_directories(${PROJECT_BINARY_DIR})
@@ -297,43 +363,26 @@ else()
     include_directories(${PROJECT_SOURCE_DIR}/deps)
     include_directories(${PROJECT_SOURCE_DIR}/src)
 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)
-
 add_library(open62541 SHARED $<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-static PRIVATE -DUA_DYNAMIC_LINKING)
+target_link_libraries(open62541-static ${open62541_LIBRARIES})
 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()
 
-# 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>)
     add_executable(server_static examples/server.c ${server_source})
     add_executable(server examples/server.c)
-    if(ENABLE_AMALGAMATION)
+    if(UA_ENABLE_AMALGAMATION)
        ADD_DEPENDENCIES(server amalgamation)
     endif()
-    target_link_libraries(server open62541)
+    target_link_libraries(server ${open62541_LIBRARIES} open62541)
+    target_link_libraries(server_static ${open62541_LIBRARIES})
     if(WIN32)
         target_link_libraries(server_static ws2_32)
         target_link_libraries(server ws2_32)
@@ -341,15 +390,24 @@ if(BUILD_EXAMPLESERVER)
         target_link_libraries(server_static rt)
         target_link_libraries(server rt)
     endif()
-    if(ENABLE_MULTITHREADING)
+    if(UA_ENABLE_MULTITHREADING)
         target_link_libraries(server_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(server urcu-cds urcu urcu-common pthread)
     endif()
+
+    if(UA_ENABLE_NONSTANDARD_UDP)
+      add_executable(exampleServerUDP $<TARGET_OBJECTS:open62541-object> examples/networklayer_udp.c examples/server_udp.c)
+      target_link_libraries(exampleServerUDP ${open62541_LIBRARIES} open62541)
+      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()
 
-## 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")
     find_package(OpenSSL REQUIRED)
     add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/server_cert.der
@@ -360,17 +418,17 @@ if(GENERATE_SELFSIGNED)
     add_custom_target(selfsigned ALL DEPENDS ${PROJECT_BINARY_DIR}/server_cert.der ${PROJECT_BINARY_DIR}/ca.crt)
 endif()
 
-# build example client
-option(BUILD_EXAMPLECLIENT "Build a test client" OFF)
-if(BUILD_EXAMPLECLIENT)
+if(UA_BUILD_EXAMPLECLIENT)
 	add_definitions(-DBENCHMARK)
     set(client_source $<TARGET_OBJECTS:open62541-object>)
 	add_executable(client_static examples/client.c ${client_source})
     add_executable(client examples/client.c)
-	if(ENABLE_AMALGAMATION)
+	if(UA_ENABLE_AMALGAMATION)
+	   ADD_DEPENDENCIES(client_static amalgamation)
 	   ADD_DEPENDENCIES(client amalgamation)
 	endif()
-	target_link_libraries(client open62541)
+	target_link_libraries(client_static ${open62541_LIBRARIES})
+	target_link_libraries(client open62541 ${open62541_LIBRARIES})
     if(WIN32)
         target_link_libraries(client_static ws2_32)
         target_link_libraries(client ws2_32)
@@ -378,36 +436,31 @@ if(BUILD_EXAMPLECLIENT)
         target_link_libraries(client_static rt)
         target_link_libraries(client rt)
     endif()
-    if(ENABLE_MULTITHREADING)
+    if(UA_ENABLE_MULTITHREADING)
         target_link_libraries(client_static urcu-cds urcu urcu-common pthread)
         target_link_libraries(client urcu-cds urcu urcu-common pthread)
     endif()
-    if(EXTENSION_STATELESS AND NOT ENABLE_AMALGAMATION)
+    if(UA_ENABLE_NONSTANDARD_STATELESS AND NOT UA_ENABLE_AMALGAMATION)
         add_executable(client_stateless examples/client_stateless.c ${client_source})
-        if(ENABLE_MULTITHREADING)
+	    target_link_libraries(client_stateless open62541 ${open62541_LIBRARIES})
+        if(UA_ENABLE_MULTITHREADING)
             target_link_libraries(client_stateless urcu-cds urcu urcu-common pthread)
         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()
 
-# 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()
     add_subdirectory(tests)
 endif()
 
-option(BUILD_EXAMPLES "Build example servers and clients" OFF)
-if(BUILD_EXAMPLES)
+if(UA_BUILD_EXAMPLES)
     #add_subdirectory(examples)
     #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/1089828/same-header-file-for-both-dll-and-static-library
+	list(APPEND LIBS ${open62541_LIBRARIES})
     if(NOT WIN32)
 		list(APPEND LIBS pthread)
 		if (NOT APPLE)
@@ -416,9 +469,9 @@ if(BUILD_EXAMPLES)
 	else()
 		list(APPEND LIBS ws2_32)
 	endif()
-	if(ENABLE_MULTITHREADING)
+	if(UA_ENABLE_MULTITHREADING)
 		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>)
 	target_link_libraries(server_variable ${LIBS})
@@ -440,7 +493,11 @@ if(BUILD_EXAMPLES)
 
 	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
+					   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
@@ -451,18 +508,19 @@ if(BUILD_EXAMPLES)
 					           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
 					           ${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})
 
-	if(ENABLE_METHODCALLS)
+	if(UA_ENABLE_METHODCALLS)
 	  add_executable(server_method ${PROJECT_SOURCE_DIR}/examples/server_method.c $<TARGET_OBJECTS:open62541-object>)
 	  target_link_libraries(server_method ${LIBS})
 	endif()
 endif()
 
 # build documentation
-option(BUILD_DOCUMENTATION "Generate documentation" OFF)
-if(BUILD_DOCUMENTATION)
+if(UA_BUILD_DOCUMENTATION)
     find_package(Sphinx REQUIRED)
     add_custom_target(doc_latex ${SPHINX_EXECUTABLE}
       -b latex -c "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc_latex"

+ 2 - 1
README.md

@@ -61,7 +61,7 @@ int main(int argc, char** argv)
     UA_VariableAttributes attr;
     UA_VariableAttributes_init(&attr);
     UA_Variant_setScalarCopy(&attr.value, &myInteger, &UA_TYPES[UA_TYPES_INT32]);
-    attr.displayName = UA_LOCALIZEDTEXT("en_US","the answer");
+    attr.displayName = UA_LOCALIZEDTEXT_ALLOC("en_US","the answer");
 
     /* 2) define where the variable shall be added with which browsename */
     UA_NodeId newNodeId = UA_NODEID_STRING(1, "the.answer");
@@ -74,6 +74,7 @@ int main(int argc, char** argv)
     UA_Server_addVariableNode(server, newNodeId, parentNodeId,
                               parentReferenceNodeId, browseName,
                               variableType, attr, NULL);
+    UA_VariableAttributes_deleteMembers(&attr);
 
     /* run the server loop */
     UA_StatusCode retval = UA_Server_run(server, WORKER_THREADS, &running);

+ 3 - 3
appveyor.yml

@@ -7,14 +7,14 @@ build_script:
 - cd c:\projects\open62541
 - md 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
 - echo "Testing amalgamation"
 - cd ..
 - rd /s /q build
 - md 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 
 - 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
@@ -22,7 +22,7 @@ build_script:
 - echo "Win 64 build"
 - md 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 
 - 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

+ 2 - 2
deps/libc_string.c

@@ -3,9 +3,9 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 
-#include <stddef.h>
+#include "ua_config.h"
 
-void *memcpy(void * UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n) {
+void *memcpy(void *UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n) {
 	unsigned char *d = dest;
 	const unsigned char *s = src;
 	while(n--)

+ 45 - 59
doc/building.rst

@@ -87,91 +87,77 @@ Follow Ubuntu instructions without the ``apt-get`` commands as these are taken c
 Build Options
 -------------
 
-Generic CMake options
-~~~~~~~~~~~~~~~~~~~~~
-
 **CMAKE_BUILD_TYPE**
   - RelWithDebInfo: -O2 optimization with debug symbols
   - Release: -O2 optimization without debug symbols
   - Debug: -O0 optimization with 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_BUILD_* group
 ~~~~~~~~~~~~~
 
 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
 specified by the following options:
 
-**BUILD_DOCUMENTATION**
+**UA_BUILD_DOCUMENTATION**
    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
-**BUILD_EXAMPLESERVER**
+**UA_BUILD_EXAMPLESERVER**
    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
-**BUILD_EXAMPLES**
+**UA_BUILD_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.
 
-**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
-**ENABLE_COVERAGE**
+**UA_ENABLE_MULTITHREADING**
+   Enable multi-threading support (experimental)
+**UA_ENABLE_COVERAGE**
    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_GNERATE_NAMESPACE0**
+**UA_ENABLE_GENERATE_NAMESPACE0**
    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
-**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
-**EXTENSION_UDP**
+**UA_ENABLE_NONSTANDARD_UDP**
    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
 
   /* do not use for cryptographic entropy */
-  UA_EXPORT UA_UInt32 UA_UInt32_random(void);
+  UA_UInt32 UA_UInt32_random(void);
 
 UA_Int64
 ^^^^^^^^
@@ -161,9 +161,9 @@ The following functions and definitions are used with UA_DateTime.
       UA_UInt16 year;
   } 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
 ^^^^^^^

+ 20 - 16
examples/CMakeLists.txt

@@ -10,9 +10,9 @@ if(NOT WIN32)
 else()
     list(APPEND LIBS ws2_32)
 endif()
-if(ENABLE_MULTITHREADING)
+if(UA_ENABLE_MULTITHREADING)
     list(APPEND LIBS urcu-cds urcu urcu-common)
-endif(ENABLE_MULTITHREADING)
+endif()
 
 # add_executable(server_readspeed server_readspeed.c)
 # target_link_libraries(server_readspeed ${LIBS})
@@ -29,25 +29,29 @@ target_link_libraries(server_firstSteps ${LIBS})
 add_executable(client_firstSteps client_firstSteps.c)
 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
-		           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)
 	target_link_libraries(server_nodeset ${LIBS})
 endif()
 
-if(ENABLE_METHODCALLS)
+if(UA_ENABLE_METHODCALLS)
   add_executable(server_method server_method.c)
   target_link_libraries(server_method ${LIBS})
 endif()

+ 4 - 4
examples/client.c

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

+ 7 - 16
examples/client_stateless.c

@@ -14,8 +14,7 @@
 #include "ua_types_generated_encoding_binary.h"
 
 
-int main(int argc , char *argv[])
-{
+int main(int argc , char *argv[]) {
 	int sock;
 	struct sockaddr_in server;
 	UA_ByteString message;
@@ -26,13 +25,12 @@ int main(int argc , char *argv[])
 	unsigned int messagepos = 0;
 
 	//Create socket
-#ifdef EXTENSION_UDP
+#ifdef UA_ENABLE_NONSTANDARD_UDP
 	sock = socket(AF_INET , SOCK_DGRAM , 0);
 #else
 	sock = socket(AF_INET , SOCK_STREAM , 0);
 #endif
-	if (sock == -1)
-	{
+	if(sock == -1) {
 		printf("Could not create socket");
 	}
 	server.sin_addr.s_addr = inet_addr("127.0.0.1");
@@ -40,13 +38,11 @@ int main(int argc , char *argv[])
 	server.sin_port = htons( 16664 );
 
 	//Connect to remote server
-	if (connect(sock , (struct sockaddr *)&server , sizeof(server)) < 0)
-	{
+	if(connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
 		perror("connect failed. Error");
 		return 1;
 	}
 
-
 	UA_TcpMessageHeader reqTcpHeader;
 	UA_UInt32 reqSecureChannelId = 0;
 	UA_UInt32 reqTokenId = 0;
@@ -61,7 +57,6 @@ int main(int argc , char *argv[])
 	reqRequestType.identifierType = UA_NODEIDTYPE_NUMERIC;
 	reqRequestType.identifier.numeric = 631; //read request
 
-
 	UA_SequenceHeader_init(&reqSequenceHeader);
 	reqSequenceHeader.sequenceNumber = 42;
 
@@ -83,7 +78,6 @@ int main(int argc , char *argv[])
 	req.nodesToRead[0].nodeId.identifier.numeric = 2255;
 	UA_QualifiedName_init(&(req.nodesToRead[0].dataEncoding));
 
-
 	/**messageEncodedLength = UA_TcpMessageHeader_calcSizeBinary(&reqTcpHeader) +
 			UA_UInt32_calcSizeBinary(&reqSecureChannelId)+
 			UA_UInt32_calcSizeBinary(&reqTokenId)+
@@ -110,24 +104,21 @@ int main(int argc , char *argv[])
     UA_NodeId_encodeBinary(&reqRequestType, &message, &messagepos);
     UA_ReadRequest_encodeBinary(&req, &message, &messagepos);
 
-
 	//Send some data
-	if( send(sock , message.data, messagepos , 0) < 0)
-	{
+	if(send(sock , message.data, messagepos , 0) < 0) {
 		puts("Send failed");
 		return 1;
 	}
 
 	//Receive a reply from the server
 	int received = recv(sock , server_reply , 2000 , 0);
-	if(received < 0)
-	{
+	if(received < 0) {
 		puts("recv failed");
 		return 1;
 	}
 
 
-	for(int i=0;i<received;i++){
+	for(int i=0;i<received;i++) {
 		  //show only printable ascii
 		  if(server_reply[i] >= 32 && server_reply[i]<= 126)
 			  printf("%c",server_reply[i]);

+ 3 - 3
examples/networklayer_tcp.c

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

+ 1 - 1
examples/networklayer_udp.c

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

+ 8 - 8
examples/server.c

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

+ 12 - 11
include/ua_config.h.in

@@ -6,11 +6,17 @@
 #endif
 
 #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 */
 #ifdef _WIN32
@@ -64,11 +70,6 @@
 # define UA_NON_LITTLEENDIAN_ARCHITECTURE
 #endif
 
-/* Aligned Memory Access */
-#if defined(__arm__) && !defined(__ARM_FEATURE_UNALIGNED)
-# define UA_ALIGNED_MEMORY_ACCESS
-#endif
-
 /* Inline Functions */
 #ifdef _MSC_VER
 # define UA_INLINE __inline
@@ -99,7 +100,7 @@
 #endif
 
 #include <stddef.h>
-#ifdef UA_EMBEDDED_LIBC
+#ifdef UA_ENABLE_EMBEDDED_LIBC
   void *memcpy(void *UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n);
   void *memset(void *dest, int c, size_t n);
   size_t strlen(const char *s);

+ 2 - 2
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,
                                     UA_NodeId *outNewNodeId);
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 typedef UA_StatusCode (*UA_MethodCallback)(void *methodHandle, const UA_NodeId objectId,
                                            size_t inputSize, const UA_Variant *input,
                                            size_t outputSize, UA_Variant *output);
@@ -520,7 +520,7 @@ UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContin
 /* Call Method */
 /***************/
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request);
 #endif
 

+ 32 - 23
include/ua_types.h

@@ -157,7 +157,8 @@ UA_Guid UA_EXPORT UA_Guid_random(void);
 /************************************/
 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); }
 
 /* Allocates memory of size length for the bytestring. The content is not set to zero. */
@@ -346,8 +347,8 @@ typedef struct {
 } 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
  * @return Does the variant contain a scalar value.
@@ -356,14 +357,15 @@ static UA_INLINE UA_Boolean UA_Variant_isScalar(const UA_Variant *v) {
     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 p A pointer to the value data
  * @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.
@@ -373,11 +375,12 @@ void UA_EXPORT UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const U
  * @param type The datatype of the value
  * @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 array A pointer to the array data
@@ -385,7 +388,8 @@ UA_StatusCode UA_EXPORT UA_Variant_setScalarCopy(UA_Variant *v, const void *p, c
  * @param type The datatype of the array
  */
 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.
@@ -397,7 +401,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
  */
 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
  * array. NumericRange has no official type structure in the standard. On the
@@ -436,7 +441,8 @@ UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRan
  * @return Returns UA_STATUSCODE_GOOD or an error code
  */
 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.
@@ -448,7 +454,8 @@ UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array, size_t arraySize, c
  * @return Returns UA_STATUSCODE_GOOD or an error code
  */
 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. */
@@ -496,21 +503,23 @@ typedef struct UA_DiagnosticInfo {
 #define UA_MAX_TYPE_MEMBERS 13 // Maximum number of members per structured type
 
 typedef struct {
-#ifdef ENABLE_TYPEINTROSPECTION
+#ifdef UA_ENABLE_TYPENAMES
     const char *memberName;
 #endif
     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_DataTypeMember;
     
 struct UA_DataType {
-#ifdef ENABLE_TYPEINTROSPECTION
+#ifdef UA_ENABLE_TYPENAMES
     const char *typeName;
 #endif
     UA_NodeId   typeId;           ///< The nodeid of the type
@@ -651,8 +660,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);
 

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

+ 2 - 2
src/client/ua_client_internal.h

@@ -8,7 +8,7 @@
 /* Subscriptions Handling */
 /**************************/
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 
 typedef struct UA_Client_NotificationsAckNumber_s {
     UA_SubscriptionAcknowledgement subAck;
@@ -68,7 +68,7 @@ struct UA_Client {
     UA_NodeId authenticationToken;
     UA_UInt32 requestHandle;
     
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     UA_Int32 monitoredItemHandles;
     LIST_HEAD(UA_ListOfUnacknowledgedNotificationNumbers, UA_Client_NotificationsAckNumber_s) pendingNotificationsAcks;
     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) {
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     p->attachedMethod = NULL;
 #endif
     UA_Node_deleteMembers((UA_Node*)p);
@@ -336,7 +336,7 @@ void UA_MethodNode_deleteMembers(UA_MethodNode *p) {
 
 void UA_MethodNode_delete(UA_MethodNode *p) {
     UA_MethodNode_deleteMembers(p);
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     p->methodHandle   = NULL;
     p->attachedMethod = NULL;
 #endif
@@ -349,7 +349,7 @@ UA_StatusCode UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
         return retval;
     dst->executable = src->executable;
     dst->userExecutable = src->userExecutable;
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     dst->methodHandle  = src->methodHandle;
     dst->attachedMethod = src->attachedMethod;
 #endif

+ 1 - 1
src/server/ua_nodes.h

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

+ 1 - 1
src/server/ua_nodestore.h

@@ -26,7 +26,7 @@
  */
 
 /* For multithreading, nodes in the nodestore are immutable */
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 # define UA_MT_CONST const
 #else
 # 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) {
             LIST_REMOVE(entry, pointers);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
             cm->currentChannelCount--;
 #else
             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));
     if(!entry)
         return UA_STATUSCODE_BADOUTOFMEMORY;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     cm->currentChannelCount++;
 #else
     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);
             UA_SecureChannel_deleteMembersCleanup(&entry->channel);
             UA_free(entry);
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
             cm->currentChannelCount--;
 #else
             cm->currentChannelCount = uatomic_add_return(&cm->currentChannelCount, -1);

+ 19 - 20
src/server/ua_server.c

@@ -6,7 +6,7 @@
 #include "ua_services.h"
 #include "ua_nodeids.h"
 
-#ifdef ENABLE_GENERATE_NAMESPACE0
+#ifdef UA_ENABLE_GENERATE_NAMESPACE0
 #include "ua_namespaceinit_generated.h"
 #endif
 
@@ -19,7 +19,7 @@ const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
     .Application_applicationURI = "urn:unconfigured:open62541:open62541Server",
     .Application_applicationName = "open62541" };
 
-#if defined(UA_MULTITHREADING) && !defined(NDEBUG)
+#if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
 UA_THREAD_LOCAL bool rcu_locked = UA_FALSE;
 #endif
 
@@ -44,7 +44,7 @@ static const UA_ExpandedNodeId expandedNodeIdBaseDataVariabletype = {
                .identifier.numeric = UA_NS0ID_BASEDATAVARIABLETYPE},
     .namespaceUri = {.length = -1, .data = NULL}, .serverIndex = 0};
 
-#ifndef ENABLE_GENERATE_NAMESPACE0
+#ifndef UA_ENABLE_GENERATE_NAMESPACE0
 static const UA_NodeId nodeIdNonHierarchicalReferences = {
         .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
         .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
@@ -54,7 +54,7 @@ static const UA_NodeId nodeIdNonHierarchicalReferences = {
 /* Namespace Handling */
 /**********************/
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 static void UA_ExternalNamespace_init(UA_ExternalNamespace *ens) {
     ens->index = 0;
     UA_String_init(&ens->url);
@@ -96,7 +96,7 @@ UA_Server_addExternalNamespace(UA_Server *server, UA_UInt16 namespaceIndex,
     server->externalNamespacesSize++;
     return UA_STATUSCODE_GOOD;
 }
-#endif /* UA_EXTERNAL_NAMESPACES*/
+#endif /* UA_ENABLE_EXTERNAL_NAMESPACES*/
 
 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
     server->namespaces = UA_realloc(server->namespaces,
@@ -106,8 +106,8 @@ UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
     return (UA_UInt16)server->namespacesSize - 1;
 }
 
-UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
-                                   UA_Boolean deleteReferences) {
+UA_StatusCode
+UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences) {
     UA_RCU_LOCK();
     UA_StatusCode retval = Service_DeleteNodes_single(server, &adminSession, &nodeId, deleteReferences);
     UA_RCU_UNLOCK();
@@ -273,7 +273,7 @@ void UA_Server_delete(UA_Server *server) {
     UA_SecureChannelManager_deleteMembers(&server->secureChannelManager);
     UA_SessionManager_deleteMembers(&server->sessionManager, server);
     UA_NodeStore_delete(server->nodestore);
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Server_deleteExternalNamespaces(server);
 #endif
     UA_ByteString_deleteMembers(&server->serverCertificate);
@@ -290,7 +290,7 @@ void UA_Server_delete(UA_Server *server) {
     UA_free(server->networkLayers);
 
     UA_RCU_UNLOCK();
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* so the workers don't spin if the queue is empty */
     pthread_cond_destroy(&server->dispatchQueue_condition);
     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;
 
     LIST_INIT(&server->repeatedJobs);
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     rcu_init();
    	rcu_register_thread();
     cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
@@ -584,7 +584,7 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
     /**************/
     /* References */
     /**************/
-#ifndef ENABLE_GENERATE_NAMESPACE0
+#ifndef UA_ENABLE_GENERATE_NAMESPACE0
     /* Bootstrap by manually inserting "references" and "hassubtype" */
     UA_ReferenceTypeNode *references = UA_ReferenceTypeNode_new();
     copyNames((UA_Node*)references, "References");
@@ -916,7 +916,7 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
                                 UA_NS0ID_BASEVARIABLETYPE, UA_FALSE);
 #endif
 
-#ifdef ENABLE_GENERATE_NAMESPACE0
+#ifdef UA_ENABLE_GENERATE_NAMESPACE0
     //load the generated namespace
     ua_namespaceinit_generated(server);
 #endif
@@ -1000,13 +1000,13 @@ UA_Server * UA_Server_new(UA_ServerConfig config) {
     UA_UInt16 profileArraySize = 0;
     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");
 #endif
-#ifdef ENABLE_SERVICESET_METHOD
+#ifdef UA_ENABLE_SERVICESET_METHOD
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
 #endif
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
 #endif
 
@@ -1210,8 +1210,8 @@ __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
     return retval;
 }
 
-static UA_StatusCode setValueCallback(UA_Server *server, UA_Session *session, UA_VariableNode *node,
-                                      UA_ValueCallback *callback) {
+static UA_StatusCode
+setValueCallback(UA_Server *server, UA_Session *session, UA_VariableNode *node, UA_ValueCallback *callback) {
     if(node->nodeClass != UA_NODECLASS_VARIABLE)
         return UA_STATUSCODE_BADNODECLASSINVALID;
     node->value.variant.callback = *callback;
@@ -1261,8 +1261,7 @@ UA_Server_setObjectTypeNode_instanceLifecycleManagement(UA_Server *server, UA_No
 }
 
 UA_StatusCode
-__UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
-                 const UA_AttributeId attributeId, void *v) {
+__UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v) {
     UA_ReadValueId item;
     UA_ReadValueId_init(&item);
     item.nodeId = *nodeId;
@@ -1310,7 +1309,7 @@ UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
     return result;
 }
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 UA_CallMethodResult UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) {
     UA_CallMethodResult result;
     UA_CallMethodResult_init(&result);

+ 8 - 8
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 */
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
 #else
     seqHeader.sequenceNumber = uatomic_add_return(&channel->sequenceNumber, 1);
@@ -210,7 +210,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
         *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
         break;
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     case UA_NS0ID_CREATESUBSCRIPTIONREQUEST:
         *service = (UA_Service)Service_CreateSubscription;
         *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
@@ -247,7 +247,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
         break;
 #endif
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
     case UA_NS0ID_CALLREQUEST:
         *service = (UA_Service)Service_Call;
         *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
@@ -255,7 +255,7 @@ getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
 	break;
 #endif
 
-#ifdef ENABLE_NODEMANAGEMENT
+#ifdef UA_ENABLE_NODEMANAGEMENT
     case UA_NS0ID_ADDNODESREQUEST:
         *service = (UA_Service)Service_AddNodes;
         *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
@@ -363,7 +363,7 @@ processMSG(UA_Connection *connection, UA_Server *server, const UA_ByteString *ms
     }
 
     /* Most services can only be called with a valid securechannel */
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
     if(channel == &anonymousChannel &&
        requestType->typeIndex > UA_TYPES_OPENSECURECHANNELREQUEST) {
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSECURECHANNELIDINVALID);
@@ -397,7 +397,7 @@ processMSG(UA_Connection *connection, UA_Server *server, const UA_ByteString *ms
         sendError(channel, msg, *pos, sequenceHeader.requestId, UA_STATUSCODE_BADSESSIONNOTACTIVATED);
         return;
     }
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
     if(session == &anonymousSession &&
        requestType->typeIndex > UA_TYPES_ACTIVATESESSIONREQUEST) {
         UA_LOG_INFO(server->logger, UA_LOGCATEGORY_SERVER, "Client tries to call a service without a session");
@@ -408,7 +408,7 @@ processMSG(UA_Connection *connection, UA_Server *server, const UA_ByteString *ms
 
     UA_Session_updateLifetime(session);
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     /* The publish request is answered with a delay */
     if(requestTypeId.identifier.numeric - UA_ENCODINGOFFSET_BINARY == UA_NS0ID_PUBLISHREQUEST) {
         Service_Publish(server, session, request, sequenceHeader.requestId);
@@ -471,7 +471,7 @@ void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection
             processOPN(connection, server, msg, &pos);
             break;
         case UA_MESSAGETYPEANDFINAL_MSGF & 0xffffff:
-#ifndef EXTENSION_STATELESS
+#ifndef UA_ENABLE_NONSTANDARD_STATELESS
             if(connection->state != UA_CONNECTION_ESTABLISHED) {
                 connection->close(connection);
                 return;

+ 4 - 4
src/server/ua_server_internal.h

@@ -8,7 +8,7 @@
 #include "ua_securechannel_manager.h"
 #include "ua_nodestore.h"
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 #include "ua_subscription_manager.h"
 #endif
 
@@ -16,7 +16,7 @@
 #define ANONYMOUS_POLICY "open62541-anonymous-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
     that have no mapping defined, the internal nodestore is used by default. */
 typedef struct UA_ExternalNamespace {
@@ -52,7 +52,7 @@ struct UA_Server {
     size_t namespacesSize;
     UA_String *namespaces;
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     size_t externalNamespacesSize;
     UA_ExternalNamespace *externalNamespaces;
 #endif
@@ -60,7 +60,7 @@ struct UA_Server {
     /* Jobs with a repetition interval */
     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) */
 	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 */
 /*******************************/
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 
 struct MainLoopJob {
     struct cds_lfs_node node;
@@ -271,7 +271,7 @@ static UA_StatusCode addRepeatedJob(UA_Server *server, struct AddRepeatedJob * U
     matchingTw->jobsSize++;
 
  cleanup:
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_free(arw);
 #endif
     return retval;
@@ -283,7 +283,7 @@ UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32
         return UA_STATUSCODE_BADINTERNALERROR;
     interval *= 10000; // from ms to 100ns resolution
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     struct AddRepeatedJob *arw = UA_malloc(sizeof(struct AddRepeatedJob));
     if(!arw)
         return UA_STATUSCODE_BADOUTOFMEMORY;
@@ -328,7 +328,7 @@ static UA_UInt16 processRepeatedJobs(UA_Server *server) {
         if(tw->nextTime > current)
             break;
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
         // copy the entry and insert at the new location
         UA_Job *jobsCopy = UA_malloc(sizeof(UA_Job) * tw->jobsSize);
         if(!jobsCopy) {
@@ -393,14 +393,14 @@ static void removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
         }
     }
  finish:
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_free(jobId);
 #endif
     return;
 }
 
 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));
     if(!idptr)
         return UA_STATUSCODE_BADOUTOFMEMORY;
@@ -429,7 +429,7 @@ void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
 /* Delayed Jobs */
 /****************/
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 
 #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 */
 /********************/
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
 static void processMainLoopJobs(UA_Server *server) {
     /* no synchronization required if we only use push and pop_all */
     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 result = UA_STATUSCODE_GOOD;
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Prepare the worker threads */
     server->running = running; // the threads need to access the variable
     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) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Run Work in the main loop */
     processMainLoopJobs(server);
 #endif
@@ -605,7 +605,7 @@ UA_StatusCode UA_Server_run_mainloop(UA_Server *server, UA_Boolean *running) {
         } else
             jobsSize = server->networkLayers[i]->stop(nl, &jobs);
 
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
         /* Filter out delayed work */
         for(UA_Int32 k=0;k<jobsSize;k++) {
             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);
         UA_free(stopJobs);
     }
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     /* Wait for all worker threads to finish */
     for(UA_UInt32 i=0;i<nThreads;i++) {
         pthread_join(server->thr[i], NULL);

+ 3 - 3
src/server/ua_services.h

@@ -218,7 +218,7 @@ void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
  */
 
 /* 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);
 #endif
 
@@ -264,7 +264,7 @@ Service_Write_single(UA_Server *server, UA_Session *session, const UA_WriteValue
  *
  * @{
  */
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 void
 Service_Call(UA_Server *server, UA_Session *session,
              const UA_CallRequest *request,
@@ -276,7 +276,7 @@ Service_Call_single(UA_Server *server, UA_Session *session,
 #endif
 /** @} */
 
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
 /**
  * @name MonitoredItem Service Set
  *

+ 7 - 7
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;
 }
 
-#ifndef BUILD_UNIT_TESTS
+#ifndef UA_BUILD_UNIT_TESTS
 static
 #endif
 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;
     }
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean) * size);
@@ -375,14 +375,14 @@ void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *
 #endif
 
     for(size_t i = 0;i < size;i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
             Service_Read_single(server, session, request->timestampsToReturn,
                                 &request->nodesToRead[i], &response->results[i]);
     }
 
-#ifdef EXTENSION_STATELESS
+#ifdef UA_ENABLE_NONSTANDARD_STATELESS
     /* Add an expiry header for caching */
     if(session==&anonymousSession){
 		UA_ExtensionObject additionalHeader;
@@ -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);
         if(!node)
             return UA_STATUSCODE_BADNODEIDUNKNOWN;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
         retval = callback(server, session, node, data);
         return retval;
 #else
@@ -697,7 +697,7 @@ void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest
         return;
     }
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     UA_Boolean isExternal[request->nodesToWriteSize];
     UA_UInt32 indices[request->nodesToWriteSize];
     memset(isExternal, UA_FALSE, sizeof(UA_Boolean)*request->nodesToWriteSize);
@@ -721,7 +721,7 @@ void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest
     
     response->resultsSize = request->nodesToWriteSize;
     for(size_t i = 0;i < request->nodesToWriteSize;i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
 		  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;
     }
     
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef _MSVC_VER
     UA_Boolean *isExternal = UA_alloca(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;
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
             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;
 }
 
-#ifdef ENABLE_METHODCALLS
+#ifdef UA_ENABLE_METHODCALLS
 UA_StatusCode UA_EXPORT
 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
                         const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
@@ -808,7 +808,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddR
 	}
 	response->resultsSize = size;
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
@@ -837,7 +837,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddR
 
 	response->resultsSize = size;
 	for(size_t i = 0; i < response->resultsSize; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 		if(!isExternal[i])
 #endif
             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;
 }
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 static const UA_Node *
 returnRelevantNodeExternal(UA_ExternalNodeStore *ens, const UA_BrowseDescription *descr,
                            const UA_ReferenceNode *reference) {
@@ -109,7 +109,7 @@ returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Bool
             return NULL;
     }
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     /* return the node from an external namespace*/
 	for(size_t nsIndex = 0; nsIndex < server->externalNamespacesSize; nsIndex++) {
 		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]);
             referencesCount++;
         }
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         /* relevant_node returns a node malloced with UA_ObjectNode_new
            if it is external (there is no UA_Node_new function) */
         if(isExternal == UA_TRUE)
@@ -384,7 +384,7 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
     }
     response->resultsSize = size;
     
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
@@ -411,7 +411,7 @@ void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseReque
 #endif
 
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
         if(!isExternal[i])
 #endif
             Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
@@ -584,7 +584,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
         return;
     }
 
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
 #ifdef NO_ALLOCA
     UA_Boolean isExternal[size];
     UA_UInt32 indices[size];
@@ -612,7 +612,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *sessio
 
     response->resultsSize = size;
     for(size_t i = 0; i < size; i++) {
-#ifdef UA_EXTERNAL_NAMESPACES
+#ifdef UA_ENABLE_EXTERNAL_NAMESPACES
     	if(!isExternal[i])
 #endif
     		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) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     UA_SecureChannel *channel = connection->channel;
     if(channel)
         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) {
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_cmpxchg(&channel->connection, NULL, connection) == NULL)
         uatomic_set(&connection->channel, channel);
 #else

+ 2 - 2
src/ua_securechannel.c

@@ -55,7 +55,7 @@ void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *sessi
     if(!se)
         return;
     se->session = session;
-#ifdef UA_MULTITHREADING
+#ifdef UA_ENABLE_MULTITHREADING
     if(uatomic_cmpxchg(&session->channel, NULL, channel) != NULL) {
         UA_free(se);
         return;
@@ -144,7 +144,7 @@ UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_U
 
     /* now write the header with the size */
     respHeader.messageHeader.messageSize = messagePos;
-#ifndef UA_MULTITHREADING
+#ifndef UA_ENABLE_MULTITHREADING
     seqHeader.sequenceNumber = ++channel->sequenceNumber;
 #else
     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;
     UA_DateTime_init(&session->validTill);
     session->channel = NULL;
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     SubscriptionManager_init(session);
 #endif
     session->availableContinuationPoints = MAXCONTINUATIONPOINTS;
@@ -62,7 +62,7 @@ void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
     }
     if(session->channel)
         UA_SecureChannel_detachSession(session->channel, session);
-#ifdef ENABLE_SUBSCRIPTIONS
+#ifdef UA_ENABLE_SUBSCRIPTIONS
     SubscriptionManager_deleteMembers(session, server);
 #endif
 }

+ 2 - 2
src/ua_session.h

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

+ 13 - 65
src/ua_types_encoding_binary.c

@@ -66,18 +66,12 @@ UInt16_encodeBinary(UA_UInt16 const *src, const UA_DataType *_,
                     UA_ByteString *dst, size_t *UA_RESTRICT offset) {
     if(*offset + sizeof(UA_UInt16) > dst->length)
         return UA_STATUSCODE_BADENCODINGERROR;
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     UA_UInt16 le_uint16 = htole16(*src);
     src = &le_uint16;
 #endif
-
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    dst->data[(*offset)++] = (*src & 0x00FF) >> 0;
-    dst->data[(*offset)++] = (*src & 0xFF00) >> 8;
-#else
-    *(UA_UInt16*)&dst->data[*offset] = *src;
+    memcpy(&dst->data[*offset], src, sizeof(UA_UInt16));
     *offset += 2;
-#endif
     return UA_STATUSCODE_GOOD;
 }
 
@@ -91,15 +85,9 @@ UInt16_decodeBinary(UA_ByteString const *src, size_t *UA_RESTRICT offset,
                     UA_UInt16 *dst, const UA_DataType *_) {
     if(*offset + sizeof(UA_UInt16) > src->length)
         return UA_STATUSCODE_BADDECODINGERROR;
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    *dst = (UA_UInt16) src->data[(*offset)++] << 0;
-    *dst |= (UA_UInt16) src->data[(*offset)++] << 8;
-#else
-    *dst = *((UA_UInt16*) &src->data[*offset]);
+    memcpy(dst, &src->data[*offset], sizeof(UA_UInt16));
     *offset += 2;
-#endif
-
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     *dst = le16toh(*dst);
 #endif
     return UA_STATUSCODE_GOOD;
@@ -116,20 +104,12 @@ UInt32_encodeBinary(UA_UInt32 const *src, const UA_DataType *_,
                     UA_ByteString *dst, size_t *UA_RESTRICT offset) {
     if(*offset + sizeof(UA_UInt32) > dst->length)
         return UA_STATUSCODE_BADENCODINGERROR;
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     UA_UInt32 le_uint32 = htole32(*src);
     src = &le_uint32;
 #endif
-
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    dst->data[(*offset)++] = (*src & 0x000000FF) >> 0;
-    dst->data[(*offset)++] = (*src & 0x0000FF00) >> 8;
-    dst->data[(*offset)++] = (*src & 0x00FF0000) >> 16;
-    dst->data[(*offset)++] = (*src & 0xFF000000) >> 24;
-#else
-    *(UA_UInt32*) &dst->data[*offset] = *src;
+    memcpy(&dst->data[*offset], src, sizeof(UA_UInt32));
     *offset += 4;
-#endif
     return UA_STATUSCODE_GOOD;
 }
 
@@ -149,17 +129,9 @@ UInt32_decodeBinary(UA_ByteString const *src, size_t *UA_RESTRICT offset,
                     UA_UInt32 *dst, const UA_DataType *_) {
     if(*offset + sizeof(UA_UInt32) > src->length)
         return UA_STATUSCODE_BADDECODINGERROR;
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    *dst = (UA_UInt32)((UA_Byte)(src->data[(*offset)++] & 0xFF));
-    *dst |= (UA_UInt32)((UA_Byte)(src->data[(*offset)++] & 0xFF) << 8);
-    *dst |= (UA_UInt32)((UA_Byte)(src->data[(*offset)++] & 0xFF) << 16);
-    *dst |= (UA_UInt32)((UA_Byte)(src->data[(*offset)++] & 0xFF) << 24);
-#else
-    *dst = *((UA_UInt32*) &src->data[*offset]);
+    memcpy(dst, &src->data[*offset], sizeof(UA_UInt32));
     *offset += 4;
-#endif
-
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     *dst = le32toh(*dst);
 #endif
     return UA_STATUSCODE_GOOD;
@@ -182,24 +154,12 @@ UInt64_encodeBinary(UA_UInt64 const *src, const UA_DataType *_,
                     UA_ByteString *dst, size_t *UA_RESTRICT offset) {
     if(*offset + sizeof(UA_UInt64) > dst->length)
         return UA_STATUSCODE_BADENCODINGERROR;
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     UA_UInt64 le_uint64 = htole64(*src);
     src = &le_uint64;
 #endif
-
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    dst->data[(*offset)++] = (*src & 0x00000000000000FF) >> 0;
-    dst->data[(*offset)++] = (*src & 0x000000000000FF00) >> 8;
-    dst->data[(*offset)++] = (*src & 0x0000000000FF0000) >> 16;
-    dst->data[(*offset)++] = (*src & 0x00000000FF000000) >> 24;
-    dst->data[(*offset)++] = (*src & 0x000000FF00000000) >> 32;
-    dst->data[(*offset)++] = (*src & 0x0000FF0000000000) >> 40;
-    dst->data[(*offset)++] = (*src & 0x00FF000000000000) >> 48;
-    dst->data[(*offset)++] = (*src & 0xFF00000000000000) >> 56;
-#else
-    *(UA_UInt64*) &dst->data[*offset] = *src;
+    memcpy(&dst->data[*offset], src, sizeof(UA_UInt64));
     *offset += 8;
-#endif
     return UA_STATUSCODE_GOOD;
 }
 
@@ -219,21 +179,9 @@ UInt64_decodeBinary(UA_ByteString const *src, size_t *UA_RESTRICT offset,
                     UA_UInt64 *dst, const UA_DataType *_) {
     if(*offset + sizeof(UA_UInt64) > src->length)
         return UA_STATUSCODE_BADDECODINGERROR;
-#ifdef UA_ALIGNED_MEMORY_ACCESS
-    *dst  = (UA_UInt64) src->data[(*offset)++];
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 8;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 16;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 24;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 32;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 40;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 48;
-    *dst |= (UA_UInt64) src->data[(*offset)++] << 56;
-#else
-    *dst = *((UA_UInt64*) &src->data[*offset]);
+    memcpy(dst, &src->data[*offset], sizeof(UA_UInt64));
     *offset += 8;
-#endif
-
-#if defined(UA_NON_LITTLEENDIAN_ARCHITECTURE) && !defined(UA_ALIGNED_MEMORY_ACCESS)
+#ifdef UA_NON_LITTLEENDIAN_ARCHITECTURE
     *dst = le64toh(*dst);
 #endif
     return UA_STATUSCODE_GOOD;
@@ -348,7 +296,7 @@ Array_encodeBinary(const void *src, size_t length, const UA_DataType *type,
     else if(src == UA_EMPTY_ARRAY_SENTINEL)
         signed_length = 0;
     UA_StatusCode retval = Int32_encodeBinary(&signed_length, NULL, dst, offset);
-    if(retval != UA_STATUSCODE_GOOD)
+    if(retval != UA_STATUSCODE_GOOD || length == 0)
         return retval;
 
 #ifndef UA_NON_LITTLEENDIAN_ARCHITECTURE

+ 2 - 2
src/ua_util.h

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

+ 4 - 4
tests/CMakeLists.txt

@@ -6,7 +6,7 @@ include_directories(${PROJECT_BINARY_DIR}/src_generated)
 find_package(Check REQUIRED)
 find_package(Threads REQUIRED)
 
-set(LIBS ${CHECK_LIBRARIES})
+set(LIBS ${CHECK_LIBRARIES} ${open62541_LIBRARIES})
 if(NOT WIN32)
   list(APPEND LIBS pthread m)
   if (NOT APPLE)
@@ -15,9 +15,9 @@ if(NOT WIN32)
 else()
     list(APPEND LIBS ws2_32)
 endif()
-if(ENABLE_MULTITHREADING)
+if(UA_ENABLE_MULTITHREADING)
     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
 # 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)
 
 #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)
 #endif()
 #add_executable(check_server_interaction_fileinput ${check_fileinput_source})

+ 19 - 19
tests/check_nodestore.c

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

+ 4 - 4
tests/check_services_attributes.c

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

+ 1 - 1
tests/check_services_nodemanagement.c

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

+ 7 - 7
tools/travis_linux_script.sh

@@ -4,7 +4,7 @@ set -ev
 echo "Documentation and certificate build"
 mkdir -p build
 cd build
-cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON -DUA_BUILD_EXAMPLES=ON -DUA_BUILD_DOCUMENTATION=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE=ON ..
 make doc
 make selfsigned
 cp -r doc ../../
@@ -13,7 +13,7 @@ cd .. && rm build -rf
 
 echo "Cross compile release build for MinGW 32 bit"
 mkdir -p build && cd build
-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 -DUA_BUILD_EXAMPLES=ON ..
 make
 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 ..
@@ -21,7 +21,7 @@ cd .. && rm build -rf
 
 echo "Cross compile release build for MinGW 64 bit"
 mkdir -p build && cd build
-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 -DUA_BUILD_EXAMPLES=ON ..
 make
 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 ..
@@ -29,7 +29,7 @@ cd .. && rm build -rf
 
 echo "Cross compile release build for 32-bit linux"
 mkdir -p build && cd build
-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
 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 ..
@@ -37,7 +37,7 @@ cd .. && rm build -rf
 
 echo "Compile release build for 64-bit linux"
 mkdir -p build && cd build
-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
 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 ..
@@ -61,14 +61,14 @@ cd .. && rm build -rf
 
 echo "Compile multithreaded version"
 mkdir -p build && cd build
-cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
+cmake -DUA_ENABLE_MULTITHREADING=ON -DUA_BUILD_EXAMPLESERVER=ON ..
 make
 cd .. && rm build -rf 
 
 #this run inclides full examples and methodcalls
 echo "Debug build and unit tests (64 bit)"
 mkdir -p build && cd build
-cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXAMPLES=ON -DENABLE_METHODCALLS=ON -DBUILD_DEMO_NODESET=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLESERVER=ON -DENABLE_COVERAGE=ON ..
+cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_METHODCALLS=ON -DUA_BUILD_DEMO_NODESET=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_ENABLE_COVERAGE=ON ..
 make && make test ARGS="-V"
 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);

+ 3 - 3
tools/travis_osx_script.sh

@@ -3,7 +3,7 @@ set -ev
 
 echo "Compile release build for OS X"
 mkdir -p build && cd build
-cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_BUILD_EXAMPLECLIENT=ON -DUA_BUILD_DOCUMENTATION=ON -DUA_GENERATE_SELFSIGNED=ON ..
 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
 cp open62541-osx.tar.gz ..
@@ -13,13 +13,13 @@ cd .. && rm -rf build
 
 echo "Compile multithreaded version"
 mkdir -p build && cd build
-cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
+cmake -DUA_ENABLE_MULTITHREADING=ON -DUA_BUILD_EXAMPLESERVER=ON ..
 make
 cd .. && rm -rf build
 
 echo "Debug build and unit tests (64 bit)"
 mkdir -p build && cd build
-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_DEMO_NODESET=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_BUILD_EXAMPLESERVER=ON -DUA_ENABLE_COVERAGE=ON ..
 make && make test
 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);