|
@@ -502,6 +502,19 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
|
|
UA_deleteMembers(response, responseType);
|
|
UA_deleteMembers(response, responseType);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/* ERR -> Error from the remote connection */
|
|
|
|
+static void processERR(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
|
|
|
|
+ UA_TcpErrorMessage errorMessage;
|
|
|
|
+ if (UA_TcpErrorMessage_decodeBinary(msg, offset, &errorMessage) != UA_STATUSCODE_GOOD) {
|
|
|
|
+ connection->close(connection);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_NETWORK,
|
|
|
|
+ "Client replied with an error message: %s %.*s",
|
|
|
|
+ UA_StatusCode_name(errorMessage.error), errorMessage.reason.length, errorMessage.reason.data);
|
|
|
|
+}
|
|
|
|
+
|
|
/* Takes decoded messages starting at the nodeid of the content type. Only OPN
|
|
/* Takes decoded messages starting at the nodeid of the content type. Only OPN
|
|
* messages start at the asymmetricalgorithmsecurityheader and are not
|
|
* messages start at the asymmetricalgorithmsecurityheader and are not
|
|
* decoded. */
|
|
* decoded. */
|
|
@@ -512,6 +525,13 @@ UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *chann
|
|
UA_assert(channel);
|
|
UA_assert(channel);
|
|
UA_assert(channel->connection);
|
|
UA_assert(channel->connection);
|
|
switch(messagetype) {
|
|
switch(messagetype) {
|
|
|
|
+ case UA_MESSAGETYPE_ERR: {
|
|
|
|
+ const UA_TcpErrorMessage *msg = (const UA_TcpErrorMessage *) message;
|
|
|
|
+ UA_LOG_ERROR_CHANNEL(server->config.logger, channel,
|
|
|
|
+ "Client replied with an error message: %s %.*s",
|
|
|
|
+ UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
case UA_MESSAGETYPE_HEL:
|
|
case UA_MESSAGETYPE_HEL:
|
|
UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
|
|
UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
|
|
"Cannot process a HEL on an open channel");
|
|
"Cannot process a HEL on an open channel");
|
|
@@ -562,6 +582,11 @@ UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
|
|
|
|
|
|
/* Dispatch according to the message type */
|
|
/* Dispatch according to the message type */
|
|
switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
|
|
switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
|
|
|
|
+ case UA_MESSAGETYPE_ERR:
|
|
|
|
+ UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
|
|
|
|
+ "Connection %i | Process ERR message", connection->sockfd);
|
|
|
|
+ processERR(server, connection, message, &offset);
|
|
|
|
+ break;
|
|
case UA_MESSAGETYPE_HEL:
|
|
case UA_MESSAGETYPE_HEL:
|
|
UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
|
|
UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
|
|
"Connection %i | Process HEL message", connection->sockfd);
|
|
"Connection %i | Process HEL message", connection->sockfd);
|