Browse Source

enable even stricter compiler warnings; test for C++ compat

Julius Pfrommer 7 years ago
parent
commit
5398343607
43 changed files with 239 additions and 226 deletions
  1. 18 4
      CMakeLists.txt
  2. 1 1
      deps/mdnsd
  3. 2 2
      deps/pcg_basic.h
  4. 8 3
      examples/CMakeLists.txt
  5. 1 1
      examples/discovery/server_multicast.c
  6. 4 1
      examples/server_nodeset.c
  7. 1 0
      examples/tutorial_server_variabletype.c
  8. 2 2
      include/ua_server_deprecated.h
  9. 1 1
      plugins/ua_network_tcp.c
  10. 2 0
      src/server/ua_mdns.c
  11. 12 12
      src/server/ua_nodestore_concurrent.c
  12. 2 2
      src/server/ua_securechannel_manager.c
  13. 10 12
      src/server/ua_server_binary.c
  14. 2 10
      src/server/ua_server_internal.h
  15. 3 3
      src/server/ua_server_worker.c
  16. 0 4
      src/server/ua_services.h
  17. 6 2
      src/server/ua_services_attribute.c
  18. 2 1
      src/server/ua_services_call.c
  19. 8 4
      src/server/ua_services_discovery.c
  20. 24 20
      src/server/ua_services_nodemanagement.c
  21. 2 1
      src/server/ua_services_securechannel.c
  22. 8 4
      src/server/ua_services_session.c
  23. 18 11
      src/server/ua_services_subscription.c
  24. 9 5
      src/server/ua_services_view.c
  25. 2 2
      src/server/ua_session_manager.c
  26. 11 7
      src/ua_securechannel.h
  27. 10 7
      src/ua_session.h
  28. 2 2
      src/ua_types.c
  29. 0 30
      src/ua_types_encoding_binary.c
  30. 6 7
      tests/check_chunking.c
  31. 1 1
      tests/check_client.c
  32. 27 22
      tests/check_discovery.c
  33. 5 9
      tests/check_nodestore.c
  34. 1 1
      tests/check_server_binary_messages.c
  35. 1 1
      tests/check_server_userspace.c
  36. 3 3
      tests/check_services_attributes.c
  37. 1 1
      tests/check_services_view.c
  38. 11 11
      tests/check_types_builtin.c
  39. 1 1
      tests/check_types_custom.c
  40. 1 1
      tests/check_types_range.c
  41. 1 1
      tests/testing_networklayers.c
  42. 7 11
      tools/pyUANamespace/ua_namespace.py
  43. 2 2
      tools/pyUANamespace/ua_node_types.py

+ 18 - 4
CMakeLists.txt

@@ -161,14 +161,28 @@ endif(UA_ENABLE_MULTITHREADING)
 
 
 if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
 if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
     # Compiler
     # Compiler
-    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 -Wstrict-overflow -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes
-                    -Winit-self -Wuninitialized -Wformat-security -Wformat-nonliteral)
+    add_definitions(-std=c99 -pipe
+                    -Wall -Wextra -Werror -Wpedantic
+                    -Wno-static-in-inline # clang doesn't like the use of static inline methods inside static inline methods
+                    -Wno-overlength-strings # may happen in the nodeset compiler when complex values are directly encoded
+                    -Wno-unused-parameter # some methods may require unused arguments to cast to a method pointer
+                    -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
+                    -Wformat -Wformat-security -Wformat-nonliteral
+                    -Wuninitialized -Winit-self
+                    -Wcast-qual
+                    -Wstrict-overflow
+                    -Wnested-externs
+                    -Wmultichar
+                    -Wundef
+                    -Wc++-compat)
      if(NOT WIN32 AND NOT CYGWIN AND NOT QNXNTO)
      if(NOT WIN32 AND NOT CYGWIN AND NOT QNXNTO)
         add_definitions(-Wshadow -Wconversion -fvisibility=hidden -fPIC)
         add_definitions(-Wshadow -Wconversion -fvisibility=hidden -fPIC)
      endif()
      endif()
 
 
+     if(UA_ENABLE_AMALGAMATION)
+         add_definitions(-Wno-unused-function)
+     endif()
+
     # Linker
     # Linker
     set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
     set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
 
 

+ 1 - 1
deps/mdnsd

@@ -1 +1 @@
-Subproject commit 47d76ed02243527d20930779c0e2242b77f011ca
+Subproject commit 9c070d0023abbb30a42a3bf1752090a94b83a4f6

+ 2 - 2
deps/pcg_basic.h

@@ -26,7 +26,7 @@
 
 
 #include "ms_stdint.h"
 #include "ms_stdint.h"
 
 
-#if __cplusplus
+#ifdef __cplusplus
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
@@ -40,7 +40,7 @@ typedef struct pcg_state_setseq_64 {
 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
 uint32_t pcg32_random_r(pcg32_random_t* rng);
 uint32_t pcg32_random_r(pcg32_random_t* rng);
 
 
-#if __cplusplus
+#ifdef __cplusplus
 }
 }
 #endif
 #endif
 
 

+ 8 - 3
examples/CMakeLists.txt

@@ -9,7 +9,7 @@ include_directories(${PROJECT_BINARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples)
 
 
 macro(add_example EXAMPLE_NAME EXAMPLE_SOURCE)
 macro(add_example EXAMPLE_NAME EXAMPLE_SOURCE)
-  add_executable(${EXAMPLE_NAME} ${STATIC_OBJECTS} ${EXAMPLE_SOURCE})
+  add_executable(${EXAMPLE_NAME} ${STATIC_OBJECTS} ${EXAMPLE_SOURCE} ${ARGN})
   target_link_libraries(${EXAMPLE_NAME} open62541 ${open62541_LIBRARIES})
   target_link_libraries(${EXAMPLE_NAME} open62541 ${open62541_LIBRARIES})
   assign_source_group(${EXAMPLE_SOURCE})
   assign_source_group(${EXAMPLE_SOURCE})
   add_dependencies(${EXAMPLE_NAME} open62541_amalgamation)
   add_dependencies(${EXAMPLE_NAME} open62541_amalgamation)
@@ -65,7 +65,11 @@ add_example(server_repeated_job server_repeated_job.c)
 
 
 add_example(server_inheritance server_inheritance.c)
 add_example(server_inheritance server_inheritance.c)
 
 
-if(NOT BUILD_SHARED_open62541_LIBRARIES AND UA_BUILD_EXAMPLES_NODESET_COMPILER)
+if(UA_BUILD_EXAMPLES_NODESET_COMPILER)
+  if(BUILD_SHARED_LIBS)
+    message(FATAL_ERROR "The nodeset compiler currently requires static linking to access internal API")
+  endif()
+
   # example information model from nodeset xml
   # example information model from nodeset xml
   add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
   add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
                     PRE_BUILD
                     PRE_BUILD
@@ -84,8 +88,9 @@ if(NOT BUILD_SHARED_open62541_LIBRARIES AND UA_BUILD_EXAMPLES_NODESET_COMPILER)
                             ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
                             ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
 
 
   # needs internal methods which are not exported in the dynamic lib
   # needs internal methods which are not exported in the dynamic lib
-  add_example(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
+  add_example(server_nodeset ${PROJECT_BINARY_DIR}/src_generated/nodeset.c server_nodeset.c)
   target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
   target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
+  set_target_properties(server_nodeset PROPERTIES COMPILE_FLAGS "-Wno-pedantic -Wno-sign-conversion")
 endif()
 endif()
 
 
 if(UA_BUILD_SELFSIGNED_CERTIFICATE)
 if(UA_BUILD_SELFSIGNED_CERTIFICATE)

+ 1 - 1
examples/discovery/server_multicast.c

@@ -77,7 +77,7 @@ serverOnNetworkCallback(const UA_ServerOnNetwork *serverOnNetwork, UA_Boolean is
 
 
     if (discovery_url != NULL)
     if (discovery_url != NULL)
         free(discovery_url);
         free(discovery_url);
-    discovery_url = malloc(serverOnNetwork->discoveryUrl.length + 1);
+    discovery_url = (char*)malloc(serverOnNetwork->discoveryUrl.length + 1);
     memcpy(discovery_url, serverOnNetwork->discoveryUrl.data, serverOnNetwork->discoveryUrl.length);
     memcpy(discovery_url, serverOnNetwork->discoveryUrl.data, serverOnNetwork->discoveryUrl.length);
     discovery_url[serverOnNetwork->discoveryUrl.length] = 0;
     discovery_url[serverOnNetwork->discoveryUrl.length] = 0;
 }
 }

+ 4 - 1
examples/server_nodeset.c

@@ -3,7 +3,10 @@
 
 
 #include <signal.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <stdlib.h>
-#include "open62541.h"
+#include "ua_server.h"
+#include "ua_log_stdout.h"
+#include "ua_config_standard.h"
+#include "ua_network_tcp.h"
 
 
 /* Files nodeset.h and nodeset.c are created from server_nodeset.xml in the
 /* Files nodeset.h and nodeset.c are created from server_nodeset.xml in the
  * /src_generated directory by CMake */
  * /src_generated directory by CMake */

+ 1 - 0
examples/tutorial_server_variabletype.c

@@ -135,6 +135,7 @@ int main(void) {
     addVariableType2DPoint(server);
     addVariableType2DPoint(server);
     addVariable(server);
     addVariable(server);
     addVariableFail(server);
     addVariableFail(server);
+    writeVariable(server);
 
 
     UA_Server_run(server, &running);
     UA_Server_run(server, &running);
     UA_Server_delete(server);
     UA_Server_delete(server);

+ 2 - 2
include/ua_server_deprecated.h

@@ -45,12 +45,12 @@ UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
                          UA_UInt32 interval, UA_Guid *jobId) {
                          UA_UInt32 interval, UA_Guid *jobId) {
     return UA_Server_addRepeatedCallback(server, job.job.methodCall.method,
     return UA_Server_addRepeatedCallback(server, job.job.methodCall.method,
                                          job.job.methodCall.data, interval,
                                          job.job.methodCall.data, interval,
-                                         (UA_UInt64*)jobId);
+                                         (UA_UInt64*)(uintptr_t)jobId);
 }
 }
 
 
 UA_DEPRECATED static UA_INLINE UA_StatusCode
 UA_DEPRECATED static UA_INLINE UA_StatusCode
 UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
 UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
-    return UA_Server_removeRepeatedCallback(server, *(UA_UInt64*)&jobId);
+    return UA_Server_removeRepeatedCallback(server, *(UA_UInt64*)(uintptr_t)&jobId);
 }
 }
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus

+ 1 - 1
plugins/ua_network_tcp.c

@@ -64,7 +64,7 @@
 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
 #endif
 #endif
 
 
-#if UNDER_CE
+#ifdef UNDER_CE
 # define errno WSAGetLastError()
 # define errno WSAGetLastError()
 #endif
 #endif
 
 

+ 2 - 0
src/server/ua_mdns.c

@@ -111,10 +111,12 @@ mdns_record_add_or_get(UA_Server *server, const char *record, const char *server
     return listEntry;
     return listEntry;
 }
 }
 
 
+#ifdef UA_ENABLE_MULTITHREADING
 static void
 static void
 delayedFree(UA_Server *server, void *data) {
 delayedFree(UA_Server *server, void *data) {
     UA_free(data);
     UA_free(data);
 }
 }
+#endif
 
 
 static void
 static void
 mdns_record_remove(UA_Server *server, const char *record,
 mdns_record_remove(UA_Server *server, const char *record,

+ 12 - 12
src/server/ua_nodestore_concurrent.c

@@ -16,9 +16,9 @@ struct nodeEntry {
     UA_Node node; ///< Might be cast from any _bigger_ UA_Node* type. Allocate enough memory!
     UA_Node node; ///< Might be cast from any _bigger_ UA_Node* type. Allocate enough memory!
 };
 };
 
 
-static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
+static struct nodeEntry * instantiateEntry(UA_NodeClass nc) {
     size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
     size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
-    switch(class) {
+    switch(nc) {
     case UA_NODECLASS_OBJECT:
     case UA_NODECLASS_OBJECT:
         size += sizeof(UA_ObjectNode);
         size += sizeof(UA_ObjectNode);
         break;
         break;
@@ -46,10 +46,10 @@ static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
     default:
     default:
         return NULL;
         return NULL;
     }
     }
-    struct nodeEntry *entry = UA_calloc(1, size);
+    struct nodeEntry *entry = (struct nodeEntry*)UA_calloc(1, size);
     if(!entry)
     if(!entry)
         return NULL;
         return NULL;
-    entry->node.nodeClass = class;
+    entry->node.nodeClass = nc;
     return entry;
     return entry;
 }
 }
 
 
@@ -91,8 +91,8 @@ void UA_NodeStore_delete(UA_NodeStore *ns) {
     UA_RCU_LOCK();
     UA_RCU_LOCK();
 }
 }
 
 
-UA_Node * UA_NodeStore_newNode(UA_NodeClass class) {
-    struct nodeEntry *entry = instantiateEntry(class);
+UA_Node * UA_NodeStore_newNode(UA_NodeClass nc) {
+    struct nodeEntry *entry = instantiateEntry(nc);
     if(!entry)
     if(!entry)
         return NULL;
         return NULL;
     return (UA_Node*)&entry->node;
     return (UA_Node*)&entry->node;
@@ -209,15 +209,15 @@ UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid) {
     struct nodeEntry *entry = (struct nodeEntry*)iter.node;
     struct nodeEntry *entry = (struct nodeEntry*)iter.node;
     if(!entry)
     if(!entry)
         return NULL;
         return NULL;
-    struct nodeEntry *new = instantiateEntry(entry->node.nodeClass);
-    if(!new)
+    struct nodeEntry *n = instantiateEntry(entry->node.nodeClass);
+    if(!n)
         return NULL;
         return NULL;
-    if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
-        deleteEntry(&new->rcu_head);
+    if(UA_Node_copyAnyNodeClass(&entry->node, &n->node) != UA_STATUSCODE_GOOD) {
+        deleteEntry(&n->rcu_head);
         return NULL;
         return NULL;
     }
     }
-    new->orig = entry;
-    return &new->node;
+    n->orig = entry;
+    return &n->node;
 }
 }
 
 
 void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor) {
 void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor) {

+ 2 - 2
src/server/ua_securechannel_manager.c

@@ -62,7 +62,7 @@ UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime
             (UA_DateTime)(entry->channel.securityToken.revisedLifetime * UA_MSEC_TO_DATETIME);
             (UA_DateTime)(entry->channel.securityToken.revisedLifetime * UA_MSEC_TO_DATETIME);
         if(timeout < nowMonotonic || !entry->channel.connection) {
         if(timeout < nowMonotonic || !entry->channel.connection) {
             UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
             UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
-                                "SecureChannel has timed out");
+                                "SecureChannel has timed out", NULL);
             removeSecureChannel(cm, entry);
             removeSecureChannel(cm, entry);
         } else if(entry->channel.nextSecurityToken.tokenId > 0) {
         } else if(entry->channel.nextSecurityToken.tokenId > 0) {
             UA_SecureChannel_revolveTokens(&entry->channel);
             UA_SecureChannel_revolveTokens(&entry->channel);
@@ -77,7 +77,7 @@ static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) {
         if(LIST_EMPTY(&(entry->channel.sessions))){
         if(LIST_EMPTY(&(entry->channel.sessions))){
             UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
             UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
                                  "Channel was purged since maxSecureChannels was "
                                  "Channel was purged since maxSecureChannels was "
-                                 "reached and channel had no session attached");
+                                 "reached and channel had no session attached", NULL);
             removeSecureChannel(cm, entry);
             removeSecureChannel(cm, entry);
             UA_assert(entry != LIST_FIRST(&cm->channels));
             UA_assert(entry != LIST_FIRST(&cm->channels));
             return true;
             return true;

+ 10 - 12
src/server/ua_server_binary.c

@@ -394,7 +394,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
         if(requestTypeId.identifier.numeric == 787) {
         if(requestTypeId.identifier.numeric == 787) {
             UA_LOG_INFO_CHANNEL(server->config.logger, channel,
             UA_LOG_INFO_CHANNEL(server->config.logger, channel,
                                 "Client requested a subscription, " \
                                 "Client requested a subscription, " \
-                                "but those are not enabled in the build");
+                                "but those are not enabled in the build", NULL);
         } else {
         } else {
             UA_LOG_INFO_CHANNEL(server->config.logger, channel,
             UA_LOG_INFO_CHANNEL(server->config.logger, channel,
                                 "Unknown request with type identifier %i",
                                 "Unknown request with type identifier %i",
@@ -419,7 +419,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
                              server->config.customDataTypes);
                              server->config.customDataTypes);
     if(retval != UA_STATUSCODE_GOOD) {
     if(retval != UA_STATUSCODE_GOOD) {
         UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
         UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
-                             "Could not decode the request");
+                             "Could not decode the request", NULL);
         sendError(channel, msg, requestPos, responseType, requestId, retval);
         sendError(channel, msg, requestPos, responseType, requestId, retval);
         return;
         return;
     }
     }
@@ -447,7 +447,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
         if(!session) {
         if(!session) {
             UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
             UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
                                  "Trying to activate a session that is " \
                                  "Trying to activate a session that is " \
-                                 "not known in the server");
+                                 "not known in the server", NULL);
             sendError(channel, msg, requestPos, responseType,
             sendError(channel, msg, requestPos, responseType,
                       requestId, UA_STATUSCODE_BADSESSIONIDINVALID);
                       requestId, UA_STATUSCODE_BADSESSIONIDINVALID);
             UA_deleteMembers(request, requestType);
             UA_deleteMembers(request, requestType);
@@ -493,7 +493,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
     /* The session is bound to another channel */
     /* The session is bound to another channel */
     if(session->channel != channel) {
     if(session->channel != channel) {
         UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
         UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
-                             "Client tries to use an obsolete securechannel");
+                             "Client tries to use an obsolete securechannel", NULL);
         sendError(channel, msg, requestPos, responseType,
         sendError(channel, msg, requestPos, responseType,
                   requestId, UA_STATUSCODE_BADSECURECHANNELIDINVALID);
                   requestId, UA_STATUSCODE_BADSECURECHANNELIDINVALID);
         UA_deleteMembers(request, requestType);
         UA_deleteMembers(request, requestType);
@@ -565,26 +565,24 @@ UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *chann
     }
     }
     case UA_MESSAGETYPE_HEL:
     case UA_MESSAGETYPE_HEL:
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
-                             "Cannot process a HEL on an open channel");
+                             "Cannot process a HEL on an open channel", NULL);
         break;
         break;
     case UA_MESSAGETYPE_OPN:
     case UA_MESSAGETYPE_OPN:
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
-                             "Process an OPN on an open channel");
+                             "Process an OPN on an open channel", NULL);
         processOPN(server, channel->connection, channel->securityToken.channelId, message);
         processOPN(server, channel->connection, channel->securityToken.channelId, message);
         break;
         break;
     case UA_MESSAGETYPE_MSG:
     case UA_MESSAGETYPE_MSG:
-        UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
-                             "Process a MSG", channel->connection->sockfd);
+        UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Process a MSG", NULL);
         processMSG(server, channel, requestId, message);
         processMSG(server, channel, requestId, message);
         break;
         break;
     case UA_MESSAGETYPE_CLO:
     case UA_MESSAGETYPE_CLO:
-        UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
-                             "Process a CLO", channel->connection->sockfd);
+        UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Process a CLO", NULL);
         Service_CloseSecureChannel(server, channel);
         Service_CloseSecureChannel(server, channel);
         break;
         break;
     default:
     default:
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
         UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
-                             "Unknown message type");
+                             "Unknown message type", NULL);
     }
     }
 }
 }
 
 
@@ -694,7 +692,7 @@ void
 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
                                UA_ByteString *message) {
                                UA_ByteString *message) {
     /* Allocate the memory for the callback data */
     /* Allocate the memory for the callback data */
-    ConnectionMessage *cm = UA_malloc(sizeof(ConnectionMessage));
+    ConnectionMessage *cm = (ConnectionMessage*)UA_malloc(sizeof(ConnectionMessage));
 
 
     /* If malloc failed, execute immediately */
     /* If malloc failed, execute immediately */
     if(!cm) {
     if(!cm) {

+ 2 - 10
src/server/ua_server_internal.h

@@ -236,9 +236,6 @@ compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
                           const UA_UInt32 *constraintArrayDimensions,
                           const UA_UInt32 *constraintArrayDimensions,
                           size_t testArrayDimensionsSize,
                           size_t testArrayDimensionsSize,
                           const UA_UInt32 *testArrayDimensions);
                           const UA_UInt32 *testArrayDimensions);
-UA_Boolean
-compatibleDataType(UA_Server *server, const UA_NodeId *dataType,
-                   const UA_NodeId *constraintDataType);
 
 
 UA_StatusCode
 UA_StatusCode
 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize);
 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize);
@@ -247,9 +244,6 @@ UA_Boolean
 compatibleDataType(UA_Server *server, const UA_NodeId *dataType,
 compatibleDataType(UA_Server *server, const UA_NodeId *dataType,
                    const UA_NodeId *constraintDataType);
                    const UA_NodeId *constraintDataType);
 
 
-UA_StatusCode
-compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize);
-
 UA_StatusCode
 UA_StatusCode
 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node,
 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node,
                         UA_Int32 valueRank, UA_Int32 constraintValueRank);
                         UA_Int32 valueRank, UA_Int32 constraintValueRank);
@@ -257,9 +251,6 @@ writeValueRankAttribute(UA_Server *server, UA_VariableNode *node,
 UA_StatusCode
 UA_StatusCode
 compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank);
 compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank);
 
 
-UA_StatusCode
-compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank);
-
 /*******************/
 /*******************/
 /* Single-Services */
 /* Single-Services */
 /*******************/
 /*******************/
@@ -276,7 +267,8 @@ void Service_Read_single(UA_Server *server, UA_Session *session,
                          UA_TimestampsToReturn timestamps,
                          UA_TimestampsToReturn timestamps,
                          const UA_ReadValueId *id, UA_DataValue *v);
                          const UA_ReadValueId *id, UA_DataValue *v);
 
 
-/* Periodic task to clean up the discovery registry */
+/* Checks if a registration timed out and removes that registration.
+ * Should be called periodically in main loop */
 void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic);
 void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic);
 
 
 # ifdef UA_ENABLE_DISCOVERY_MULTICAST
 # ifdef UA_ENABLE_DISCOVERY_MULTICAST

+ 3 - 3
src/server/ua_server_worker.c

@@ -119,7 +119,7 @@ UA_Server_workerCallback(UA_Server *server, UA_ServerCallback callback,
     callback(server, data);
     callback(server, data);
 #else
 #else
     /* Execute immediately if memory could not be allocated */
     /* Execute immediately if memory could not be allocated */
-    WorkerCallback *dc = UA_malloc(sizeof(WorkerCallback));
+    WorkerCallback *dc = (WorkerCallback*)UA_malloc(sizeof(WorkerCallback));
     if(!dc) {
     if(!dc) {
         callback(server, data);
         callback(server, data);
         return;
         return;
@@ -195,7 +195,7 @@ UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback,
                           void *data) {
                           void *data) {
     size_t dcsize = sizeof(WorkerCallback) +
     size_t dcsize = sizeof(WorkerCallback) +
         (sizeof(UA_UInt32) * server->config.nThreads);
         (sizeof(UA_UInt32) * server->config.nThreads);
-    WorkerCallback *dc = UA_malloc(dcsize);
+    WorkerCallback *dc = (WorkerCallback*)UA_malloc(dcsize);
     if(!dc)
     if(!dc)
         return UA_STATUSCODE_BADOUTOFMEMORY;
         return UA_STATUSCODE_BADOUTOFMEMORY;
 
 
@@ -286,7 +286,7 @@ UA_Server_run_startup(UA_Server *server) {
                 "Spinning up %u worker thread(s)", server->config.nThreads);
                 "Spinning up %u worker thread(s)", server->config.nThreads);
     pthread_cond_init(&server->dispatchQueue_condition, 0);
     pthread_cond_init(&server->dispatchQueue_condition, 0);
     pthread_mutex_init(&server->dispatchQueue_mutex, 0);
     pthread_mutex_init(&server->dispatchQueue_mutex, 0);
-    server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
+    server->workers = (UA_Worker*)UA_malloc(server->config.nThreads * sizeof(UA_Worker));
     if(!server->workers)
     if(!server->workers)
         return UA_STATUSCODE_BADOUTOFMEMORY;
         return UA_STATUSCODE_BADOUTOFMEMORY;
     for(size_t i = 0; i < server->config.nThreads; ++i) {
     for(size_t i = 0; i < server->config.nThreads; ++i) {

+ 0 - 4
src/server/ua_services.h

@@ -69,10 +69,6 @@ void Service_RegisterServer(UA_Server *server, UA_Session *session,
                             const UA_RegisterServerRequest *request,
                             const UA_RegisterServerRequest *request,
                             UA_RegisterServerResponse *response);
                             UA_RegisterServerResponse *response);
 
 
-/* Checks if a registration timed out and removes that registration.
- * Should be called periodically in main loop */
-void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic);
-
 /* This Service allows a Server to register its DiscoveryUrls and capabilities
 /* This Service allows a Server to register its DiscoveryUrls and capabilities
  * with a Discovery Server. It extends the registration information from
  * with a Discovery Server. It extends the registration information from
  * RegisterServer with information necessary for FindServersOnNetwork. */
  * RegisterServer with information necessary for FindServersOnNetwork. */

+ 6 - 2
src/server/ua_services_attribute.c

@@ -891,7 +891,9 @@ void Service_Read_single(UA_Server *server, UA_Session *session,
 
 
 void Service_Read(UA_Server *server, UA_Session *session,
 void Service_Read(UA_Server *server, UA_Session *session,
                   const UA_ReadRequest *request, UA_ReadResponse *response) {
                   const UA_ReadRequest *request, UA_ReadResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing ReadRequest", NULL);
+
     if(request->nodesToReadSize <= 0) {
     if(request->nodesToReadSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -1199,7 +1201,9 @@ copyAttributeIntoNode(UA_Server *server, UA_Session *session,
 void
 void
 Service_Write(UA_Server *server, UA_Session *session,
 Service_Write(UA_Server *server, UA_Session *session,
               const UA_WriteRequest *request, UA_WriteResponse *response) {
               const UA_WriteRequest *request, UA_WriteResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing WriteRequest", NULL);
+
     if(request->nodesToWriteSize <= 0) {
     if(request->nodesToWriteSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;

+ 2 - 1
src/server/ua_services_call.c

@@ -165,7 +165,8 @@ callMethod(UA_Server *server, UA_Session *session,
 void Service_Call(UA_Server *server, UA_Session *session,
 void Service_Call(UA_Server *server, UA_Session *session,
                   const UA_CallRequest *request,
                   const UA_CallRequest *request,
                   UA_CallResponse *response) {
                   UA_CallResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing CallRequest", NULL);
 
 
     if(request->methodsToCallSize <= 0) {
     if(request->methodsToCallSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;

+ 8 - 4
src/server/ua_services_discovery.c

@@ -105,7 +105,7 @@ void Service_FindServers(UA_Server *server, UA_Session *session,
                          const UA_FindServersRequest *request,
                          const UA_FindServersRequest *request,
                          UA_FindServersResponse *response) {
                          UA_FindServersResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing FindServersRequest");
+                         "Processing FindServersRequest", NULL);
 
 
     size_t foundServersSize = 0;
     size_t foundServersSize = 0;
     UA_ApplicationDescription *foundServers = NULL;
     UA_ApplicationDescription *foundServers = NULL;
@@ -242,7 +242,7 @@ void Service_GetEndpoints(UA_Server *server, UA_Session *session,
                              UA_PRINTF_STRING_FORMAT, UA_PRINTF_STRING_DATA(*endpointUrl));
                              UA_PRINTF_STRING_FORMAT, UA_PRINTF_STRING_DATA(*endpointUrl));
     } else {
     } else {
         UA_LOG_DEBUG_SESSION(server->config.logger, session,
         UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                             "Processing GetEndpointsRequest with an empty endpointUrl");
+                             "Processing GetEndpointsRequest with an empty endpointUrl", NULL);
     }
     }
 
 
     /* test if the supported binary profile shall be returned */
     /* test if the supported binary profile shall be returned */
@@ -316,10 +316,12 @@ void Service_GetEndpoints(UA_Server *server, UA_Session *session,
 
 
 #ifdef UA_ENABLE_DISCOVERY
 #ifdef UA_ENABLE_DISCOVERY
 
 
+#ifdef UA_ENABLE_MULTITHREADING
 static void
 static void
 freeEntry(UA_Server *server, void *entry) {
 freeEntry(UA_Server *server, void *entry) {
     UA_free(entry);
     UA_free(entry);
 }
 }
+#endif
 
 
 static void
 static void
 process_RegisterServer(UA_Server *server, UA_Session *session,
 process_RegisterServer(UA_Server *server, UA_Session *session,
@@ -477,7 +479,8 @@ process_RegisterServer(UA_Server *server, UA_Session *session,
 void Service_RegisterServer(UA_Server *server, UA_Session *session,
 void Service_RegisterServer(UA_Server *server, UA_Session *session,
                             const UA_RegisterServerRequest *request,
                             const UA_RegisterServerRequest *request,
                             UA_RegisterServerResponse *response) {
                             UA_RegisterServerResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterServerRequest");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing RegisterServerRequest", NULL);
     process_RegisterServer(server, session, &request->requestHeader, &request->server, 0,
     process_RegisterServer(server, session, &request->requestHeader, &request->server, 0,
                            NULL, &response->responseHeader, 0, NULL, 0, NULL);
                            NULL, &response->responseHeader, 0, NULL, 0, NULL);
 }
 }
@@ -485,7 +488,8 @@ void Service_RegisterServer(UA_Server *server, UA_Session *session,
 void Service_RegisterServer2(UA_Server *server, UA_Session *session,
 void Service_RegisterServer2(UA_Server *server, UA_Session *session,
                             const UA_RegisterServer2Request *request,
                             const UA_RegisterServer2Request *request,
                              UA_RegisterServer2Response *response) {
                              UA_RegisterServer2Response *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterServer2Request");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing RegisterServer2Request", NULL);
     process_RegisterServer(server, session, &request->requestHeader, &request->server,
     process_RegisterServer(server, session, &request->requestHeader, &request->server,
                            request->discoveryConfigurationSize, request->discoveryConfiguration,
                            request->discoveryConfigurationSize, request->discoveryConfiguration,
                            &response->responseHeader, &response->configurationResultsSize,
                            &response->responseHeader, &response->configurationResultsSize,

+ 24 - 20
src/server/ua_services_nodemanagement.c

@@ -56,7 +56,7 @@ checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeCl
     const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
     const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
     if(!parent) {
     if(!parent) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Parent node not found");
+                            "AddNodes: Parent node not found", NULL);
         return UA_STATUSCODE_BADPARENTNODEIDINVALID;
         return UA_STATUSCODE_BADPARENTNODEIDINVALID;
     }
     }
 
 
@@ -65,21 +65,21 @@ checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeCl
         (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
         (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
     if(!referenceType) {
     if(!referenceType) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Reference type to the parent not found");
+                            "AddNodes: Reference type to the parent not found", NULL);
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
     }
     }
 
 
     /* Check if the referencetype is a reference type node */
     /* Check if the referencetype is a reference type node */
     if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
     if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Reference type to the parent invalid");
+                            "AddNodes: Reference type to the parent invalid", NULL);
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
     }
     }
 
 
     /* Check that the reference type is not abstract */
     /* Check that the reference type is not abstract */
     if(referenceType->isAbstract == true) {
     if(referenceType->isAbstract == true) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Abstract reference type to the parent not allowed");
+                            "AddNodes: Abstract reference type to the parent not allowed", NULL);
         return UA_STATUSCODE_BADREFERENCENOTALLOWED;
         return UA_STATUSCODE_BADREFERENCENOTALLOWED;
     }
     }
 
 
@@ -93,14 +93,14 @@ checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeCl
         if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
         if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
             UA_LOG_INFO_SESSION(server->config.logger, session,
             UA_LOG_INFO_SESSION(server->config.logger, session,
                                 "AddNodes: New type node need to have a "
                                 "AddNodes: New type node need to have a "
-                                "HasSubType reference");
+                                "HasSubType reference", NULL);
             return UA_STATUSCODE_BADREFERENCENOTALLOWED;
             return UA_STATUSCODE_BADREFERENCENOTALLOWED;
         }
         }
         /* supertype needs to be of the same node type  */
         /* supertype needs to be of the same node type  */
         if(parent->nodeClass != nodeClass) {
         if(parent->nodeClass != nodeClass) {
             UA_LOG_INFO_SESSION(server->config.logger, session,
             UA_LOG_INFO_SESSION(server->config.logger, session,
                                 "AddNodes: New type node needs to be of the same "
                                 "AddNodes: New type node needs to be of the same "
-                                "node type as the parent");
+                                "node type as the parent", NULL);
             return UA_STATUSCODE_BADPARENTNODEIDINVALID;
             return UA_STATUSCODE_BADPARENTNODEIDINVALID;
         }
         }
         return UA_STATUSCODE_GOOD;
         return UA_STATUSCODE_GOOD;
@@ -112,7 +112,7 @@ checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeCl
     if(!isNodeInTree(server->nodestore, referenceTypeId,
     if(!isNodeInTree(server->nodestore, referenceTypeId,
                      &hierarchicalReference, &subtypeId, 1)) {
                      &hierarchicalReference, &subtypeId, 1)) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Reference type is not hierarchical");
+                            "AddNodes: Reference type is not hierarchical", NULL);
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
         return UA_STATUSCODE_BADREFERENCETYPEIDINVALID;
     }
     }
 
 
@@ -194,7 +194,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session,
     if(node->valueRank == 0 &&
     if(node->valueRank == 0 &&
        (!value.hasValue || !value.value.type || UA_Variant_isScalar(&value.value))) {
        (!value.hasValue || !value.value.type || UA_Variant_isScalar(&value.value))) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Use a default ValueRank of -2");
+                            "AddNodes: Use a default ValueRank of -2", NULL);
         UA_RCU_UNLOCK();
         UA_RCU_UNLOCK();
         retval = UA_Server_writeValueRank(server, node->nodeId, -2);
         retval = UA_Server_writeValueRank(server, node->nodeId, -2);
         UA_RCU_LOCK();
         UA_RCU_LOCK();
@@ -223,7 +223,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session,
     /* Fix the variable: If no datatype is given, use the datatype of the vt */
     /* Fix the variable: If no datatype is given, use the datatype of the vt */
     if(UA_NodeId_isNull(&node->dataType)) {
     if(UA_NodeId_isNull(&node->dataType)) {
         UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: "
         UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: "
-                            "Use a default DataType (from the TypeDefinition)");
+                            "Use a default DataType (from the TypeDefinition)", NULL);
         UA_RCU_UNLOCK();
         UA_RCU_UNLOCK();
         retval = UA_Server_writeDataType(server, node->nodeId, vt->dataType);
         retval = UA_Server_writeDataType(server, node->nodeId, vt->dataType);
         UA_RCU_LOCK();
         UA_RCU_LOCK();
@@ -555,7 +555,7 @@ instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
             UA_RCU_UNLOCK();
             UA_RCU_UNLOCK();
             UA_Server_editNode(server, session, nodeId,
             UA_Server_editNode(server, session, nodeId,
                                (UA_EditNodeCallback)setObjectInstanceHandle,
                                (UA_EditNodeCallback)setObjectInstanceHandle,
-                               olm->constructor);
+                               (void*)(uintptr_t)olm->constructor);
             UA_RCU_LOCK();
             UA_RCU_LOCK();
         }
         }
     }
     }
@@ -752,7 +752,7 @@ Service_AddNode_begin(UA_Server *server, UA_Session *session,
     /* Check the namespaceindex */
     /* Check the namespaceindex */
     if(item->requestedNewNodeId.nodeId.namespaceIndex >= server->namespacesSize) {
     if(item->requestedNewNodeId.nodeId.namespaceIndex >= server->namespacesSize) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Namespace invalid");
+                            "AddNodes: Namespace invalid", NULL);
         result->statusCode = UA_STATUSCODE_BADNODEIDINVALID;
         result->statusCode = UA_STATUSCODE_BADNODEIDINVALID;
         return;
         return;
     }
     }
@@ -774,7 +774,7 @@ Service_AddNode_begin(UA_Server *server, UA_Session *session,
     result->statusCode = UA_NodeId_copy(&node->nodeId, &result->addedNodeId);
     result->statusCode = UA_NodeId_copy(&node->nodeId, &result->addedNodeId);
     if(result->statusCode != UA_STATUSCODE_GOOD) {
     if(result->statusCode != UA_STATUSCODE_GOOD) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: Could not copy the nodeid");
+                            "AddNodes: Could not copy the nodeid", NULL);
         deleteNode(server, &adminSession, &node->nodeId, true);
         deleteNode(server, &adminSession, &node->nodeId, true);
     }
     }
 }
 }
@@ -805,7 +805,7 @@ Service_AddNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *
     if((node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_OBJECT) &&
     if((node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_OBJECT) &&
        UA_NodeId_isNull(typeDefinition)) {
        UA_NodeId_isNull(typeDefinition)) {
         UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Use a default "
         UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Use a default "
-                            "TypeDefinition for the Variable/Object");
+                            "TypeDefinition for the Variable/Object", NULL);
         if(node->nodeClass == UA_NODECLASS_VARIABLE)
         if(node->nodeClass == UA_NODECLASS_VARIABLE)
             typeDefinition = &baseDataVariableType;
             typeDefinition = &baseDataVariableType;
         else
         else
@@ -817,7 +817,7 @@ Service_AddNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *
                                                 parentNodeId, referenceTypeId);
                                                 parentNodeId, referenceTypeId);
     if(retval != UA_STATUSCODE_GOOD) {
     if(retval != UA_STATUSCODE_GOOD) {
         UA_LOG_INFO_SESSION(server->config.logger, session,
         UA_LOG_INFO_SESSION(server->config.logger, session,
-                            "AddNodes: The parent reference is invalid");
+                            "AddNodes: The parent reference is invalid", NULL);
         deleteNode(server, &adminSession, nodeId, true);
         deleteNode(server, &adminSession, nodeId, true);
         return retval;
         return retval;
     }
     }
@@ -851,7 +851,7 @@ Service_AddNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *
             const UA_VariableNode *vn = (const UA_VariableNode*)node;
             const UA_VariableNode *vn = (const UA_VariableNode*)node;
             if(!(vn->accessLevel & (UA_ACCESSLEVELMASK_READ))) {
             if(!(vn->accessLevel & (UA_ACCESSLEVELMASK_READ))) {
                 UA_LOG_INFO_SESSION(server->config.logger, session,
                 UA_LOG_INFO_SESSION(server->config.logger, session,
-                                    "AddNodes: Set the AccessLevel to readable by default");
+                                    "AddNodes: Set the AccessLevel to readable by default", NULL);
                 UA_Byte readable = vn->accessLevel | (UA_ACCESSLEVELMASK_READ);
                 UA_Byte readable = vn->accessLevel | (UA_ACCESSLEVELMASK_READ);
                 UA_Server_writeAccessLevel(server, vn->nodeId, readable);
                 UA_Server_writeAccessLevel(server, vn->nodeId, readable);
             }
             }
@@ -869,7 +869,7 @@ Service_AddNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *
         retval = addReference(server, session, &ref_item);
         retval = addReference(server, session, &ref_item);
         if(retval != UA_STATUSCODE_GOOD) {
         if(retval != UA_STATUSCODE_GOOD) {
             UA_LOG_INFO_SESSION(server->config.logger, session,
             UA_LOG_INFO_SESSION(server->config.logger, session,
-                                "AddNodes: Adding reference to parent failed");
+                                "AddNodes: Adding reference to parent failed", NULL);
             deleteNode(server, &adminSession, nodeId, true);
             deleteNode(server, &adminSession, nodeId, true);
             return retval;
             return retval;
         }
         }
@@ -903,7 +903,8 @@ void Service_AddNodes(UA_Server *server, UA_Session *session,
                       const UA_AddNodesRequest *request,
                       const UA_AddNodesRequest *request,
                       UA_AddNodesResponse *response) {
                       UA_AddNodesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing AddNodesRequest");
+                         "Processing AddNodesRequest", NULL);
+
     if(request->nodesToAddSize <= 0) {
     if(request->nodesToAddSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -1329,7 +1330,8 @@ void Service_AddReferences(UA_Server *server, UA_Session *session,
                            const UA_AddReferencesRequest *request,
                            const UA_AddReferencesRequest *request,
                            UA_AddReferencesResponse *response) {
                            UA_AddReferencesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing AddReferencesRequest");
+                         "Processing AddReferencesRequest", NULL);
+
     if(request->referencesToAddSize <= 0) {
     if(request->referencesToAddSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -1428,7 +1430,8 @@ void Service_DeleteNodes(UA_Server *server, UA_Session *session,
                          const UA_DeleteNodesRequest *request,
                          const UA_DeleteNodesRequest *request,
                          UA_DeleteNodesResponse *response) {
                          UA_DeleteNodesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing DeleteNodesRequest");
+                         "Processing DeleteNodesRequest", NULL);
+
     if(request->nodesToDeleteSize == 0) {
     if(request->nodesToDeleteSize == 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -1531,7 +1534,8 @@ Service_DeleteReferences(UA_Server *server, UA_Session *session,
                          const UA_DeleteReferencesRequest *request,
                          const UA_DeleteReferencesRequest *request,
                          UA_DeleteReferencesResponse *response) {
                          UA_DeleteReferencesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing DeleteReferencesRequest");
+                         "Processing DeleteReferencesRequest", NULL);
+
     if(request->referencesToDeleteSize <= 0) {
     if(request->referencesToDeleteSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;

+ 2 - 1
src/server/ua_services_securechannel.c

@@ -41,6 +41,7 @@ void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
 
 
 /* The server does not send a CloseSecureChannel response */
 /* The server does not send a CloseSecureChannel response */
 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
-    UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel");
+    UA_LOG_INFO_CHANNEL(server->config.logger, channel,
+                        "CloseSecureChannel", NULL);
     UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId);
     UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId);
 }
 }

+ 8 - 4
src/server/ua_services_session.c

@@ -31,7 +31,8 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
     response->responseHeader.serviceResult =
     response->responseHeader.serviceResult =
         UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
         UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
     if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
     if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
-        UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed");
+        UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
+                             "Processing CreateSessionRequest failed", NULL);
         return;
         return;
     }
     }
 
 
@@ -81,7 +82,8 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
 
 
     /* Detach the old SecureChannel */
     /* Detach the old SecureChannel */
     if(session->channel && session->channel != channel) {
     if(session->channel && session->channel != channel) {
-        UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel");
+        UA_LOG_INFO_SESSION(server->config.logger, session,
+                            "ActivateSession: Detach from old channel", NULL);
         UA_SecureChannel_detachSession(session->channel, session);
         UA_SecureChannel_detachSession(session->channel, session);
     }
     }
 
 
@@ -89,13 +91,15 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
     UA_SecureChannel_attachSession(channel, session);
     UA_SecureChannel_attachSession(channel, session);
     session->activated = true;
     session->activated = true;
     UA_Session_updateLifetime(session);
     UA_Session_updateLifetime(session);
-    UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated");
+    UA_LOG_INFO_SESSION(server->config.logger, session,
+                        "ActivateSession: Session activated", NULL);
 }
 }
 
 
 void
 void
 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
                      UA_CloseSessionResponse *response) {
                      UA_CloseSessionResponse *response) {
-    UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
+    UA_LOG_INFO_SESSION(server->config.logger, session,
+                        "CloseSession", NULL);
     /* Callback into userland access control */
     /* Callback into userland access control */
     server->config.accessControl.closeSession(&session->sessionId, session->sessionHandle);
     server->config.accessControl.closeSession(&session->sessionId, session->sessionHandle);
     response->responseHeader.serviceResult =
     response->responseHeader.serviceResult =

+ 18 - 11
src/server/ua_services_subscription.c

@@ -61,7 +61,7 @@ Service_CreateSubscription(UA_Server *server, UA_Session *session,
     UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
     UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
     if(!newSubscription) {
     if(!newSubscription) {
         UA_LOG_DEBUG_SESSION(server->config.logger, session,
         UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                             "Processing CreateSubscriptionRequest failed");
+                             "Processing CreateSubscriptionRequest failed", NULL);
         response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY;
         return;
         return;
     }
     }
@@ -92,7 +92,8 @@ Service_ModifySubscription(UA_Server *server, UA_Session *session,
                            const UA_ModifySubscriptionRequest *request,
                            const UA_ModifySubscriptionRequest *request,
                            UA_ModifySubscriptionResponse *response) {
                            UA_ModifySubscriptionResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing ModifySubscriptionRequest");
+                         "Processing ModifySubscriptionRequest", NULL);
+
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     if(!sub) {
     if(!sub) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
@@ -113,7 +114,8 @@ Service_SetPublishingMode(UA_Server *server, UA_Session *session,
                           const UA_SetPublishingModeRequest *request,
                           const UA_SetPublishingModeRequest *request,
                           UA_SetPublishingModeResponse *response) {
                           UA_SetPublishingModeResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing SetPublishingModeRequest");
+                         "Processing SetPublishingModeRequest", NULL);
+
     if(request->subscriptionIdsSize <= 0) {
     if(request->subscriptionIdsSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -268,7 +270,7 @@ Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
                              const UA_CreateMonitoredItemsRequest *request,
                              const UA_CreateMonitoredItemsRequest *request,
                              UA_CreateMonitoredItemsResponse *response) {
                              UA_CreateMonitoredItemsResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing CreateMonitoredItemsRequest");
+                         "Processing CreateMonitoredItemsRequest", NULL);
 
 
     /* Check if the timestampstoreturn is valid */
     /* Check if the timestampstoreturn is valid */
     if(request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) {
     if(request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) {
@@ -322,7 +324,7 @@ void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
                                   const UA_ModifyMonitoredItemsRequest *request,
                                   const UA_ModifyMonitoredItemsRequest *request,
                                   UA_ModifyMonitoredItemsResponse *response) {
                                   UA_ModifyMonitoredItemsResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing ModifyMonitoredItemsRequest");
+                         "Processing ModifyMonitoredItemsRequest", NULL);
 
 
     /* check if the timestampstoreturn is valid */
     /* check if the timestampstoreturn is valid */
     if(request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) {
     if(request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) {
@@ -361,7 +363,9 @@ void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
                                const UA_SetMonitoringModeRequest *request,
                                const UA_SetMonitoringModeRequest *request,
                                UA_SetMonitoringModeResponse *response) {
                                UA_SetMonitoringModeResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing SetMonitoringMode", NULL);
+
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     if(!sub) {
     if(!sub) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
@@ -413,7 +417,8 @@ subscriptionSendError(UA_SecureChannel *channel, UA_UInt32 requestHandle,
 void
 void
 Service_Publish(UA_Server *server, UA_Session *session,
 Service_Publish(UA_Server *server, UA_Session *session,
                 const UA_PublishRequest *request, UA_UInt32 requestId) {
                 const UA_PublishRequest *request, UA_UInt32 requestId) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest");
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing PublishRequest", NULL);
 
 
     /* Return an error if the session has no subscription */
     /* Return an error if the session has no subscription */
     if(LIST_EMPTY(&session->serverSubscriptions)) {
     if(LIST_EMPTY(&session->serverSubscriptions)) {
@@ -485,7 +490,7 @@ Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
                             const UA_DeleteSubscriptionsRequest *request,
                             const UA_DeleteSubscriptionsRequest *request,
                             UA_DeleteSubscriptionsResponse *response) {
                             UA_DeleteSubscriptionsResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing DeleteSubscriptionsRequest");
+                         "Processing DeleteSubscriptionsRequest", NULL);
 
 
     if(request->subscriptionIdsSize == 0) {
     if(request->subscriptionIdsSize == 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
@@ -528,7 +533,7 @@ void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
                                   const UA_DeleteMonitoredItemsRequest *request,
                                   const UA_DeleteMonitoredItemsRequest *request,
                                   UA_DeleteMonitoredItemsResponse *response) {
                                   UA_DeleteMonitoredItemsResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing DeleteMonitoredItemsRequest");
+                         "Processing DeleteMonitoredItemsRequest", NULL);
 
 
     if(request->monitoredItemIdsSize == 0) {
     if(request->monitoredItemIdsSize == 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
@@ -557,8 +562,10 @@ void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
 
 
 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
                        UA_RepublishResponse *response) {
                        UA_RepublishResponse *response) {
-    UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest");
-    /* get the subscription */
+    UA_LOG_DEBUG_SESSION(server->config.logger, session,
+                         "Processing RepublishRequest", NULL);
+
+    /* Get the subscription */
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
     if (!sub) {
     if (!sub) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;

+ 9 - 5
src/server/ua_services_view.c

@@ -267,7 +267,7 @@ void Service_Browse(UA_Server *server, UA_Session *session,
                     const UA_BrowseRequest *request,
                     const UA_BrowseRequest *request,
                     UA_BrowseResponse *response) {
                     UA_BrowseResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing BrowseRequest");
+                         "Processing BrowseRequest", NULL);
 
 
     if(!UA_NodeId_isNull(&request->view.viewId)) {
     if(!UA_NodeId_isNull(&request->view.viewId)) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADVIEWIDUNKNOWN;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADVIEWIDUNKNOWN;
@@ -334,7 +334,8 @@ Service_BrowseNext(UA_Server *server, UA_Session *session,
                    const UA_BrowseNextRequest *request,
                    const UA_BrowseNextRequest *request,
                    UA_BrowseNextResponse *response) {
                    UA_BrowseNextResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing BrowseNextRequest");
+                         "Processing BrowseNextRequest", NULL);
+
     if(request->continuationPointsSize == 0) {
     if(request->continuationPointsSize == 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -663,7 +664,8 @@ Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
                                       const UA_TranslateBrowsePathsToNodeIdsRequest *request,
                                       const UA_TranslateBrowsePathsToNodeIdsRequest *request,
                                       UA_TranslateBrowsePathsToNodeIdsResponse *response) {
                                       UA_TranslateBrowsePathsToNodeIdsResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing TranslateBrowsePathsToNodeIdsRequest");
+                         "Processing TranslateBrowsePathsToNodeIdsRequest", NULL);
+
     if(request->browsePathsSize <= 0) {
     if(request->browsePathsSize <= 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         return;
         return;
@@ -688,7 +690,8 @@ void Service_RegisterNodes(UA_Server *server, UA_Session *session,
                            const UA_RegisterNodesRequest *request,
                            const UA_RegisterNodesRequest *request,
                            UA_RegisterNodesResponse *response) {
                            UA_RegisterNodesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing RegisterNodesRequest");
+                         "Processing RegisterNodesRequest", NULL);
+
     //TODO: hang the nodeids to the session if really needed
     //TODO: hang the nodeids to the session if really needed
     if(request->nodesToRegisterSize == 0) {
     if(request->nodesToRegisterSize == 0) {
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
@@ -706,7 +709,8 @@ void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
                              const UA_UnregisterNodesRequest *request,
                              const UA_UnregisterNodesRequest *request,
                              UA_UnregisterNodesResponse *response) {
                              UA_UnregisterNodesResponse *response) {
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
     UA_LOG_DEBUG_SESSION(server->config.logger, session,
-                         "Processing UnRegisterNodesRequest");
+                         "Processing UnRegisterNodesRequest", NULL);
+
     //TODO: remove the nodeids from the session if really needed
     //TODO: remove the nodeids from the session if really needed
     if(request->nodesToUnregisterSize == 0)
     if(request->nodesToUnregisterSize == 0)
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
         response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;

+ 2 - 2
src/server/ua_session_manager.c

@@ -60,7 +60,7 @@ UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm,
         if(sentry->session.validTill >= nowMonotonic)
         if(sentry->session.validTill >= nowMonotonic)
             continue;
             continue;
         UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
         UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
-                            "Session has timed out");
+                            "Session has timed out", NULL);
         sm->server->config.accessControl.closeSession(&sentry->session.sessionId,
         sm->server->config.accessControl.closeSession(&sentry->session.sessionId,
                                                       sentry->session.sessionHandle);
                                                       sentry->session.sessionHandle);
         removeSession(sm, sentry);
         removeSession(sm, sentry);
@@ -78,7 +78,7 @@ UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token) {
         /* Session has timed out */
         /* Session has timed out */
         if(UA_DateTime_nowMonotonic() > current->session.validTill) {
         if(UA_DateTime_nowMonotonic() > current->session.validTill) {
             UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
             UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
-                                "Client tries to use a session that has timed out");
+                                "Client tries to use a session that has timed out", NULL);
             return NULL;
             return NULL;
         }
         }
 
 

+ 11 - 7
src/ua_securechannel.h

@@ -84,36 +84,40 @@ UA_SecureChannel_processChunks(UA_SecureChannel *channel, const UA_ByteString *c
 
 
 /**
 /**
  * Log Helper
  * Log Helper
- * ---------- */
+ * ----------
+ * C99 requires at least one element for the variadic argument. If the log
+ * statement has no variable arguments, supply an additional NULL. It will be
+ * ignored by printf. */
+
 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
     UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
                  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
-                 (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                 (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
     UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
-                 (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                 (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...)                   \
 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...)                   \
     UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                 ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
                 ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
-                (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...)               \
 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...)               \
     UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                    ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
                    ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
-                   (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                   (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
     UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
-                 (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                 (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...)                 \
     UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
     UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
                  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
-                 (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
+                 (CHANNEL)->securityToken.channelId, __VA_ARGS__);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 } // extern "C"
 } // extern "C"

+ 10 - 7
src/ua_session.h

@@ -85,49 +85,52 @@ UA_Session_getUniqueSubscriptionID(UA_Session *session);
 
 
 /**
 /**
  * Log Helper
  * Log Helper
- * ---------- */
+ * ----------
+ * C99 requires at least one element for the variadic argument. If the log
+ * statement has no variable arguments, supply an additional NULL. It will be
+ * ignored by printf. */
 
 
 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...)                 \
 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...)                 \
     UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                 ##__VA_ARGS__);
+                 __VA_ARGS__);
 
 
 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...)                 \
 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...)                 \
     UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                 ##__VA_ARGS__);
+                 __VA_ARGS__);
 
 
 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...)                  \
 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...)                  \
     UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                 ##__VA_ARGS__);
+                 __VA_ARGS__);
 
 
 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...)               \
 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...)               \
     UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                    ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                    ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                    ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                    ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                    UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                    UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                   ##__VA_ARGS__);
+                   __VA_ARGS__);
 
 
 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...)                 \
 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...)                 \
     UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                 ##__VA_ARGS__);
+                 __VA_ARGS__);
 
 
 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...)                 \
 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...)                 \
     UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
     UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
                  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
-                 ##__VA_ARGS__);
+                 __VA_ARGS__);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 } // extern "C"
 } // extern "C"

+ 2 - 2
src/ua_types.c

@@ -460,8 +460,8 @@ UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
 static UA_StatusCode
 static UA_StatusCode
 computeStrides(const UA_Variant *v, const UA_NumericRange range,
 computeStrides(const UA_Variant *v, const UA_NumericRange range,
                size_t *total, size_t *block, size_t *stride, size_t *first) {
                size_t *total, size_t *block, size_t *stride, size_t *first) {
-    /* Test for max array size */
-#if(MAX_SIZE > 0xffffffff) /* 64bit only */
+    /* Test for max array size (64bit only) */
+#if (SIZE_MAX > 0xffffffff)
     if(v->arrayLength > UA_UINT32_MAX)
     if(v->arrayLength > UA_UINT32_MAX)
         return UA_STATUSCODE_BADINTERNALERROR;
         return UA_STATUSCODE_BADINTERNALERROR;
 #endif
 #endif

+ 0 - 30
src/ua_types_encoding_binary.c

@@ -215,11 +215,6 @@ UInt16_encodeBinary(UA_UInt16 const *src, const UA_DataType *_) {
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
 
 
-static UA_INLINE UA_StatusCode
-Int16_encodeBinary(UA_Int16 const *src, const UA_DataType *_) {
-    return UInt16_encodeBinary((const UA_UInt16*)src, NULL);
-}
-
 static UA_StatusCode
 static UA_StatusCode
 UInt16_decodeBinary(UA_UInt16 *dst, const UA_DataType *_) {
 UInt16_decodeBinary(UA_UInt16 *dst, const UA_DataType *_) {
     if(pos + sizeof(UA_UInt16) > end)
     if(pos + sizeof(UA_UInt16) > end)
@@ -233,11 +228,6 @@ UInt16_decodeBinary(UA_UInt16 *dst, const UA_DataType *_) {
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
 
 
-static UA_INLINE UA_StatusCode
-Int16_decodeBinary(UA_Int16 *dst) {
-    return UInt16_decodeBinary((UA_UInt16*)dst, NULL);
-}
-
 /* UInt32 */
 /* UInt32 */
 static UA_StatusCode
 static UA_StatusCode
 UInt32_encodeBinary(UA_UInt32 const *src, const UA_DataType *_) {
 UInt32_encodeBinary(UA_UInt32 const *src, const UA_DataType *_) {
@@ -257,11 +247,6 @@ Int32_encodeBinary(UA_Int32 const *src) {
     return UInt32_encodeBinary((const UA_UInt32*)src, NULL);
     return UInt32_encodeBinary((const UA_UInt32*)src, NULL);
 }
 }
 
 
-static UA_INLINE UA_StatusCode
-StatusCode_encodeBinary(UA_StatusCode const *src) {
-    return UInt32_encodeBinary((const UA_UInt32*)src, NULL);
-}
-
 static UA_StatusCode
 static UA_StatusCode
 UInt32_decodeBinary(UA_UInt32 *dst, const UA_DataType *_) {
 UInt32_decodeBinary(UA_UInt32 *dst, const UA_DataType *_) {
     if(pos + sizeof(UA_UInt32) > end)
     if(pos + sizeof(UA_UInt32) > end)
@@ -299,16 +284,6 @@ UInt64_encodeBinary(UA_UInt64 const *src, const UA_DataType *_) {
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
 
 
-static UA_INLINE UA_StatusCode
-Int64_encodeBinary(UA_Int64 const *src) {
-    return UInt64_encodeBinary((const UA_UInt64*)src, NULL);
-}
-
-static UA_INLINE UA_StatusCode
-DateTime_encodeBinary(UA_DateTime const *src) {
-    return UInt64_encodeBinary((const UA_UInt64*)src, NULL);
-}
-
 static UA_StatusCode
 static UA_StatusCode
 UInt64_decodeBinary(UA_UInt64 *dst, const UA_DataType *_) {
 UInt64_decodeBinary(UA_UInt64 *dst, const UA_DataType *_) {
     if(pos + sizeof(UA_UInt64) > end)
     if(pos + sizeof(UA_UInt64) > end)
@@ -322,11 +297,6 @@ UInt64_decodeBinary(UA_UInt64 *dst, const UA_DataType *_) {
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
 
 
-static UA_INLINE UA_StatusCode
-Int64_decodeBinary(UA_Int64 *dst) {
-    return UInt64_decodeBinary((UA_UInt64*)dst, NULL);
-}
-
 static UA_INLINE UA_StatusCode
 static UA_INLINE UA_StatusCode
 DateTime_decodeBinary(UA_DateTime *dst) {
 DateTime_decodeBinary(UA_DateTime *dst) {
     return UInt64_decodeBinary((UA_UInt64*)dst, NULL);
     return UInt64_decodeBinary((UA_UInt64*)dst, NULL);

+ 6 - 7
tests/check_chunking.c

@@ -34,8 +34,8 @@ START_TEST(encodeArrayIntoFiveChunksShallWork) {
     bufIndex = 0;
     bufIndex = 0;
     counter = 0;
     counter = 0;
     dataCount = 0;
     dataCount = 0;
-    UA_Int32 *ar = UA_Array_new(arraySize,&UA_TYPES[UA_TYPES_INT32]);
-    buffers = UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
+    UA_Int32 *ar = (UA_Int32*)UA_Array_new(arraySize,&UA_TYPES[UA_TYPES_INT32]);
+    buffers = (UA_ByteString*)UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
     for(size_t i=0;i<chunkCount;i++){
     for(size_t i=0;i<chunkCount;i++){
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
     }
     }
@@ -78,11 +78,11 @@ START_TEST(encodeStringIntoFiveChunksShallWork) {
     counter = 0;
     counter = 0;
     dataCount = 0;
     dataCount = 0;
     UA_String_init(&string);
     UA_String_init(&string);
-    string.data = malloc(stringLength);
+    string.data = (UA_Byte*)malloc(stringLength);
     string.length = stringLength;
     string.length = stringLength;
     char tmpString[9] = {'o','p','e','n','6','2','5','4','1'};
     char tmpString[9] = {'o','p','e','n','6','2','5','4','1'};
     //char tmpString[9] = {'1','4','5','2','6','n','e','p','o'};
     //char tmpString[9] = {'1','4','5','2','6','n','e','p','o'};
-    buffers = UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
+    buffers = (UA_ByteString*)UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
     for(size_t i=0;i<chunkCount;i++){
     for(size_t i=0;i<chunkCount;i++){
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
     }
     }
@@ -125,11 +125,10 @@ START_TEST(encodeTwoStringsIntoTenChunksShallWork) {
     counter = 0;
     counter = 0;
     dataCount = 0;
     dataCount = 0;
     UA_String_init(&string);
     UA_String_init(&string);
-    string.data = malloc(stringLength);
+    string.data = (UA_Byte*)malloc(stringLength);
     string.length = stringLength;
     string.length = stringLength;
     char tmpString[9] = {'o','p','e','n','6','2','5','4','1'};
     char tmpString[9] = {'o','p','e','n','6','2','5','4','1'};
-    //char tmpString[9] = {'1','4','5','2','6','n','e','p','o'};
-    buffers = UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
+    buffers = (UA_ByteString*)UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]);
     for(size_t i=0;i<chunkCount;i++){
     for(size_t i=0;i<chunkCount;i++){
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
         UA_ByteString_allocBuffer(&buffers[i],chunkSize);
     }
     }

+ 1 - 1
tests/check_client.c

@@ -23,7 +23,7 @@ addVariable(size_t size) {
     /* Define the attribute of the myInteger variable node */
     /* Define the attribute of the myInteger variable node */
     UA_VariableAttributes attr;
     UA_VariableAttributes attr;
     UA_VariableAttributes_init(&attr);
     UA_VariableAttributes_init(&attr);
-    UA_Int32* array = malloc(size * sizeof(UA_Int32));
+    UA_Int32* array = (UA_Int32*)malloc(size * sizeof(UA_Int32));
     memset(array, 0, size * sizeof(UA_Int32));
     memset(array, 0, size * sizeof(UA_Int32));
     UA_Variant_setArray(&attr.value, array, size, &UA_TYPES[UA_TYPES_INT32]);
     UA_Variant_setArray(&attr.value, array, size, &UA_TYPES[UA_TYPES_INT32]);
 
 

+ 27 - 22
tests/check_discovery.c

@@ -201,7 +201,7 @@ FindAndCheck(const UA_String expectedUris[], size_t expectedUrisSize,
 
 
     if(filterUri) {
     if(filterUri) {
         serverUrisSize = 1;
         serverUrisSize = 1;
-        serverUris = UA_malloc(sizeof(UA_String));
+        serverUris = UA_String_new();
         serverUris[0] = UA_String_fromChars(filterUri);
         serverUris[0] = UA_String_fromChars(filterUri);
     }
     }
 
 
@@ -210,7 +210,7 @@ FindAndCheck(const UA_String expectedUris[], size_t expectedUrisSize,
 
 
     if(filterLocale) {
     if(filterLocale) {
         localeIdsSize = 1;
         localeIdsSize = 1;
-        localeIds = UA_malloc(sizeof(UA_String));
+        localeIds = UA_String_new();
         localeIds[0] = UA_String_fromChars(filterLocale);
         localeIds[0] = UA_String_fromChars(filterLocale);
     }
     }
 
 
@@ -251,6 +251,8 @@ FindAndCheck(const UA_String expectedUris[], size_t expectedUrisSize,
     UA_Client_delete(client);
     UA_Client_delete(client);
 }
 }
 
 
+#ifdef UA_ENABLE_DISCOVERY_MULTICAST
+
 static void
 static void
 FindOnNetworkAndCheck(UA_String expectedServerNames[], size_t expectedServerNamesSize,
 FindOnNetworkAndCheck(UA_String expectedServerNames[], size_t expectedServerNamesSize,
                       const char *filterUri, const char *filterLocale,
                       const char *filterUri, const char *filterLocale,
@@ -266,7 +268,7 @@ FindOnNetworkAndCheck(UA_String expectedServerNames[], size_t expectedServerName
 
 
     if(filterCapabilitiesSize) {
     if(filterCapabilitiesSize) {
         serverCapabilityFilterSize = filterCapabilitiesSize;
         serverCapabilityFilterSize = filterCapabilitiesSize;
-        serverCapabilityFilter = UA_malloc(sizeof(UA_String) * filterCapabilitiesSize);
+        serverCapabilityFilter = (UA_String*)UA_malloc(sizeof(UA_String) * filterCapabilitiesSize);
         for(size_t i = 0; i < filterCapabilitiesSize; i++)
         for(size_t i = 0; i < filterCapabilitiesSize; i++)
             serverCapabilityFilter[i] = UA_String_fromChars(filterCapabilities[i]);
             serverCapabilityFilter[i] = UA_String_fromChars(filterCapabilities[i]);
     }
     }
@@ -314,7 +316,7 @@ GetEndpoints(UA_Client *client, const UA_String* endpointUrl,
     request.endpointUrl = *endpointUrl; // assume the endpointurl outlives the service call
     request.endpointUrl = *endpointUrl; // assume the endpointurl outlives the service call
     if (filterTransportProfileUri) {
     if (filterTransportProfileUri) {
         request.profileUrisSize = 1;
         request.profileUrisSize = 1;
-        request.profileUris = UA_malloc(sizeof(UA_String));
+        request.profileUris = (UA_String*)UA_malloc(sizeof(UA_String));
         request.profileUris[0] = UA_String_fromChars(filterTransportProfileUri);
         request.profileUris[0] = UA_String_fromChars(filterTransportProfileUri);
     }
     }
 
 
@@ -341,7 +343,6 @@ GetEndpoints(UA_Client *client, const UA_String* endpointUrl,
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }
 
 
-
 static void
 static void
 GetEndpointsAndCheck(const char* discoveryUrl, const char* filterTransportProfileUri,
 GetEndpointsAndCheck(const char* discoveryUrl, const char* filterTransportProfileUri,
                      const UA_String expectedEndpointUrls[], size_t expectedEndpointUrlsSize) {
                      const UA_String expectedEndpointUrls[], size_t expectedEndpointUrlsSize) {
@@ -368,13 +369,6 @@ GetEndpointsAndCheck(const char* discoveryUrl, const char* filterTransportProfil
     UA_Client_delete(client);
     UA_Client_delete(client);
 }
 }
 
 
-// Test if discovery server lists himself as registered server, before any other registration.
-START_TEST(Client_find_discovery) {
-    const UA_String expectedUris[] = {UA_STRING("urn:open62541.test.local_discovery_server")};
-    FindAndCheck(expectedUris, 1, NULL, NULL, NULL, NULL);
-}
-END_TEST
-
 // Test if discovery server lists himself as registered server if it is filtered by his uri
 // Test if discovery server lists himself as registered server if it is filtered by his uri
 START_TEST(Client_filter_discovery) {
 START_TEST(Client_filter_discovery) {
     const UA_String expectedUris[] = {UA_STRING("urn:open62541.test.local_discovery_server")};
     const UA_String expectedUris[] = {UA_STRING("urn:open62541.test.local_discovery_server")};
@@ -399,16 +393,6 @@ START_TEST(Client_filter_locale) {
 }
 }
 END_TEST
 END_TEST
 
 
-// Test if registered server is returned from LDS
-START_TEST(Client_find_registered) {
-    const UA_String expectedUris[] = {
-        UA_STRING("urn:open62541.test.local_discovery_server"),
-        UA_STRING("urn:open62541.test.server_register")
-    };
-    FindAndCheck(expectedUris, 2, NULL, NULL, NULL, NULL);
-}
-END_TEST
-
 // Test if registered server is returned from LDS using FindServersOnNetwork
 // Test if registered server is returned from LDS using FindServersOnNetwork
 START_TEST(Client_find_on_network_registered) {
 START_TEST(Client_find_on_network_registered) {
     char urls[2][64];
     char urls[2][64];
@@ -466,6 +450,25 @@ START_TEST(Client_get_endpoints) {
 }
 }
 END_TEST
 END_TEST
 
 
+#endif
+
+// Test if discovery server lists himself as registered server, before any other registration.
+START_TEST(Client_find_discovery) {
+    const UA_String expectedUris[] = {UA_STRING("urn:open62541.test.local_discovery_server")};
+    FindAndCheck(expectedUris, 1, NULL, NULL, NULL, NULL);
+}
+END_TEST
+
+// Test if registered server is returned from LDS
+START_TEST(Client_find_registered) {
+    const UA_String expectedUris[] = {
+        UA_STRING("urn:open62541.test.local_discovery_server"),
+        UA_STRING("urn:open62541.test.server_register")
+    };
+    FindAndCheck(expectedUris, 2, NULL, NULL, NULL, NULL);
+}
+END_TEST
+
 START_TEST(Util_start_lds) {
 START_TEST(Util_start_lds) {
     setup_lds();
     setup_lds();
 }
 }
@@ -483,11 +486,13 @@ START_TEST(Util_wait_timeout) {
 }
 }
 END_TEST
 END_TEST
 
 
+#ifdef UA_ENABLE_DISCOVERY_MULTICAST
 START_TEST(Util_wait_mdns) {
 START_TEST(Util_wait_mdns) {
     UA_sleep(1000);
     UA_sleep(1000);
     sleep(1);
     sleep(1);
 }
 }
 END_TEST
 END_TEST
+#endif
 
 
 START_TEST(Util_wait_startup) {
 START_TEST(Util_wait_startup) {
     UA_sleep(1000);
     UA_sleep(1000);

+ 5 - 9
tests/check_nodestore.c

@@ -36,10 +36,6 @@ static void checkZeroVisitor(const UA_Node* node) {
     if (node == NULL) zeroCnt++;
     if (node == NULL) zeroCnt++;
 }
 }
 
 
-static void printVisitor(const UA_Node* node) {
-    printf("%d\n", node->nodeId.identifier.numeric);
-}
-
 static UA_Node* createNode(UA_Int16 nsid, UA_Int32 id) {
 static UA_Node* createNode(UA_Int16 nsid, UA_Int32 id) {
     UA_Node *p = (UA_Node *)UA_NodeStore_newVariableNode();
     UA_Node *p = (UA_Node *)UA_NodeStore_newVariableNode();
     p->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
     p->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
@@ -213,7 +209,7 @@ static void *profileGetThread(void *arg) {
 #endif
 #endif
 
 
 START_TEST(profileGetDelete) {
 START_TEST(profileGetDelete) {
-#define N 1000000
+#define N 100 /* make bigger to test */
     for(UA_UInt32 i = 0; i < N; i++) {
     for(UA_UInt32 i = 0; i < N; i++) {
         UA_Node *n = createNode(0,i);
         UA_Node *n = createNode(0,i);
         UA_NodeStore_insert(ns, n);
         UA_NodeStore_insert(ns, n);
@@ -271,10 +267,10 @@ static Suite * namespace_suite (void) {
     tcase_add_test (tc_iterate, iterateOverExpandedNamespaceShallNotVisitEmptyNodes);
     tcase_add_test (tc_iterate, iterateOverExpandedNamespaceShallNotVisitEmptyNodes);
     suite_add_tcase (s, tc_iterate);
     suite_add_tcase (s, tc_iterate);
     
     
-    /* TCase* tc_profile = tcase_create ("Profile"); */
-    /* tcase_add_checked_fixture(tc_profile, setup, teardown); */
-    /* tcase_add_test (tc_profile, profileGetDelete); */
-    /* suite_add_tcase (s, tc_profile); */
+    TCase* tc_profile = tcase_create ("Profile");
+    tcase_add_checked_fixture(tc_profile, setup, teardown);
+    tcase_add_test (tc_profile, profileGetDelete);
+    suite_add_tcase (s, tc_profile);
 
 
     return s;
     return s;
 }
 }

+ 1 - 1
tests/check_server_binary_messages.c

@@ -24,7 +24,7 @@ static UA_ByteString readFile(char *filename) {
         fseek(f, 0, SEEK_END);
         fseek(f, 0, SEEK_END);
         length = ftell(f);
         length = ftell(f);
         rewind(f);
         rewind(f);
-        buf.data = malloc(length);
+        buf.data = (UA_Byte*)malloc(length);
         fread(buf.data, sizeof(char), length, f);
         fread(buf.data, sizeof(char), length, f);
         buf.length = length;
         buf.length = length;
         fclose(f);
         fclose(f);

+ 1 - 1
tests/check_server_userspace.c

@@ -46,7 +46,7 @@ START_TEST(Server_addNamespace_writeService)
 
 
     namespaces.data = realloc(namespaces.data, (namespaces.arrayLength + 1) * sizeof(UA_String));
     namespaces.data = realloc(namespaces.data, (namespaces.arrayLength + 1) * sizeof(UA_String));
     ++namespaces.arrayLength;
     ++namespaces.arrayLength;
-    UA_String *ns = namespaces.data;
+    UA_String *ns = (UA_String*)namespaces.data;
     ns[namespaces.arrayLength-1] = UA_STRING_ALLOC("test");
     ns[namespaces.arrayLength-1] = UA_STRING_ALLOC("test");
     size_t nsSize = namespaces.arrayLength;
     size_t nsSize = namespaces.arrayLength;
 
 

+ 3 - 3
tests/check_services_attributes.c

@@ -645,11 +645,11 @@ START_TEST(WriteSingleAttributeNodeclass) {
     UA_WriteValue wValue;
     UA_WriteValue wValue;
     UA_WriteValue_init(&wValue);
     UA_WriteValue_init(&wValue);
     wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
     wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
-    UA_NodeClass class;
-    UA_NodeClass_init(&class);
+    UA_NodeClass nc;
+    UA_NodeClass_init(&nc);
     wValue.attributeId = UA_ATTRIBUTEID_NODECLASS;
     wValue.attributeId = UA_ATTRIBUTEID_NODECLASS;
     wValue.value.hasValue = true;
     wValue.value.hasValue = true;
-    UA_Variant_setScalar(&wValue.value.value, &class, &UA_TYPES[UA_TYPES_NODECLASS]);
+    UA_Variant_setScalar(&wValue.value.value, &nc, &UA_TYPES[UA_TYPES_NODECLASS]);
     UA_StatusCode retval = UA_Server_write(server, &wValue);
     UA_StatusCode retval = UA_Server_write(server, &wValue);
     ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
     ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
     UA_Server_delete(server);
     UA_Server_delete(server);

+ 1 - 1
tests/check_services_view.c

@@ -140,7 +140,7 @@ START_TEST(Service_TranslateBrowsePathsToNodeIds) {
     UA_BrowsePath browsePath;
     UA_BrowsePath browsePath;
     UA_BrowsePath_init(&browsePath);
     UA_BrowsePath_init(&browsePath);
     browsePath.startingNode = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
     browsePath.startingNode = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
-    browsePath.relativePath.elements = UA_Array_new(BROWSE_PATHS_SIZE, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
+    browsePath.relativePath.elements = (UA_RelativePathElement*)UA_Array_new(BROWSE_PATHS_SIZE, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
     browsePath.relativePath.elementsSize = BROWSE_PATHS_SIZE;
     browsePath.relativePath.elementsSize = BROWSE_PATHS_SIZE;
 
 
     for(size_t i = 0; i < BROWSE_PATHS_SIZE; i++) {
     for(size_t i = 0; i < BROWSE_PATHS_SIZE; i++) {

+ 11 - 11
tests/check_types_builtin.c

@@ -851,12 +851,12 @@ START_TEST(UA_String_encodeShallWorkOnExample) {
     // given
     // given
     UA_String src;
     UA_String src;
     src.length = 11;
     src.length = 11;
-    UA_Byte   mem[11] = "ACPLT OPCUA";
-    src.data   = mem;
+    UA_Byte mem[12] = "ACPLT OPCUA";
+    src.data = mem;
 
 
-    UA_Byte data[] = {  0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
-                        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
-                        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };
+    UA_Byte data[] = { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+                       0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+                       0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };
     UA_ByteString dst = { 24, data };
     UA_ByteString dst = { 24, data };
     UA_Byte *pos = dst.data;
     UA_Byte *pos = dst.data;
     const UA_Byte *end = &dst.data[dst.length];
     const UA_Byte *end = &dst.data[dst.length];
@@ -1050,7 +1050,7 @@ START_TEST(UA_Array_copyByteArrayShallWorkOnExample) {
     UA_Byte  *dstArray;
     UA_Byte  *dstArray;
     UA_Int32  size = 5;
     UA_Int32  size = 5;
     UA_Int32  i    = 0;
     UA_Int32  i    = 0;
-    testString.data = UA_malloc(size);
+    testString.data = (UA_Byte*)UA_malloc(size);
     testString.data[0] = 'O';
     testString.data[0] = 'O';
     testString.data[1] = 'P';
     testString.data[1] = 'P';
     testString.data[2] = 'C';
     testString.data[2] = 'C';
@@ -1076,7 +1076,7 @@ END_TEST
 START_TEST(UA_Array_copyUA_StringShallWorkOnExample) {
 START_TEST(UA_Array_copyUA_StringShallWorkOnExample) {
     // given
     // given
     UA_Int32   i, j;
     UA_Int32   i, j;
-    UA_String *srcArray = UA_Array_new(3, &UA_TYPES[UA_TYPES_STRING]);
+    UA_String *srcArray = (UA_String*)UA_Array_new(3, &UA_TYPES[UA_TYPES_STRING]);
     UA_String *dstArray;
     UA_String *dstArray;
 
 
     srcArray[0] = UA_STRING_ALLOC("open");
     srcArray[0] = UA_STRING_ALLOC("open");
@@ -1311,13 +1311,13 @@ END_TEST
 
 
 START_TEST(UA_Variant_copyShallWorkOn1DArrayExample) {
 START_TEST(UA_Variant_copyShallWorkOn1DArrayExample) {
     // given
     // given
-    UA_String *srcArray = UA_Array_new(3, &UA_TYPES[UA_TYPES_STRING]);
+    UA_String *srcArray = (UA_String*)UA_Array_new(3, &UA_TYPES[UA_TYPES_STRING]);
     srcArray[0] = UA_STRING_ALLOC("__open");
     srcArray[0] = UA_STRING_ALLOC("__open");
     srcArray[1] = UA_STRING_ALLOC("_62541");
     srcArray[1] = UA_STRING_ALLOC("_62541");
     srcArray[2] = UA_STRING_ALLOC("opc ua");
     srcArray[2] = UA_STRING_ALLOC("opc ua");
 
 
     UA_UInt32 *dimensions;
     UA_UInt32 *dimensions;
-    dimensions = UA_malloc(sizeof(UA_UInt32));
+    dimensions = (UA_UInt32*)UA_malloc(sizeof(UA_UInt32));
     dimensions[0] = 3;
     dimensions[0] = 3;
 
 
     UA_Variant value, copiedValue;
     UA_Variant value, copiedValue;
@@ -1359,7 +1359,7 @@ END_TEST
 
 
 START_TEST(UA_Variant_copyShallWorkOn2DArrayExample) {
 START_TEST(UA_Variant_copyShallWorkOn2DArrayExample) {
     // given
     // given
-    UA_Int32 *srcArray = UA_Array_new(6, &UA_TYPES[UA_TYPES_INT32]);
+    UA_Int32 *srcArray = (UA_Int32*)UA_Array_new(6, &UA_TYPES[UA_TYPES_INT32]);
     srcArray[0] = 0;
     srcArray[0] = 0;
     srcArray[1] = 1;
     srcArray[1] = 1;
     srcArray[2] = 2;
     srcArray[2] = 2;
@@ -1367,7 +1367,7 @@ START_TEST(UA_Variant_copyShallWorkOn2DArrayExample) {
     srcArray[4] = 4;
     srcArray[4] = 4;
     srcArray[5] = 5;
     srcArray[5] = 5;
 
 
-    UA_UInt32 *dimensions = UA_Array_new(2, &UA_TYPES[UA_TYPES_INT32]);
+    UA_UInt32 *dimensions = (UA_UInt32*)UA_Array_new(2, &UA_TYPES[UA_TYPES_INT32]);
     UA_UInt32 dim1 = 3;
     UA_UInt32 dim1 = 3;
     UA_UInt32 dim2 = 2;
     UA_UInt32 dim2 = 2;
     dimensions[0] = dim1;
     dimensions[0] = dim1;

+ 1 - 1
tests/check_types_custom.c

@@ -212,4 +212,4 @@ int main(void) {
 
 
 #ifdef __clang__
 #ifdef __clang__
 #pragma clang diagnostic pop
 #pragma clang diagnostic pop
-#endif
+#endif

+ 1 - 1
tests/check_types_range.c

@@ -77,7 +77,7 @@ START_TEST(copyIntoStringArrayRange) {
 
 
     UA_String s1 = UA_STRING("bc");
     UA_String s1 = UA_STRING("bc");
     UA_String s2 = UA_STRING("xy");
     UA_String s2 = UA_STRING("xy");
-    UA_String *arr2 = v2.data;
+    UA_String *arr2 = (UA_String*)v2.data;
     ck_assert(UA_String_equal(&arr2[0], &s1));
     ck_assert(UA_String_equal(&arr2[0], &s1));
     ck_assert(UA_String_equal(&arr2[1], &s2));
     ck_assert(UA_String_equal(&arr2[1], &s2));
 
 

+ 1 - 1
tests/testing_networklayers.c

@@ -8,7 +8,7 @@
 
 
 static UA_StatusCode
 static UA_StatusCode
 dummyGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
 dummyGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
-    buf->data = malloc(length);
+    buf->data = (UA_Byte*)malloc(length);
     buf->length = length;
     buf->length = length;
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }

+ 7 - 11
tools/pyUANamespace/ua_namespace.py

@@ -646,17 +646,13 @@ class opcua_namespace():
 
 
     header.append('#ifndef '+outfilename.upper()+'_H_')
     header.append('#ifndef '+outfilename.upper()+'_H_')
     header.append('#define '+outfilename.upper()+'_H_')
     header.append('#define '+outfilename.upper()+'_H_')
-    header.append('#ifdef UA_NO_AMALGAMATION')
-    header.append(  '#include "server/ua_server_internal.h"')
-    header.append(  '#include "server/ua_nodes.h"')
-    header.append('  #include "ua_util.h"')
-    header.append('  #include "ua_types.h"')
-    header.append('  #include "ua_types_encoding_binary.h"')
-    header.append('  #include "ua_types_generated_encoding_binary.h"')
-    header.append('  #include "ua_transport_generated_encoding_binary.h"')
-    header.append('#else')
-    header.append('  #include "open62541.h"')
-    header.append('#endif')
+    header.append('')
+    header.append('#include "server/ua_server_internal.h"')
+    header.append('#include "server/ua_nodes.h"')
+    header.append('#include "ua_util.h"')
+    header.append('#include "ua_types_encoding_binary.h"')
+    header.append('#include "ua_types_generated_encoding_binary.h"')
+    header.append('#include "ua_transport_generated_encoding_binary.h"')
     header.append('')
     header.append('')
     header.append('/* Definition that (in userspace models) may be ')
     header.append('/* Definition that (in userspace models) may be ')
     header.append(' * - not included in the amalgamated header or')
     header.append(' * - not included in the amalgamated header or')

+ 2 - 2
tools/pyUANamespace/ua_node_types.py

@@ -1084,7 +1084,7 @@ class opcua_node_variable_t(opcua_node_t):
           code = code + self.value().printOpen62541CCode(bootstrapping)
           code = code + self.value().printOpen62541CCode(bootstrapping)
           return code
           return code
     if(bootstrapping):
     if(bootstrapping):
-      code.append("UA_Variant *" + self.getCodePrintableID() + "_variant = UA_alloca(sizeof(UA_Variant));")
+      code.append("UA_Variant *" + self.getCodePrintableID() + "_variant = (UA_Variant*)UA_alloca(sizeof(UA_Variant));")
       code.append("UA_Variant_init(" + self.getCodePrintableID() + "_variant);")
       code.append("UA_Variant_init(" + self.getCodePrintableID() + "_variant);")
     return code
     return code
 
 
@@ -1338,7 +1338,7 @@ class opcua_node_variableType_t(opcua_node_t):
           code = code + self.value().printOpen62541CCode(bootstrapping)
           code = code + self.value().printOpen62541CCode(bootstrapping)
           return code
           return code
     if(bootstrapping):
     if(bootstrapping):
-      code.append("UA_Variant *" + self.getCodePrintableID() + "_variant = UA_alloca(sizeof(UA_Variant));")
+      code.append("UA_Variant *" + self.getCodePrintableID() + "_variant = (UA_Variant*)UA_alloca(sizeof(UA_Variant));")
       code.append("UA_Variant_init(" + self.getCodePrintableID() + "_variant);")
       code.append("UA_Variant_init(" + self.getCodePrintableID() + "_variant);")
     return code
     return code