diff --git a/examples/server_ctt.c b/examples/server_ctt.c index 15adc808bcc..8f65134635e 100644 --- a/examples/server_ctt.c +++ b/examples/server_ctt.c @@ -918,7 +918,7 @@ enableNoneSecurityPolicy(UA_ServerConfig *config) { UA_StatusCode retval = UA_ServerConfig_addEndpoint(config, UA_SECURITY_POLICY_NONE_URI, UA_MESSAGESECURITYMODE_NONE); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Failed to add SecurityPolicy#None to the endpoint list."); } config->securityPolicyNoneDiscoveryOnly = false; @@ -928,7 +928,7 @@ static void enableBasic128SecurityPolicy(UA_ServerConfig *config) { UA_StatusCode retval = UA_ServerConfig_addSecurityPolicyBasic128Rsa15(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic128Rsa15 with error code %s", UA_StatusCode_name(retval)); return; @@ -943,7 +943,7 @@ static void enableBasic256SecurityPolicy(UA_ServerConfig *config) { UA_StatusCode retval = UA_ServerConfig_addSecurityPolicyBasic256(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256 with error code %s", UA_StatusCode_name(retval)); return; diff --git a/examples/server_loglevel.c b/examples/server_loglevel.c index 3eae466cdbe..5b433d25a65 100644 --- a/examples/server_loglevel.c +++ b/examples/server_loglevel.c @@ -46,10 +46,12 @@ int main(int argc, char **argv) { } #endif + UA_Logger logger = UA_Log_Stdout_withLevel( log_level ); + UA_Server *server = UA_Server_new(); UA_ServerConfig *config = UA_Server_getConfig(server); UA_ServerConfig_setDefault(config); - config->logger = UA_Log_Stdout_withLevel( log_level ); + config->logging = &logger; /* Some data */ UA_StatusCode retval; diff --git a/include/open62541/server.h b/include/open62541/server.h index 6b0e0202612..26bf452955f 100644 --- a/include/open62541/server.h +++ b/include/open62541/server.h @@ -82,9 +82,7 @@ typedef struct { * The :ref:`tutorials` provide a good starting point for this. */ struct UA_ServerConfig { - UA_Logger logger; /* logger is deprecated but still supported at this time. - Use logging pointer instead. */ - UA_Logger *logging; /* If NULL and "logger" is set, make this point to "logger" */ + const UA_Logger *logging; /* Plugin for log output */ void *context; /* Used to attach custom data to a server config. This can * then be retrieved e.g. in a callback that forwards a * pointer to the server. */ diff --git a/plugins/ua_accesscontrol_default.c b/plugins/ua_accesscontrol_default.c index 8d2ed7d2208..0d808819df8 100644 --- a/plugins/ua_accesscontrol_default.c +++ b/plugins/ua_accesscontrol_default.c @@ -296,7 +296,7 @@ UA_AccessControl_default(UA_ServerConfig *config, const UA_ByteString *userTokenPolicyUri, size_t usernamePasswordLoginSize, const UA_UsernamePasswordLogin *usernamePasswordLogin) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "AccessControl: Unconfigured AccessControl. Users have all permissions."); UA_AccessControl *ac = &config->accessControl; @@ -336,7 +336,7 @@ UA_AccessControl_default(UA_ServerConfig *config, /* Allow anonymous? */ context->allowAnonymous = allowAnonymous; if(allowAnonymous) { - UA_LOG_INFO(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(config->logging, UA_LOGCATEGORY_SERVER, "AccessControl: Anonymous login is enabled"); } @@ -360,7 +360,7 @@ UA_AccessControl_default(UA_ServerConfig *config, if(config->securityPoliciesSize > 0) numOfPolcies = config->securityPoliciesSize; else { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "No security policies defined for the secure channel."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -382,7 +382,7 @@ UA_AccessControl_default(UA_ServerConfig *config, ac->userTokenPoliciesSize = policies * numOfPolcies; if(policies == 0) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "No allowed policies set."); return UA_STATUSCODE_GOOD; } @@ -408,7 +408,7 @@ UA_AccessControl_default(UA_ServerConfig *config, ac->userTokenPolicies[policies].policyId = UA_STRING_ALLOC(CERTIFICATE_POLICY); #if UA_LOGLEVEL <= 400 if(UA_ByteString_equal(utpUri, &UA_SECURITY_POLICY_NONE_URI)) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "x509 Certificate Authentication configured, " "but no encrypting SecurityPolicy. " "This can leak credentials on the network."); @@ -424,7 +424,7 @@ UA_AccessControl_default(UA_ServerConfig *config, ac->userTokenPolicies[policies].policyId = UA_STRING_ALLOC(USERNAME_POLICY); #if UA_LOGLEVEL <= 400 if(UA_ByteString_equal(utpUri, &UA_SECURITY_POLICY_NONE_URI)) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "Username/Password Authentication configured, " "but no encrypting SecurityPolicy. " "This can leak credentials on the network."); diff --git a/plugins/ua_config_default.c b/plugins/ua_config_default.c index d541a6f5d04..7c17fb3c037 100644 --- a/plugins/ua_config_default.c +++ b/plugins/ua_config_default.c @@ -69,7 +69,7 @@ static void shutdownServer(UA_Server *server, void *context) { struct InterruptContext *ic = (struct InterruptContext*)context; UA_ServerConfig *config = UA_Server_getConfig(ic->server); - UA_LOG_INFO(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(config->logging, UA_LOGCATEGORY_USERLAND, "Stopping the server"); ic->running = false; } @@ -81,13 +81,13 @@ interruptServer(UA_InterruptManager *im, uintptr_t interruptHandle, UA_ServerConfig *config = UA_Server_getConfig(ic->server); if(config->shutdownDelay <= 0.0) { - UA_LOG_INFO(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(config->logging, UA_LOGCATEGORY_USERLAND, "Received SIGINT interrupt. Stopping the server."); ic->running = false; return; } - UA_LOG_INFO(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(config->logging, UA_LOGCATEGORY_USERLAND, "Received SIGINT interrupt. Stopping the server in %.2fs.", config->shutdownDelay / 1000.0); @@ -122,7 +122,7 @@ UA_Server_runUntilInterrupt(UA_Server *server) { es = es->next; } if(!es) { - UA_LOG_ERROR(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_USERLAND, "No Interrupt EventSource configured"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -136,7 +136,7 @@ UA_Server_runUntilInterrupt(UA_Server *server) { im->registerInterrupt(im, SIGINT, &UA_KEYVALUEMAP_NULL, interruptServer, &ic); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_USERLAND, "Could not register the interrupt with status code %s", UA_StatusCode_name(retval)); return retval; @@ -267,14 +267,12 @@ setDefaultConfig(UA_ServerConfig *conf, UA_UInt16 portNumber) { UA_Nodestore_HashMap(&conf->nodestore); /* Logging */ - if(!conf->logger.log) - conf->logger = UA_Log_Stdout_withLevel(UA_LOGLEVEL_INFO); if(conf->logging == NULL) - conf->logging = &conf->logger; + conf->logging = UA_Log_Stdout; /* EventLoop */ if(conf->eventLoop == NULL) { - conf->eventLoop = UA_EventLoop_new_POSIX(&conf->logger); + conf->eventLoop = UA_EventLoop_new_POSIX(conf->logging); if(conf->eventLoop == NULL) return UA_STATUSCODE_BADOUTOFMEMORY; @@ -305,7 +303,7 @@ setDefaultConfig(UA_ServerConfig *conf, UA_UInt16 portNumber) { if(im) { conf->eventLoop->registerEventSource(conf->eventLoop, &im->eventSource); } else { - UA_LOG_WARNING(&conf->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(conf->logging, UA_LOGCATEGORY_USERLAND, "Cannot create the Interrupt Manager (only relevant if used)"); } #ifdef UA_ENABLE_MQTT @@ -377,11 +375,11 @@ setDefaultConfig(UA_ServerConfig *conf, UA_UInt16 portNumber) { char serverUrlBuffer[2][512]; if(portNumber == 0) { - UA_LOG_WARNING(&conf->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(conf->logging, UA_LOGCATEGORY_USERLAND, "Cannot set the ServerUrl with a zero port"); } else { if(conf->serverUrlsSize > 0) { - UA_LOG_WARNING(&conf->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(conf->logging, UA_LOGCATEGORY_USERLAND, "ServerUrls already set. Overriding."); UA_Array_delete(conf->serverUrls, conf->serverUrlsSize, &UA_TYPES[UA_TYPES_STRING]); @@ -540,7 +538,7 @@ UA_ServerConfig_addSecurityPolicyNone(UA_ServerConfig *config, localCertificate = *certificate; UA_StatusCode retval = UA_SecurityPolicy_None(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, &config->logger); + localCertificate, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -697,7 +695,7 @@ UA_ServerConfig_addSecurityPolicyBasic128Rsa15(UA_ServerConfig *config, localPrivateKey = *privateKey; UA_StatusCode retval = UA_SecurityPolicy_Basic128Rsa15(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, localPrivateKey, &config->logger); + localCertificate, localPrivateKey, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -731,7 +729,7 @@ UA_ServerConfig_addSecurityPolicyBasic256(UA_ServerConfig *config, localPrivateKey = *privateKey; UA_StatusCode retval = UA_SecurityPolicy_Basic256(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, localPrivateKey, &config->logger); + localCertificate, localPrivateKey, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -765,7 +763,7 @@ UA_ServerConfig_addSecurityPolicyBasic256Sha256(UA_ServerConfig *config, localPrivateKey = *privateKey; UA_StatusCode retval = UA_SecurityPolicy_Basic256Sha256(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, localPrivateKey, &config->logger); + localCertificate, localPrivateKey, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -799,7 +797,7 @@ UA_ServerConfig_addSecurityPolicyAes128Sha256RsaOaep(UA_ServerConfig *config, localPrivateKey = *privateKey; UA_StatusCode retval = UA_SecurityPolicy_Aes128Sha256RsaOaep(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, localPrivateKey, &config->logger); + localCertificate, localPrivateKey, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -833,7 +831,7 @@ UA_ServerConfig_addSecurityPolicyAes256Sha256RsaPss(UA_ServerConfig *config, localPrivateKey = *privateKey; UA_StatusCode retval = UA_SecurityPolicy_Aes256Sha256RsaPss(&config->securityPolicies[config->securityPoliciesSize], - localCertificate, localPrivateKey, &config->logger); + localCertificate, localPrivateKey, config->logging); if(retval != UA_STATUSCODE_GOOD) { if(config->securityPoliciesSize == 0) { UA_free(config->securityPolicies); @@ -861,42 +859,42 @@ UA_ServerConfig_addAllSecurityPolicies(UA_ServerConfig *config, UA_StatusCode retval = UA_ServerConfig_addSecurityPolicyNone(config, &localCertificate); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#None with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyBasic128Rsa15(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic128Rsa15 with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyBasic256(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256 with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyAes256Sha256RsaPss(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Aes256Sha256RsaPss with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyBasic256Sha256(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256Sha256 with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyAes128Sha256RsaOaep(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Aes128Sha256RsaOaep with error code %s", UA_StatusCode_name(retval)); } @@ -919,21 +917,21 @@ UA_ServerConfig_addAllSecureSecurityPolicies(UA_ServerConfig *config, UA_StatusCode retval = UA_ServerConfig_addSecurityPolicyBasic256Sha256(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256Sha256 with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyAes128Sha256RsaOaep(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Aes128Sha256RsaOaep with error code %s", UA_StatusCode_name(retval)); } retval = UA_ServerConfig_addSecurityPolicyAes256Sha256RsaPss(config, &localCertificate, &localPrivateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Aes256Sha256RsaPss with error code %s", UA_StatusCode_name(retval)); } diff --git a/plugins/ua_config_json.c b/plugins/ua_config_json.c index af608fb83c5..defc4c9d6a5 100644 --- a/plugins/ua_config_json.c +++ b/plugins/ua_config_json.c @@ -698,7 +698,7 @@ PARSE_JSON(SecurityPolciesField) { } if(certificate.length == 0 || privateKey.length == 0) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Certificate and PrivateKey must be set for every policy."); if(policy.length > 0) UA_String_clear(&policy); @@ -714,33 +714,33 @@ PARSE_JSON(SecurityPolciesField) { } else if(UA_String_equal(&policy, &basic128Rsa15uri)) { retval = UA_ServerConfig_addSecurityPolicyBasic128Rsa15(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic128Rsa15 with error code %s", UA_StatusCode_name(retval)); } } else if(UA_String_equal(&policy, &basic256uri)) { retval = UA_ServerConfig_addSecurityPolicyBasic256(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256 with error code %s", UA_StatusCode_name(retval)); } } else if(UA_String_equal(&policy, &basic256Sha256uri)) { retval = UA_ServerConfig_addSecurityPolicyBasic256Sha256(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Basic256Sha256 with error code %s", UA_StatusCode_name(retval)); } } else if(UA_String_equal(&policy, &aes128sha256rsaoaepuri)) { retval = UA_ServerConfig_addSecurityPolicyAes128Sha256RsaOaep(config, &certificate, &privateKey); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Could not add SecurityPolicy#Aes128Sha256RsaOaep with error code %s", UA_StatusCode_name(retval)); } } else { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND, "Unknown Security Policy."); + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_USERLAND, "Unknown Security Policy."); } /* Add all Endpoints */ diff --git a/src/pubsub/ua_pubsub_config.c b/src/pubsub/ua_pubsub_config.c index 0a019b229fd..327895eff49 100644 --- a/src/pubsub/ua_pubsub_config.c +++ b/src/pubsub/ua_pubsub_config.c @@ -60,7 +60,7 @@ extractPubSubConfigFromExtensionObject(UA_Server *server, UA_PubSubConfigurationDataType **dst) { if(src->encoding != UA_EXTENSIONOBJECT_DECODED || src->content.decoded.type != &UA_TYPES[UA_TYPES_UABINARYFILEDATATYPE]) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_extractPubSubConfigFromDecodedObject] " "Reading extensionObject failed"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -69,14 +69,14 @@ extractPubSubConfigFromExtensionObject(UA_Server *server, UA_UABinaryFileDataType *binFile = (UA_UABinaryFileDataType*)src->content.decoded.data; if(binFile->body.arrayLength != 0 || binFile->body.arrayDimensionsSize != 0) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_extractPubSubConfigFromDecodedObject] " "Loading multiple configurations is not supported"); return UA_STATUSCODE_BADNOTIMPLEMENTED; } if(binFile->body.type != &UA_TYPES[UA_TYPES_PUBSUBCONFIGURATIONDATATYPE]) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_extractPubSubConfigFromDecodedObject] " "Invalid datatype encoded in the binary file"); return UA_STATUSCODE_BADTYPEMISMATCH; @@ -93,7 +93,7 @@ updatePubSubConfig(UA_Server *server, UA_LOCK_ASSERT(&server->serviceMutex, 1); if(configurationParameters == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_updatePubSubConfig] Invalid argument"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -113,7 +113,7 @@ updatePubSubConfig(UA_Server *server, &configurationParameters->publishedDataSets[i], &publishedDataSetIdent[i]); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_updatePubSubConfig] PDS creation failed"); UA_free(publishedDataSetIdent); return res; @@ -122,7 +122,7 @@ updatePubSubConfig(UA_Server *server, /* Configuration of PubSub Connections: */ if(configurationParameters->connectionsSize < 1) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_updatePubSubConfig] no connection in " "UA_PubSubConfigurationDataType"); UA_free(publishedDataSetIdent); @@ -164,7 +164,7 @@ setConnectionPublisherId(UA_Server *server, dst->publisherIdType = UA_PUBLISHERIDTYPE_UINT64; dst->publisherId.uint64 = *(UA_UInt64*)src->publisherId.data; } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setConnectionPublisherId] PublisherId is not valid."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -186,7 +186,7 @@ createComponentsForConnection(UA_Server *server, res = createWriterGroup(server, &connParams->writerGroups[i], connectionIdent, pdsCount, pdsIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createComponentsForConnection] " "Error occured during %d. WriterGroup Creation", (UA_UInt32)i+1); return res; @@ -197,7 +197,7 @@ createComponentsForConnection(UA_Server *server, for(size_t j = 0; j < connParams->readerGroupsSize; j++) { res = createReaderGroup(server, &connParams->readerGroups[j], connectionIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createComponentsForConnection] " "Error occured during %d. ReaderGroup Creation", (UA_UInt32)j+1); return res; @@ -229,7 +229,7 @@ createPubSubConnection(UA_Server *server, const UA_PubSubConnectionDataType *con UA_StatusCode res = setConnectionPublisherId(server, connParams, &config); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPubSubConnection] " "Setting PublisherId failed"); return res; @@ -240,7 +240,7 @@ createPubSubConnection(UA_Server *server, const UA_PubSubConnectionDataType *con connParams->address.content.decoded.data, connParams->address.content.decoded.type); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPubSubConnection] " "Reading connection address failed"); return UA_STATUSCODE_BADINTERNALERROR; @@ -251,7 +251,7 @@ createPubSubConnection(UA_Server *server, const UA_PubSubConnectionDataType *con connParams->transportSettings.content.decoded.data, connParams->transportSettings.content.decoded.type); } else { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPubSubConnection] " "TransportSettings can not be read"); } @@ -264,7 +264,7 @@ createPubSubConnection(UA_Server *server, const UA_PubSubConnectionDataType *con res = createComponentsForConnection(server, connParams, connectionIdent, pdsCount, pdsIdent); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPubSubConnection] " "Connection creation failed"); } @@ -279,7 +279,7 @@ setWriterGroupEncodingType(UA_Server *server, const UA_WriterGroupDataType *writerGroupParameters, UA_WriterGroupConfig *config) { if(writerGroupParameters->messageSettings.encoding != UA_EXTENSIONOBJECT_DECODED) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setWriterGroupEncodingType] " "getting message type information failed"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -290,12 +290,12 @@ setWriterGroupEncodingType(UA_Server *server, config->encodingMimeType = UA_PUBSUB_ENCODING_UADP; } else if(writerGroupParameters->messageSettings.content.decoded.type == &UA_TYPES[UA_TYPES_JSONWRITERGROUPMESSAGEDATATYPE]) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setWriterGroupEncodingType] " "encoding type: JSON (not implemented!)"); return UA_STATUSCODE_BADNOTIMPLEMENTED; } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setWriterGroupEncodingType] " "invalid message encoding type"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -335,7 +335,7 @@ createWriterGroup(UA_Server *server, UA_StatusCode res = setWriterGroupEncodingType(server, writerGroupParameters, &config); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createWriterGroup] " "Setting message settings failed"); return res; @@ -348,7 +348,7 @@ createWriterGroup(UA_Server *server, if(wg) UA_WriterGroup_setPubSubState(server, wg, UA_PUBSUBSTATE_OPERATIONAL, UA_STATUSCODE_GOOD); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createWriterGroup] " "Adding WriterGroup to server failed: 0x%x", res); return res; @@ -359,7 +359,7 @@ createWriterGroup(UA_Server *server, res = createDataSetWriter(server, &writerGroupParameters->dataSetWriters[dsw], writerGroupIdent, pdsCount, pdsIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createWriterGroup] " "DataSetWriter Creation failed."); break; @@ -392,7 +392,7 @@ addDataSetWriterWithPdsReference(UA_Server *server, UA_NodeId writerGroupIdent, res = getPublishedDataSetConfig(server, pdsIdent[pds], &pdsConfig); /* members of pdsConfig must be deleted manually */ if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addDataSetWriterWithPdsReference] " "Getting pdsConfig from NodeId failed."); return res; @@ -406,7 +406,7 @@ addDataSetWriterWithPdsReference(UA_Server *server, UA_NodeId writerGroupIdent, res = UA_DataSetWriter_create(server, writerGroupIdent, pdsIdent[pds], dsWriterConfig, &dataSetWriterIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addDataSetWriterWithPdsReference] " "Adding DataSetWriter failed"); } else { @@ -420,7 +420,7 @@ addDataSetWriterWithPdsReference(UA_Server *server, UA_NodeId writerGroupIdent, } if(!pdsFound) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addDataSetWriterWithPdsReference] " "No matching DataSet found; no DataSetWriter created"); } @@ -456,7 +456,7 @@ createDataSetWriter(UA_Server *server, UA_StatusCode res = addDataSetWriterWithPdsReference(server, writerGroupIdent, &config, pdsCount, pdsIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createDataSetWriter] " "Referencing related PDS failed"); } @@ -485,19 +485,19 @@ createReaderGroup(UA_Server *server, UA_StatusCode res = UA_ReaderGroup_create(server, connectionIdent, &config, &readerGroupIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createReaderGroup] Adding ReaderGroup " "to server failed: 0x%x", res); return res; } - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createReaderGroup] ReaderGroup successfully added."); for(UA_UInt32 i = 0; i < readerGroupParameters->dataSetReadersSize; i++) { res = createDataSetReader(server, &readerGroupParameters->dataSetReaders[i], readerGroupIdent); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createReaderGroup] Creating DataSetReader failed"); break; } @@ -540,7 +540,7 @@ addSubscribedDataSet(UA_Server *server, const UA_NodeId dsReaderIdent, tmpTargetVars->targetVariablesSize, targetVars); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addSubscribedDataSet] " "create TargetVariables failed"); } @@ -555,13 +555,13 @@ addSubscribedDataSet(UA_Server *server, const UA_NodeId dsReaderIdent, if(subscribedDataSet->content.decoded.type == &UA_TYPES[UA_TYPES_SUBSCRIBEDDATASETMIRRORDATATYPE]) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addSubscribedDataSet] " "DataSetMirror is currently not supported"); return UA_STATUSCODE_BADINVALIDARGUMENT; } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addSubscribedDataSet] " "Invalid Type of SubscribedDataSet"); return UA_STATUSCODE_BADINTERNALERROR; @@ -596,7 +596,7 @@ createDataSetReader(UA_Server *server, const UA_DataSetReaderDataType *dsrParams res = addSubscribedDataSet(server, dsReaderIdent, &dsrParams->subscribedDataSet); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createDataSetReader] " "create subscribedDataSet failed"); } @@ -622,12 +622,12 @@ setPublishedDataSetType(UA_Server *server, return UA_STATUSCODE_GOOD; } else if(sourceType == &UA_TYPES[UA_TYPES_PUBLISHEDEVENTSDATATYPE]) { /* config.publishedDataSetType = UA_PUBSUB_DATASET_PUBLISHEDEVENTS; */ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setPublishedDataSetType] Published events not supported."); return UA_STATUSCODE_BADNOTIMPLEMENTED; } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_setPublishedDataSetType] Invalid DataSetSourceDataType."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -653,7 +653,7 @@ createPublishedDataSet(UA_Server *server, res = UA_PublishedDataSet_create(server, &config, pdsIdent).addResult; if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPublishedDataSet] " "Adding PublishedDataSet failed."); return res; @@ -662,7 +662,7 @@ createPublishedDataSet(UA_Server *server, /* DataSetField configuration for this publishedDataSet: */ res = createDataSetFields(server, pdsIdent, pdsParams); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createPublishedDataSet] " "Creating DataSetFieldConfig failed."); } @@ -700,7 +700,7 @@ addDataSetFieldVariables(UA_Server *server, const UA_NodeId *pdsIdent, UA_NodeId fieldIdent; UA_StatusCode res = UA_DataSetField_create(server, *pdsIdent, &fc, &fieldIdent).result; if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_addDataSetFieldVariables] " "Adding DataSetField Variable failed."); return res; @@ -731,13 +731,13 @@ createDataSetFields(UA_Server *server, const UA_NodeId *pdsIdent, /* TODO: Implement Routine for adding Event DataSetFields */ if(pdsParams->dataSetSource.content.decoded.type == &UA_TYPES[UA_TYPES_PUBLISHEDEVENTSDATATYPE]) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createDataSetFields] " "Published events not supported."); return UA_STATUSCODE_BADNOTIMPLEMENTED; } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_createDataSetFields] " "Invalid DataSetSourceDataType."); return UA_STATUSCODE_BADINTERNALERROR; @@ -751,7 +751,7 @@ UA_PubSubManager_loadPubSubConfigFromByteString(UA_Server *server, UA_StatusCode res; if(server == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_loadPubSubConfigFromByteString] Invalid argument"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -760,7 +760,7 @@ UA_PubSubManager_loadPubSubConfigFromByteString(UA_Server *server, res = UA_ExtensionObject_decodeBinary(&buffer, &offset, &decodedFile); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_decodeBinFile] decoding UA_Binary failed"); goto cleanup; } @@ -768,7 +768,7 @@ UA_PubSubManager_loadPubSubConfigFromByteString(UA_Server *server, UA_PubSubConfigurationDataType *pubSubConfig = NULL; res = extractPubSubConfigFromExtensionObject(server, &decodedFile, &pubSubConfig); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_loadPubSubConfigFromByteString] " "Extracting PubSub Configuration failed"); goto cleanup; @@ -776,7 +776,7 @@ UA_PubSubManager_loadPubSubConfigFromByteString(UA_Server *server, res = updatePubSubConfig(server, pubSubConfig); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_loadPubSubConfigFromByteString] " "Loading PubSub configuration into server failed"); goto cleanup; @@ -809,7 +809,7 @@ encodePubSubConfiguration(UA_Server *server, size_t fileSize = UA_ExtensionObject_calcSizeBinary(&container); buffer->data = (UA_Byte*)UA_calloc(fileSize, sizeof(UA_Byte)); if(buffer->data == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_encodePubSubConfiguration] Allocating buffer failed"); return UA_STATUSCODE_BADOUTOFMEMORY; } @@ -820,7 +820,7 @@ encodePubSubConfiguration(UA_Server *server, UA_StatusCode res = UA_ExtensionObject_encodeBinary(&container, &bufferPos, bufferPos + fileSize); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_encodePubSubConfiguration] Encoding failed"); } return res; @@ -844,7 +844,7 @@ generatePublishedDataSetDataType(UA_Server* server, tmp->publishedData = (UA_PublishedVariableDataType*) UA_Array_new(tmp->publishedDataSize, &UA_TYPES[UA_TYPES_PUBLISHEDVARIABLEDATATYPE]); if(tmp->publishedData == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "Allocation memory failed"); + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Allocation memory failed"); return UA_STATUSCODE_BADOUTOFMEMORY; } @@ -852,7 +852,7 @@ generatePublishedDataSetDataType(UA_Server* server, UA_Array_new(dst->dataSetMetaData.fieldsSize, &UA_TYPES[UA_TYPES_FIELDMETADATA]); if(dst->dataSetMetaData.fields == NULL) { UA_free(tmp->publishedData); - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "Allocation memory failed"); + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Allocation memory failed"); return UA_STATUSCODE_BADOUTOFMEMORY; } @@ -1051,7 +1051,7 @@ generatePubSubConnectionDataType(UA_Server* server, publisherIdType = &UA_TYPES[UA_TYPES_STRING]; break; default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "generatePubSubConnectionDataType(): publisher Id type is not supported"); return UA_STATUSCODE_BADINTERNALERROR; break; @@ -1149,7 +1149,7 @@ generatePubSubConfigurationDataType(UA_Server* server, UA_PublishedDataSetDataType *dst = &configDT->publishedDataSets[pdsIndex]; res = generatePublishedDataSetDataType(server, pds, dst); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_generatePubSubConfigurationDataType] " "retrieving PublishedDataSet configuration failed"); return res; @@ -1169,7 +1169,7 @@ generatePubSubConfigurationDataType(UA_Server* server, UA_PubSubConnectionDataType *cdt = &configDT->connections[connectionIndex]; res = generatePubSubConnectionDataType(server, connection, cdt); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_generatePubSubConfigurationDataType] " "retrieving PubSubConnection configuration failed"); return res; @@ -1187,7 +1187,7 @@ UA_PubSubManager_getEncodedPubSubConfiguration(UA_Server *server, memset(&config, 0, sizeof(UA_PubSubConfigurationDataType)); if(server == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "[UA_PubSubManager_getEncodedPubSubConfiguration] Invalid argument"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -1196,19 +1196,19 @@ UA_PubSubManager_getEncodedPubSubConfiguration(UA_Server *server, UA_StatusCode res = generatePubSubConfigurationDataType(server, &config); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "retrieving PubSub configuration from server failed"); goto cleanup; } res = encodePubSubConfiguration(server, &config, buffer); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "encoding PubSub configuration failed"); goto cleanup; } - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Saving PubSub config was successful"); cleanup: diff --git a/src/pubsub/ua_pubsub_connection.c b/src/pubsub/ua_pubsub_connection.c index c73f29f9aa3..0cf31766fde 100644 --- a/src/pubsub/ua_pubsub_connection.c +++ b/src/pubsub/ua_pubsub_connection.c @@ -36,7 +36,7 @@ decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos, UA_StatusCode rv = UA_NetworkMessage_decodeHeaders(buffer, pos, nm); if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, connection, + UA_LOG_WARNING_CONNECTION(server->config.logging, connection, "PubSub receive. decoding headers failed"); UA_NetworkMessage_clear(nm); return rv; @@ -56,10 +56,10 @@ decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos, if(retval != UA_STATUSCODE_GOOD) continue; processed = true; - rv = verifyAndDecryptNetworkMessage(&server->config.logger, buffer, pos, + rv = verifyAndDecryptNetworkMessage(server->config.logging, buffer, pos, nm, readerGroup); if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, connection, + UA_LOG_WARNING_CONNECTION(server->config.logging, connection, "Subscribe failed, verify and decrypt " "network message failed."); UA_NetworkMessage_clear(nm); @@ -73,7 +73,7 @@ decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos, loops_exit: if(!processed) { - UA_LOG_INFO_CONNECTION(&server->config.logger, connection, + UA_LOG_INFO_CONNECTION(server->config.logging, connection, "Dataset reader not found. Check PublisherId, " "WriterGroupId and DatasetWriterId"); /* Possible multicast scenario: there are multiple connections (with one @@ -164,14 +164,14 @@ UA_PubSubConnection_create(UA_Server *server, const UA_PubSubConnectionConfig *c /* Validate preconditions */ UA_CHECK_MEM(server, return UA_STATUSCODE_BADINTERNALERROR); UA_CHECK_ERROR(cc != NULL, return UA_STATUSCODE_BADINTERNALERROR, - &server->config.logger, UA_LOGCATEGORY_SERVER, + server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub Connection creation failed. Missing connection configuration."); /* Allocate */ UA_PubSubConnection *c = (UA_PubSubConnection *) UA_calloc(1, sizeof(UA_PubSubConnection)); if(!c) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub Connection creation failed. Out of Memory."); return UA_STATUSCODE_BADOUTOFMEMORY; } @@ -334,7 +334,7 @@ UA_PubSubConnection_setPubSubState(UA_Server *server, UA_PubSubConnection *c, UA_PUBSUBSTATE_ERROR, ret); break; default: - UA_LOG_WARNING_CONNECTION(&server->config.logger, c, + UA_LOG_WARNING_CONNECTION(server->config.logging, c, "Received unknown PubSub state!"); return UA_STATUSCODE_BADINTERNALERROR; } diff --git a/src/pubsub/ua_pubsub_dataset.c b/src/pubsub/ua_pubsub_dataset.c index 7b8e769d12c..34b0592144f 100644 --- a/src/pubsub/ua_pubsub_dataset.c +++ b/src/pubsub/ua_pubsub_dataset.c @@ -153,7 +153,7 @@ UA_PublishedDataSet_clear(UA_Server *server, UA_PublishedDataSet *publishedDataS * function regenerates DataSetMetaData, which is not necessary if we want to * clear the whole PDS anyway. */ if(field->configurationFrozen) { - UA_LOG_WARNING_DATASET(&server->config.logger, publishedDataSet, + UA_LOG_WARNING_DATASET(server->config.logging, publishedDataSet, "Clearing a frozen field."); } field->fieldMetaData.arrayDimensions = NULL; @@ -221,7 +221,7 @@ generateFieldMetaData(UA_Server *server, UA_PublishedDataSet *pds, res = readWithReadValue(server, &pp->publishedVariable, UA_ATTRIBUTEID_ARRAYDIMENSIONS, &value); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub meta data generation: Reading the array dimensions failed"); return res; } @@ -242,7 +242,7 @@ generateFieldMetaData(UA_Server *server, UA_PublishedDataSet *pds, res = readWithReadValue(server, &pp->publishedVariable, UA_ATTRIBUTEID_DATATYPE, &fieldMetaData->dataType); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub meta data generation: Reading the datatype failed"); return res; } @@ -252,7 +252,7 @@ generateFieldMetaData(UA_Server *server, UA_PublishedDataSet *pds, UA_findDataTypeWithCustom(&fieldMetaData->dataType, server->config.customDataTypes); #ifdef UA_ENABLE_TYPEDESCRIPTION - UA_LOG_DEBUG_DATASET(&server->config.logger, pds, + UA_LOG_DEBUG_DATASET(server->config.logging, pds, "MetaData creation: Found DataType %s", currentDataType->typeName); #endif @@ -266,12 +266,12 @@ generateFieldMetaData(UA_Server *server, UA_PublishedDataSet *pds, currentDataType->typeKind == UA_DATATYPEKIND_LOCALIZEDTEXT) { fieldMetaData->maxStringLength = field->config.field.variable.maxStringLength; } else { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub meta data generation: MaxStringLength with incompatible DataType configured."); } } } else { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub meta data generation: DataType is UA_NODEID_NULL"); } @@ -280,7 +280,7 @@ generateFieldMetaData(UA_Server *server, UA_PublishedDataSet *pds, res = readWithReadValue(server, &pp->publishedVariable, UA_ATTRIBUTEID_VALUERANK, &valueRank); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub meta data generation: Reading the value rank failed"); return res; } @@ -322,7 +322,7 @@ UA_DataSetField_create(UA_Server *server, const UA_NodeId publishedDataSet, } if(currDS->configurationFreezeCounter > 0) { - UA_LOG_WARNING_DATASET(&server->config.logger, currDS, + UA_LOG_WARNING_DATASET(server->config.logging, currDS, "Adding DataSetField failed: PublishedDataSet is frozen"); result.result = UA_STATUSCODE_BADCONFIGURATIONERROR; return result; @@ -434,14 +434,14 @@ UA_DataSetField_remove(UA_Server *server, UA_DataSetField *currentField) { } if(currentField->configurationFrozen) { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "Remove DataSetField failed: DataSetField is frozen"); result.result = UA_STATUSCODE_BADCONFIGURATIONERROR; return result; } if(pds->configurationFreezeCounter > 0) { - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "Remove DataSetField failed: PublishedDataSet is frozen"); result.result = UA_STATUSCODE_BADCONFIGURATIONERROR; return result; @@ -487,7 +487,7 @@ UA_DataSetField_remove(UA_Server *server, UA_DataSetField *currentField) { result.result = generateFieldMetaData(server, pds, tmpDSF, &fieldMetaData[counter]); if(result.result != UA_STATUSCODE_GOOD) { UA_FieldMetaData_clear(&fieldMetaData[counter]); - UA_LOG_WARNING_DATASET(&server->config.logger, pds, + UA_LOG_WARNING_DATASET(server->config.logging, pds, "PubSub MetaData regeneration failed " "after removing a field!"); break; @@ -611,27 +611,27 @@ UA_PublishedDataSet_create(UA_Server *server, UA_AddPublishedDataSetResult result = {UA_STATUSCODE_BADINVALIDARGUMENT, 0, NULL, {0, 0}}; if(!publishedDataSetConfig){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. No config passed in."); return result; } if(publishedDataSetConfig->publishedDataSetType != UA_PUBSUB_DATASET_PUBLISHEDITEMS){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. Unsupported PublishedDataSet type."); return result; } if(UA_String_isEmpty(&publishedDataSetConfig->name)) { // DataSet has to have a valid name - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. Invalid name."); return result; } if(UA_PublishedDataSet_findPDSbyName(server, publishedDataSetConfig->name)) { // DataSet name has to be unique in the publisher - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. DataSet with the same name already exists."); result.addResult = UA_STATUSCODE_BADBROWSENAMEDUPLICATED; return result; @@ -641,7 +641,7 @@ UA_PublishedDataSet_create(UA_Server *server, UA_PublishedDataSet *newPDS = (UA_PublishedDataSet *) UA_calloc(1, sizeof(UA_PublishedDataSet)); if(!newPDS) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. Out of Memory."); result.addResult = UA_STATUSCODE_BADOUTOFMEMORY; return result; @@ -654,7 +654,7 @@ UA_PublishedDataSet_create(UA_Server *server, UA_StatusCode res = UA_PublishedDataSetConfig_copy(publishedDataSetConfig, newConfig); if(res != UA_STATUSCODE_GOOD){ UA_free(newPDS); - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PublishedDataSet creation failed. Configuration copy failed."); result.addResult = UA_STATUSCODE_BADINTERNALERROR; return result; @@ -730,7 +730,7 @@ UA_Server_addPublishedDataSet(UA_Server *server, UA_StatusCode UA_PublishedDataSet_remove(UA_Server *server, UA_PublishedDataSet *publishedDataSet) { if(publishedDataSet->configurationFreezeCounter > 0) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Remove PublishedDataSet failed. PublishedDataSet is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } diff --git a/src/pubsub/ua_pubsub_eventloop.c b/src/pubsub/ua_pubsub_eventloop.c index 63544453d6c..03126e8de6d 100644 --- a/src/pubsub/ua_pubsub_eventloop.c +++ b/src/pubsub/ua_pubsub_eventloop.c @@ -182,7 +182,7 @@ PubSubChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, UA_PubSubConnection_addRecvConnection(psc, connectionId) : UA_PubSubConnection_addSendConnection(psc, connectionId); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, psc, + UA_LOG_WARNING_CONNECTION(server->config.logging, psc, "No more space for an additional EventLoop connection"); if(psc->cm) psc->cm->closeConnection(psc->cm, connectionId); @@ -232,7 +232,7 @@ PubSubChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, #endif } if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, psc, + UA_LOG_WARNING_CONNECTION(server->config.logging, psc, "Verify, decrypt and decode network message failed"); nonRT = false; } @@ -253,7 +253,7 @@ PubSubChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, } if(!processed) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, psc, + UA_LOG_WARNING_CONNECTION(server->config.logging, psc, "Message received that could not be processed. " "Check PublisherID, WriterGroupID and DatasetWriterID."); } @@ -292,7 +292,7 @@ UA_PubSubConnection_connectUDP(UA_Server *server, UA_PubSubConnection *c, UA_UInt16 port; UA_StatusCode res = UA_parseEndpointUrl(&addressUrl->url, &address, &port, NULL); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not parse the UDP network URL"); return res; } @@ -327,7 +327,7 @@ UA_PubSubConnection_connectUDP(UA_Server *server, UA_PubSubConnection *c, /* Validate only if no ReaderGroup configured */ validate = (c->readerGroupsSize == 0); if(validate) { - UA_LOG_INFO_CONNECTION(&server->config.logger, c, + UA_LOG_INFO_CONNECTION(server->config.logging, c, "No ReaderGroups configured. " "Only validate the connection parameters " "instead of opening a receiving channel."); @@ -337,7 +337,7 @@ UA_PubSubConnection_connectUDP(UA_Server *server, UA_PubSubConnection *c, res = c->cm->openConnection(c->cm, &kvm, server, c, PubSubRecvChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not open an UDP channel for receiving"); return res; } @@ -359,13 +359,13 @@ UA_PubSubConnection_connectUDP(UA_Server *server, UA_PubSubConnection *c, strncmp((const char*)&address.data[address.length - localhostAddrs[2].length], (const char*)localhostAddrs[2].data, localhostAddrs[2].length) == 0)) { /* Localhost address -- no send connection */ - UA_LOG_INFO_CONNECTION(&server->config.logger, c, + UA_LOG_INFO_CONNECTION(server->config.logging, c, "Localhost address - don't open UDP send connection"); } else if(c->sendChannel == 0) { /* Validate only if no WriterGroup configured */ validate = (c->writerGroupsSize == 0); if(validate) { - UA_LOG_INFO_CONNECTION(&server->config.logger, c, + UA_LOG_INFO_CONNECTION(server->config.logging, c, "No WriterGroups configured. " "Only validate the connection parameters " "instead of opening a channel for sending."); @@ -377,7 +377,7 @@ UA_PubSubConnection_connectUDP(UA_Server *server, UA_PubSubConnection *c, res = c->cm->openConnection(c->cm, &kvm, server, c, PubSubSendChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not open an UDP recv channel"); } } @@ -398,7 +398,7 @@ UA_PubSubConnection_connectETH(UA_Server *server, UA_PubSubConnection *c, UA_String vidPCP = UA_STRING_NULL; UA_StatusCode res = UA_parseEndpointUrl(&addressUrl->url, &address, NULL, &vidPCP); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not parse the ETH network URL"); return res; } @@ -424,7 +424,7 @@ UA_PubSubConnection_connectETH(UA_Server *server, UA_PubSubConnection *c, res = c->cm->openConnection(c->cm, &kvm, server, c, PubSubRecvChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not open an ETH recv channel"); return res; } @@ -437,7 +437,7 @@ UA_PubSubConnection_connectETH(UA_Server *server, UA_PubSubConnection *c, res = c->cm->openConnection(c->cm, &kvm, server, c, PubSubSendChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not open an ETH channel for sending"); } } @@ -465,7 +465,7 @@ UA_PubSubConnection_connect(UA_Server *server, UA_PubSubConnection *c, UA_EventLoop *el = UA_PubSubConnection_getEL(server, c); if(!el) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, "No EventLoop configured"); + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "No EventLoop configured"); UA_PubSubConnection_setPubSubState(server, c, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); return UA_STATUSCODE_BADINTERNALERROR;; @@ -477,7 +477,7 @@ UA_PubSubConnection_connect(UA_Server *server, UA_PubSubConnection *c, if(profile) cm = getCM(el, profile->protocol); if(!cm || (c->cm && cm != c->cm)) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "The requested protocol is not supported"); UA_PubSubConnection_setPubSubState(server, c, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); @@ -490,7 +490,7 @@ UA_PubSubConnection_connect(UA_Server *server, UA_PubSubConnection *c, /* Check the configuration address type */ if(!UA_Variant_hasScalarType(&c->config.address, &UA_TYPES[UA_TYPES_NETWORKADDRESSURLDATATYPE])) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, "No NetworkAddressUrlDataType " + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "No NetworkAddressUrlDataType " "for the address configuration"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -550,7 +550,7 @@ WriterGroupChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, /* Store the connectionId (if a new connection) */ if(wg->sendChannel && wg->sendChannel != connectionId) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "WriterGroup is already bound to a different channel"); UA_UNLOCK(&server->serviceMutex); return; @@ -587,7 +587,7 @@ UA_WriterGroup_connectUDPUnicast(UA_Server *server, UA_WriterGroup *wg, wg->config.transportSettings.encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) || wg->config.transportSettings.content.decoded.type != &UA_TYPES[UA_TYPES_DATAGRAMWRITERGROUPTRANSPORT2DATATYPE]) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Invalid TransportSettings for a UDP Connection"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -599,7 +599,7 @@ UA_WriterGroup_connectUDPUnicast(UA_Server *server, UA_WriterGroup *wg, if((ts->address.encoding != UA_EXTENSIONOBJECT_DECODED && ts->address.encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) || ts->address.content.decoded.type != &UA_TYPES[UA_TYPES_NETWORKADDRESSURLDATATYPE]) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Invalid TransportSettings Address for a UDP Connection"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -611,7 +611,7 @@ UA_WriterGroup_connectUDPUnicast(UA_Server *server, UA_WriterGroup *wg, UA_UInt16 port; UA_StatusCode res = UA_parseEndpointUrl(&addressUrl->url, &address, &port, NULL); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Could not parse the UDP network URL"); return res; } @@ -641,7 +641,7 @@ UA_WriterGroup_connectUDPUnicast(UA_Server *server, UA_WriterGroup *wg, res = cm->openConnection(cm, &kvm, server, wg, WriterGroupChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Could not open a UDP send channel"); } return res; @@ -662,7 +662,7 @@ UA_WriterGroup_connectMQTT(UA_Server *server, UA_WriterGroup *wg, ts->encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) || ts->content.decoded.type != &UA_TYPES[UA_TYPES_BROKERWRITERGROUPTRANSPORTDATATYPE]) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Wrong TransportSettings type for MQTT"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -674,7 +674,7 @@ UA_WriterGroup_connectMQTT(UA_Server *server, UA_WriterGroup *wg, UA_UInt16 port = 1883; /* Default */ UA_StatusCode res = UA_parseEndpointUrl(&addressUrl->url, &address, &port, NULL); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not parse the MQTT network URL"); return res; } @@ -701,7 +701,7 @@ UA_WriterGroup_connectMQTT(UA_Server *server, UA_WriterGroup *wg, res = c->cm->openConnection(c->cm, &kvm, server, wg, WriterGroupChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Could not open the MQTT connection"); } return res; @@ -731,7 +731,7 @@ UA_WriterGroup_connect(UA_Server *server, UA_WriterGroup *wg, UA_Boolean validat UA_EventLoop *el = UA_PubSubConnection_getEL(server, wg->linkedConnection); if(!el) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, "No EventLoop configured"); + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "No EventLoop configured"); UA_WriterGroup_setPubSubState(server, wg, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); return UA_STATUSCODE_BADINTERNALERROR;; @@ -747,7 +747,7 @@ UA_WriterGroup_connect(UA_Server *server, UA_WriterGroup *wg, UA_Boolean validat if(profile) cm = getCM(el, profile->protocol); if(!cm || (c->cm && cm != c->cm)) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "The requested protocol is not supported"); UA_PubSubConnection_setPubSubState(server, c, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); @@ -847,7 +847,7 @@ ReaderGroupChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, /* Store the connectionId (if a new connection) */ UA_StatusCode res = UA_ReaderGroup_addRecvConnection(rg, connectionId); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "No more space for an additional EventLoop connection"); UA_PubSubConnection *c = rg->linkedConnection; if(c && c->cm) @@ -873,7 +873,7 @@ ReaderGroupChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, } if(rg->state != UA_PUBSUBSTATE_OPERATIONAL) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Received a messaage for a non-operational ReaderGroup"); UA_UNLOCK(&server->serviceMutex); return; @@ -901,7 +901,7 @@ ReaderGroupChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId, #endif } if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Verify, decrypt and decode network message failed"); UA_UNLOCK(&server->serviceMutex); return; @@ -928,7 +928,7 @@ UA_ReaderGroup_connectMQTT(UA_Server *server, UA_ReaderGroup *rg, ts->encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) || ts->content.decoded.type != &UA_TYPES[UA_TYPES_BROKERDATASETREADERTRANSPORTDATATYPE]) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, rg, + UA_LOG_ERROR_READERGROUP(server->config.logging, rg, "Wrong TransportSettings type for MQTT"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -940,7 +940,7 @@ UA_ReaderGroup_connectMQTT(UA_Server *server, UA_ReaderGroup *rg, UA_UInt16 port = 1883; /* Default */ UA_StatusCode res = UA_parseEndpointUrl(&addressUrl->url, &address, &port, NULL); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "Could not parse the MQTT network URL"); return res; } @@ -967,7 +967,7 @@ UA_ReaderGroup_connectMQTT(UA_Server *server, UA_ReaderGroup *rg, res = c->cm->openConnection(c->cm, &kvm, server, rg, ReaderGroupChannelCallback); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, rg, + UA_LOG_ERROR_READERGROUP(server->config.logging, rg, "Could not open the MQTT connection"); } return res; @@ -999,7 +999,7 @@ UA_ReaderGroup_connect(UA_Server *server, UA_ReaderGroup *rg, UA_Boolean validat UA_EventLoop *el = UA_PubSubConnection_getEL(server, rg->linkedConnection); if(!el) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, rg, "No EventLoop configured"); + UA_LOG_ERROR_READERGROUP(server->config.logging, rg, "No EventLoop configured"); UA_ReaderGroup_setPubSubState(server, rg, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); return UA_STATUSCODE_BADINTERNALERROR;; @@ -1015,7 +1015,7 @@ UA_ReaderGroup_connect(UA_Server *server, UA_ReaderGroup *rg, UA_Boolean validat if(profile) cm = getCM(el, profile->protocol); if(!cm || (c->cm && cm != c->cm)) { - UA_LOG_ERROR_CONNECTION(&server->config.logger, c, + UA_LOG_ERROR_CONNECTION(server->config.logging, c, "The requested protocol is not supported"); UA_PubSubConnection_setPubSubState(server, c, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); diff --git a/src/pubsub/ua_pubsub_keystorage.c b/src/pubsub/ua_pubsub_keystorage.c index 3032198351a..6ec48e8567c 100644 --- a/src/pubsub/ua_pubsub_keystorage.c +++ b/src/pubsub/ua_pubsub_keystorage.c @@ -345,7 +345,7 @@ UA_PubSubKeyStorage_activateKeyToChannelContext(UA_Server *server, UA_NodeId pub server, securityGroupId, securityTokenId, signingKey, encryptKey, keyNonce); if(retval != UA_STATUSCODE_GOOD) - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to set Encrypting keys with Error: %s", UA_StatusCode_name(retval)); @@ -356,14 +356,14 @@ static void nextGetSecuritykeysCallback(UA_Server *server, UA_PubSubKeyStorage *keyStorage) { UA_StatusCode retval = UA_STATUSCODE_BAD; if(!keyStorage) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "GetSecurityKeysCall Failed with error: KeyStorage does not exist " "in the server"); return; } retval = getSecurityKeysAndStoreFetchedKeys(server, keyStorage); if(retval != UA_STATUSCODE_GOOD) - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "GetSecurityKeysCall Failed with error: %s ", UA_StatusCode_name(retval)); } @@ -377,7 +377,7 @@ UA_PubSubKeyStorage_keyRolloverCallback(UA_Server *server, UA_PubSubKeyStorage * (UA_ServerCallback)UA_PubSubKeyStorage_keyRolloverCallback, keyStorage->keyLifeTime, &keyStorage->callBackId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to update keys for security group id '%.*s'. Reason: '%s'.", (int)keyStorage->securityGroupID.length, keyStorage->securityGroupID.data, UA_StatusCode_name(retval)); @@ -389,7 +389,7 @@ UA_PubSubKeyStorage_keyRolloverCallback(UA_Server *server, UA_PubSubKeyStorage * retval = UA_PubSubKeyStorage_activateKeyToChannelContext(server, UA_NODEID_NULL, keyStorage->securityGroupID); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to update keys for security group id '%.*s'. Reason: '%s'.", (int)keyStorage->securityGroupID.length, keyStorage->securityGroupID.data, UA_StatusCode_name(retval)); @@ -504,7 +504,7 @@ sksClientCleanupCb(void *client, void *context) { sksClient->config.securityPolicies = NULL; sksClient->config.securityPoliciesSize = 0; sksClient->config.certificateVerification.context = NULL; - sksClient->config.logger.context = NULL; + sksClient->config.logging = NULL; sksClient->config.clientContext = NULL; UA_Client_delete(sksClient); UA_free(context); @@ -528,7 +528,7 @@ storeFetchedKeys(UA_Client *client, void *userdata, UA_UInt32 requestId, if(response->resultsSize != 0) retval = response->results->statusCode; if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "SKS Client: Failed to call GetSecurityKeys on SKS server with error: %s ", UA_StatusCode_name(retval)); goto cleanup; @@ -583,7 +583,7 @@ storeFetchedKeys(UA_Client *client, void *userdata, UA_UInt32 requestId, cleanup: if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to store the fetched keys from SKS server with error: %s", UA_StatusCode_name(retval)); } @@ -625,7 +625,7 @@ onConnect(UA_Client *client, UA_SecureChannelState channelState, if(connectStatus != UA_STATUSCODE_GOOD && connectStatus != UA_STATUSCODE_BADNOTCONNECTED && sessionState != UA_SESSIONSTATE_ACTIVATED) { - UA_LOG_ERROR(&client->config.logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_ERROR(client->config.logging, UA_LOGCATEGORY_CLIENT, "SKS Client: Failed to connect SKS server with error: %s ", UA_StatusCode_name(connectStatus)); triggerSKSCleanup = true; @@ -633,7 +633,7 @@ onConnect(UA_Client *client, UA_SecureChannelState channelState, if(connectStatus == UA_STATUSCODE_GOOD && sessionState == UA_SESSIONSTATE_ACTIVATED) { connectStatus = callGetSecurityKeysMethod(client); if(connectStatus != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&client->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(client->config.logging, UA_LOGCATEGORY_SERVER, "SKS Client: Failed to call GetSecurityKeys on SKS server with " "error: %s ", UA_StatusCode_name(connectStatus)); @@ -666,7 +666,7 @@ getSecurityKeysAndStoreFetchedKeys(UA_Server *server, UA_PubSubKeyStorage *keySt UA_UInt32 requestKeyCount = UA_UINT32_MAX; if(keyStorage->sksConfig.reqId != 0) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "SKS Client: SKS Pull request in process "); return UA_STATUSCODE_GOOD; } @@ -697,7 +697,7 @@ getSecurityKeysAndStoreFetchedKeys(UA_Server *server, UA_PubSubKeyStorage *keySt /* connect to sks server */ retval = UA_Client_connectAsync(client, keyStorage->sksConfig.endpointUrl); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&client->config.logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_ERROR(client->config.logging, UA_LOGCATEGORY_CLIENT, "Failed to connect SKS server with error: %s ", UA_StatusCode_name(retval)); /* Make sure the client channel state is closed and not fresh, otherwise, eventloop will @@ -734,7 +734,6 @@ UA_Server_setSksClient(UA_Server *server, UA_String securityGroupId, clientConfig->authSecurityPolicies = NULL; clientConfig->certificateVerification.context = NULL; clientConfig->eventLoop = NULL; - clientConfig->logger.context = NULL; clientConfig->logging = NULL; clientConfig->securityPolicies = NULL; UA_ClientConfig_clear(clientConfig); diff --git a/src/pubsub/ua_pubsub_manager.c b/src/pubsub/ua_pubsub_manager.c index 378ffd7307c..3ebaf9e9312 100644 --- a/src/pubsub/ua_pubsub_manager.c +++ b/src/pubsub/ua_pubsub_manager.c @@ -31,7 +31,7 @@ UA_PubSubManager_addTopic(UA_PubSubManager *pubSubManager, UA_TopicAssign *topic static UA_TopicAssign * UA_TopicAssign_new(UA_ReaderGroup *readerGroup, - UA_String topic, UA_Logger *logger) { + UA_String topic, const UA_Logger *logger) { UA_TopicAssign *topicAssign = (UA_TopicAssign *) calloc(1, sizeof(UA_TopicAssign)); if(!topicAssign) { UA_LOG_ERROR(logger, UA_LOGCATEGORY_SERVER, @@ -46,7 +46,7 @@ UA_TopicAssign_new(UA_ReaderGroup *readerGroup, UA_StatusCode UA_PubSubManager_addPubSubTopicAssign(UA_Server *server, UA_ReaderGroup *readerGroup, UA_String topic) { UA_PubSubManager *pubSubManager = &server->pubSubManager; - UA_TopicAssign *topicAssign = UA_TopicAssign_new(readerGroup, topic, &server->config.logger); + UA_TopicAssign *topicAssign = UA_TopicAssign_new(readerGroup, topic, server->config.logging); UA_PubSubManager_addTopic(pubSubManager, topicAssign); return UA_STATUSCODE_GOOD; } @@ -70,7 +70,7 @@ UA_ReserveId_new(UA_Server *server, UA_UInt16 id, UA_String transportProfileUri, UA_ReserveIdType reserveIdType, UA_NodeId sessionId) { UA_ReserveId *reserveId = (UA_ReserveId *) calloc(1, sizeof(UA_ReserveId)); if(!reserveId) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub ReserveId creation failed. Out of Memory."); return NULL; } @@ -144,7 +144,7 @@ UA_ReserveId_createId(UA_Server *server, UA_NodeId sessionId, next_id++; } if(!is_free) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub ReserveId creation failed. No free ID could be found."); return 0; } @@ -224,7 +224,7 @@ UA_PubSubManager_reserveIds(UA_Server *server, UA_NodeId sessionId, UA_UInt16 nu if(!UA_String_equal(&transportProfileUri, &profile_1) && !UA_String_equal(&transportProfileUri, &profile_2) && !UA_String_equal(&transportProfileUri, &profile_3)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub ReserveId creation failed. No valid transport profile uri."); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -257,7 +257,7 @@ addStandaloneSubscribedDataSet(UA_Server *server, UA_LOCK_ASSERT(&server->serviceMutex, 1); if(!sdsConfig){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "SubscribedDataSet creation failed. No config passed in."); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -265,7 +265,7 @@ addStandaloneSubscribedDataSet(UA_Server *server, UA_StandaloneSubscribedDataSetConfig tmpSubscribedDataSetConfig; memset(&tmpSubscribedDataSetConfig, 0, sizeof(UA_StandaloneSubscribedDataSetConfig)); if(UA_StandaloneSubscribedDataSetConfig_copy(sdsConfig, &tmpSubscribedDataSetConfig) != UA_STATUSCODE_GOOD){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "SubscribedDataSet creation failed. Configuration copy failed."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -274,7 +274,7 @@ addStandaloneSubscribedDataSet(UA_Server *server, UA_calloc(1, sizeof(UA_StandaloneSubscribedDataSet)); if(!newSubscribedDataSet) { UA_StandaloneSubscribedDataSetConfig_clear(&tmpSubscribedDataSetConfig); - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "SubscribedDataSet creation failed. Out of Memory."); return UA_STATUSCODE_BADOUTOFMEMORY; } @@ -415,7 +415,7 @@ UA_PubSubManager_shutdown(UA_Server *server, UA_PubSubManager *pubSubManager) { * action also delete the configured PubSub transport Layers. */ void UA_PubSubManager_delete(UA_Server *server, UA_PubSubManager *pubSubManager) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "PubSub cleanup was called."); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -474,7 +474,7 @@ UA_PubSubComponent_createMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubCo UA_PubSubMonitoringType eMonitoringType, void *data, UA_ServerCallback callback) { if ((!server) || (!data)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_createMonitoring(): " + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_createMonitoring(): " "null pointer param"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -484,12 +484,12 @@ UA_PubSubComponent_createMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubCo UA_DataSetReader *reader = (UA_DataSetReader*) data; switch (eMonitoringType) { case UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT: - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_createMonitoring(): DataSetReader '%.*s' " + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_createMonitoring(): DataSetReader '%.*s' " "- MessageReceiveTimeout", (UA_Int32) reader->config.name.length, reader->config.name.data); reader->msgRcvTimeoutTimerCallback = callback; break; default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_createMonitoring(): DataSetReader '%.*s' " + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_createMonitoring(): DataSetReader '%.*s' " "DataSetReader does not support timeout type '%i'", (UA_Int32) reader->config.name.length, reader->config.name.data, eMonitoringType); ret = UA_STATUSCODE_BADNOTSUPPORTED; @@ -498,7 +498,7 @@ UA_PubSubComponent_createMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubCo break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_createMonitoring(): PubSub component type '%i' is not supported", eComponentType); ret = UA_STATUSCODE_BADNOTSUPPORTED; break; @@ -520,7 +520,7 @@ UA_PubSubComponent_startMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubComponentEnumType eComponentType, UA_PubSubMonitoringType eMonitoringType, void *data) { if ((!server) || (!data)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_startMonitoring(): " "null pointer param"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -541,14 +541,14 @@ UA_PubSubComponent_startMonitoring(UA_Server *server, UA_NodeId Id, NULL, UA_TIMER_HANDLE_CYCLEMISS_WITH_CURRENTTIME, &reader->msgRcvTimeoutTimerId); if(ret == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_startMonitoring(): DataSetReader '%.*s'- " "MessageReceiveTimeout: MessageReceiveTimeout = '%f' " "Timer Id = '%u'", (UA_Int32) reader->config.name.length, reader->config.name.data, reader->config.messageReceiveTimeout, (UA_UInt32) reader->msgRcvTimeoutTimerId); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_startMonitoring(): DataSetReader " "'%.*s' - MessageReceiveTimeout: start timer failed", (UA_Int32) reader->config.name.length, reader->config.name.data); @@ -556,7 +556,7 @@ UA_PubSubComponent_startMonitoring(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_startMonitoring(): DataSetReader '%.*s' " "DataSetReader does not support timeout type '%i'", (UA_Int32) reader->config.name.length, reader->config.name.data, @@ -567,7 +567,7 @@ UA_PubSubComponent_startMonitoring(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_startMonitoring(): PubSub component " "type '%i' is not supported", eComponentType); ret = UA_STATUSCODE_BADNOTSUPPORTED; @@ -581,7 +581,7 @@ UA_PubSubComponent_stopMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubComponentEnumType eComponentType, UA_PubSubMonitoringType eMonitoringType, void *data) { if ((!server) || (!data)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_stopMonitoring(): " "null pointer param"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -595,7 +595,7 @@ UA_PubSubComponent_stopMonitoring(UA_Server *server, UA_NodeId Id, case UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT: { UA_EventLoop *el = server->config.eventLoop; el->removeCyclicCallback(el, reader->msgRcvTimeoutTimerId); - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_stopMonitoring(): DataSetReader '%.*s' - " "MessageReceiveTimeout: MessageReceiveTimeout = '%f' " "Timer Id = '%u'", (UA_Int32) reader->config.name.length, @@ -604,7 +604,7 @@ UA_PubSubComponent_stopMonitoring(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_stopMonitoring(): DataSetReader '%.*s' " "DataSetReader does not support timeout type '%i'", (UA_Int32) reader->config.name.length, reader->config.name.data, @@ -615,7 +615,7 @@ UA_PubSubComponent_stopMonitoring(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_stopMonitoring(): PubSub component type '%i' " "is not supported", eComponentType); ret = UA_STATUSCODE_BADNOTSUPPORTED; @@ -629,7 +629,7 @@ UA_PubSubComponent_updateMonitoringInterval(UA_Server *server, UA_NodeId Id, UA_PubSubComponentEnumType eComponentType, UA_PubSubMonitoringType eMonitoringType, void *data) { if ((!server) || (!data)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_updateMonitoringInterval(): " "null pointer param"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -645,7 +645,7 @@ UA_PubSubComponent_updateMonitoringInterval(UA_Server *server, UA_NodeId Id, reader->config.messageReceiveTimeout, NULL, UA_TIMER_HANDLE_CYCLEMISS_WITH_CURRENTTIME); if (ret == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_updateMonitoringInterval(): " "DataSetReader '%.*s' - MessageReceiveTimeout: new " "MessageReceiveTimeout = '%f' Timer Id = '%u'", @@ -653,7 +653,7 @@ UA_PubSubComponent_updateMonitoringInterval(UA_Server *server, UA_NodeId Id, reader->config.messageReceiveTimeout, (UA_UInt32) reader->msgRcvTimeoutTimerId); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_updateMonitoringInterval(): " "DataSetReader '%.*s': update timer interval failed", (UA_Int32) reader->config.name.length, reader->config.name.data); @@ -661,7 +661,7 @@ UA_PubSubComponent_updateMonitoringInterval(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_createMonitoring(): DataSetReader '%.*s' " "DataSetReader does not support timeout type '%i'", (UA_Int32) reader->config.name.length, reader->config.name.data, @@ -672,7 +672,7 @@ UA_PubSubComponent_updateMonitoringInterval(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_updateMonitoringInterval(): " "PubSub component type '%i' is not supported", eComponentType); ret = UA_STATUSCODE_BADNOTSUPPORTED; @@ -687,7 +687,7 @@ UA_PubSubComponent_deleteMonitoring(UA_Server *server, UA_NodeId Id, UA_PubSubMonitoringType eMonitoringType, void *data) { if ((!server) || (!data)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_deleteMonitoring(): " "null pointer param"); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -698,14 +698,14 @@ UA_PubSubComponent_deleteMonitoring(UA_Server *server, UA_NodeId Id, UA_DataSetReader *reader = (UA_DataSetReader*) data; switch (eMonitoringType) { case UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT: - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_deleteMonitoring(): DataSetReader '%.*s' - " "MessageReceiveTimeout: Timer Id = '%u'", (UA_Int32)reader->config.name.length, reader->config.name.data, (UA_UInt32) reader->msgRcvTimeoutTimerId); break; default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_PubSubComponent_deleteMonitoring(): DataSetReader '%.*s' " "DataSetReader does not support timeout type '%i'", (UA_Int32) reader->config.name.length, reader->config.name.data, @@ -716,7 +716,7 @@ UA_PubSubComponent_deleteMonitoring(UA_Server *server, UA_NodeId Id, break; } default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Error UA_PubSubComponent_deleteMonitoring(): PubSub component type " "'%i' is not supported", eComponentType); ret = UA_STATUSCODE_BADNOTSUPPORTED; diff --git a/src/pubsub/ua_pubsub_ns0.c b/src/pubsub/ua_pubsub_ns0.c index 2d94693a232..0be1f2f4a20 100644 --- a/src/pubsub/ua_pubsub_ns0.c +++ b/src/pubsub/ua_pubsub_ns0.c @@ -101,12 +101,12 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext &UA_TYPES[UA_TYPES_STRING]); break; default: - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown PublisherId type."); } break; default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; @@ -122,7 +122,7 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext dataSetReader->config.publisherId.type); break; default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; @@ -137,7 +137,7 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext &UA_TYPES[UA_TYPES_DURATION]); break; default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; @@ -153,7 +153,7 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext &UA_TYPES[UA_TYPES_UINT16]); break; default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; @@ -191,7 +191,7 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext break; } default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; @@ -211,13 +211,13 @@ onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext break; } default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown property."); } break; } default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown parent element."); } @@ -271,19 +271,19 @@ onWriteLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContex UA_WriterGroupConfig_clear(&writerGroupConfig); break; default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Write error! Unknown property element."); } break; } default: - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Read error! Unknown parent element."); } cleanup: if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Changing the ReaderGroupConfig failed with status %s", UA_StatusCode_name(res)); } @@ -352,7 +352,7 @@ addPubSubConnectionConfig(UA_Server *server, UA_PubSubConnectionDataType *pubsub UA_String_copy((UA_String *) pubsubConnection->publisherId.data, &connectionConfig.publisherId.string); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Unsupported PublisherId Type used."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -717,7 +717,7 @@ addPubSubConnectionLocked(UA_Server *server, UA_NodeId connectionId; retVal |= addPubSubConnectionConfig(server, pubSubConnection, &connectionId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addPubSubConnection failed"); return retVal; } @@ -727,7 +727,7 @@ addPubSubConnectionLocked(UA_Server *server, UA_WriterGroupDataType *writerGroup = &pubSubConnection->writerGroups[i]; retVal |= addWriterGroupConfig(server, connectionId, writerGroup, &writerGroupId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addWriterGroup failed"); return retVal; } @@ -736,7 +736,7 @@ addPubSubConnectionLocked(UA_Server *server, UA_DataSetWriterDataType *dataSetWriter = &writerGroup->dataSetWriters[j]; retVal |= addDataSetWriterConfig(server, &writerGroupId, dataSetWriter, NULL); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addDataSetWriter failed"); return retVal; } @@ -762,7 +762,7 @@ addPubSubConnectionLocked(UA_Server *server, UA_ReaderGroupDataType *readerGroup = &pubSubConnection->readerGroups[i]; retVal |= addReaderGroupConfig(server, connectionId, readerGroup, &readerGroupId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addReaderGroup failed"); return retVal; } @@ -773,7 +773,7 @@ addPubSubConnectionLocked(UA_Server *server, retVal |= addDataSetReaderConfig(server, readerGroupId, dataSetReader, &dataSetReaderId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addDataSetReader failed"); return retVal; } @@ -913,7 +913,7 @@ addDataSetReaderLocked(UA_Server *server, UA_StatusCode retVal = UA_STATUSCODE_GOOD; UA_ReaderGroup *rg = UA_ReaderGroup_findRGbyId(server, *objectId); if(rg->configurationFrozen) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "AddDataSetReader cannot be done because ReaderGroup config frozen"); return UA_STATUSCODE_BAD; } @@ -922,7 +922,7 @@ addDataSetReaderLocked(UA_Server *server, UA_DataSetReaderDataType *dataSetReader= (UA_DataSetReaderDataType *) input[0].data; retVal |= addDataSetReaderConfig(server, *objectId, dataSetReader, &dataSetReaderId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "AddDataSetReader failed"); return retVal; } @@ -1125,7 +1125,7 @@ addPublishedDataItemsAction(UA_Server *server, retVal |= UA_Server_addPublishedDataSet(server, &publishedDataSetConfig, &dataSetItemsNodeId).addResult; if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addPublishedDataset failed"); return retVal; } @@ -1142,7 +1142,7 @@ addPublishedDataItemsAction(UA_Server *server, retVal |= UA_Server_addDataSetField(server, dataSetItemsNodeId, &dataSetFieldConfig, NULL).result; if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addDataSetField failed"); return retVal; } @@ -1446,7 +1446,7 @@ addWriterGroupAction(UA_Server *server, UA_NodeId writerGroupId; retVal |= addWriterGroupConfig(server, *objectId, writerGroup, &writerGroupId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "addWriterGroup failed"); + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addWriterGroup failed"); UA_UNLOCK(&server->serviceMutex); return retVal; } @@ -1505,7 +1505,7 @@ addReserveIdsLocked(UA_Server *server, numRegDataSetWriterIds, transportProfileUri, &writerGroupIds, &dataSetWriterIds); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "addReserveIds failed"); + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addReserveIds failed"); return retVal; } @@ -1515,7 +1515,7 @@ addReserveIdsLocked(UA_Server *server, if(UA_String_equal(&transportProfileUri, &profile_1) || UA_String_equal(&transportProfileUri, &profile_2)) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, "ApplicationUri: %.*s", + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "ApplicationUri: %.*s", (int)server->config.applicationDescription.applicationUri.length, server->config.applicationDescription.applicationUri.data); retVal |= UA_Variant_setScalarCopy(&output[0], @@ -1596,7 +1596,7 @@ addReaderGroupAction(UA_Server *server, UA_NodeId readerGroupId; retVal |= addReaderGroupConfig(server, *objectId, readerGroup, &readerGroupId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, "addReaderGroup failed"); + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addReaderGroup failed"); UA_UNLOCK(&server->serviceMutex); return retVal; } @@ -1698,7 +1698,7 @@ addSecurityGroupRepresentation(UA_Server *server, UA_SecurityGroup *securityGrou &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], NULL, &securityGroup->securityGroupNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Add SecurityGroup failed with error: %s.", UA_StatusCode_name(retval)); return retval; @@ -1708,7 +1708,7 @@ addSecurityGroupRepresentation(UA_Server *server, UA_SecurityGroup *securityGrou &securityGroup->securityGroupNodeId, securityGroupConfig); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Add SecurityGroup failed with error: %s.", UA_StatusCode_name(retval)); deleteNode(server, securityGroup->securityGroupNodeId, true); @@ -1813,12 +1813,12 @@ addDataSetWriterLocked(UA_Server *server, UA_StatusCode retVal = UA_STATUSCODE_GOOD; UA_WriterGroup *wg = UA_WriterGroup_findWGbyId(server, *objectId); if(!wg) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Not a WriterGroup"); return UA_STATUSCODE_BAD; } if(wg->configurationFrozen) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addDataSetWriter cannot be done because writergroup config frozen"); return UA_STATUSCODE_BAD; } @@ -1827,7 +1827,7 @@ addDataSetWriterLocked(UA_Server *server, UA_DataSetWriterDataType *dataSetWriterData = (UA_DataSetWriterDataType *)input->data; retVal |= addDataSetWriterConfig(server, objectId, dataSetWriterData, &dataSetWriterId); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "addDataSetWriter failed"); return retVal; } @@ -1941,7 +1941,7 @@ setSecurityKeysLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessi ks->securityGroupID); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_INFO( - &server->config.logger, UA_LOGCATEGORY_SERVER, + server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to import Symmetric Keys into PubSub Channel Context with %s \n", UA_StatusCode_name(retval)); return retval; @@ -2128,7 +2128,7 @@ connectionTypeDestructor(UA_Server *server, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { UA_LOCK(&server->serviceMutex); - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "Connection destructor called!"); UA_NodeId publisherIdNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublisherId"), @@ -2145,7 +2145,7 @@ writerGroupTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "WriterGroup destructor called!"); UA_LOCK(&server->serviceMutex); UA_NodeId intervalNode = @@ -2163,7 +2163,7 @@ readerGroupTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "ReaderGroup destructor called!"); } @@ -2172,7 +2172,7 @@ dataSetWriterTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "DataSetWriter destructor called!"); UA_LOCK(&server->serviceMutex); UA_NodeId dataSetWriterIdNode = @@ -2190,7 +2190,7 @@ dataSetReaderTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "DataSetReader destructor called!"); UA_LOCK(&server->serviceMutex); UA_NodeId publisherIdNode = @@ -2208,7 +2208,7 @@ publishedDataItemsTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "PublishedDataItems destructor called!"); UA_LOCK(&server->serviceMutex); void *childContext; @@ -2238,7 +2238,7 @@ standaloneSubscribedDataSetTypeDestructor(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *typeId, void *typeContext, const UA_NodeId *nodeId, void **nodeContext) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "Standalone SubscribedDataSet destructor called!"); UA_LOCK(&server->serviceMutex); void *childContext; diff --git a/src/pubsub/ua_pubsub_reader.c b/src/pubsub/ua_pubsub_reader.c index 5788eaf299e..83e28247bfc 100644 --- a/src/pubsub/ua_pubsub_reader.c +++ b/src/pubsub/ua_pubsub_reader.c @@ -71,7 +71,7 @@ UA_DataSetReader_checkIdentifier(UA_Server *server, UA_NetworkMessage *msg, } if(msg->groupHeaderEnabled && msg->groupHeader.writerGroupIdEnabled) { if(reader->config.writerGroupId != msg->groupHeader.writerGroupId) { - UA_LOG_INFO_READER(&server->config.logger, reader, + UA_LOG_INFO_READER(server->config.logging, reader, "WriterGroupId doesn't match"); return UA_STATUSCODE_BADNOTFOUND; } @@ -85,7 +85,7 @@ UA_DataSetReader_checkIdentifier(UA_Server *server, UA_NetworkMessage *msg, } } if (iterator == totalDataSets) { - UA_LOG_INFO_READER(&server->config.logger, reader, "DataSetWriterId doesn't match"); + UA_LOG_INFO_READER(server->config.logging, reader, "DataSetWriterId doesn't match"); return UA_STATUSCODE_BADNOTFOUND; } } @@ -95,7 +95,7 @@ UA_DataSetReader_checkIdentifier(UA_Server *server, UA_NetworkMessage *msg, return UA_STATUSCODE_BADNOTFOUND; if(reader->config.dataSetWriterId == *msg->payloadHeader.dataSetPayloadHeader.dataSetWriterIds) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "DataSetReader found. Process NetworkMessage"); return UA_STATUSCODE_GOOD; } @@ -118,7 +118,7 @@ UA_DataSetReader_create(UA_Server *server, UA_NodeId readerGroupIdentifier, return UA_STATUSCODE_BADNOTFOUND; if(readerGroup->configurationFrozen) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_WARNING_READERGROUP(server->config.logging, readerGroup, "Add DataSetReader failed, Subscriber configuration is frozen"); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -139,7 +139,7 @@ UA_DataSetReader_create(UA_Server *server, UA_NodeId readerGroupIdentifier, #ifdef UA_ENABLE_PUBSUB_INFORMATIONMODEL retVal = addDataSetReaderRepresentation(server, newDataSetReader); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_ERROR_READERGROUP(server->config.logging, readerGroup, "Add DataSetReader failed, addDataSetReaderRepresentation failed"); UA_DataSetReaderConfig_clear(&newDataSetReader->config); UA_free(newDataSetReader); @@ -161,7 +161,7 @@ UA_DataSetReader_create(UA_Server *server, UA_NodeId readerGroupIdentifier, (void (*)(UA_Server *, void *)) UA_DataSetReader_handleMessageReceiveTimeout); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_ERROR_READERGROUP(server->config.logging, readerGroup, "Add DataSetReader failed, create message " "receive timeout timer failed"); UA_DataSetReaderConfig_clear(&newDataSetReader->config); @@ -182,15 +182,15 @@ UA_DataSetReader_create(UA_Server *server, UA_NodeId readerGroupIdentifier, newDataSetReader->config.linkedStandaloneSubscribedDataSetName); if(subscribedDataSet != NULL) { if(subscribedDataSet->config.subscribedDataSetType != UA_PUBSUB_SDS_TARGET) { - UA_LOG_ERROR_READER(&server->config.logger, newDataSetReader, + UA_LOG_ERROR_READER(server->config.logging, newDataSetReader, "Not implemented! Currently only SubscribedDataSet as " "TargetVariables is implemented"); } else { if(subscribedDataSet->config.isConnected) { - UA_LOG_ERROR_READER(&server->config.logger, newDataSetReader, + UA_LOG_ERROR_READER(server->config.logging, newDataSetReader, "SubscribedDataSet is already connected"); } else { - UA_LOG_DEBUG_READER(&server->config.logger, newDataSetReader, + UA_LOG_DEBUG_READER(server->config.logging, newDataSetReader, "Found SubscribedDataSet"); subscribedDataSet->config.isConnected = true; UA_DataSetMetaDataType_copy( @@ -243,7 +243,7 @@ UA_DataSetReader_create(UA_Server *server, UA_NodeId readerGroupIdentifier, retVal = UA_DataSetReader_setPubSubState(server, newDataSetReader, readerGroup->state, UA_STATUSCODE_GOOD); if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_ERROR_READERGROUP(server->config.logging, readerGroup, "Add DataSetReader failed, setPubSubState failed"); } } @@ -266,7 +266,7 @@ UA_Server_addDataSetReader(UA_Server *server, UA_NodeId readerGroupIdentifier, UA_StatusCode UA_DataSetReader_remove(UA_Server *server, UA_DataSetReader *dsr) { if(dsr->configurationFrozen) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Remove DataSetReader failed, " "Subscriber configuration is frozen"); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -284,7 +284,7 @@ UA_DataSetReader_remove(UA_Server *server, UA_DataSetReader *dsr) { stopMonitoring(server, dsr->identifier, UA_PUBSUB_COMPONENT_DATASETREADER, UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT, dsr); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "Remove DataSetReader failed. Stop message " "receive timeout timer of DataSetReader '%.*s' failed.", (int) dsr->config.name.length, dsr->config.name.data); @@ -295,7 +295,7 @@ UA_DataSetReader_remove(UA_Server *server, UA_DataSetReader *dsr) { deleteMonitoring(server, dsr->identifier, UA_PUBSUB_COMPONENT_DATASETREADER, UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT, dsr); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "Remove DataSetReader failed. Delete message receive " "timeout timer of DataSetReader '%.*s' failed.", (int) dsr->config.name.length, dsr->config.name.data); @@ -351,21 +351,21 @@ DataSetReader_updateConfig(UA_Server *server, UA_ReaderGroup *rg, UA_DataSetRead UA_LOCK_ASSERT(&server->serviceMutex, 1); if(dsr->configurationFrozen) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Update DataSetReader config failed. " "Subscriber configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } if(rg->configurationFrozen) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Update DataSetReader config failed. " "Subscriber configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } if(dsr->config.subscribedDataSetType != UA_PUBSUB_SDS_TARGET) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Unsupported SubscribedDataSetType."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -405,7 +405,7 @@ DataSetReader_updateConfig(UA_Server *server, UA_ReaderGroup *rg, UA_DataSetRead UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT, dsr); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "Update DataSetReader message receive timeout timer failed."); } } @@ -539,7 +539,7 @@ UA_DataSetReader_setState_disabled(UA_Server *server, UA_DataSetReader *dsr) { if(ret == UA_STATUSCODE_GOOD) { dsr->msgRcvTimeoutTimerRunning = false; } else { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "Disable ReaderGroup failed. Stop message receive " "timeout timer of DataSetReader '%.*s' failed.", (int) dsr->config.name.length, dsr->config.name.data); @@ -552,7 +552,7 @@ UA_DataSetReader_setState_disabled(UA_Server *server, UA_DataSetReader *dsr) { case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Received unknown PubSub state!"); } return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -579,7 +579,7 @@ UA_DataSetReader_setPubSubState(UA_Server *server, dataSetReader->state = state; break; default: - UA_LOG_WARNING_READER(&server->config.logger, dataSetReader, + UA_LOG_WARNING_READER(server->config.logging, dataSetReader, "Received unknown PubSub state!"); ret = UA_STATUSCODE_BADINVALIDARGUMENT; break; @@ -637,7 +637,7 @@ DataSetReader_createTargetVariables(UA_Server *server, UA_DataSetReader *dsr, UA_LOCK_ASSERT(&server->serviceMutex, 1); if(dsr->configurationFrozen) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Create Target Variables failed. " "Subscriber configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -686,7 +686,7 @@ UA_Server_DataSetReader_createDataSetMirror(UA_Server *server, UA_String *parent } if(pDataSetReader->configurationFrozen) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Add Target Variables failed. Subscriber configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } // TODO: Frozen configuration variable in TargetVariable structure @@ -744,11 +744,11 @@ UA_Server_DataSetReader_createDataSetMirror(UA_Server *server, UA_String *parent UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE), vAttr, NULL, &newNode); if(retval == UA_STATUSCODE_GOOD) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_USERLAND, "addVariableNode %s succeeded", szTmpName); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "addVariableNode: error 0x%" PRIx32, retval); } @@ -768,7 +768,7 @@ UA_Server_DataSetReader_createDataSetMirror(UA_Server *server, UA_String *parent static void DataSetReader_processRaw(UA_Server *server, UA_ReaderGroup *rg, UA_DataSetReader *dsr, UA_DataSetMessage* msg) { - UA_LOG_TRACE_READER(&server->config.logger, dsr, "Received RAW Frame"); + UA_LOG_TRACE_READER(server->config.logging, dsr, "Received RAW Frame"); msg->data.keyFrameData.fieldCount = (UA_UInt16) dsr->config.dataSetMetaData.fieldsSize; @@ -796,7 +796,7 @@ DataSetReader_processRaw(UA_Server *server, UA_ReaderGroup *rg, } } if(res != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "Error during Raw-decode KeyFrame field %u: %s", (unsigned)i, UA_StatusCode_name(res)); return; @@ -837,7 +837,7 @@ DataSetReader_processRaw(UA_Server *server, UA_ReaderGroup *rg, Operation_Write(server, &server->adminSession, NULL, &writeVal, &res); UA_clear(value, type); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "Error writing KeyFrame field %u: %s", (unsigned)i, UA_StatusCode_name(res)); } @@ -859,7 +859,7 @@ DataSetReader_processFixedSize(UA_Server *server, UA_ReaderGroup *rg, if(msg->data.keyFrameData.dataSetFields[i].value.type != (*tv->externalDataValue)->value.type) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "Mismatching type"); continue; } @@ -900,7 +900,7 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, msg->header.configVersionMajorVersion != 0 || msg->header.configVersionMinorVersion != 0 || msg->data.keyFrameData.fieldCount != 0) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "This DSR expects heartbeat, but the received " "message doesn't seem to be so."); } @@ -911,18 +911,18 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, return; } - UA_LOG_DEBUG_READER(&server->config.logger, dsr, + UA_LOG_DEBUG_READER(server->config.logging, dsr, "DataSetReader '%.*s': received a network message", (int)dsr->config.name.length, dsr->config.name.data); if(!msg->header.dataSetMessageValid) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "DataSetMessage is discarded: message is not valid"); /* To Do check ConfigurationVersion */ /* if(msg->header.configVersionMajorVersionEnabled) { * if(msg->header.configVersionMajorVersion != * dsr->config.dataSetMetaData.configurationVersion.majorVersion) { - * UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, + * UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, * "DataSetMessage is discarded: ConfigurationVersion " * "MajorVersion does not match"); * return; @@ -932,7 +932,7 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, } if(msg->header.dataSetMessageType != UA_DATASETMESSAGE_DATAKEYFRAME) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "DataSetMessage is discarded: Only keyframes are supported"); return; } @@ -981,7 +981,7 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, writeVal.value = msg->data.keyFrameData.dataSetFields[i]; Operation_Write(server, &server->adminSession, NULL, &writeVal, &res); if(res != UA_STATUSCODE_GOOD) - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "Error writing KeyFrame field %u: %s", (unsigned)i, UA_StatusCode_name(res)); } @@ -1015,7 +1015,7 @@ UA_DataSetReader_checkMessageReceiveTimeout(UA_Server *server, if(res == UA_STATUSCODE_GOOD) { dsr->msgRcvTimeoutTimerRunning = false; } else { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "DataSetReader '%.*s': stop receive timeout timer failed", (int)dsr->config.name.length, dsr->config.name.data); UA_DataSetReader_setPubSubState(server, dsr, UA_PUBSUBSTATE_ERROR, @@ -1028,12 +1028,12 @@ UA_DataSetReader_checkMessageReceiveTimeout(UA_Server *server, startMonitoring(server, dsr->identifier, UA_PUBSUB_COMPONENT_DATASETREADER, UA_PUBSUB_MONITORING_MESSAGE_RECEIVE_TIMEOUT, dsr); if(res == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_READER(&server->config.logger, dsr, + UA_LOG_DEBUG_READER(server->config.logging, dsr, "Info: DataSetReader '%.*s': start receive timeout timer", (int)dsr->config.name.length, dsr->config.name.data); dsr->msgRcvTimeoutTimerRunning = true; } else { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "Starting Message Receive Timeout timer failed."); UA_DataSetReader_setPubSubState(server, dsr, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); @@ -1047,13 +1047,13 @@ UA_DataSetReader_handleMessageReceiveTimeout(UA_Server *server, UA_DataSetReader UA_assert(dsr); if(dsr->componentType != UA_PUBSUB_COMPONENT_DATASETREADER) { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "UA_DataSetReader_handleMessageReceiveTimeout(): " "input param is not of type DataSetReader"); return; } - UA_LOG_DEBUG_READER(&server->config.logger, dsr, + UA_LOG_DEBUG_READER(server->config.logging, dsr, "UA_DataSetReader_handleMessageReceiveTimeout(): " "MessageReceiveTimeout occurred at DataSetReader " "'%.*s': MessageReceiveTimeout = %f Timer Id = %u ", @@ -1065,7 +1065,7 @@ UA_DataSetReader_handleMessageReceiveTimeout(UA_Server *server, UA_DataSetReader UA_DataSetReader_setPubSubState(server, dsr, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADTIMEOUT); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READER(&server->config.logger, dsr, + UA_LOG_ERROR_READER(server->config.logging, dsr, "UA_DataSetReader_handleMessageReceiveTimeout(): " "setting pubsub state failed"); } @@ -1085,7 +1085,7 @@ processMessageWithReader(UA_Server *server, UA_ReaderGroup *readerGroup, * written to the wrong dataset reader. */ if(!msg->payloadHeaderEnabled || (reader->config.dataSetWriterId == msg->payloadHeader.dataSetPayloadHeader.dataSetWriterIds[i])) { - UA_LOG_DEBUG_READER(&server->config.logger, reader, + UA_LOG_DEBUG_READER(server->config.logging, reader, "Process Msg with DataSetReader!"); UA_DataSetReader_process(server, readerGroup, reader, &msg->payload.dataSetPayload.dataSetMessages[i]); @@ -1198,7 +1198,7 @@ UA_ReaderGroup_decodeAndProcessRT(UA_Server *server, UA_ReaderGroup *readerGroup memset(¤tNetworkMessage, 0, sizeof(UA_NetworkMessage)); UA_StatusCode rv = UA_NetworkMessage_decodeHeaders(buf, &pos, ¤tNetworkMessage); if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_WARNING_READERGROUP(server->config.logging, readerGroup, "PubSub receive. decoding headers failed"); goto error; } @@ -1209,7 +1209,7 @@ UA_ReaderGroup_decodeAndProcessRT(UA_Server *server, UA_ReaderGroup *readerGroup matches[i] = (rv == UA_STATUSCODE_GOOD); i++; if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "PubSub receive. Message intended for a different reader."); continue; } @@ -1222,10 +1222,10 @@ UA_ReaderGroup_decodeAndProcessRT(UA_Server *server, UA_ReaderGroup *readerGroup /* Decrypt the message once for all readers */ #ifdef UA_ENABLE_PUBSUB_ENCRYPTION /* Keep pos to right after the header */ - rv = verifyAndDecryptNetworkMessage(&server->config.logger, buf, &pos, + rv = verifyAndDecryptNetworkMessage(server->config.logging, buf, &pos, ¤tNetworkMessage, readerGroup); if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_WARNING_READERGROUP(server->config.logging, readerGroup, "Subscribe failed. verify and decrypt network " "message failed."); goto error; @@ -1259,7 +1259,7 @@ UA_ReaderGroup_decodeAndProcessRT(UA_Server *server, UA_ReaderGroup *readerGroup rv = UA_NetworkMessage_updateBufferedNwMessage(&dsr->bufferedMessage, buf, &pos); } if(rv != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_READER(&server->config.logger, dsr, + UA_LOG_INFO_READER(server->config.logging, dsr, "PubSub decoding failed. Could not decode with " "status code %s.", UA_StatusCode_name(rv)); return false; diff --git a/src/pubsub/ua_pubsub_readergroup.c b/src/pubsub/ua_pubsub_readergroup.c index e45164cec0d..742c2954ccf 100644 --- a/src/pubsub/ua_pubsub_readergroup.c +++ b/src/pubsub/ua_pubsub_readergroup.c @@ -92,7 +92,7 @@ UA_ReaderGroup_create(UA_Server *server, UA_NodeId connectionId, return UA_STATUSCODE_BADNOTFOUND; if(connection->configurationFreezeCounter > 0) { - UA_LOG_WARNING_CONNECTION(&server->config.logger, connection, + UA_LOG_WARNING_CONNECTION(server->config.logging, connection, "Adding ReaderGroup failed. " "Connection configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -189,7 +189,7 @@ UA_Server_addReaderGroup(UA_Server *server, UA_NodeId connectionIdentifier, UA_StatusCode UA_ReaderGroup_remove(UA_Server *server, UA_ReaderGroup *rg) { if(rg->configurationFrozen) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Remove ReaderGroup failed. " "Subscriber configuration is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -315,7 +315,7 @@ UA_ReaderGroup_setPubSubState_disable(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Unknown PubSub state!"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -326,7 +326,7 @@ static UA_StatusCode UA_ReaderGroup_setPubSubState_paused(UA_Server *server, UA_ReaderGroup *rg, UA_StatusCode cause) { - UA_LOG_DEBUG_READERGROUP(&server->config.logger, rg, + UA_LOG_DEBUG_READERGROUP(server->config.logging, rg, "PubSub state paused is unsupported at the moment!"); (void)cause; switch(rg->state) { @@ -340,7 +340,7 @@ UA_ReaderGroup_setPubSubState_paused(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, "Unknown PubSub state!"); + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Unknown PubSub state!"); return UA_STATUSCODE_BADINTERNALERROR; } return UA_STATUSCODE_BADNOTSUPPORTED; @@ -358,7 +358,7 @@ UA_ReaderGroup_setPubSubState_operational(UA_Server *server, if(ret != UA_STATUSCODE_GOOD || (pubSubConnection->state != UA_PUBSUBSTATE_OPERATIONAL && pubSubConnection->state != UA_PUBSUBSTATE_PREOPERATIONAL)) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Connection not operational"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -367,7 +367,7 @@ UA_ReaderGroup_setPubSubState_operational(UA_Server *server, if(rg->recvChannelsSize == 0) ret = UA_ReaderGroup_connect(server, rg, false); if(ret != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_READERGROUP(&server->config.logger, rg, "Could not connect"); + UA_LOG_ERROR_READERGROUP(server->config.logging, rg, "Could not connect"); UA_PubSubConnection_setPubSubState(server, pubSubConnection, UA_PUBSUBSTATE_ERROR, ret); } @@ -406,7 +406,7 @@ UA_ReaderGroup_setPubSubState_error(UA_Server *server, case UA_PUBSUBSTATE_ERROR: return UA_STATUSCODE_GOOD; default: - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, "Unknown PubSub state!"); + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Unknown PubSub state!"); return UA_STATUSCODE_BADINTERNALERROR; } rg->state = UA_PUBSUBSTATE_ERROR; @@ -436,7 +436,7 @@ UA_ReaderGroup_setPubSubState(UA_Server *server, ret = UA_ReaderGroup_setPubSubState_error(server, readerGroup, cause); break; default: - UA_LOG_WARNING_READERGROUP(&server->config.logger, readerGroup, + UA_LOG_WARNING_READERGROUP(server->config.logging, readerGroup, "Received unknown PubSub state!"); break; } @@ -500,13 +500,13 @@ setReaderGroupEncryptionKeys(UA_Server *server, const UA_NodeId readerGroup, UA_ReaderGroup *rg = UA_ReaderGroup_findRGbyId(server, readerGroup); UA_CHECK_MEM(rg, return UA_STATUSCODE_BADNOTFOUND); if(rg->config.encodingMimeType == UA_PUBSUB_ENCODING_JSON) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "JSON encoding is enabled. The message security is " "only defined for the UADP message mapping."); return UA_STATUSCODE_BADINTERNALERROR; } if(!rg->config.securityPolicy) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "No SecurityPolicy configured for the ReaderGroup"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -579,7 +579,7 @@ UA_ReaderGroup_freezeConfiguration(UA_Server *server, UA_ReaderGroup *rg) { return UA_STATUSCODE_GOOD; if(dsrCount > 1) { - UA_LOG_WARNING_READERGROUP(&server->config.logger, rg, + UA_LOG_WARNING_READERGROUP(server->config.logging, rg, "Mutiple DSR in a readerGroup not supported in RT " "fixed size configuration"); return UA_STATUSCODE_BADNOTIMPLEMENTED; @@ -590,14 +590,14 @@ UA_ReaderGroup_freezeConfiguration(UA_Server *server, UA_ReaderGroup *rg) { /* Support only to UADP encoding */ if(dsr->config.messageSettings.content.decoded.type != &UA_TYPES[UA_TYPES_UADPDATASETREADERMESSAGEDATATYPE]) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "PubSub-RT configuration fail: Non-RT capable encoding."); return UA_STATUSCODE_BADNOTSUPPORTED; } /* Don't support string PublisherId for the fast-path (at this time) */ if(!dsr->config.publisherId.type->pointerFree) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "PubSub-RT configuration fail: String PublisherId"); return UA_STATUSCODE_BADNOTSUPPORTED; } @@ -610,7 +610,7 @@ UA_ReaderGroup_freezeConfiguration(UA_Server *server, UA_ReaderGroup *rg) { UA_NODESTORE_GET(server, &tv->targetVariable.targetNodeId); if(!rtNode || rtNode->valueBackend.backendType != UA_VALUEBACKENDTYPE_EXTERNAL) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "PubSub-RT configuration fail: PDS contains field " "without external data source."); UA_NODESTORE_RELEASE(server, (const UA_Node *) rtNode); @@ -626,13 +626,13 @@ UA_ReaderGroup_freezeConfiguration(UA_Server *server, UA_ReaderGroup *rg) { if((UA_NodeId_equal(&field->dataType, &UA_TYPES[UA_TYPES_STRING].typeId) || UA_NodeId_equal(&field->dataType, &UA_TYPES[UA_TYPES_BYTESTRING].typeId)) && field->maxStringLength == 0) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "PubSub-RT configuration fail: " "PDS contains String/ByteString with dynamic length."); return UA_STATUSCODE_BADNOTSUPPORTED; } else if(!UA_DataType_isNumeric(UA_findDataType(&field->dataType)) && !UA_NodeId_equal(&field->dataType, &UA_TYPES[UA_TYPES_BOOLEAN].typeId)) { - UA_LOG_WARNING_READER(&server->config.logger, dsr, + UA_LOG_WARNING_READER(server->config.logging, dsr, "PubSub-RT configuration fail: " "PDS contains variable with dynamic size."); return UA_STATUSCODE_BADNOTSUPPORTED; diff --git a/src/pubsub/ua_pubsub_securitygroup.c b/src/pubsub/ua_pubsub_securitygroup.c index 68440a3f5dd..24ee95ad348 100644 --- a/src/pubsub/ua_pubsub_securitygroup.c +++ b/src/pubsub/ua_pubsub_securitygroup.c @@ -75,7 +75,7 @@ static void updateSKSKeyStorage(UA_Server *server, UA_SecurityGroup *securityGroup){ if(!securityGroup) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_PUBSUB, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_PUBSUB, "UpdateSKSKeyStorage callback failed with Error: %s ", UA_StatusCode_name(UA_STATUSCODE_BADINVALIDARGUMENT)); return; @@ -89,7 +89,7 @@ updateSKSKeyStorage(UA_Server *server, UA_SecurityGroup *securityGroup){ retval = UA_ByteString_allocBuffer(&newKey, keyLength); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_PUBSUB, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_PUBSUB, "UpdateSKSKeyStorage callback failed to allocate memory for new key with Error: %s ", UA_StatusCode_name(retval)); return; @@ -115,7 +115,7 @@ updateSKSKeyStorage(UA_Server *server, UA_SecurityGroup *securityGroup){ UA_PubSubKeyListItem *newItem = UA_PubSubKeyStorage_push(keyStorage, &newKey, newKeyID); if(!newItem) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_PUBSUB, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_PUBSUB, "UpdateSKSKeyStorage callback failed to add new key to the " "sks keystorage for the SecurityGroup %.*s", (int)securityGroup->securityGroupId.length, @@ -254,7 +254,7 @@ addSecurityGroup(UA_Server *server, UA_NodeId securityGroupFolderNodeId, #ifdef UA_ENABLE_PUBSUB_INFORMATIONMODEL retval = addSecurityGroupRepresentation(server, newSecurityGroup); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Add SecurityGroup failed with error: %s.", UA_StatusCode_name(retval)); UA_SecurityGroup_delete(newSecurityGroup); diff --git a/src/pubsub/ua_pubsub_writer.c b/src/pubsub/ua_pubsub_writer.c index 9969a441f5b..f4ca4a84fdc 100644 --- a/src/pubsub/ua_pubsub_writer.c +++ b/src/pubsub/ua_pubsub_writer.c @@ -118,7 +118,7 @@ UA_DataSetWriter_setPubSubState(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Received unknown PubSub state!"); } break; @@ -133,7 +133,7 @@ UA_DataSetWriter_setPubSubState(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Received unknown PubSub state!"); } break; @@ -149,7 +149,7 @@ UA_DataSetWriter_setPubSubState(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Received unknown PubSub state!"); } break; @@ -164,12 +164,12 @@ UA_DataSetWriter_setPubSubState(UA_Server *server, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Received unknown PubSub state!"); } break; default: - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Received unknown PubSub state!"); } if (state != oldState) { @@ -198,14 +198,14 @@ UA_DataSetWriter_create(UA_Server *server, /* Make checks for a heartbeat */ if(UA_NodeId_isNull(&dataSet) && dataSetWriterConfig->keyFrameCount != 1) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Adding DataSetWriter failed: DataSet can be null only for " "a heartbeat in which case KeyFrameCount shall be 1"); return UA_STATUSCODE_BADCONFIGURATIONERROR; } if(wg->configurationFrozen) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Adding DataSetWriter failed: WriterGroup is frozen"); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -218,7 +218,7 @@ UA_DataSetWriter_create(UA_Server *server, return UA_STATUSCODE_BADNOTFOUND; if(currentDataSetContext->configurationFreezeCounter > 0) { - UA_LOG_WARNING_DATASET(&server->config.logger, currentDataSetContext, + UA_LOG_WARNING_DATASET(server->config.logging, currentDataSetContext, "Adding DataSetWriter failed: PublishedDataSet is frozen"); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -228,7 +228,7 @@ UA_DataSetWriter_create(UA_Server *server, TAILQ_FOREACH(tmpDSF, ¤tDataSetContext->fields, listEntry) { if(!tmpDSF->config.field.variable.rtValueSource.rtFieldSourceEnabled && !tmpDSF->config.field.variable.rtValueSource.rtInformationModelNode) { - UA_LOG_WARNING_DATASET(&server->config.logger, currentDataSetContext, + UA_LOG_WARNING_DATASET(server->config.logging, currentDataSetContext, "Adding DataSetWriter failed: " "Fields in PDS are not RT capable"); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -250,7 +250,7 @@ UA_DataSetWriter_create(UA_Server *server, UA_PUBSUBSTATE_OPERATIONAL, UA_STATUSCODE_GOOD); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Add DataSetWriter failed: setPubSubState failed"); UA_free(newDataSetWriter); return res; @@ -364,7 +364,7 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, UA_PublishedDataSet_findPDSbyId(server, dsw->connectedDataSet); if(!pds) { if(!UA_NodeId_isNull(&dsw->connectedDataSet)) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "PublishedDataSet not found"); return UA_STATUSCODE_BADINTERNALERROR; @@ -372,7 +372,7 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, res = UA_DataSetWriter_generateDataSetMessage(server, dsm, dsw); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "Heartbeat DataSetMessage creation failed"); } @@ -380,7 +380,7 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, } if(pds->promotedFieldsCount > 0) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "PDS contains promoted fields"); return UA_STATUSCODE_BADNOTSUPPORTED; @@ -395,7 +395,7 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, UA_NODESTORE_GET(server, publishedVariable); if(rtNode != NULL && rtNode->valueBackend.backendType != UA_VALUEBACKENDTYPE_EXTERNAL) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "PDS contains field without external data source"); UA_NODESTORE_RELEASE(server, (const UA_Node *)rtNode); @@ -409,14 +409,14 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, UA_NodeId_equal(&dsf->fieldMetaData.dataType, &UA_TYPES[UA_TYPES_BYTESTRING].typeId)) && dsf->fieldMetaData.maxStringLength == 0) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "PDS contains String/ByteString with dynamic length"); return UA_STATUSCODE_BADNOTSUPPORTED; } else if(!UA_DataType_isNumeric(UA_findDataType(&dsf->fieldMetaData.dataType)) && !UA_NodeId_equal(&dsf->fieldMetaData.dataType, &UA_TYPES[UA_TYPES_BOOLEAN].typeId)) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "PDS contains variable with dynamic size"); return UA_STATUSCODE_BADNOTSUPPORTED; @@ -426,7 +426,7 @@ UA_DataSetWriter_prepareDataSet(UA_Server *server, UA_DataSetWriter *dsw, /* Generate the DSM */ res = UA_DataSetWriter_generateDataSetMessage(server, dsm, dsw); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_WRITER(&server->config.logger, dsw, + UA_LOG_WARNING_WRITER(server->config.logging, dsw, "PubSub-RT configuration fail: " "DataSetMessage buffering failed"); } @@ -440,7 +440,7 @@ UA_DataSetWriter_remove(UA_Server *server, UA_DataSetWriter *dataSetWriter) { /* Frozen? */ if(dataSetWriter->configurationFrozen) { - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Remove DataSetWriter failed: WriterGroup is frozen"); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -772,7 +772,7 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server, if(dsm->networkMessageNumber != 0 || dsm->dataSetOffset != 0 || dsm->configuredSize != 0) { - UA_LOG_WARNING_WRITER(&server->config.logger, dataSetWriter, + UA_LOG_WARNING_WRITER(server->config.logging, dataSetWriter, "Static DSM configuration not supported, using defaults"); dsm->networkMessageNumber = 0; dsm->dataSetOffset = 0; diff --git a/src/pubsub/ua_pubsub_writergroup.c b/src/pubsub/ua_pubsub_writergroup.c index 09d245c27e1..ce44de34de6 100644 --- a/src/pubsub/ua_pubsub_writergroup.c +++ b/src/pubsub/ua_pubsub_writergroup.c @@ -108,7 +108,7 @@ UA_WriterGroup_create(UA_Server *server, const UA_NodeId connection, return UA_STATUSCODE_BADNOTFOUND; if(currentConnectionContext->configurationFreezeCounter > 0) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Adding WriterGroup failed. PubSubConnection is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -225,7 +225,7 @@ UA_WriterGroup_remove(UA_Server *server, UA_WriterGroup *wg) { UA_LOCK_ASSERT(&server->serviceMutex, 1); if(wg->configurationFrozen) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Deleting the WriterGroup failed. " "WriterGroup is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -236,7 +236,7 @@ UA_WriterGroup_remove(UA_Server *server, UA_WriterGroup *wg) { return UA_STATUSCODE_BADNOTFOUND; if(connection->configurationFreezeCounter > 0) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Deleting the WriterGroup failed. " "PubSubConnection is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; @@ -324,7 +324,7 @@ UA_WriterGroup_freezeConfiguration(UA_Server *server, UA_WriterGroup *wg) { /* Check if RT is possible */ if(wg->config.encodingMimeType != UA_PUBSUB_ENCODING_UADP) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "PubSub-RT configuration fail: Non-RT capable encoding."); return UA_STATUSCODE_BADNOTSUPPORTED; } @@ -545,7 +545,7 @@ UA_WriterGroup_updateConfig(UA_Server *server, UA_WriterGroup *wg, return UA_STATUSCODE_BADINVALIDARGUMENT; if(wg->configurationFrozen){ - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Modify WriterGroup failed. WriterGroup is frozen."); return UA_STATUSCODE_BADCONFIGURATIONERROR; } @@ -555,7 +555,7 @@ UA_WriterGroup_updateConfig(UA_Server *server, UA_WriterGroup *wg, if(wg->config.maxEncapsulatedDataSetMessageCount != config->maxEncapsulatedDataSetMessageCount) { wg->config.maxEncapsulatedDataSetMessageCount = config->maxEncapsulatedDataSetMessageCount; if(wg->config.messageSettings.encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "MaxEncapsulatedDataSetMessag need enabled " "'PayloadHeader' within the message settings."); } @@ -571,7 +571,7 @@ UA_WriterGroup_updateConfig(UA_Server *server, UA_WriterGroup *wg, } if(wg->config.priority != config->priority) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "Priority parameter is not yet " "supported for WriterGroup updates"); } @@ -667,12 +667,12 @@ setWriterGroupEncryptionKeys(UA_Server *server, const UA_NodeId writerGroup, if(!wg) return UA_STATUSCODE_BADNOTFOUND; if(wg->config.encodingMimeType == UA_PUBSUB_ENCODING_JSON) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "JSON encoding is enabled. The message security is only defined for the UADP message mapping."); return UA_STATUSCODE_BADINTERNALERROR; } if(!wg->config.securityPolicy) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, wg, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, wg, "No SecurityPolicy configured for the WriterGroup"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -749,7 +749,7 @@ UA_WriterGroup_setPubSubState(UA_Server *server, UA_WriterGroup *writerGroup, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Received unknown PubSub state!"); } break; @@ -764,7 +764,7 @@ UA_WriterGroup_setPubSubState(UA_Server *server, UA_WriterGroup *writerGroup, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Received unknown PubSub state!"); } break; @@ -794,7 +794,7 @@ UA_WriterGroup_setPubSubState(UA_Server *server, UA_WriterGroup *writerGroup, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Received unknown PubSub state!"); } @@ -805,7 +805,7 @@ UA_WriterGroup_setPubSubState(UA_Server *server, UA_WriterGroup *writerGroup, if(ret != UA_STATUSCODE_GOOD || (c->state != UA_PUBSUBSTATE_OPERATIONAL && c->state != UA_PUBSUBSTATE_PREOPERATIONAL)) { - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Connection not operational"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -828,14 +828,14 @@ UA_WriterGroup_setPubSubState(UA_Server *server, UA_WriterGroup *writerGroup, case UA_PUBSUBSTATE_ERROR: break; default: - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Received unknown PubSub state!"); } writerGroup->state = UA_PUBSUBSTATE_ERROR; break; } default: - UA_LOG_WARNING_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_WARNING_WRITERGROUP(server->config.logging, writerGroup, "Received unknown PubSub state!"); } @@ -932,7 +932,7 @@ sendNetworkMessageBuffer(UA_Server *server, UA_WriterGroup *wg, /* Failure, set the WriterGroup into an error mode */ if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Sending NetworkMessage failed"); UA_WriterGroup_setPubSubState(server, wg, UA_PUBSUBSTATE_ERROR, res); UA_PubSubConnection_setPubSubState(server, connection, UA_PUBSUBSTATE_ERROR, res); @@ -972,7 +972,7 @@ sendNetworkMessageJson(UA_Server *server, UA_PubSubConnection *connection, UA_Wr if(wg->sendChannel != 0) sendChannel = wg->sendChannel; if(sendChannel == 0) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Cannot send, no open connection"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1131,7 +1131,7 @@ sendNetworkMessageBinary(UA_Server *server, UA_PubSubConnection *connection, UA_ if(wg->sendChannel != 0) sendChannel = wg->sendChannel; if(sendChannel == 0) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "Cannot send, no open connection"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1164,7 +1164,7 @@ publishRT(UA_Server *server, UA_WriterGroup *writerGroup, UA_PubSubConnection *c UA_NetworkMessage_updateBufferedMessage(&writerGroup->bufferedMessage); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_DEBUG_WRITERGROUP(server->config.logging, writerGroup, "PubSub sending. Unknown field type."); return; } @@ -1189,7 +1189,7 @@ publishRT(UA_Server *server, UA_WriterGroup *writerGroup, UA_PubSubConnection *c writerGroup->bufferedMessage.encryptBuffer.length - sigSize); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, writerGroup, "PubSub Encryption failed"); return; } @@ -1207,7 +1207,7 @@ publishRT(UA_Server *server, UA_WriterGroup *writerGroup, UA_PubSubConnection *c if(writerGroup->sendChannel != 0) sendChannel = writerGroup->sendChannel; if(sendChannel == 0) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, writerGroup, "Cannot send, no open connection"); return; } @@ -1216,7 +1216,7 @@ publishRT(UA_Server *server, UA_WriterGroup *writerGroup, UA_PubSubConnection *c UA_ByteString outBuf; res = cm->allocNetworkBuffer(cm, sendChannel, &outBuf, buf->length); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, writerGroup, "PubSub message memory allocation failed"); return; } @@ -1244,7 +1244,7 @@ sendNetworkMessage(UA_Server *server, UA_WriterGroup *wg, UA_PubSubConnection *c /* If sending failed, disable all writer of the writergroup */ if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, wg, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, wg, "PubSub Publish: Could not send a NetworkMessage " "with status code %s", UA_StatusCode_name(res)); UA_WriterGroup_setPubSubState(server, wg, UA_PUBSUBSTATE_ERROR, res); @@ -1260,7 +1260,7 @@ UA_WriterGroup_publishCallback(UA_Server *server, UA_WriterGroup *writerGroup) { UA_LOCK(&server->serviceMutex); - UA_LOG_DEBUG_WRITERGROUP(&server->config.logger, writerGroup, "Publish Callback"); + UA_LOG_DEBUG_WRITERGROUP(server->config.logging, writerGroup, "Publish Callback"); /* Nothing to do? */ if(writerGroup->writersCount == 0) { @@ -1271,7 +1271,7 @@ UA_WriterGroup_publishCallback(UA_Server *server, UA_WriterGroup *writerGroup) { /* Find the connection associated with the writer */ UA_PubSubConnection *connection = writerGroup->linkedConnection; if(!connection) { - UA_LOG_ERROR_WRITERGROUP(&server->config.logger, writerGroup, + UA_LOG_ERROR_WRITERGROUP(server->config.logging, writerGroup, "Publish failed. PubSubConnection invalid"); UA_WriterGroup_setPubSubState(server, writerGroup, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADNOTCONNECTED); @@ -1311,7 +1311,7 @@ UA_WriterGroup_publishCallback(UA_Server *server, UA_WriterGroup *writerGroup) { UA_PublishedDataSet *pds = (heartbeat) ? NULL : UA_PublishedDataSet_findPDSbyId(server, dsw->connectedDataSet); if(!heartbeat && !pds) { - UA_LOG_ERROR_WRITER(&server->config.logger, dsw, + UA_LOG_ERROR_WRITER(server->config.logging, dsw, "PubSub Publish: PublishedDataSet not found"); UA_DataSetWriter_setPubSubState(server, dsw, UA_PUBSUBSTATE_ERROR, UA_STATUSCODE_BADINTERNALERROR); @@ -1323,7 +1323,7 @@ UA_WriterGroup_publishCallback(UA_Server *server, UA_WriterGroup *writerGroup) { UA_StatusCode res = UA_DataSetWriter_generateDataSetMessage(server, &dsmStore[dsmCount], dsw); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR_WRITER(&server->config.logger, dsw, + UA_LOG_ERROR_WRITER(server->config.logging, dsw, "PubSub Publish: DataSetMessage creation failed"); UA_DataSetWriter_setPubSubState(server, dsw, UA_PUBSUBSTATE_ERROR, res); continue; diff --git a/src/server/ua_discovery.c b/src/server/ua_discovery.c index 1d24e81a772..23375cbd8ed 100644 --- a/src/server/ua_discovery.c +++ b/src/server/ua_discovery.c @@ -54,7 +54,7 @@ UA_DiscoveryManager_free(UA_Server *server, UA_DiscoveryManager *dm = (UA_DiscoveryManager*)sc; if(sc->state != UA_LIFECYCLESTATE_STOPPED) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Cannot delete the DiscoveryManager because " "it is not stopped"); return UA_STATUSCODE_BADINTERNALERROR; @@ -123,7 +123,7 @@ UA_DiscoveryManager_cleanupTimedOut(UA_Server *server, semaphoreDeleted = UA_fileExists(filePath) == false; UA_free(filePath); } else { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Cannot check registration semaphore. Out of memory"); } } @@ -133,7 +133,7 @@ UA_DiscoveryManager_cleanupTimedOut(UA_Server *server, (server->config.discoveryCleanupTimeout && current->lastSeen < timedOut)) { if(semaphoreDeleted) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Registration of server with URI %.*s is removed because " "the semaphore file '%.*s' was deleted", (int)current->registeredServer.serverUri.length, @@ -142,7 +142,7 @@ UA_DiscoveryManager_cleanupTimedOut(UA_Server *server, current->registeredServer.semaphoreFilePath.data); } else { // cppcheck-suppress unreadVariable - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Registration of server with URI %.*s has timed out " "and is removed", (int)current->registeredServer.serverUri.length, @@ -173,7 +173,7 @@ UA_DiscoveryManager_start(UA_Server *server, if(res != UA_STATUSCODE_GOOD) return res; - dm->logging = &server->config.logger; + dm->logging = server->config.logging; dm->serverConfig = &server->config; #ifdef UA_ENABLE_DISCOVERY_MULTICAST @@ -265,10 +265,10 @@ register2AsyncResponse(UA_Client *client, void *userdata, const UA_ServerConfig *sc = ar->dm->serverConfig; UA_RegisterServer2Response *response = (UA_RegisterServer2Response*)resp; if(response->responseHeader.serviceResult == UA_STATUSCODE_GOOD) { - UA_LOG_INFO(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(sc->logging, UA_LOGCATEGORY_SERVER, "RegisterServer succeeded"); } else { - UA_LOG_WARNING(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(sc->logging, UA_LOGCATEGORY_SERVER, "RegisterServer failed with statuscode %s", UA_StatusCode_name(response->responseHeader.serviceResult)); } @@ -314,7 +314,7 @@ registerAsyncResponse(UA_Client *client, void *userdata, /* Close the client connection, will be cleaned up in the client state * callback when closing is complete */ UA_Client_disconnectSecureChannelAsync(ar->client); - UA_LOG_INFO(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(sc->logging, UA_LOGCATEGORY_SERVER, "RegisterServer succeeded"); return; } @@ -325,7 +325,7 @@ registerAsyncResponse(UA_Client *client, void *userdata, /* Close the client connection, will be cleaned up in the client state * callback when closing is complete */ UA_Client_disconnectSecureChannelAsync(ar->client); - UA_LOG_WARNING(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(sc->logging, UA_LOGCATEGORY_SERVER, "RegisterServer failed with error %s", UA_StatusCode_name(serviceResult)); return; @@ -355,7 +355,7 @@ registerAsyncResponse(UA_Client *client, void *userdata, /* Close the client connection, will be cleaned up in the client state * callback when closing is complete */ UA_Client_disconnectSecureChannelAsync(ar->client); - UA_LOG_ERROR(&sc->logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_ERROR(sc->logging, UA_LOGCATEGORY_CLIENT, "RegisterServer2 failed with statuscode %s", UA_StatusCode_name(res)); } @@ -373,7 +373,7 @@ discoveryClientStateCallback(UA_Client *client, /* Connection failed */ if(connectStatus != UA_STATUSCODE_GOOD) { if(connectStatus != UA_STATUSCODE_BADCONNECTIONCLOSED) { - UA_LOG_ERROR(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(sc->logging, UA_LOGCATEGORY_SERVER, "Could not connect to the Discovery server with error %s", UA_StatusCode_name(connectStatus)); } @@ -412,7 +412,7 @@ discoveryClientStateCallback(UA_Client *client, /* Close the client connection, will be cleaned up in the client state * callback when closing is complete */ UA_Client_disconnectSecureChannelAsync(ar->client); - UA_LOG_ERROR(&sc->logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_ERROR(sc->logging, UA_LOGCATEGORY_CLIENT, "RegisterServer failed with statuscode %s", UA_StatusCode_name(res)); } @@ -433,7 +433,7 @@ UA_Server_register(UA_Server *server, UA_ClientConfig *cc, UA_Boolean unregister /* Check that the discovery manager is running */ UA_ServerConfig *sc = &server->config; if(dm->sc.state != UA_LIFECYCLESTATE_STARTED) { - UA_LOG_ERROR(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(sc->logging, UA_LOGCATEGORY_SERVER, "The server must be started for registering"); UA_ClientConfig_clear(cc); return UA_STATUSCODE_BADINTERNALERROR; @@ -448,7 +448,7 @@ UA_Server_register(UA_Server *server, UA_ClientConfig *cc, UA_Boolean unregister } } if(!ar) { - UA_LOG_ERROR(&sc->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(sc->logging, UA_LOGCATEGORY_SERVER, "Too many outstanding register requests. Cannot proceed."); UA_ClientConfig_clear(cc); return UA_STATUSCODE_BADINTERNALERROR; @@ -506,7 +506,7 @@ UA_StatusCode UA_Server_registerDiscovery(UA_Server *server, UA_ClientConfig *cc, const UA_String discoveryServerUrl, const UA_String semaphoreFilePath) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Registering at the DiscoveryServer: %.*s", (int)discoveryServerUrl.length, discoveryServerUrl.data); UA_LOCK(&server->serviceMutex); @@ -519,7 +519,7 @@ UA_Server_registerDiscovery(UA_Server *server, UA_ClientConfig *cc, UA_StatusCode UA_Server_deregisterDiscovery(UA_Server *server, UA_ClientConfig *cc, const UA_String discoveryServerUrl) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Deregistering at the DiscoveryServer: %.*s", (int)discoveryServerUrl.length, discoveryServerUrl.data); UA_LOCK(&server->serviceMutex); diff --git a/src/server/ua_discovery.h b/src/server/ua_discovery.h index 0a6214a3f8f..55248c3f4c2 100644 --- a/src/server/ua_discovery.h +++ b/src/server/ua_discovery.h @@ -76,7 +76,7 @@ struct UA_DiscoveryManager { UA_UInt64 discoveryCallbackId; /* Taken from the server config during startup */ - UA_Logger *logging; + const UA_Logger *logging; UA_ServerConfig *serverConfig; /* Outstanding requests. So they can be cancelled during shutdown. */ diff --git a/src/server/ua_discovery_mdns.c b/src/server/ua_discovery_mdns.c index 4cde3c05d14..4e20df4a5d9 100644 --- a/src/server/ua_discovery_mdns.c +++ b/src/server/ua_discovery_mdns.c @@ -942,7 +942,7 @@ startMulticastDiscoveryServer(UA_Server *server) { if(dm->mdnsSendConnection == 0) discovery_createMulticastSocket(server, dm); if(dm->mdnsSendConnection == 0) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_DISCOVERY, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_DISCOVERY, "Could not create multicast socket"); return; } @@ -1156,7 +1156,7 @@ discovery_multicastQueryAnswer(mdns_answer_t *a, void *arg) { if(mdnsd_has_query(dm->mdnsDaemon, a->rdname)) return 0; - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_DISCOVERY, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_DISCOVERY, "mDNS send query for: %s SRV&TXT %s", a->name, a->rdname); mdnsd_query(dm->mdnsDaemon, a->rdname, QTYPE_SRV, diff --git a/src/server/ua_server.c b/src/server/ua_server.c index 7bb83f608cb..74f8eca3c3c 100644 --- a/src/server/ua_server.c +++ b/src/server/ua_server.c @@ -248,7 +248,7 @@ UA_Server_delete(UA_Server *server) { } if(server->state != UA_LIFECYCLESTATE_STOPPED) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "The server must be fully stopped before it can be deleted"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -335,7 +335,7 @@ static UA_Server * UA_Server_init(UA_Server *server) { UA_StatusCode res = UA_STATUSCODE_GOOD; UA_CHECK_FATAL(UA_Server_NodestoreIsConfigured(server), goto cleanup, - &server->config.logger, UA_LOGCATEGORY_SERVER, + server->config.logging, UA_LOGCATEGORY_SERVER, "No Nodestore configured in the server"); /* Init start time to zero, the actual start time will be sampled in @@ -423,27 +423,14 @@ UA_Server_newWithConfig(UA_ServerConfig *config) { UA_CHECK_MEM(config, return NULL); UA_CHECK_LOG(config->eventLoop != NULL, return NULL, ERROR, - &config->logger, UA_LOGCATEGORY_SERVER, "No EventLoop configured"); + config->logging, UA_LOGCATEGORY_SERVER, "No EventLoop configured"); UA_Server *server = (UA_Server *)UA_calloc(1, sizeof(UA_Server)); UA_CHECK_MEM(server, UA_ServerConfig_clean(config); return NULL); server->config = *config; - /* The config might have been "moved" into the server struct. Ensure that - * the logger pointer is correct. */ - for(size_t i = 0; i < server->config.securityPoliciesSize; i++) - if(server->config.securityPolicies[i].logger == &config->logger) - server->config.securityPolicies[i].logger = &server->config.logger; - - if(server->config.eventLoop->logger == &config->logger) - server->config.eventLoop->logger = &server->config.logger; - - if((server->config.logging == NULL) || - (server->config.logging == &config->logger)) { - /* re-set the logger pointer */ - server->config.logging = &server->config.logger; - } + /* If not defined, set logging to what the server has */ if(!server->config.secureChannelPKI.logging) server->config.secureChannelPKI.logging = server->config.logging; if(!server->config.sessionPKI.logging) @@ -461,7 +448,7 @@ setServerShutdown(UA_Server *server) { return false; if(server->config.shutdownDelay == 0) return true; - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Shutting down the server with a delay of %i ms", (int)server->config.shutdownDelay); server->endTime = UA_DateTime_now() + (UA_DateTime)(server->config.shutdownDelay * UA_DATETIME_MSEC); return false; @@ -629,7 +616,7 @@ verifyServerApplicationURI(const UA_Server *server) { &sp->localCertificate, &server->config.applicationDescription.applicationUri); - UA_CHECK_STATUS_ERROR(retval, return retval, &server->config.logger, UA_LOGCATEGORY_SERVER, + UA_CHECK_STATUS_ERROR(retval, return retval, server->config.logging, UA_LOGCATEGORY_SERVER, "The configured ApplicationURI \"%.*s\"does not match the " "ApplicationURI specified in the certificate for the " "SecurityPolicy %.*s", @@ -699,13 +686,13 @@ UA_Server_run_startup(UA_Server *server) { * with authentication tokens and other important variables E.g. if fuzzing * is enabled, and two clients are connected, subscriptions do not work * properly, since the tokens will be overridden to allow easier fuzzing. */ - UA_LOG_FATAL(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_FATAL(server->config.logging, UA_LOGCATEGORY_SERVER, "Server was built with unsafe fuzzing mode. " "This should only be used for specific fuzzing builds."); #endif if(server->state != UA_LIFECYCLESTATE_STOPPED) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "The server has already been started"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -719,8 +706,8 @@ UA_Server_run_startup(UA_Server *server) { } } if(config->accessControl.userTokenPoliciesSize == 0 && hasUserIdentityTokens == false) { - UA_LOG_ERROR(&config->logger, UA_LOGCATEGORY_SERVER, - "The server has no userIdentificationPolicies defined."); + UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_SERVER, + "The server has no userIdentificationPolicies defined."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -728,7 +715,7 @@ UA_Server_run_startup(UA_Server *server) { UA_StatusCode retVal = UA_STATUSCODE_GOOD; UA_EventLoop *el = config->eventLoop; UA_CHECK_MEM_ERROR(el, return UA_STATUSCODE_BADINTERNALERROR, - &config->logger, UA_LOGCATEGORY_SERVER, + config->logging, UA_LOGCATEGORY_SERVER, "An EventLoop must be configured"); if(el->state != UA_EVENTLOOPSTATE_STARTED) { @@ -748,7 +735,7 @@ UA_Server_run_startup(UA_Server *server) { /* Are there enough SecureChannels possible for the max number of sessions? */ if(config->maxSecureChannels != 0 && (config->maxSessions == 0 || config->maxSessions >= config->maxSecureChannels)) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "Maximum SecureChannels count not enough for the " "maximum Sessions count"); } @@ -757,7 +744,7 @@ UA_Server_run_startup(UA_Server *server) { retVal = addRepeatedCallback(server, serverHouseKeeping, NULL, 1000.0, &server->houseKeepingCallbackId); UA_CHECK_STATUS_ERROR(retVal, UA_UNLOCK(&server->serviceMutex); return retVal, - &config->logger, UA_LOGCATEGORY_SERVER, + config->logging, UA_LOGCATEGORY_SERVER, "Could not create the server housekeeping task"); /* Ensure that the uri for ns1 is set up from the app description */ @@ -765,7 +752,7 @@ UA_Server_run_startup(UA_Server *server) { /* At least one endpoint has to be configured */ if(config->endpointsSize == 0) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "There has to be at least one endpoint."); } @@ -848,7 +835,7 @@ UA_Server_run_shutdown(UA_Server *server) { UA_LOCK(&server->serviceMutex); if(server->state != UA_LIFECYCLESTATE_STARTED) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "The server is not started, cannot be shut down"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADINTERNALERROR; diff --git a/src/server/ua_server_async.c b/src/server/ua_server_async.c index 2d0bfe091ab..1642530e9b2 100644 --- a/src/server/ua_server_async.c +++ b/src/server/ua_server_async.c @@ -28,7 +28,7 @@ UA_AsyncManager_sendAsyncResponse(UA_AsyncManager *am, UA_Server *server, if(!session) { UA_String sessionId = UA_STRING_NULL; UA_NodeId_print(&ar->sessionId, &sessionId); - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Async Service: Session %.*s no longer exists", (int)sessionId.length, sessionId.data); UA_String_clear(&sessionId); @@ -39,7 +39,7 @@ UA_AsyncManager_sendAsyncResponse(UA_AsyncManager *am, UA_Server *server, /* Check the channel */ UA_SecureChannel *channel = session->header.channel; if(!channel) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Async Service Response cannot be sent. " "No SecureChannel for the session."); UA_AsyncManager_removeAsyncResponse(&server->asyncManager, ar); @@ -56,7 +56,7 @@ UA_AsyncManager_sendAsyncResponse(UA_AsyncManager *am, UA_Server *server, sendResponse(server, session, channel, ar->requestId, (UA_Response*)&ar->response, &UA_TYPES[UA_TYPES_CALLRESPONSE]); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Async Response for Req# %" PRIu32 " failed " "with StatusCode %s", ar->requestId, UA_StatusCode_name(res)); @@ -78,7 +78,7 @@ integrateOperationResult(UA_AsyncManager *am, UA_Server *server, /* Reduce the number of open results */ ar->opCountdown -= 1; - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Return result in the server thread with %" PRIu32 " remaining", ar->opCountdown); @@ -139,7 +139,7 @@ checkTimeouts(UA_Server *server, void *_) { op->response.statusCode = UA_STATUSCODE_BADTIMEOUT; TAILQ_REMOVE(&am->dispatchedQueue, op, pointers); TAILQ_INSERT_TAIL(&am->resultQueue, op, pointers); - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Operation was removed due to a timeout"); } @@ -153,7 +153,7 @@ checkTimeouts(UA_Server *server, void *_) { op->response.statusCode = UA_STATUSCODE_BADTIMEOUT; TAILQ_REMOVE(&am->newQueue, op, pointers); TAILQ_INSERT_TAIL(&am->resultQueue, op, pointers); - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Operation was removed due to a timeout"); } @@ -258,7 +258,7 @@ UA_AsyncManager_createAsyncOp(UA_AsyncManager *am, UA_Server *server, const UA_CallMethodRequest *opRequest) { if(server->config.maxAsyncOperationQueueSize != 0 && am->opsCount >= server->config.maxAsyncOperationQueueSize) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetNextAsyncMethod: Queue exceeds limit (%d).", (int unsigned)server->config.maxAsyncOperationQueueSize); return UA_STATUSCODE_BADUNEXPECTEDERROR; @@ -266,14 +266,14 @@ UA_AsyncManager_createAsyncOp(UA_AsyncManager *am, UA_Server *server, UA_AsyncOperation *ao = (UA_AsyncOperation*)UA_calloc(1, sizeof(UA_AsyncOperation)); if(!ao) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetNextAsyncMethod: Mem alloc failed."); return UA_STATUSCODE_BADOUTOFMEMORY; } UA_StatusCode result = UA_CallMethodRequest_copy(opRequest, &ao->request); if(result != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetAsyncMethodResult: UA_CallMethodRequest_copy failed."); UA_free(ao); return result; @@ -331,7 +331,7 @@ UA_Server_setAsyncOperationResult(UA_Server *server, UA_AsyncOperation *ao = (UA_AsyncOperation*)context; if(!ao) { /* Something went wrong. Not a good AsyncOp. */ - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetAsyncMethodResult: Invalid context"); return; } @@ -353,7 +353,7 @@ UA_Server_setAsyncOperationResult(UA_Server *server, } if(!found) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetAsyncMethodResult: The operation has timed out"); UA_UNLOCK(&am->queueLock); return; @@ -363,7 +363,7 @@ UA_Server_setAsyncOperationResult(UA_Server *server, UA_StatusCode result = UA_CallMethodResult_copy(&response->callMethodResult, &ao->response); if(result != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "UA_Server_SetAsyncMethodResult: UA_CallMethodResult_copy failed."); ao->response.statusCode = UA_STATUSCODE_BADOUTOFMEMORY; } @@ -374,7 +374,7 @@ UA_Server_setAsyncOperationResult(UA_Server *server, UA_UNLOCK(&am->queueLock); - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Set the result from the worker thread"); } diff --git a/src/server/ua_server_binary.c b/src/server/ua_server_binary.c index dc5c4e1768f..86e93214b48 100644 --- a/src/server/ua_server_binary.c +++ b/src/server/ua_server_binary.c @@ -81,7 +81,7 @@ typedef struct { UA_ServerComponent sc; UA_Server *server; /* remember the pointer so we don't need an additional context pointer for connections */ - UA_Logger *logging; /* shortcut */ + const UA_Logger *logging; /* shortcut */ UA_UInt64 houseKeepingCallbackId; UA_ServerConnection serverConnections[UA_MAXSERVERCONNECTIONS]; @@ -487,7 +487,7 @@ processHEL(UA_Server *server, UA_SecureChannel *channel, const UA_ByteString *ms retval = UA_SecureChannel_processHELACK(channel, (UA_TcpAcknowledgeMessage*)&helloMessage); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Error during the HEL/ACK handshake"); return retval; } @@ -547,7 +547,7 @@ processOPN(UA_Server *server, UA_SecureChannel *channel, UA_StatusCode retval = UA_NodeId_decodeBinary(msg, &offset, &requestType); if(retval != UA_STATUSCODE_GOOD) { UA_NodeId_clear(&requestType); - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Could not decode the NodeId. " "Closing the SecureChannel."); UA_SecureChannel_shutdown(channel, UA_SHUTDOWNREASON_REJECT); @@ -562,7 +562,7 @@ processOPN(UA_Server *server, UA_SecureChannel *channel, if(retval != UA_STATUSCODE_GOOD || !UA_NodeId_equal(&requestType, opnRequestId)) { UA_NodeId_clear(&requestType); UA_OpenSecureChannelRequest_clear(&openSecureChannelRequest); - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Could not decode the OPN message. " "Closing the SecureChannel."); UA_SecureChannel_shutdown(channel, UA_SHUTDOWNREASON_REJECT); @@ -576,7 +576,7 @@ processOPN(UA_Server *server, UA_SecureChannel *channel, Service_OpenSecureChannel(server, channel, &openSecureChannelRequest, &openScResponse); UA_OpenSecureChannelRequest_clear(&openSecureChannelRequest); if(openScResponse.responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Could not open a SecureChannel. " "Closing the connection."); UA_SecureChannel_shutdown(channel, UA_SHUTDOWNREASON_REJECT); @@ -588,7 +588,7 @@ processOPN(UA_Server *server, UA_SecureChannel *channel, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); UA_OpenSecureChannelResponse_clear(&openScResponse); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Could not send the OPN answer with error code %s", UA_StatusCode_name(retval)); UA_SecureChannel_shutdown(channel, UA_SHUTDOWNREASON_REJECT); @@ -614,21 +614,21 @@ sendResponse(UA_Server *server, UA_Session *session, UA_SecureChannel *channel, if(session) { #ifdef UA_ENABLE_TYPEDESCRIPTION - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Sending response for RequestId %u of type %s", (unsigned)requestId, responseType->typeName); #else - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Sending reponse for RequestId %u of type %" PRIu32, (unsigned)requestId, responseType->binaryEncodingId.identifier.numeric); #endif } else { #ifdef UA_ENABLE_TYPEDESCRIPTION - UA_LOG_DEBUG_CHANNEL(&server->config.logger, channel, + UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Sending response for RequestId %u of type %s", (unsigned)requestId, responseType->typeName); #else - UA_LOG_DEBUG_CHANNEL(&server->config.logger, channel, + UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Sending reponse for RequestId %u of type %" PRIu32, (unsigned)requestId, responseType->binaryEncodingId.identifier.numeric); #endif @@ -756,11 +756,11 @@ processMSGDecoded(UA_Server *server, UA_SecureChannel *channel, UA_UInt32 reques if(!session) { if(sessionRequired) { #ifdef UA_ENABLE_TYPEDESCRIPTION - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "%s refused without a valid session", requestType->typeName); #else - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Service %" PRIu32 " refused without a valid session", requestType->binaryEncodingId.identifier.numeric); #endif @@ -779,11 +779,11 @@ processMSGDecoded(UA_Server *server, UA_SecureChannel *channel, UA_UInt32 reques /* Trying to use a non-activated session? */ if(sessionRequired && !session->activated) { #ifdef UA_ENABLE_TYPEDESCRIPTION - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "%s refused on a non-activated session", requestType->typeName); #else - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Service %" PRIu32 " refused on a non-activated session", requestType->binaryEncodingId.identifier.numeric); #endif @@ -884,11 +884,11 @@ processMSG(UA_Server *server, UA_SecureChannel *channel, if(!requestType) { if(requestTypeId.identifier.numeric == UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY) { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Client requested a subscription, " "but those are not enabled in the build"); } else { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Unknown request with type identifier %" PRIi32, requestTypeId.identifier.numeric); } @@ -903,7 +903,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel, retval = UA_decodeBinaryInternal(msg, &offset, &request, requestType, server->config.customDataTypes); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_CHANNEL(&server->config.logger, channel, + UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Could not decode the request with StatusCode %s", UA_StatusCode_name(retval)); return decodeHeaderSendServiceFault(channel, msg, requestPos, @@ -914,7 +914,7 @@ processMSG(UA_Server *server, UA_SecureChannel *channel, UA_RequestHeader *requestHeader = &request.requestHeader; if(requestHeader->timestamp == 0 && server->config.verifyRequestTimestamp <= UA_RULEHANDLING_WARN) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "The server sends no timestamp in the request header. " "See the 'verifyRequestTimestamp' setting."); if(server->config.verifyRequestTimestamp <= UA_RULEHANDLING_ABORT) { @@ -958,35 +958,35 @@ processSecureChannelMessage(void *application, UA_SecureChannel *channel, UA_StatusCode retval = UA_STATUSCODE_GOOD; switch(messagetype) { case UA_MESSAGETYPE_HEL: - UA_LOG_TRACE_CHANNEL(&server->config.logger, channel, "Process a HEL message"); + UA_LOG_TRACE_CHANNEL(server->config.logging, channel, "Process a HEL message"); retval = processHEL(server, channel, message); break; case UA_MESSAGETYPE_OPN: - UA_LOG_TRACE_CHANNEL(&server->config.logger, channel, "Process an OPN message"); + UA_LOG_TRACE_CHANNEL(server->config.logging, channel, "Process an OPN message"); retval = processOPN(server, channel, requestId, message); break; case UA_MESSAGETYPE_MSG: - UA_LOG_TRACE_CHANNEL(&server->config.logger, channel, "Process a MSG"); + UA_LOG_TRACE_CHANNEL(server->config.logging, channel, "Process a MSG"); retval = processMSG(server, channel, requestId, message); break; case UA_MESSAGETYPE_CLO: - UA_LOG_TRACE_CHANNEL(&server->config.logger, channel, "Process a CLO"); + UA_LOG_TRACE_CHANNEL(server->config.logging, channel, "Process a CLO"); Service_CloseSecureChannel(server, channel); /* Regular close */ break; default: - UA_LOG_TRACE_CHANNEL(&server->config.logger, channel, "Invalid message type"); + UA_LOG_TRACE_CHANNEL(server->config.logging, channel, "Invalid message type"); retval = UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; break; } if(retval != UA_STATUSCODE_GOOD) { if(!UA_SecureChannel_isConnected(channel)) { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Processing the message failed. Channel already closed " "with StatusCode %s. ", UA_StatusCode_name(retval)); return retval; } - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Processing the message failed with StatusCode %s. " "Closing the channel.", UA_StatusCode_name(retval)); UA_TcpErrorMessage errMsg; @@ -1410,7 +1410,7 @@ retryReverseConnectCallback(UA_Server *server, void *context) { LIST_FOREACH(rc, &bpm->reverseConnects, next) { if(rc->currentConnection.connectionId) continue; - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Attempt to reverse reconnect to %.*s:%d", (int)rc->hostname.length, rc->hostname.data, rc->port); attemptReverseConnect(bpm, rc); @@ -1491,14 +1491,14 @@ attemptReverseConnect(UA_BinaryProtocolManager *bpm, reverse_connect_context *co UA_StatusCode res = cm->openConnection(cm, &kvm, bpm, context, serverReverseConnectCallback); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to create connection for reverse connect: %s\n", UA_StatusCode_name(res)); } return res; } - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "No ConnectionManager found for reverse connect"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1512,7 +1512,7 @@ UA_Server_addReverseConnect(UA_Server *server, UA_String url, getServerComponentByName(server, UA_STRING("binary")); UA_BinaryProtocolManager *bpm = (UA_BinaryProtocolManager*)sc; if(!bpm) { - UA_LOG_ERROR(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_SERVER, "No BinaryProtocolManager configured"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1522,7 +1522,7 @@ UA_Server_addReverseConnect(UA_Server *server, UA_String url, UA_UInt16 port = 0; UA_StatusCode res = UA_parseEndpointUrl(&url, &hostname, &port, NULL); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "OPC UA URL is invalid: %.*s", (int)url.length, url.data); return res; @@ -1568,7 +1568,7 @@ UA_Server_removeReverseConnect(UA_Server *server, UA_UInt64 handle) { getServerComponentByName(server, UA_STRING("binary")); UA_BinaryProtocolManager *bpm = (UA_BinaryProtocolManager*)sc; if(!bpm) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "No BinaryProtocolManager configured"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADINTERNALERROR; @@ -1736,7 +1736,7 @@ UA_BinaryProtocolManager_start(UA_Server *server, UA_Boolean haveServerSocket = false; if(config->serverUrlsSize == 0) { /* Empty hostname -> listen on all devices */ - UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(config->logging, UA_LOGCATEGORY_SERVER, "No Server URL configured. Using \"opc.tcp://:4840\" " "to configure the listen socket."); UA_String defaultUrl = UA_STRING("opc.tcp://:4840"); @@ -1752,7 +1752,7 @@ UA_BinaryProtocolManager_start(UA_Server *server, } if(!haveServerSocket) { - UA_LOG_ERROR(&config->logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_SERVER, "The server has no server socket"); } @@ -1863,7 +1863,7 @@ UA_BinaryProtocolManager_new(UA_Server *server) { return NULL; bpm->server = server; - bpm->logging = &server->config.logger; + bpm->logging = server->config.logging; /* Initialize SecureChannel */ TAILQ_INIT(&bpm->channels); diff --git a/src/server/ua_server_config.c b/src/server/ua_server_config.c index f6b80a8d68a..95229b2264c 100644 --- a/src/server/ua_server_config.c +++ b/src/server/ua_server_config.c @@ -87,17 +87,9 @@ UA_ServerConfig_clean(UA_ServerConfig *config) { #endif /* Logger */ - if(config->logging != NULL) { - if((config->logging != &config->logger) && - (config->logging->clear != NULL)) { - config->logging->clear(config->logging->context); - } - config->logging = NULL; - } - if(config->logger.clear) - config->logger.clear(config->logger.context); - config->logger.log = NULL; - config->logger.clear = NULL; + if(config->logging != NULL && config->logging->clear != NULL) + config->logging->clear(config->logging->context); + config->logging = NULL; #ifdef UA_ENABLE_PUBSUB #ifdef UA_ENABLE_PUBSUB_ENCRYPTION diff --git a/src/server/ua_server_ns0.c b/src/server/ua_server_ns0.c index fd7878842cb..acc956110bc 100644 --- a/src/server/ua_server_ns0.c +++ b/src/server/ua_server_ns0.c @@ -927,7 +927,7 @@ initNS0(UA_Server *server) { server->bootstrapNS0 = false; if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Initialization of Namespace 0 failed with %s. " "See previous outputs for any error messages.", UA_StatusCode_name(retVal)); @@ -1315,7 +1315,7 @@ initNS0(UA_Server *server) { #endif /* UA_GENERATED_NAMESPACE_ZERO */ if(retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Initialization of Namespace 0 (after bootstrapping) " "failed with %s. See previous outputs for any error messages.", UA_StatusCode_name(retVal)); diff --git a/src/server/ua_server_ns0_diagnostics.c b/src/server/ua_server_ns0_diagnostics.c index 8b1ce425a6b..5fa23d6ab0f 100644 --- a/src/server/ua_server_ns0_diagnostics.c +++ b/src/server/ua_server_ns0_diagnostics.c @@ -230,7 +230,7 @@ createSubscriptionObject(UA_Server *server, UA_Session *session, cleanup: UA_BrowsePathResult_clear(&bpr); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Creating the subscription diagnostics object failed " "with StatusCode %s", UA_StatusCode_name(res)); } @@ -522,7 +522,7 @@ createSessionObject(UA_Server *server, UA_Session *session) { cleanup: if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Creating the session diagnostics object failed " "with StatusCode %s", UA_StatusCode_name(res)); } diff --git a/src/server/ua_services_attribute.c b/src/server/ua_services_attribute.c index f9cdb4b5dab..809d228d8a8 100644 --- a/src/server/ua_services_attribute.c +++ b/src/server/ua_services_attribute.c @@ -386,7 +386,7 @@ ReadWithNode(const UA_Node *node, UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestampsToReturn, const UA_ReadValueId *id, UA_DataValue *v) { UA_LOG_NODEID_TRACE(&node->head.nodeId, - UA_LOG_TRACE_SESSION(&server->config.logger, session, + UA_LOG_TRACE_SESSION(server->config.logging, session, "Read attribute %"PRIi32 " of Node %.*s", id->attributeId, (int)nodeIdStr.length, nodeIdStr.data)); @@ -649,7 +649,7 @@ Operation_Read(UA_Server *server, UA_Session *session, UA_TimestampsToReturn *tt void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing ReadRequest"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing ReadRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); /* Check if the timestampstoreturn is valid */ @@ -873,7 +873,7 @@ compatibleValueRankArrayDimensions(UA_Server *server, UA_Session *session, UA_Int32 valueRank, size_t arrayDimensionsSize) { /* ValueRank invalid */ if(valueRank < UA_VALUERANK_SCALAR_OR_ONE_DIMENSION) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "The ValueRank is invalid (< -3)"); return false; } @@ -887,7 +887,7 @@ compatibleValueRankArrayDimensions(UA_Server *server, UA_Session *session, * one or more dimensions */ if(valueRank <= UA_VALUERANK_ONE_OR_MORE_DIMENSIONS) { if(arrayDimensionsSize > 0) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "No ArrayDimensions can be defined for a ValueRank <= 0"); return false; } @@ -897,7 +897,7 @@ compatibleValueRankArrayDimensions(UA_Server *server, UA_Session *session, /* case >= 1, UA_VALUERANK_ONE_DIMENSION: the value is an array with the specified number of dimensions */ if(arrayDimensionsSize != (size_t)valueRank) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "The number of ArrayDimensions is not equal to " "the (positive) ValueRank"); return false; @@ -1042,7 +1042,7 @@ compatibleValue(UA_Server *server, UA_Session *session, const UA_NodeId *targetD server->config.allowEmptyVariables == UA_RULEHANDLING_ACCEPT) return true; - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "Only Variables with data type BaseDataType " "can contain an empty value"); @@ -1201,7 +1201,7 @@ writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session, * when we do the change */ if(node->head.nodeClass == UA_NODECLASS_VARIABLETYPE && UA_Node_hasSubTypeOrInstances(&node->head)) { - UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_INFO(server->config.logging, UA_LOGCATEGORY_SERVER, "Cannot change a variable type with existing instances"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1209,7 +1209,7 @@ writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session, /* Check that the array dimensions match with the valuerank */ if(!compatibleValueRankArrayDimensions(server, session, node->valueRank, arrayDimensionsSize)) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Cannot write the ArrayDimensions. The ValueRank does not match."); return UA_STATUSCODE_BADTYPEMISMATCH; } @@ -1219,7 +1219,7 @@ writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session, if(type->arrayDimensions && !compatibleArrayDimensions(type->arrayDimensionsSize, type->arrayDimensions, arrayDimensionsSize, arrayDimensions)) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Array dimensions in the variable type do not match"); return UA_STATUSCODE_BADTYPEMISMATCH; } @@ -1236,7 +1236,7 @@ writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session, retval = UA_STATUSCODE_BADTYPEMISMATCH; UA_DataValue_clear(&value); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Array dimensions in the current value do not match"); return retval; } @@ -1334,7 +1334,7 @@ writeDataTypeAttribute(UA_Server *server, UA_Session *session, retval = UA_STATUSCODE_BADTYPEMISMATCH; UA_DataValue_clear(&value); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "The current value does not match the new data type"); return retval; } @@ -1439,13 +1439,13 @@ writeNodeValueAttribute(UA_Server *server, UA_Session *session, UA_LOG_NODEID_WARNING(&node->head.nodeId, if(session == &server->adminSession) { /* If the value is written via the local API, log a warning */ - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Writing the value of Node %.*s failed with the " "following reason: %s", (int)nodeIdStr.length, nodeIdStr.data, reason); } else { /* Don't spam the logs if writing from remote failed */ - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Writing the value of Node %.*s failed with the " "following reason: %s", (int)nodeIdStr.length, nodeIdStr.data, reason); @@ -1626,7 +1626,7 @@ triggerImmediateDataChange(UA_Server *server, UA_Session *session, UA_StatusCode res = sampleCallbackWithValue(server, sub, mon, &value); if(res != UA_STATUSCODE_GOOD) { UA_DataValue_clear(&value); - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | " "Sampling returned the statuscode %s", mon->monitoredItemId, @@ -1647,7 +1647,7 @@ copyAttributeIntoNode(UA_Server *server, UA_Session *session, UA_StatusCode retval = UA_STATUSCODE_GOOD; UA_LOG_NODEID_TRACE(&node->head.nodeId, - UA_LOG_TRACE_SESSION(&server->config.logger, session, + UA_LOG_TRACE_SESSION(server->config.logging, session, "Write attribute %"PRIi32 " of Node %.*s", wvalue->attributeId, (int)nodeIdStr.length, nodeIdStr.data)); @@ -1801,7 +1801,7 @@ copyAttributeIntoNode(UA_Server *server, UA_Session *session, /* Check if writing succeeded */ if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "WriteRequest returned status code %s", UA_StatusCode_name(retval)); return retval; @@ -1829,7 +1829,7 @@ Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response) { UA_assert(session != NULL); - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing WriteRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); diff --git a/src/server/ua_services_discovery.c b/src/server/ua_services_discovery.c index 7a440332319..b2735cf9b7a 100644 --- a/src/server/ua_services_discovery.c +++ b/src/server/ua_services_discovery.c @@ -93,7 +93,7 @@ setApplicationDescriptionFromRegisteredServer(const UA_FindServersRequest *reque void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, UA_FindServersResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing FindServersRequest"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing FindServersRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); /* Return the server itself? */ @@ -294,7 +294,7 @@ getDefaultEncryptedSecurityPolicy(UA_Server *server) { if(!UA_String_equal(&UA_SECURITY_POLICY_NONE_URI, &sp->policyUri)) return sp; } - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_CLIENT, "Could not find a SecurityPolicy with encryption for the " "UserTokenPolicy. Using an unencrypted policy."); return server->config.securityPoliciesSize > 0 ? @@ -467,11 +467,11 @@ Service_GetEndpoints(UA_Server *server, UA_Session *session, /* If the client expects to see a specific endpointurl, mirror it back. If * not, clone the endpoints with the discovery url of all networklayers. */ if(request->endpointUrl.length > 0) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing GetEndpointsRequest with endpointUrl " UA_PRINTF_STRING_FORMAT, UA_PRINTF_STRING_DATA(request->endpointUrl)); } else { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing GetEndpointsRequest with an empty endpointUrl"); } @@ -556,7 +556,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session, char* filePath = (char*) UA_malloc(sizeof(char)*requestServer->semaphoreFilePath.length+1); if(!filePath) { - UA_LOG_ERROR_SESSION(&server->config.logger, session, + UA_LOG_ERROR_SESSION(server->config.logging, session, "Cannot allocate memory for semaphore path. Out of memory."); responseHeader->serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; return; @@ -570,7 +570,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session, } UA_free(filePath); #else - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_CLIENT, "Ignoring semaphore file path. open62541 not compiled " "with UA_ENABLE_DISCOVERY_SEMAPHORE=ON"); #endif @@ -593,7 +593,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session, // server is shutting down. Remove it from the registered servers list if(!registeredServer_entry) { // server not found, show warning - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "Could not unregister server %.*s. Not registered.", (int)requestServer->serverUri.length, requestServer->serverUri.data); responseHeader->serviceResult = UA_STATUSCODE_BADNOTHINGTODO; @@ -619,7 +619,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session, UA_StatusCode retval = UA_STATUSCODE_GOOD; if(!registeredServer_entry) { // server not yet registered, register it by adding it to the list - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Registering new server: %.*s", + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Registering new server: %.*s", (int)requestServer->serverUri.length, requestServer->serverUri.data); registeredServer_entry = @@ -656,7 +656,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session, void Service_RegisterServer(UA_Server *server, UA_Session *session, const UA_RegisterServerRequest *request, UA_RegisterServerResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing RegisterServerRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); process_RegisterServer(server, session, &request->requestHeader, &request->server, 0, @@ -666,7 +666,7 @@ void Service_RegisterServer(UA_Server *server, UA_Session *session, void Service_RegisterServer2(UA_Server *server, UA_Session *session, const UA_RegisterServer2Request *request, UA_RegisterServer2Response *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing RegisterServer2Request"); UA_LOCK_ASSERT(&server->serviceMutex, 1); process_RegisterServer(server, session, &request->requestHeader, &request->server, diff --git a/src/server/ua_services_method.c b/src/server/ua_services_method.c index ac2a872bdff..d8f8e8ecfe0 100644 --- a/src/server/ua_services_method.c +++ b/src/server/ua_services_method.c @@ -429,7 +429,7 @@ void Service_CallAsync(UA_Server *server, UA_Session *session, UA_UInt32 requestId, const UA_CallRequest *request, UA_CallResponse *response, UA_Boolean *finished) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing CallRequestAsync"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing CallRequestAsync"); if(server->config.maxNodesPerMethodCall != 0 && request->methodsToCallSize > server->config.maxNodesPerMethodCall) { response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; @@ -503,7 +503,7 @@ Operation_CallMethod(UA_Server *server, UA_Session *session, void *context, void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing CallRequest"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing CallRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); if(server->config.maxNodesPerMethodCall != 0 && diff --git a/src/server/ua_services_monitoreditem.c b/src/server/ua_services_monitoreditem.c index 03f9c3d91bf..23e24e01742 100644 --- a/src/server/ua_services_monitoreditem.c +++ b/src/server/ua_services_monitoreditem.c @@ -421,7 +421,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, if(request->itemToMonitor.attributeId == UA_ATTRIBUTEID_EVENTNOTIFIER) { /* TODO: Only remote clients can add Event-MonitoredItems at the moment */ if(!cmc->sub) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Only remote clients can add Event-MonitoredItems"); result->statusCode = UA_STATUSCODE_BADNOTSUPPORTED; UA_DataValue_clear(&v); @@ -438,7 +438,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, UA_Byte eventNotifierValue = *((UA_Byte *)v.value.data); if((eventNotifierValue & 0x01) != 1) { result->statusCode = UA_STATUSCODE_BADNOTSUPPORTED; - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, cmc->sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, cmc->sub, "Could not create a MonitoredItem as the " "'SubscribeToEvents' bit of the EventNotifier " "attribute is not set"); @@ -485,7 +485,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, &newMon->parameters, result); #endif if(result->statusCode != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, cmc->sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, cmc->sub, "Could not create a MonitoredItem " "with StatusCode %s", UA_StatusCode_name(result->statusCode)); @@ -521,7 +521,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, if(result->revisedSamplingInterval < 0.0 && cmc->sub) result->revisedSamplingInterval = cmc->sub->publishingInterval; - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, cmc->sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, cmc->sub, "MonitoredItem %" PRIi32 " | " "Created the MonitoredItem " "(Sampling Interval: %.2fms, Queue Size: %lu)", @@ -534,7 +534,7 @@ void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing CreateMonitoredItemsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -664,7 +664,7 @@ Operation_ModifyMonitoredItem(UA_Server *server, UA_Session *session, UA_Subscri if(result->revisedSamplingInterval < 0.0 && mon->subscription) result->revisedSamplingInterval = mon->subscription->publishingInterval; - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | " "Modified the MonitoredItem " "(Sampling Interval: %fms, Queue Size: %lu)", @@ -677,7 +677,7 @@ void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, UA_ModifyMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing ModifyMonitoredItemsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -733,7 +733,7 @@ void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, UA_SetMonitoringModeResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing SetMonitoringMode"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing SetMonitoringMode"); UA_LOCK_ASSERT(&server->serviceMutex, 1); if(server->config.maxMonitoredItemsPerCall != 0 && @@ -779,7 +779,7 @@ void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, UA_DeleteMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing DeleteMonitoredItemsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); diff --git a/src/server/ua_services_nodemanagement.c b/src/server/ua_services_nodemanagement.c index 319ea488f3a..5a4ca440648 100644 --- a/src/server/ua_services_nodemanagement.c +++ b/src/server/ua_services_nodemanagement.c @@ -123,7 +123,7 @@ checkParentReference(UA_Server *server, UA_Session *session, const UA_NodeHead * /* See if the parent exists */ const UA_Node *parent = UA_NODESTORE_GET(server, parentNodeId); if(!parent) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Parent node not found"); return UA_STATUSCODE_BADPARENTNODEIDINVALID; } @@ -134,14 +134,14 @@ checkParentReference(UA_Server *server, UA_Session *session, const UA_NodeHead * /* Check the referencetype exists */ const UA_Node *referenceType = UA_NODESTORE_GET(server, referenceTypeId); if(!referenceType) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Reference type to the parent not found"); return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; } /* Check if the referencetype is a reference type node */ if(referenceType->head.nodeClass != UA_NODECLASS_REFERENCETYPE) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Reference type to the parent is not a ReferenceTypeNode"); UA_NODESTORE_RELEASE(server, referenceType); return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; @@ -151,7 +151,7 @@ checkParentReference(UA_Server *server, UA_Session *session, const UA_NodeHead * UA_Boolean referenceTypeIsAbstract = referenceType->referenceTypeNode.isAbstract; UA_NODESTORE_RELEASE(server, referenceType); if(referenceTypeIsAbstract == true) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Abstract reference type to the parent not allowed"); return UA_STATUSCODE_BADREFERENCENOTALLOWED; } @@ -164,13 +164,13 @@ checkParentReference(UA_Server *server, UA_Session *session, const UA_NodeHead * /* Type needs hassubtype reference to the supertype */ if(referenceType->referenceTypeNode.referenceTypeIndex != UA_REFERENCETYPEINDEX_HASSUBTYPE) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Type nodes need to have a HasSubType reference to the parent"); return UA_STATUSCODE_BADREFERENCENOTALLOWED; } /* Supertype needs to be of the same node type */ if(parentNodeClass != head->nodeClass) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Type nodes needs to be of the same node " "type as their parent"); return UA_STATUSCODE_BADPARENTNODEIDINVALID; @@ -182,7 +182,7 @@ checkParentReference(UA_Server *server, UA_Session *session, const UA_NodeHead * const UA_NodeId hierarchRefs = UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES); if(!isNodeInTree_singleRef(server, referenceTypeId, &hierarchRefs, UA_REFERENCETYPEINDEX_HASSUBTYPE)) { - logAddNode(&server->config.logger, session, &head->nodeId, + logAddNode(server->config.logging, session, &head->nodeId, "Reference type to the parent is not hierarchical"); return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; } @@ -286,7 +286,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, const UA_VariableTypeNode *vt) { /* Check the datatype against the vt */ if(!compatibleDataTypes(server, &node->dataType, &vt->dataType)) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "The value of is incompatible with " "the datatype of the VariableType"); return UA_STATUSCODE_BADTYPEMISMATCH; @@ -295,14 +295,14 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, /* Check valueRank against array dimensions */ if(!compatibleValueRankArrayDimensions(server, session, node->valueRank, node->arrayDimensionsSize)) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "The value rank of is incompatible with its array dimensions"); return UA_STATUSCODE_BADTYPEMISMATCH; } /* Check valueRank against the vt */ if(!compatibleValueRanks(node->valueRank, vt->valueRank)) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "The value rank is incompatible " "with the value rank of the VariableType"); return UA_STATUSCODE_BADTYPEMISMATCH; @@ -311,7 +311,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, /* Check array dimensions against the vt */ if(!compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions, node->arrayDimensionsSize, node->arrayDimensions)) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "The array dimensions are incompatible with the " "array dimensions of the VariableType"); return UA_STATUSCODE_BADTYPEMISMATCH; @@ -350,7 +350,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, /* Warn if that is configured */ if(server->config.allowEmptyVariables != UA_RULEHANDLING_ACCEPT) UA_LOG_NODEID_DEBUG(&node->head.nodeId, - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "AddNode (%.*s): The value is empty. " "But this is only allowed for BaseDataType. " "Create a matching default value.", @@ -365,7 +365,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, retval = setDefaultValue(server, node); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Could not create a default value " "with StatusCode %s", (int)nodeIdStr.length, nodeIdStr.data, UA_StatusCode_name(retval))); @@ -380,7 +380,7 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session, node->arrayDimensionsSize, node->arrayDimensions, &value.value, NULL, &reason)) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): The VariableNode value has " "failed the type check with reason %s. ", (int)nodeIdStr.length, nodeIdStr.data, reason)); @@ -432,7 +432,7 @@ useVariableTypeAttributes(UA_Server *server, UA_Session *session, UA_DataValue_clear(&v); if(retval != UA_STATUSCODE_GOOD) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "The default content of the VariableType could " "not be used. This may happen if the VariableNode " "makes additional restrictions."); @@ -442,7 +442,7 @@ useVariableTypeAttributes(UA_Server *server, UA_Session *session, /* If no datatype is given, use the datatype of the vt */ if(UA_NodeId_isNull(&node->dataType)) { - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "No datatype given; Copy the datatype attribute " "from the TypeDefinition"); retval = writeAttribute(server, session, &node->head.nodeId, @@ -858,7 +858,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_StatusCode retval; /* Make sure newly created node does not have itself as parent */ if(UA_NodeId_equal(nodeId, parentNodeId)) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "A node cannot have itself as parent"); retval = UA_STATUSCODE_BADINVALIDARGUMENT; goto cleanup; @@ -868,7 +868,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, /* Check parent reference. Objects may have no parent. */ retval = checkParentReference(server, session, head, parentNodeId, referenceTypeId); if(retval != UA_STATUSCODE_GOOD) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "The parent reference for is invalid"); goto cleanup; } @@ -877,7 +877,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, if((head->nodeClass == UA_NODECLASS_VARIABLE || head->nodeClass == UA_NODECLASS_OBJECT) && UA_NodeId_isNull(typeDefinitionId)) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "No TypeDefinition. Use the default " "TypeDefinition for the Variable/Object"); if(head->nodeClass == UA_NODECLASS_VARIABLE) @@ -892,7 +892,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, /* Get the type node */ type = UA_NODESTORE_GET(server, typeDefinitionId); if(!type) { - logAddNode(&server->config.logger, session, nodeId, "Node type not found"); + logAddNode(server->config.logging, session, nodeId, "Node type not found"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; goto cleanup; } @@ -924,7 +924,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, typeOk = false; } if(!typeOk) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Type does not match the NodeClass"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; goto cleanup; @@ -949,7 +949,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, const UA_NodeId objectTypes = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE); if(!isNodeInTree(server, parentNodeId, &variableTypes, &refTypes) && !isNodeInTree(server, parentNodeId, &objectTypes, &refTypes)) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Type of variable node must be a " "VariableType and not cannot be abstract"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; @@ -982,7 +982,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, if(!isInBaseObjectType && !(isInBaseEventType && UA_NodeId_isNull(parentNodeId))) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Type of ObjectNode must be ObjectType and not be abstract"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; goto cleanup; @@ -993,7 +993,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, /* Add reference to the parent */ if(!UA_NodeId_isNull(parentNodeId)) { if(UA_NodeId_isNull(referenceTypeId)) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Reference to parent cannot be null"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; goto cleanup; @@ -1002,7 +1002,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, retval = addRefWithSession(server, session, &head->nodeId, referenceTypeId, parentNodeId, false); if(retval != UA_STATUSCODE_GOOD) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Adding reference to parent failed"); goto cleanup; } @@ -1015,7 +1015,7 @@ addNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, retval = addRefWithSession(server, session, &head->nodeId, &hasTypeDefinition, &type->head.nodeId, true); if(retval != UA_STATUSCODE_GOOD) { - logAddNode(&server->config.logger, session, nodeId, + logAddNode(server->config.logging, session, nodeId, "Adding a reference to the type definition failed"); } } @@ -1047,14 +1047,14 @@ addNode_raw(UA_Server *server, UA_Session *session, void *nodeContext, /* Check the namespaceindex */ if(item->requestedNewNodeId.nodeId.namespaceIndex >= server->namespacesSize) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode: Namespace invalid"); return UA_STATUSCODE_BADNODEIDINVALID; } if(item->nodeAttributes.encoding != UA_EXTENSIONOBJECT_DECODED && item->nodeAttributes.encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode: Node attributes invalid"); return UA_STATUSCODE_BADINTERNALERROR; } @@ -1062,7 +1062,7 @@ addNode_raw(UA_Server *server, UA_Session *session, void *nodeContext, /* Create a node */ UA_Node *node = UA_NODESTORE_NEW(server, item->nodeClass); if(!node) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode: Node could not create a node " "in the nodestore"); return UA_STATUSCODE_BADOUTOFMEMORY; @@ -1097,7 +1097,7 @@ addNode_raw(UA_Server *server, UA_Session *session, void *nodeContext, outNewNodeId = &tmpOutId; retval = UA_NODESTORE_INSERT(server, node, outNewNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode: Node could not add the new node " "to the nodestore with error code %s", UA_StatusCode_name(retval)); @@ -1110,7 +1110,7 @@ addNode_raw(UA_Server *server, UA_Session *session, void *nodeContext, return UA_STATUSCODE_GOOD; create_error: - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode: Node could not create a node " "with error code %s", UA_StatusCode_name(retval)); UA_NODESTORE_DELETE(server, node); @@ -1468,7 +1468,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) if(node->head.references[i].referenceTypeIndex == UA_REFERENCETYPEINDEX_HASSUBTYPE) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Variable not allowed " "to have HasSubType reference", (int)nodeIdStr.length, nodeIdStr.data)); @@ -1495,7 +1495,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) if(!type) { if(server->bootstrapNS0) goto constructor; - logAddNode(&server->config.logger, session, &node->head.nodeId, + logAddNode(server->config.logging, session, &node->head.nodeId, "Node type not found"); retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; goto cleanup; @@ -1512,7 +1512,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) &type->variableTypeNode); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Using attributes for from " "the variable type failed with error code %s", (int)nodeIdStr.length, nodeIdStr.data, @@ -1538,7 +1538,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) &type->variableTypeNode); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Type-checking " "failed with error code %s", (int)nodeIdStr.length, nodeIdStr.data, UA_StatusCode_name(retval))); @@ -1552,7 +1552,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) retval = addTypeChildren(server, session, nodeId, &type->head.nodeId); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Adding child nodes " "failed with error code %s", (int)nodeIdStr.length, nodeIdStr.data, UA_StatusCode_name(retval))); @@ -1565,7 +1565,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) retval = addInterfaceChildren(server, session, nodeId, &type->head.nodeId); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Adding child nodes " "interface failed with error code %s", (int)nodeIdStr.length, nodeIdStr.data, @@ -1580,7 +1580,7 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId) retval = recursiveCallConstructors(server, session, nodeId, type); if(retval != UA_STATUSCODE_GOOD) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "AddNode (%.*s): Calling the node constructor(s) " "failed with status code %s", (int)nodeIdStr.length, nodeIdStr.data, UA_StatusCode_name(retval))); @@ -1618,7 +1618,7 @@ void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing AddNodesRequest"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing AddNodesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); if(server->config.maxNodesPerNodeManagement != 0 && @@ -1984,7 +1984,7 @@ deleteNodeOperation(UA_Server *server, UA_Session *session, void *context, if(UA_Node_hasSubTypeOrInstances(&node->head)) { UA_LOG_NODEID_INFO(&node->head.nodeId, - UA_LOG_INFO_SESSION(&server->config.logger, session, "DeleteNode (%.*s): " + UA_LOG_INFO_SESSION(server->config.logging, session, "DeleteNode (%.*s): " "Cannot delete a type node with active instances or " "subtypes", (int)nodeIdStr.length, nodeIdStr.data)); UA_NODESTORE_RELEASE(server, node); @@ -2019,7 +2019,7 @@ deleteNodeOperation(UA_Server *server, UA_Session *session, void *context, *result = buildDeleteNodeSet(server, session, &hierarchRefsSet, &item->nodeId, item->deleteTargetReferences, &refTree); if(*result != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "DeleteNode: Incomplete lookup of nodes. " "Still deleting what we have."); /* Continue, so the RefTree is cleaned up. Return the error message @@ -2037,7 +2037,7 @@ void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, UA_DeleteNodesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing DeleteNodesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -2140,7 +2140,7 @@ Operation_addReference(UA_Server *server, UA_Session *session, void *context, const UA_Node *refType = UA_NODESTORE_GET(server, &item->referenceTypeId); if(!refType) { UA_LOG_NODEID_DEBUG(&item->referenceTypeId, - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Cannot add reference - ReferenceType %.*s unknown", (int)nodeIdStr.length, nodeIdStr.data)); *retval = UA_STATUSCODE_BADREFERENCETYPEIDINVALID; @@ -2148,7 +2148,7 @@ Operation_addReference(UA_Server *server, UA_Session *session, void *context, } if(refType->head.nodeClass != UA_NODECLASS_REFERENCETYPE) { UA_LOG_NODEID_DEBUG(&item->referenceTypeId, - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Cannot add reference - ReferenceType %.*s with wrong NodeClass", (int)nodeIdStr.length, nodeIdStr.data)); UA_NODESTORE_RELEASE(server, refType); @@ -2162,7 +2162,7 @@ Operation_addReference(UA_Server *server, UA_Session *session, void *context, const UA_Node *targetNode = UA_NODESTORE_GET(server, &item->targetNodeId.nodeId); if(!targetNode) { UA_LOG_NODEID_DEBUG(&item->targetNodeId.nodeId, - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Cannot add reference - target %.*s does not exist", (int)nodeIdStr.length, nodeIdStr.data)); *retval = UA_STATUSCODE_BADTARGETNODEIDINVALID; @@ -2213,7 +2213,7 @@ Operation_addReference(UA_Server *server, UA_Session *session, void *context, * result if BOTH directions already existed */ if(UA_NodeId_equal(&item->sourceNodeId, &item->targetNodeId.nodeId)) { *retval = UA_STATUSCODE_GOOD; - UA_LOG_INFO_SESSION(&server->config.logger, session, "The source node and the target node are identical. The check for duplicate references is skipped."); + UA_LOG_INFO_SESSION(server->config.logging, session, "The source node and the target node are identical. The check for duplicate references is skipped."); } else if(firstExisted) { *retval = UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED; @@ -2240,7 +2240,7 @@ void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing AddReferencesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); UA_assert(session); @@ -2328,7 +2328,7 @@ void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing DeleteReferencesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); diff --git a/src/server/ua_services_securechannel.c b/src/server/ua_services_securechannel.c index fa6e9a0d285..53f89d107ce 100644 --- a/src/server/ua_services_securechannel.c +++ b/src/server/ua_services_securechannel.c @@ -27,7 +27,7 @@ Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, case UA_SECURITYTOKENREQUESTTYPE_ISSUE: /* We must expect an OPN handshake */ if(channel->state != UA_SECURECHANNELSTATE_ACK_SENT) { - UA_LOG_ERROR_CHANNEL(&server->config.logger, channel, + UA_LOG_ERROR_CHANNEL(server->config.logging, channel, "Called open on already open or closed channel"); response->responseHeader.serviceResult = UA_STATUSCODE_BADINTERNALERROR; goto error; @@ -46,7 +46,7 @@ Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, case UA_SECURITYTOKENREQUESTTYPE_RENEW: /* The channel must be open to be renewed */ if(channel->state != UA_SECURECHANNELSTATE_OPEN) { - UA_LOG_ERROR_CHANNEL(&server->config.logger, channel, + UA_LOG_ERROR_CHANNEL(server->config.logging, channel, "Called renew on channel which is not open"); response->responseHeader.serviceResult = UA_STATUSCODE_BADINTERNALERROR; goto error; @@ -55,7 +55,7 @@ Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, /* Check whether the nonce was reused */ if(channel->securityMode != UA_MESSAGESECURITYMODE_NONE && UA_ByteString_equal(&channel->remoteNonce, &request->clientNonce)) { - UA_LOG_ERROR_CHANNEL(&server->config.logger, channel, + UA_LOG_ERROR_CHANNEL(server->config.logging, channel, "The client reused the last nonce"); response->responseHeader.serviceResult = UA_STATUSCODE_BADSECURITYCHECKSFAILED; goto error; @@ -103,14 +103,14 @@ Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, /* Success */ if(request->requestType == UA_SECURITYTOKENREQUESTTYPE_ISSUE) { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "SecureChannel opened with SecurityPolicy %.*s " "and a revised lifetime of %.2fs", (int)channel->securityPolicy->policyUri.length, channel->securityPolicy->policyUri.data, (UA_Float)response->securityToken.revisedLifetime / 1000); } else { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, "SecureChannel renewed " + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "SecureChannel renewed " "with a revised lifetime of %.2fs", (UA_Float)response->securityToken.revisedLifetime / 1000); } @@ -119,10 +119,10 @@ Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, error: if(request->requestType == UA_SECURITYTOKENREQUESTTYPE_ISSUE) { - UA_LOG_INFO_CHANNEL(&server->config.logger, channel, + UA_LOG_INFO_CHANNEL(server->config.logging, channel, "Opening a SecureChannel failed"); } else { - UA_LOG_DEBUG_CHANNEL(&server->config.logger, channel, + UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Renewing SecureChannel failed"); } } diff --git a/src/server/ua_services_session.c b/src/server/ua_services_session.c index c2145f3022d..8d85eef4151 100644 --- a/src/server/ua_services_session.c +++ b/src/server/ua_services_session.c @@ -121,7 +121,7 @@ UA_Server_cleanupSessions(UA_Server *server, UA_DateTime nowMonotonic) { /* Session has timed out? */ if(sentry->session.validTill >= nowMonotonic) continue; - UA_LOG_INFO_SESSION(&server->config.logger, &sentry->session, + UA_LOG_INFO_SESSION(server->config.logging, &sentry->session, "Session has timed out"); UA_Server_removeSession(server, sentry, UA_SHUTDOWNREASON_TIMEOUT); } @@ -143,7 +143,7 @@ getSessionByToken(UA_Server *server, const UA_NodeId *token) { /* Session has timed out */ if(UA_DateTime_nowMonotonic() > current->session.validTill) { - UA_LOG_INFO_SESSION(&server->config.logger, ¤t->session, + UA_LOG_INFO_SESSION(server->config.logging, ¤t->session, "Client tries to use a session that has timed out"); return NULL; } @@ -166,7 +166,7 @@ getSessionById(UA_Server *server, const UA_NodeId *sessionId) { /* Session has timed out */ if(UA_DateTime_nowMonotonic() > current->session.validTill) { - UA_LOG_INFO_SESSION(&server->config.logger, ¤t->session, + UA_LOG_INFO_SESSION(server->config.logging, ¤t->session, "Client tries to use a session that has timed out"); return NULL; } @@ -228,7 +228,7 @@ UA_Server_createSession(UA_Server *server, UA_SecureChannel *channel, UA_LOCK_ASSERT(&server->serviceMutex, 1); if(server->sessionCount >= server->config.maxSessions) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Could not create a Session - Server limits reached"); return UA_STATUSCODE_BADTOOMANYSESSIONS; } @@ -266,7 +266,7 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response) { UA_LOCK_ASSERT(&server->serviceMutex, 1); - UA_LOG_DEBUG_CHANNEL(&server->config.logger, channel, "Trying to create session"); + UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Trying to create session"); if(channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { @@ -280,7 +280,7 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, UA_StatusCode retval = channel->securityPolicy->channelModule. compareCertificate(channel->channelContext, &request->clientCertificate); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "The client certificate did not validate"); response->responseHeader.serviceResult = UA_STATUSCODE_BADCERTIFICATEINVALID; return; @@ -302,7 +302,7 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, cv->verifyApplicationURI(cv, &request->clientCertificate, &request->clientDescription.applicationUri); if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "The client's ApplicationURI did not match the certificate"); server->serverDiagnosticsSummary.securityRejectedSessionCount++; server->serverDiagnosticsSummary.rejectedSessionCount++; @@ -315,7 +315,7 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, response->responseHeader.serviceResult = UA_Server_createSession(server, channel, request, &newSession); if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "Processing CreateSessionRequest failed"); server->serverDiagnosticsSummary.rejectedSessionCount++; return; @@ -391,7 +391,7 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, createSessionObject(server, newSession); #endif - UA_LOG_INFO_SESSION(&server->config.logger, newSession, "Session created"); + UA_LOG_INFO_SESSION(server->config.logging, newSession, "Session created"); } static UA_StatusCode @@ -539,7 +539,7 @@ decryptUserNamePW(UA_Server *server, UA_Session *session, if(userToken->encryptionAlgorithm.length > 0) return UA_STATUSCODE_BADIDENTITYTOKENINVALID; - UA_LOG_WARNING_SESSION(&server->config.logger, session, "ActivateSession: " + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: " "Received an unencrypted username/passwort. " "Is the server misconfigured to allow that?"); return UA_STATUSCODE_GOOD; @@ -559,7 +559,7 @@ decryptUserNamePW(UA_Server *server, UA_Session *session, sp->channelModule.newContext(sp, &sp->localCertificate, &tempChannelContext); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Failed to create a " "context for the SecurityPolicy %.*s", (int)sp->policyUri.length, @@ -628,7 +628,7 @@ decryptUserNamePW(UA_Server *server, UA_Session *session, UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Failed to decrypt the " "password with the StatusCode %s", UA_StatusCode_name(res)); @@ -652,7 +652,7 @@ checkActivateSessionX509(UA_Server *server, UA_Session *session, newContext(sp, &token->certificateData, &tempChannelContext); UA_LOCK(&server->serviceMutex); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Failed to create a context " "for the SecurityPolicy %.*s", (int)sp->policyUri.length, @@ -664,7 +664,7 @@ checkActivateSessionX509(UA_Server *server, UA_Session *session, res = checkCertificateSignature(server, sp, tempChannelContext, &session->serverNonce, tokenSignature, true); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: User token signature check " "failed with StatusCode %s", UA_StatusCode_name(res)); } @@ -698,7 +698,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, /* Get the session */ UA_Session *session = getSessionByToken(server, &req->requestHeader.authenticationToken); if(!session) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "ActivateSession: Session not found"); resp->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID; goto rejected; @@ -710,7 +710,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, * CreateSession request. Subsequent calls to ActivateSession may be * associated with different SecureChannels. */ if(!session->activated && session->header.channel != channel) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "ActivateSession: The Session has to be initially activated " "on the SecureChannel that created it"); resp->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID; @@ -719,7 +719,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, /* Has the session timed out? */ if(session->validTill < UA_DateTime_nowMonotonic()) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: The Session has timed out"); resp->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID; goto rejected; @@ -734,7 +734,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, &session->serverNonce, &req->clientSignature, false); if(resp->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Client signature check failed " "with StatusCode %s", UA_StatusCode_name(resp->responseHeader.serviceResult)); @@ -784,7 +784,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, &req->userIdentityToken, &session->sessionHandle); UA_LOCK(&server->serviceMutex); if(resp->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: The AccessControl " "plugin denied the activation with the StatusCode %s", UA_StatusCode_name(resp->responseHeader.serviceResult)); @@ -797,7 +797,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, if(!session->header.channel || session->header.channel != channel) { /* Attach the new SecureChannel, the old channel will be detached if present */ UA_Session_attachToSecureChannel(session, channel); - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "ActivateSession: Session attached to new channel"); } @@ -807,7 +807,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_ByteString_copy(&session->serverNonce, &resp->serverNonce); if(resp->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { UA_Session_detachFromSecureChannel(session); - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Could not generate the server nonce"); goto rejected; } @@ -823,7 +823,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, (void**)&tmpLocaleIds, &UA_TYPES[UA_TYPES_STRING]); if(resp->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { UA_Session_detachFromSecureChannel(session); - UA_LOG_WARNING_SESSION(&server->config.logger, session, + UA_LOG_WARNING_SESSION(server->config.logging, session, "ActivateSession: Could not store the Session LocaleIds"); goto rejected; } @@ -887,7 +887,7 @@ Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, #endif /* Log the user for which the Session was activated */ - UA_LOG_INFO_SESSION(&server->config.logger, session, + UA_LOG_INFO_SESSION(server->config.logging, session, "ActivateSession: Session activated with ClientUserId \"%.*s\"", (int)session->clientUserIdOfSession.length, session->clientUserIdOfSession.data); @@ -918,20 +918,20 @@ Service_CloseSession(UA_Server *server, UA_SecureChannel *channel, if(!session && response->responseHeader.serviceResult == UA_STATUSCODE_GOOD) response->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID; if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_CHANNEL(&server->config.logger, channel, + UA_LOG_WARNING_CHANNEL(server->config.logging, channel, "CloseSession: No Session activated to the SecureChannel"); return; } UA_assert(session); /* Assured by the previous section */ - UA_LOG_INFO_SESSION(&server->config.logger, session, "Closing the Session"); + UA_LOG_INFO_SESSION(server->config.logging, session, "Closing the Session"); #ifdef UA_ENABLE_SUBSCRIPTIONS /* If Subscriptions are not deleted, detach them from the Session */ if(!request->deleteSubscriptions) { UA_Subscription *sub, *sub_tmp; TAILQ_FOREACH_SAFE(sub, &session->subscriptions, sessionListEntry, sub_tmp) { - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, sub, "Detaching the Subscription from the Session"); UA_Session_detachSubscription(server, session, sub, true); } diff --git a/src/server/ua_services_subscription.c b/src/server/ua_services_subscription.c index d26eb521565..67bfc22d0e9 100644 --- a/src/server/ua_services_subscription.c +++ b/src/server/ua_services_subscription.c @@ -69,7 +69,7 @@ Service_CreateSubscription(UA_Server *server, UA_Session *session, /* Create the subscription */ UA_Subscription *sub = UA_Subscription_new(); if(!sub) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing CreateSubscriptionRequest failed"); response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; return; @@ -104,7 +104,7 @@ Service_CreateSubscription(UA_Server *server, UA_Session *session, UA_SUBSCRIPTIONSTATE_ENABLED : UA_SUBSCRIPTIONSTATE_ENABLED_NOPUBLISH; UA_StatusCode res = Subscription_setState(server, sub, sState); if(res != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_SESSION(&server->config.logger, sub->session, + UA_LOG_DEBUG_SESSION(server->config.logging, sub->session, "Subscription %" PRIu32 " | Could not register " "publish callback with error code %s", sub->subscriptionId, UA_StatusCode_name(res)); @@ -113,7 +113,7 @@ Service_CreateSubscription(UA_Server *server, UA_Session *session, return; } - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, sub, "Subscription created (Publishing interval %.2fms, " "max %lu notifications per publish)", sub->publishingInterval, @@ -130,7 +130,7 @@ void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, UA_ModifySubscriptionResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing ModifySubscriptionRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -217,7 +217,7 @@ void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, UA_SetPublishingModeResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing SetPublishingModeRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -235,7 +235,7 @@ Service_SetPublishingMode(UA_Server *server, UA_Session *session, UA_StatusCode Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing PublishRequest with RequestId %u", requestId); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -291,7 +291,7 @@ Service_Publish(UA_Server *server, UA_Session *session, UA_Subscription *sub = UA_Session_getSubscriptionById(session, ack->subscriptionId); if(!sub) { response->results[i] = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Cannot process acknowledgements subscription %u" PRIu32, ack->subscriptionId); continue; @@ -313,7 +313,7 @@ Service_Publish(UA_Server *server, UA_Session *session, * callback. This can also be triggered right now for a late * subscription. */ UA_Session_queuePublishReq(session, entry, false); - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Queued a publication message"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Queued a publication message"); /* If there are late subscriptions, the new publish request is used to * answer them immediately. Late subscriptions with higher priority are @@ -327,7 +327,7 @@ Service_Publish(UA_Server *server, UA_Session *session, continue; /* Call publish on the late subscription */ - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, late, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, late, "Send PublishResponse on a late subscription"); UA_Subscription_publish(server, late); @@ -360,7 +360,7 @@ Operation_DeleteSubscription(UA_Server *server, UA_Session *session, void *_, UA_Subscription *sub = UA_Session_getSubscriptionById(session, *subscriptionId); if(!sub) { *result = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Deleting Subscription with Id %" PRIu32 " failed with error code %s", *subscriptionId, UA_StatusCode_name(*result)); @@ -369,7 +369,7 @@ Operation_DeleteSubscription(UA_Server *server, UA_Session *session, void *_, UA_Subscription_delete(server, sub); *result = UA_STATUSCODE_GOOD; - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Subscription %" PRIu32 " | Subscription deleted", *subscriptionId); } @@ -378,7 +378,7 @@ void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, UA_DeleteSubscriptionsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing DeleteSubscriptionsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -393,7 +393,7 @@ void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, UA_RepublishResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing RepublishRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -583,7 +583,7 @@ Operation_TransferSubscription(UA_Server *server, UA_Session *session, /* Attach to the session */ UA_Session_attachSubscription(session, newSub); - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, newSub, "Transferred to this Session"); + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, newSub, "Transferred to this Session"); /* Set StatusChange in the original subscription and force publish. This * also removes the Subscription, even if there was no PublishResponse @@ -634,7 +634,7 @@ Operation_TransferSubscription(UA_Server *server, UA_Session *session, void Service_TransferSubscriptions(UA_Server *server, UA_Session *session, const UA_TransferSubscriptionsRequest *request, UA_TransferSubscriptionsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing TransferSubscriptionsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); diff --git a/src/server/ua_services_view.c b/src/server/ua_services_view.c index 2dbe087efba..0bafe865e32 100644 --- a/src/server/ua_services_view.c +++ b/src/server/ua_services_view.c @@ -959,7 +959,7 @@ Operation_Browse(UA_Server *server, UA_Session *session, const UA_UInt32 *maxref void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, "Processing BrowseRequest"); + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing BrowseRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); /* Test the number of operations in the request */ @@ -1078,7 +1078,7 @@ void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, UA_BrowseNextResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing BrowseNextRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -1385,7 +1385,7 @@ void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing TranslateBrowsePathsToNodeIdsRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -1413,7 +1413,7 @@ browseSimplifiedBrowsePath(UA_Server *server, const UA_NodeId origin, UA_BrowsePathResult bpr; UA_BrowsePathResult_init(&bpr); if(browsePathSize > UA_MAX_TREE_RECURSE) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Simplified Browse Path too long"); bpr.statusCode = UA_STATUSCODE_BADINTERNALERROR; return bpr; @@ -1457,7 +1457,7 @@ UA_Server_browseSimplifiedBrowsePath(UA_Server *server, const UA_NodeId origin, void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, UA_RegisterNodesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing RegisterNodesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); @@ -1484,7 +1484,7 @@ void Service_RegisterNodes(UA_Server *server, UA_Session *session, void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, UA_UnregisterNodesResponse *response) { - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing UnRegisterNodesRequest"); UA_LOCK_ASSERT(&server->serviceMutex, 1); diff --git a/src/server/ua_subscription.c b/src/server/ua_subscription.c index cf29c591dbd..714bf5e3258 100644 --- a/src/server/ua_subscription.c +++ b/src/server/ua_subscription.c @@ -71,7 +71,7 @@ UA_Subscription_delete(UA_Server *server, UA_Subscription *sub) { UA_NodeId_clear(&sub->ns0Id); #endif - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, sub, "Subscription deleted"); + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, sub, "Subscription deleted"); /* Detach from the session if necessary */ if(sub->session) @@ -172,13 +172,13 @@ UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub /* Release the oldest entry if there is not enough space */ UA_Session *session = sub->session; if(sub->retransmissionQueueSize >= UA_MAX_RETRANSMISSIONQUEUESIZE) { - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "Subscription retransmission queue overflow"); removeOldestRetransmissionMessageFromSub(sub); } else if(session && server->config.maxRetransmissionQueueSize > 0 && session->totalRetransmissionQueueSize >= server->config.maxRetransmissionQueueSize) { - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "Session-wide retransmission queue overflow"); removeOldestRetransmissionMessageFromSession(sub->session); } @@ -366,16 +366,16 @@ sendStatusChangeDelete(UA_Server *server, UA_Subscription *sub, /* Cannot send out the StatusChange because no response is queued. * Delete the Subscription without sending the StatusChange, if the statusChange is Bad*/ if(!pre) { - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Cannot send the StatusChange notification because no response is queued."); if(UA_StatusCode_isBad(sub->statusChange)) { - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, "Removing the subscription."); + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Removing the subscription."); UA_Subscription_delete(server, sub); } return; } - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Sending out a StatusChange " "notification and removing the subscription"); @@ -398,7 +398,7 @@ sendStatusChangeDelete(UA_Server *server, UA_Subscription *sub, /* Send the response */ UA_assert(sub->session); /* Otherwise pre is NULL */ - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Sending out a publish response"); sendResponse(server, sub->session, sub->session->header.channel, pre->requestId, (UA_Response *)response, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); @@ -439,7 +439,7 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { /* Check if the TimeoutHint is still valid. Otherwise return with a bad * statuscode and continue. */ if(pre->maxTime < nowMonotonic) { - UA_LOG_DEBUG_SESSION(&server->config.logger, sub->session, + UA_LOG_DEBUG_SESSION(server->config.logging, sub->session, "Publish request %u has timed out", pre->requestId); pre->response.responseHeader.serviceResult = UA_STATUSCODE_BADTIMEOUT; sendResponse(server, sub->session, sub->session->header.channel, @@ -456,11 +456,11 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { if(pre) { Subscription_resetLifetime(sub); } else { - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "The publish queue is empty"); ++sub->currentLifetimeCount; if(sub->currentLifetimeCount > sub->lifeTimeCount) { - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "End of subscription lifetime"); /* Set the StatusChange to delete the subscription. */ sub->statusChange = UA_STATUSCODE_BADTIMEOUT; @@ -490,14 +490,14 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { UA_Session_queuePublishReq(sub->session, pre, true); /* Re-enqueue */ return; } - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, "Sending a KeepAlive"); + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Sending a KeepAlive"); } /* We want to send a response, but cannot. Either because there is no queued * response or because the Subscription is detached from a Session or because * the SecureChannel for the Session is closed. */ if(!pre || !sub->session || !sub->session->header.channel) { - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Want to send a publish response but cannot. " "The subscription is late."); sub->late = true; @@ -523,7 +523,7 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { retransmission = (UA_NotificationMessageEntry*) UA_malloc(sizeof(UA_NotificationMessageEntry)); if(!retransmission) { - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "Could not allocate memory for retransmission. " "The subscription is late."); sub->late = true; @@ -536,7 +536,7 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { UA_StatusCode retval = prepareNotificationMessage(server, sub, message, notifications); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "Could not prepare the notification message. " "The subscription is late."); /* If the retransmission queue is enabled a retransmission message is allocated */ @@ -590,7 +590,7 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) { UA_assert(i == sub->retransmissionQueueSize); /* Send the response */ - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Sending out a publish response with %" PRIu32 " notifications", notifications); sendResponse(server, sub->session, sub->session->header.channel, pre->requestId, @@ -681,7 +681,7 @@ UA_Session_ensurePublishQueueSpace(UA_Server* server, UA_Session* session) { UA_PublishResponseEntry *pre = UA_Session_dequeuePublishReq(session); UA_assert(pre != NULL); /* There must be a pre as session->responseQueueSize > 0 */ - UA_LOG_DEBUG_SESSION(&server->config.logger, session, + UA_LOG_DEBUG_SESSION(server->config.logging, session, "Sending out a publish response triggered by too many publish requests"); /* Send the response. This response has no related subscription id */ @@ -701,7 +701,7 @@ sampleAndPublishCallback(UA_Server *server, UA_Subscription *sub) { UA_LOCK(&server->serviceMutex); UA_assert(sub); - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "Sample and Publish Callback"); /* Sample the MonitoredItems with sampling interval <0 (which implies diff --git a/src/server/ua_subscription_alarms_conditions.c b/src/server/ua_subscription_alarms_conditions.c index 1e7610a579b..ce0b7467136 100644 --- a/src/server/ua_subscription_alarms_conditions.c +++ b/src/server/ua_subscription_alarms_conditions.c @@ -173,7 +173,7 @@ static const UA_QualifiedName fieldExpirationLimitQN = STATIC_QN(CONDITION_FIELD #define CONDITION_ASSERT_RETURN_RETVAL(retval, logMessage, deleteFunction) \ { \ if(retval != UA_STATUSCODE_GOOD) { \ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, \ + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, \ logMessage". StatusCode %s", UA_StatusCode_name(retval)); \ deleteFunction \ return retval; \ @@ -183,7 +183,7 @@ static const UA_QualifiedName fieldExpirationLimitQN = STATIC_QN(CONDITION_FIELD #define CONDITION_ASSERT_RETURN_VOID(retval, logMessage, deleteFunction) \ { \ if(retval != UA_STATUSCODE_GOOD) { \ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, \ + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, \ logMessage". StatusCode %s", UA_StatusCode_name(retval)); \ deleteFunction \ return; \ @@ -533,7 +533,7 @@ UA_Server_getConditionLastSeverity(UA_Server *server, const UA_NodeId *condition UA_LOCK(&server->serviceMutex); UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADNOTFOUND; @@ -552,7 +552,7 @@ UA_Server_updateConditionLastSeverity(UA_Server *server, const UA_NodeId *condit UA_LOCK(&server->serviceMutex); UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADNOTFOUND; @@ -571,7 +571,7 @@ UA_Server_getConditionActiveState(UA_Server *server, const UA_NodeId *conditionS UA_LOCK(&server->serviceMutex); UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADNOTFOUND; @@ -591,7 +591,7 @@ UA_Server_updateConditionActiveState(UA_Server *server, const UA_NodeId *conditi UA_LOCK(&server->serviceMutex); UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); UA_UNLOCK(&server->serviceMutex); return UA_STATUSCODE_BADNOTFOUND; @@ -611,7 +611,7 @@ updateConditionLastEventId(UA_Server *server, const UA_NodeId *triggeredEvent, UA_Condition *cond = getCondition(server, conditionSource, triggeredEvent); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); return UA_STATUSCODE_BADNOTFOUND; } @@ -624,7 +624,7 @@ updateConditionLastEventId(UA_Server *server, const UA_NodeId *triggeredEvent, return UA_ByteString_copy(lastEventId, &branch->lastEventId); } } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Branch not implemented"); return UA_STATUSCODE_BADNOTFOUND; } @@ -636,7 +636,7 @@ setIsCallerAC(UA_Server *server, const UA_NodeId *condition, UA_Condition *cond = getCondition(server, conditionSource, condition); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); return; } @@ -648,7 +648,7 @@ setIsCallerAC(UA_Server *server, const UA_NodeId *condition, return; } } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Branch not implemented"); } @@ -659,7 +659,7 @@ isConditionOrBranch(UA_Server *server, const UA_NodeId *condition, UA_Condition *cond = getCondition(server, conditionSource, condition); if(!cond) { - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); return false; } @@ -671,7 +671,7 @@ isConditionOrBranch(UA_Server *server, const UA_NodeId *condition, return true; } } - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Branch not implemented"); return false; } @@ -684,7 +684,7 @@ isRetained(UA_Server *server, const UA_NodeId *condition) { UA_NodeId retainNodeId; UA_StatusCode retval = getConditionFieldNodeId(server, condition, &fieldRetainQN, &retainNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Retain not found. StatusCode %s", UA_StatusCode_name(retval)); return false; //TODO maybe a better error handling? } @@ -728,7 +728,7 @@ isTwoStateVariableInTrueState(UA_Server *server, const UA_NodeId *condition, &twoStateVariableIdQN, &twoStateVariableIdNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "TwoStateVariable/Id not found. StatusCode %s", UA_StatusCode_name(retval)); return false; //TODO maybe a better error handling? } @@ -769,7 +769,7 @@ enteringDisabledState(UA_Server *server, const UA_NodeId *conditionId, UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); return UA_STATUSCODE_BADNOTFOUND; } @@ -836,7 +836,7 @@ enteringEnabledState(UA_Server *server, /* Get Condition */ UA_Condition *cond = getCondition(server, conditionSource, conditionId); if(!cond) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Entry not found in list!"); return UA_STATUSCODE_BADNOTFOUND; } @@ -1375,7 +1375,7 @@ disableMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_NodeId conditionTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_CONDITIONTYPE); if(UA_NodeId_equal(objectId, &conditionTypeNodeId)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot call method of ConditionType Node. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNODEIDINVALID)); return UA_STATUSCODE_BADNODEIDINVALID; @@ -1408,7 +1408,7 @@ enableMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_NodeId conditionTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_CONDITIONTYPE); if(UA_NodeId_equal(objectId, &conditionTypeNodeId)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot call method of ConditionType Node. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNODEIDINVALID)); return UA_STATUSCODE_BADNODEIDINVALID; @@ -1449,7 +1449,7 @@ addCommentMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_NodeId conditionTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_CONDITIONTYPE); if(UA_NodeId_equal(objectId, &conditionTypeNodeId)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot call method of ConditionType Node. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNODEIDINVALID)); return UA_STATUSCODE_BADNODEIDINVALID; @@ -1532,7 +1532,7 @@ acknowledgeMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_NodeId conditionTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_CONDITIONTYPE); if(UA_NodeId_equal(objectId, &conditionTypeNodeId)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot call method of ConditionType Node. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNODEIDINVALID)); return UA_STATUSCODE_BADNODEIDINVALID; @@ -1569,7 +1569,7 @@ acknowledgeMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_REFERENCETYPEINDEX_HASSUBTYPE); UA_UNLOCK(&server->serviceMutex); if(!found) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Type must be a subtype of AcknowledgeableConditionType!"); UA_NodeId_clear(&conditionNode); UA_NodeId_clear(&eventType); @@ -1614,7 +1614,7 @@ confirmMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_NodeId conditionTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_CONDITIONTYPE); if(UA_NodeId_equal(objectId, &conditionTypeNodeId)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot call method of ConditionType Node. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNODEIDINVALID)); return UA_STATUSCODE_BADNODEIDINVALID; @@ -1651,7 +1651,7 @@ confirmMethodCallback(UA_Server *server, const UA_NodeId *sessionId, UA_REFERENCETYPEINDEX_HASSUBTYPE); UA_UNLOCK(&server->serviceMutex); if(!found) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Type must be a subtype of AcknowledgeableConditionType!"); UA_NodeId_clear(&conditionNode); UA_NodeId_clear(&eventType); @@ -2122,7 +2122,7 @@ setStandardConditionFields(UA_Server *server, const UA_NodeId* condition, /* Get ConditionSourceNode*/ const UA_Node *conditionSourceNode = UA_NODESTORE_GET(server, conditionSource); if(!conditionSourceNode) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Couldn't find ConditionSourceNode. StatusCode %s", UA_StatusCode_name(retval)); return UA_STATUSCODE_BADNOTFOUND; } @@ -2133,7 +2133,7 @@ setStandardConditionFields(UA_Server *server, const UA_NodeId* condition, retval = setConditionField(server, *condition, &value, UA_QUALIFIEDNAME(0,CONDITION_FIELD_SOURCENAME)); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Set SourceName Field failed. StatusCode %s", UA_StatusCode_name(retval)); UA_NODESTORE_RELEASE(server, conditionSourceNode); @@ -2145,7 +2145,7 @@ setStandardConditionFields(UA_Server *server, const UA_NodeId* condition, &UA_TYPES[UA_TYPES_NODEID]); retval = setConditionField(server, *condition, &value, fieldSourceQN); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Set SourceNode Field failed. StatusCode %s", UA_StatusCode_name(retval)); UA_NODESTORE_RELEASE(server, conditionSourceNode); return retval; @@ -2544,7 +2544,7 @@ UA_Server_createCondition(UA_Server *server, UA_LOCK_ASSERT(&server->serviceMutex, 0); if(!outNodeId) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "outNodeId cannot be NULL!"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -2568,7 +2568,7 @@ UA_Server_addCondition_begin(UA_Server *server, const UA_NodeId conditionId, UA_LOCK_ASSERT(&server->serviceMutex, 0); if(!outNodeId) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "outNodeId cannot be NULL!"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -2580,7 +2580,7 @@ UA_Server_addCondition_begin(UA_Server *server, const UA_NodeId conditionId, UA_REFERENCETYPEINDEX_HASSUBTYPE); UA_UNLOCK(&server->serviceMutex); if(!found) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Condition Type must be a subtype of ConditionType!"); return UA_STATUSCODE_BADNOMATCH; } @@ -2648,7 +2648,7 @@ addOptionalVariableField(UA_Server *server, const UA_NodeId *originCondition, /* Get typedefintion */ const UA_Node *type = getNodeType(server, &optionalVariableFieldNode->head); if(!type) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Invalid VariableType. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADTYPEDEFINITIONINVALID)); return UA_STATUSCODE_BADTYPEDEFINITIONINVALID; @@ -2687,7 +2687,7 @@ addOptionalObjectField(UA_Server *server, const UA_NodeId *originCondition, /* Get typedefintion */ const UA_Node *type = getNodeType(server, &optionalObjectFieldNode->head); if(!type) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Invalid ObjectType. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADTYPEDEFINITIONINVALID)); return UA_STATUSCODE_BADTYPEDEFINITIONINVALID; @@ -2729,7 +2729,7 @@ addConditionOptionalField(UA_Server *server, const UA_NodeId condition, UA_NodeId optionalFieldNodeId = bpr.targets[0].targetId.nodeId; const UA_Node *optionalFieldNode = UA_NODESTORE_GET(server, &optionalFieldNodeId); if(NULL == optionalFieldNode) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Couldn't find optional Field Node in ConditionType. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNOTFOUND)); UA_BrowsePathResult_clear(&bpr); @@ -2742,7 +2742,7 @@ addConditionOptionalField(UA_Server *server, const UA_NodeId condition, addOptionalVariableField(server, &condition, &fieldName, (const UA_VariableNode *)optionalFieldNode, outOptionalNode); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Adding Condition Optional Variable Field failed. StatusCode %s", UA_StatusCode_name(retval)); } @@ -2755,7 +2755,7 @@ addConditionOptionalField(UA_Server *server, const UA_NodeId condition, addOptionalObjectField(server, &condition, &fieldName, (const UA_ObjectNode *)optionalFieldNode, outOptionalNode); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Adding Condition Optional Object Field failed. StatusCode %s", UA_StatusCode_name(retval)); } @@ -2777,7 +2777,7 @@ addConditionOptionalField(UA_Server *server, const UA_NodeId condition, } #else - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Adding Condition Optional Fields disabled. StatusCode %s", UA_StatusCode_name(UA_STATUSCODE_BADNOTSUPPORTED)); return UA_STATUSCODE_BADNOTSUPPORTED; @@ -2893,7 +2893,7 @@ triggerConditionEvent(UA_Server *server, const UA_NodeId condition, UA_ByteString eventId = UA_BYTESTRING_NULL; UA_QualifiedName enabledStateField = UA_QUALIFIEDNAME(0, CONDITION_FIELD_ENABLEDSTATE); if(!isTwoStateVariableInTrueState(server, &condition, &enabledStateField)) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_USERLAND, "Cannot trigger condition event when " CONDITION_FIELD_ENABLEDSTATE"." CONDITION_FIELD_TWOSTATEVARIABLE_ID" is false."); @@ -3125,7 +3125,7 @@ UA_Server_setExpirationDate(UA_Server *server, const UA_NodeId conditionId, UA_StatusCode retval; if(cert.data == NULL){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "No Certificate found."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -3133,14 +3133,14 @@ UA_Server_setExpirationDate(UA_Server *server, const UA_NodeId conditionId, UA_CertificateVerification *cv = &server->config.sessionPKI; UA_DateTime getExpiryDateAndTime; if(cv == NULL && cv->getExpirationDate == NULL) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Certificate verification and get Expiration date function is not registered"); return UA_STATUSCODE_BADINTERNALERROR; } retval = cv->getExpirationDate(&getExpiryDateAndTime, &cert); if(retval != UA_STATUSCODE_GOOD){ - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_SERVER, "Failed to get certificate expiration date"); return UA_STATUSCODE_BADINTERNALERROR; } diff --git a/src/server/ua_subscription_datachange.c b/src/server/ua_subscription_datachange.c index 047e97e2938..4ec7bd8915b 100644 --- a/src/server/ua_subscription_datachange.c +++ b/src/server/ua_subscription_datachange.c @@ -157,7 +157,7 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub, /* Has the value changed (with the filters applied)? */ UA_Boolean changed = detectValueChange(server, mon, value); if(!changed) { - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | " "The value has not changed", mon->monitoredItemId); UA_DataValue_clear(value); @@ -213,7 +213,7 @@ monitoredItem_sampleCallback(UA_Server *server, UA_MonitoredItem *mon) { if(sub) session = sub->session; - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, "MonitoredItem %" PRIi32 + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | Sample callback called", mon->monitoredItemId); UA_assert(mon->itemToMonitor.attributeId != UA_ATTRIBUTEID_EVENTNOTIFIER); @@ -226,7 +226,7 @@ monitoredItem_sampleCallback(UA_Server *server, UA_MonitoredItem *mon) { UA_StatusCode res = sampleCallbackWithValue(server, sub, mon, &dv); if(res != UA_STATUSCODE_GOOD) { UA_DataValue_clear(&dv); - UA_LOG_WARNING_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_WARNING_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | " "Sampling returned the statuscode %s", mon->monitoredItemId, UA_StatusCode_name(res)); diff --git a/src/server/ua_subscription_events.c b/src/server/ua_subscription_events.c index 6e8a6945f24..7c719aa62b0 100644 --- a/src/server/ua_subscription_events.c +++ b/src/server/ua_subscription_events.c @@ -31,7 +31,7 @@ generateEventId(UA_ByteString *generatedId) { UA_StatusCode createEvent(UA_Server *server, const UA_NodeId eventType, UA_NodeId *outNodeId) { if(!outNodeId) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "outNodeId must not be NULL. The event's NodeId must be returned " "so it can be triggered."); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -41,7 +41,7 @@ createEvent(UA_Server *server, const UA_NodeId eventType, UA_NodeId *outNodeId) UA_NodeId baseEventTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEEVENTTYPE); if(!isNodeInTree_singleRef(server, &eventType, &baseEventTypeId, UA_REFERENCETYPEINDEX_HASSUBTYPE)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Event type must be a subtype of BaseEventType!"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -63,7 +63,7 @@ createEvent(UA_Server *server, const UA_NodeId eventType, UA_NodeId *outNodeId) NULL, /* no node context */ &newNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Adding event failed. StatusCode %s", UA_StatusCode_name(retval)); return retval; } @@ -225,7 +225,7 @@ setHistoricalEvent(UA_Server *server, const UA_NodeId *origin, if(retval != UA_STATUSCODE_GOOD) { /* Do not vex users with no match errors */ if(retval != UA_STATUSCODE_BADNOMATCH) - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Cannot read the HistoricalEventFilter property of a " "listening node. StatusCode %s", UA_StatusCode_name(retval)); @@ -236,7 +236,7 @@ setHistoricalEvent(UA_Server *server, const UA_NodeId *origin, if(UA_Variant_isEmpty(&historicalEventFilterValue) || !UA_Variant_isScalar(&historicalEventFilterValue) || historicalEventFilterValue.type != &UA_TYPES[UA_TYPES_EVENTFILTER]) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "HistoricalEventFilter property of a listening node " "does not have a valid value"); UA_Variant_clear(&historicalEventFilterValue); @@ -276,7 +276,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, UA_LOCK_ASSERT(&server->serviceMutex, 1); UA_LOG_NODEID_DEBUG(&origin, - UA_LOG_DEBUG(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: An event is triggered on node %.*s", (int)nodeIdStr.length, nodeIdStr.data)); @@ -284,7 +284,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, UA_Boolean isCallerAC = false; if(isConditionOrBranch(server, &eventNodeId, &origin, &isCallerAC)) { if(!isCallerAC) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Condition Events: Please use A&C API to trigger Condition Events 0x%08X", UA_STATUSCODE_BADINVALIDARGUMENT); return UA_STATUSCODE_BADINVALIDARGUMENT; @@ -295,7 +295,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, /* Check that the origin node exists */ const UA_Node *originNode = UA_NODESTORE_GET(server, &origin); if(!originNode) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Origin node for event does not exist."); return UA_STATUSCODE_BADNOTFOUND; } @@ -310,7 +310,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, UA_ReferenceTypeSet tmpRefTypes; retval = referenceTypeIndices(server, &isInFolderReferences[i], &tmpRefTypes, true); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: Could not create the list of references and their subtypes " "with StatusCode %s", UA_StatusCode_name(retval)); } @@ -318,7 +318,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, } if(!isNodeInTree(server, &origin, &objectsFolderId, &refTypes)) { - UA_LOG_ERROR(&server->config.logger, UA_LOGCATEGORY_USERLAND, + UA_LOG_ERROR(server->config.logging, UA_LOGCATEGORY_USERLAND, "Node for event must be in ObjectsFolder!"); return UA_STATUSCODE_BADINVALIDARGUMENT; } @@ -326,7 +326,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, /* Update the standard fields of the event */ retval = eventSetStandardFields(server, &eventNodeId, &origin, outEventId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: Could not set the standard event fields with StatusCode %s", UA_StatusCode_name(retval)); return retval; @@ -355,7 +355,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, UA_ReferenceTypeSet tmpRefTypes; retval = referenceTypeIndices(server, &emitReferencesRoots[i], &tmpRefTypes, true); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: Could not create the list of references for event " "propagation with StatusCode %s", UA_StatusCode_name(retval)); goto cleanup; @@ -368,7 +368,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, &emitRefTypes, UA_NODECLASS_UNSPECIFIED, true, &emitNodesSize, &emitNodes); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: Could not create the list of nodes listening on the " "event with StatusCode %s", UA_StatusCode_name(retval)); goto cleanup; @@ -395,7 +395,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, continue; retval = UA_MonitoredItem_addEvent(server, mon, &eventNodeId); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Events: Could not add the event to a listening " "node with StatusCode %s", UA_StatusCode_name(retval)); retval = UA_STATUSCODE_GOOD; /* Only log problems with individual emit nodes */ @@ -415,7 +415,7 @@ triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, if(deleteEventNode) { retval = deleteNode(server, eventNodeId, true); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(&server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(server->config.logging, UA_LOGCATEGORY_SERVER, "Attempt to remove event using deleteNode failed. StatusCode %s", UA_StatusCode_name(retval)); } diff --git a/src/server/ua_subscription_events_filter.c b/src/server/ua_subscription_events_filter.c index 022b1065905..74615ac29f3 100644 --- a/src/server/ua_subscription_events_filter.c +++ b/src/server/ua_subscription_events_filter.c @@ -601,7 +601,7 @@ ofTypeOperator(UA_FilterEvalContext *ctx, size_t index) { UA_CHECK_STATUS(res, return res); if(!UA_Variant_hasScalarType(&eventTypeVar, &UA_TYPES[UA_TYPES_NODEID])) { - UA_LOG_WARNING(&ctx->server->config.logger, UA_LOGCATEGORY_SERVER, + UA_LOG_WARNING(ctx->server->config.logging, UA_LOGCATEGORY_SERVER, "EventType has an invalid type."); UA_Variant_clear(&eventTypeVar); return UA_STATUSCODE_BADINTERNALERROR; diff --git a/src/server/ua_subscription_monitoreditem.c b/src/server/ua_subscription_monitoreditem.c index a8b4d6d3334..b08b0aa0864 100644 --- a/src/server/ua_subscription_monitoreditem.c +++ b/src/server/ua_subscription_monitoreditem.c @@ -227,7 +227,7 @@ UA_Notification_enqueueMon(UA_Server *server, UA_Notification *n) { * adding the new Notification. */ UA_MonitoredItem_ensureQueueSpace(server, mon); - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, mon->subscription, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, mon->subscription, "MonitoredItem %" PRIi32 " | " "Notification enqueued (Queue size %lu / %lu)", mon->monitoredItemId, @@ -277,7 +277,7 @@ UA_Notification_enqueueAndTrigger(UA_Server *server, UA_Notification *n) { mon->triggeredUntil > UA_DateTime_nowMonotonic())) { UA_Notification_enqueueSub(n); mon->triggeredUntil = UA_INT64_MIN; - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, mon->subscription, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, mon->subscription, "Notification enqueued (Queue size %lu)", (long unsigned)mon->subscription->notificationQueueSize); } @@ -314,7 +314,7 @@ UA_Notification_enqueueAndTrigger(UA_Server *server, UA_Notification *n) { triggeredMon->triggeredUntil = UA_DateTime_nowMonotonic() + (UA_DateTime)(sub->publishingInterval * (UA_Double)UA_DATETIME_MSEC); - UA_LOG_DEBUG_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %u triggers MonitoredItem %u", mon->monitoredItemId, triggeredMon->monitoredItemId); } @@ -469,7 +469,7 @@ UA_Server_unregisterMonitoredItem(UA_Server *server, UA_MonitoredItem *mon) { return; UA_Subscription *sub = mon->subscription; - UA_LOG_INFO_SUBSCRIPTION(&server->config.logger, sub, + UA_LOG_INFO_SUBSCRIPTION(server->config.logging, sub, "MonitoredItem %" PRIi32 " | Deleting the MonitoredItem", mon->monitoredItemId); diff --git a/tests/server/check_server_speed_addnodes.c b/tests/server/check_server_speed_addnodes.c index d3dccc1e3cb..1db106a9ec1 100644 --- a/tests/server/check_server_speed_addnodes.c +++ b/tests/server/check_server_speed_addnodes.c @@ -17,7 +17,7 @@ static void setup(void) { UA_ServerConfig_setDefault(UA_Server_getConfig(server)); /* Disable logging */ UA_ServerConfig *config = UA_Server_getConfig(server); - config->logger.log = NULL; + config->logging = NULL; } static void teardown(void) {