refactor(client): Improve the logging of Endpoint selection

This commit is contained in:
Julius Pfrommer 2024-12-03 20:25:16 +01:00 committed by Julius Pfrommer
parent 9e17e1b4f9
commit d005cc1bcc

View File

@ -961,7 +961,8 @@ matchEndpoint(UA_Client *client, const UA_EndpointDescription *endpoint, unsigne
!UA_String_equal(&client->config.applicationUri,
&endpoint->server.applicationUri)) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: application uri not match", i);
"Rejecting Endpoint %u: The server's ApplicationUri %S does not match "
"the client configuration", i, endpoint->server.applicationUri);
return false;
}
@ -970,14 +971,15 @@ matchEndpoint(UA_Client *client, const UA_EndpointDescription *endpoint, unsigne
if(endpoint->transportProfileUri.length != 0 &&
!UA_String_equal(&endpoint->transportProfileUri, &binaryTransport)) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: transport profile does not match", i);
"Rejecting Endpoint %u: TransportProfileUri %S not supported",
i, endpoint->transportProfileUri);
return false;
}
/* Valid SecurityMode? */
if(endpoint->securityMode < 1 || endpoint->securityMode > 3) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: invalid security mode", i);
"Rejecting Endpoint %u: Invalid SecurityMode", i);
return false;
}
@ -985,7 +987,7 @@ matchEndpoint(UA_Client *client, const UA_EndpointDescription *endpoint, unsigne
if(client->config.securityMode > 0 &&
client->config.securityMode != endpoint->securityMode) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: security mode does not match", i);
"Rejecting Endpoint %u: SecurityMode does not match the configuration", i);
return false;
}
@ -993,14 +995,16 @@ matchEndpoint(UA_Client *client, const UA_EndpointDescription *endpoint, unsigne
if(client->config.securityPolicyUri.length > 0 &&
!UA_String_equal(&client->config.securityPolicyUri, &endpoint->securityPolicyUri)) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: security policy does not match the configuration", i);
"Rejecting Endpoint %u: SecurityPolicy %S does not match the configuration",
i, endpoint->securityPolicyUri);
return false;
}
/* SecurityPolicy available? */
if(!getSecurityPolicy(client, endpoint->securityPolicyUri)) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %u: security policy not available", i);
"Rejecting Endpoint %u: SecurityPolicy %S not supported",
i, endpoint->securityPolicyUri);
return false;
}
@ -1127,7 +1131,7 @@ responseGetEndpoints(UA_Client *client, void *userdata,
* UserTokenPolicy that matches the configuration. */
if(!client->config.noSession && !findUserTokenPolicy(client, endpoint)) {
UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Rejecting endpoint %lu: No matching UserTokenPolicy",
"Rejecting Endpoint %lu: No matching UserTokenPolicy",
(long unsigned)i);
continue;
}