|
@@ -11,25 +11,30 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
|
|
|
const UA_CreateSessionRequest *request,
|
|
|
UA_CreateSessionResponse *response) {
|
|
|
if(channel->securityToken.channelId == 0) {
|
|
|
- response->responseHeader.serviceResult = UA_STATUSCODE_BADSECURECHANNELIDINVALID;
|
|
|
+ response->responseHeader.serviceResult =
|
|
|
+ UA_STATUSCODE_BADSECURECHANNELIDINVALID;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
response->responseHeader.serviceResult =
|
|
|
- UA_Array_copy(server->endpointDescriptions, server->endpointDescriptionsSize,
|
|
|
- (void**)&response->serverEndpoints, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
|
|
|
+ UA_Array_copy(server->endpointDescriptions,
|
|
|
+ server->endpointDescriptionsSize,
|
|
|
+ (void**)&response->serverEndpoints,
|
|
|
+ &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
|
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD)
|
|
|
return;
|
|
|
response->serverEndpointsSize = server->endpointDescriptionsSize;
|
|
|
|
|
|
|
|
|
for(size_t i = 0; i < response->serverEndpointsSize; ++i)
|
|
|
- UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
|
|
|
+ UA_String_copy(&request->endpointUrl,
|
|
|
+ &response->serverEndpoints[i].endpointUrl);
|
|
|
|
|
|
UA_Session *newSession;
|
|
|
response->responseHeader.serviceResult =
|
|
|
- UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
|
|
|
+ UA_SessionManager_createSession(&server->sessionManager,
|
|
|
+ channel, request, &newSession);
|
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
|
|
|
UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
|
|
|
"Processing CreateSessionRequest failed");
|
|
@@ -38,15 +43,18 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
|
|
|
|
|
|
|
|
|
newSession->maxResponseMessageSize = request->maxResponseMessageSize;
|
|
|
- newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize;
|
|
|
+ newSession->maxRequestMessageSize =
|
|
|
+ channel->connection->localConf.maxMessageSize;
|
|
|
response->responseHeader.serviceResult |=
|
|
|
- UA_ApplicationDescription_copy(&request->clientDescription, &newSession->clientDescription);
|
|
|
+ UA_ApplicationDescription_copy(&request->clientDescription,
|
|
|
+ &newSession->clientDescription);
|
|
|
|
|
|
|
|
|
response->sessionId = newSession->sessionId;
|
|
|
response->revisedSessionTimeout = (UA_Double)newSession->timeout;
|
|
|
response->authenticationToken = newSession->authenticationToken;
|
|
|
- response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName);
|
|
|
+ response->responseHeader.serviceResult =
|
|
|
+ UA_String_copy(&request->sessionName, &newSession->sessionName);
|
|
|
if(server->endpointDescriptionsSize > 0)
|
|
|
response->responseHeader.serviceResult |=
|
|
|
UA_ByteString_copy(&server->endpointDescriptions->serverCertificate,
|
|
@@ -54,28 +62,35 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
|
|
|
|
|
|
|
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
|
|
|
- UA_SessionManager_removeSession(&server->sessionManager, &newSession->authenticationToken);
|
|
|
+ UA_SessionManager_removeSession(&server->sessionManager,
|
|
|
+ &newSession->authenticationToken);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created",
|
|
|
- UA_PRINTF_GUID_DATA(newSession->sessionId.identifier.guid));
|
|
|
+ UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
|
|
|
+ "Session " UA_PRINTF_GUID_FORMAT " created",
|
|
|
+ UA_PRINTF_GUID_DATA(newSession->sessionId.identifier.guid));
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
|
|
|
- UA_Session *session, const UA_ActivateSessionRequest *request,
|
|
|
+Service_ActivateSession(UA_Server *server,
|
|
|
+ UA_SecureChannel *channel, UA_Session *session,
|
|
|
+ const UA_ActivateSessionRequest *request,
|
|
|
UA_ActivateSessionResponse *response) {
|
|
|
if(session->validTill < UA_DateTime_nowMonotonic()) {
|
|
|
- UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
|
|
|
- "to activate, but the session has timed out", channel->securityToken.channelId);
|
|
|
- response->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID;
|
|
|
+ UA_LOG_INFO_SESSION(server->config.logger, session,
|
|
|
+ "ActivateSession: SecureChannel %i wants "
|
|
|
+ "to activate, but the session has timed out",
|
|
|
+ channel->securityToken.channelId);
|
|
|
+ response->responseHeader.serviceResult =
|
|
|
+ UA_STATUSCODE_BADSESSIONIDINVALID;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
response->responseHeader.serviceResult =
|
|
|
- server->config.accessControl.activateSession(&session->sessionId, &request->userIdentityToken,
|
|
|
+ server->config.accessControl.activateSession(&session->sessionId,
|
|
|
+ &request->userIdentityToken,
|
|
|
&session->sessionHandle);
|
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD)
|
|
|
return;
|
|
@@ -100,8 +115,11 @@ Service_CloseSession(UA_Server *server, UA_Session *session,
|
|
|
const UA_CloseSessionRequest *request,
|
|
|
UA_CloseSessionResponse *response) {
|
|
|
UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
|
|
|
+
|
|
|
|
|
|
- server->config.accessControl.closeSession(&session->sessionId, session->sessionHandle);
|
|
|
+ server->config.accessControl.closeSession(&session->sessionId,
|
|
|
+ session->sessionHandle);
|
|
|
response->responseHeader.serviceResult =
|
|
|
- UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken);
|
|
|
+ UA_SessionManager_removeSession(&server->sessionManager,
|
|
|
+ &session->authenticationToken);
|
|
|
}
|