Explorar o código

bugfixes within session handling and UA_Guid_copy function

FlorianPalm %!s(int64=10) %!d(string=hai) anos
pai
achega
7b19e1882c

+ 2 - 2
examples/src/opcuaServerACPLT.c

@@ -116,7 +116,7 @@ void server_run() {
 			exit(1);
 		}
 
-		UA_TL_ConnectionManager_getConnectionById(newsockfd, &tmpConnection);
+		UA_TL_ConnectionManager_getConnectionByHandle(newsockfd, &tmpConnection);
 		if(tmpConnection == UA_NULL)
 		{
 			UA_TL_Connection_new(&connection, localBuffers, (TL_Writer)NL_TCP_writer);
@@ -143,7 +143,7 @@ void server_run() {
 		} while(connectionState != CONNECTIONSTATE_CLOSE);
 		shutdown(newsockfd,2);
 		close(newsockfd);
-		UA_TL_ConnectionManager_getConnectionById(newsockfd, &tmpConnection);
+		UA_TL_ConnectionManager_getConnectionByHandle(newsockfd, &tmpConnection);
 		UA_TL_ConnectionManager_removeConnection(tmpConnection);
 	}
 	shutdown(sockfd,2);

+ 1 - 1
src/ua_basictypes.c

@@ -619,7 +619,7 @@ UA_TYPE_METHOD_NEW_DEFAULT(UA_Guid)
 UA_Int32 UA_Guid_copy(UA_Guid const *src, UA_Guid *dst)
 {
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_alloc((void**)&dst,UA_Guid_calcSize(UA_NULL));
+	//retval |= UA_alloc((void**)&dst,UA_Guid_calcSize(UA_NULL));
 	retval |= UA_memcpy((void*)dst,(void*)src,UA_Guid_calcSize(UA_NULL));
 	return retval;
 }

+ 35 - 19
src/ua_services_attribute.c

@@ -186,26 +186,42 @@ static UA_DataValue *service_read_node(Application * app, const UA_ReadValueId *
 }
 
 UA_Int32 Service_Read(UA_Session session, const UA_ReadRequest * request, UA_ReadResponse * response) {
-//TODO GET SESSION HERE//if(channel->session == UA_NULL || channel->session->application == UA_NULL)
-	//	return UA_ERROR;	// TODO: Return error message
-
-	int readsize = request->nodesToReadSize;
-	/* NothingTodo */
-	if(readsize <= 0) {
-		response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
-		response->resultsSize = 0;
+	if(session)
+	{
+
+		//if(channel->session == UA_NULL || channel->session->application == UA_NULL)
+		//	return UA_ERROR;	// TODO: Return error message
+		Application *application = UA_NULL;
+		int readsize = request->nodesToReadSize;
+		/* NothingTodo */
+		if(readsize <= 0) {
+			response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO;
+			response->resultsSize = 0;
+			return UA_SUCCESS;
+		}
+
+		response->resultsSize = readsize;
+		UA_alloc((void **)&response->results, sizeof(void *)*readsize);
+		for(int i=0;i<readsize;i++) {
+			DBG_VERBOSE(printf("service_read - attributeId=%d\n",request->nodesToRead[i]->attributeId));
+			DBG_VERBOSE(UA_NodeId_printf("service_read - nodeId=",&(request->nodesToRead[i]->nodeId)));
+
+			UA_Session_getApplicationPointer(session,&application);
+			if(application){
+				response->results[i] = service_read_node(application, request->nodesToRead[i]);
+			}
+			else
+			{
+				printf("Service_Read - ERROR: no valid application pointer");
+				return UA_ERROR;
+			}
+
+		}
+		response->responseHeader.serviceResult = UA_STATUSCODE_GOOD;
+		response->diagnosticInfosSize = -1;
 		return UA_SUCCESS;
 	}
-
-	response->resultsSize = readsize;
-	UA_alloc((void **)&response->results, sizeof(void *)*readsize);
-	for(int i=0;i<readsize;i++) {
-		DBG_VERBOSE(printf("service_read - attributeId=%d\n",request->nodesToRead[i]->attributeId));
-		DBG_VERBOSE(UA_NodeId_printf("service_read - nodeId=",&(request->nodesToRead[i]->nodeId)));
-//TODO GET SESSION HERE//response->results[i] = service_read_node(channel->session->application, request->nodesToRead[i]);
-	}
-	response->responseHeader.serviceResult = UA_STATUSCODE_GOOD;
-	response->diagnosticInfosSize = -1;
-	return UA_SUCCESS;
+	printf("Service_Read - ERROR: no valid session object");
+	return UA_ERROR;
 }
 

+ 7 - 3
src/ua_services_session.c

@@ -14,11 +14,15 @@ UA_Int32 Service_CreateSession(UA_Session session, const UA_CreateSessionRequest
 
 	UA_Session_new(&newSession);
 	//TODO get maxResponseMessageSize
-	UA_Session_init(*newSession, (UA_String*)&request->sessionName, request->requestedSessionTimeout,request->maxResponseMessageSize,500);
+	UA_Session_init(*newSession, (UA_String*)&request->sessionName,
+			request->requestedSessionTimeout,
+			request->maxResponseMessageSize,
+			9999,
+			(UA_Session_idProvider)UA_SessionManager_generateSessionId);
 
 	UA_SessionManager_addSession(newSession);
 	UA_Session_getId(*newSession, &response->sessionId);
-
+	UA_Session_getToken(*newSession, &(response->authenticationToken));
 
 
 	return UA_SUCCESS;
@@ -31,7 +35,7 @@ UA_Int32 Service_ActivateSession(UA_Session session, const UA_ActivateSessionReq
 	// 321 == AnonymousIdentityToken_Encoding_DefaultBinary
 	UA_NodeId_printf("ActivateSession - uIdToken.type=", &(request->userIdentityToken.typeId));
 	UA_ByteString_printx_hex("ActivateSession - uIdToken.body=", &(request->userIdentityToken.body));
-
+	UA_Session_setApplicationPointer(session,&appMockup);
 	// FIXME: channel->session->application = <Application Ptr>
 	//FIXME channel->session = &sessionMockup;
 	return UA_SUCCESS;

+ 2 - 1
src/ua_stack_channel.c

@@ -6,7 +6,8 @@
  */
 
 #include "ua_stack_channel.h"
-
+#include <time.h>
+#include <stdlib.h>
 
 typedef struct SL_Channel1 {
 	SL_channelState state;

+ 15 - 9
src/ua_stack_channel_manager.c

@@ -51,12 +51,12 @@ UA_Int32 SL_ChannelManager_addChannel(SL_secureChannel *channel)
 	{
 
 //TODO lock access (mulitthreading)------------
-		UA_list_Element *element;
-		UA_alloc((void**)&element, sizeof(UA_list_Element));
-		UA_list_initElement(element);
-		element->payload =(void*) channel;
-
-		UA_list_addElementToBack(&channelManager->channels,element);
+	//	UA_list_Element *element;
+	//	UA_alloc((void**)&element, sizeof(UA_list_Element));
+	//	UA_list_initElement(element);
+	//	element->payload =(void*) channel;
+		UA_list_addPayloadToBack(&channelManager->channels,(void*)channel);
+	//	UA_list_addElementToBack(&channelManager->channels,element);
 		return UA_SUCCESS;
 		//set id in channel object which was added
 //TODO lock access------------
@@ -165,10 +165,14 @@ UA_Int32 SL_ChannelManager_removeChannel(UA_Int32 channelId)
 {
 	//TODO lock access
 	SL_secureChannel channel;
+	UA_Int32 retval = UA_SUCCESS;
 	SL_ChannelManager_getChannel(channelId, &channel);
-	UA_list_Element *element =  UA_list_search(&channelManager->channels, SL_Channel_equal, channel);
-
-	if (element)
+	UA_list_Element *element =  UA_list_search(&channelManager->channels, SL_Channel_equal, &channel);
+	if(element){
+		retval |= UA_list_removeElement(element,(UA_list_PayloadVisitor)SL_Channel_delete);
+		return retval;
+	}
+	/*if (element)
 	{
 		element->next->prev = element->prev;
 		element->prev->next = element->next;
@@ -176,6 +180,7 @@ UA_Int32 SL_ChannelManager_removeChannel(UA_Int32 channelId)
 		SL_Channel_delete((SL_secureChannel)element->payload);
 		//TODO notify server application that secureChannel has been closed part 6 - §7.1.4
 	}
+	*/
 	//channel not found
 	return UA_ERROR;
 }
@@ -207,6 +212,7 @@ UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_secureChannel *cha
 		 		return UA_SUCCESS;
 		 	}
 		}
+		current = current->next;
 	}
 	*channel = UA_NULL;
 	return UA_ERROR;

+ 71 - 3
src/ua_stack_session.c

@@ -4,7 +4,8 @@
  *  Created on: 05.06.2014
  *      Author: root
  */
-
+#include <time.h>
+#include <stdlib.h>
 
 #include "ua_stack_session.h"
 typedef struct UA_SessionType
@@ -21,6 +22,36 @@ typedef struct UA_SessionType
 
 }UA_SessionType;
 
+/* mock up function to generate tokens for authentication */
+UA_Int32 UA_Session_generateAuthenticationToken(UA_NodeId *newToken)
+{
+	//Random token generation
+	UA_Int32 retval = UA_SUCCESS;
+	srand(time(NULL));
+
+	UA_Int32 i = 0;
+	UA_Int32 r = 0;
+	//retval |= UA_NodeId_new(newToken);
+
+	newToken->encodingByte = 0x04; //GUID
+
+	newToken->identifier.guid.data1 = rand();
+	r = rand();
+	newToken->identifier.guid.data2 = (UA_UInt16)((r>>16) );
+	r = rand();
+	UA_Int32 r1 = (r>>16);
+	UA_Int32 r2 = r1 && 0xFFFF;
+	r2 = r2 * 1;
+	newToken->identifier.guid.data3 = (UA_UInt16)((r>>16) );
+	for(i=0;i<8;i++)
+	{
+		r = rand();
+		newToken->identifier.guid.data4[i] = (UA_Byte)((r>>28) );
+	}
+
+
+	return retval;
+}
 UA_Int32 UA_Session_new(UA_Session **newSession)
 {
 	UA_Int32 retval = UA_SUCCESS;
@@ -35,13 +66,19 @@ UA_Int32 UA_Session_new(UA_Session **newSession)
 	return retval;
 }
 
-UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout, UA_UInt32 maxRequestMessageSize, UA_UInt32 maxResponseMessageSize)
-{
+UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
+		UA_UInt32 maxRequestMessageSize,
+		UA_UInt32 maxResponseMessageSize,
+		UA_Session_idProvider idProvider){
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_String_copy(sessionName, &((UA_SessionType*)session)->name);
 	((UA_SessionType*)session)->maxRequestMessageSize = maxRequestMessageSize;
 	((UA_SessionType*)session)->maxResponseMessageSize = maxResponseMessageSize;
 
+	UA_Session_generateAuthenticationToken(&((UA_SessionType*)session)->authenticationToken);
+
+	idProvider(&((UA_SessionType*)session)->sessionId);
+
 	//TODO handle requestedSessionTimeout
 	return retval;
 }
@@ -80,6 +117,15 @@ UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId)
 	return UA_ERROR;
 }
 
+UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken)
+{
+	if(session)
+	{
+		return UA_NodeId_copy(&((UA_SessionType*)session)->authenticationToken, authenticationToken);
+	}
+	return UA_ERROR;
+}
+
 UA_Int32 UA_Session_getChannel(UA_Session session, SL_secureChannel *channel)
 {
 	if(session)
@@ -88,5 +134,27 @@ UA_Int32 UA_Session_getChannel(UA_Session session, SL_secureChannel *channel)
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
+}
 
+UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** application)
+{
+	if(session)
+	{
+		*application = ((UA_SessionType*)session)->application;
+		return UA_SUCCESS;
+	}
+	*application = UA_NULL;
+	return UA_ERROR;
 }
+
+UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* application)
+{
+	if(session)
+	{
+		((UA_SessionType*)session)->application = application;
+		return UA_SUCCESS;
+	}
+	return UA_ERROR;
+}
+
+

+ 8 - 3
src/ua_stack_session.h

@@ -12,12 +12,14 @@
 #include "ua_stack_channel.h"
 
 
-
-
 typedef struct UA_SessionType *UA_Session;
+typedef UA_Int32(*UA_Session_idProvider)(UA_NodeId *newSessionId);
 
 UA_Int32 UA_Session_new(UA_Session **newSession);
-UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout, UA_UInt32 maxRequestMessageSize, UA_UInt32 maxResponseMessageSize);
+UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
+		UA_UInt32 maxRequestMessageSize,
+		UA_UInt32 maxResponseMessageSize,
+		UA_Session_idProvider idProvider);
 
 
 UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2);
@@ -25,6 +27,9 @@ UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token);
 UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId);
 
 UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId);
+UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken);
 UA_Int32 UA_Session_getChannel(UA_Session session, SL_secureChannel *channel);
+UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** application);
 
+UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* application);
 #endif /* UA_STACK_SESSION_H_ */

+ 26 - 9
src/ua_stack_session_manager.c

@@ -10,7 +10,7 @@
 
 typedef struct UA_SessionManagerType
 {
-	UA_list_List *sessions;
+	UA_list_List sessions;
 
 
 	UA_UInt32 maxSessionCount;
@@ -22,12 +22,21 @@ typedef struct UA_SessionManagerType
 }UA_SessionManagerType;
 
 static UA_SessionManagerType *sessionManager;
+
+UA_Int32 UA_SessionManager_generateSessionId(UA_NodeId *sessionId)
+{
+	sessionId->encodingByte = 0x00;
+	sessionId->namespace = 0;
+	sessionId->identifier.numeric = sessionManager->lastSessionId++;
+	return UA_SUCCESS;
+}
+
 UA_Int32 UA_SessionManager_init(UA_UInt32 maxSessionCount,UA_UInt32 sessionLifetime, UA_UInt32 startSessionId)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_alloc((void**)&sessionManager,sizeof(UA_SessionManagerType));
 
-	retval |= UA_list_init(sessionManager->sessions);
+	retval |= UA_list_init(&sessionManager->sessions);
 
 	sessionManager->maxSessionCount = maxSessionCount;
 	sessionManager->lastSessionId = startSessionId;
@@ -37,7 +46,7 @@ UA_Int32 UA_SessionManager_init(UA_UInt32 maxSessionCount,UA_UInt32 sessionLifet
 
 UA_Boolean UA_SessionManager_sessionExists(UA_Session *session)
 {
-	if(UA_list_search(sessionManager->sessions,(UA_list_PayloadComparer)UA_Session_compare,(void*)session))
+	if(UA_list_search(&sessionManager->sessions,(UA_list_PayloadComparer)UA_Session_compare,(void*)session))
 	{
 		return UA_TRUE;
 	}
@@ -46,18 +55,19 @@ UA_Boolean UA_SessionManager_sessionExists(UA_Session *session)
 
 UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *session)
 {
- 	UA_list_Element* current = sessionManager->sessions->first;
+ 	UA_list_Element* current = sessionManager->sessions.first;
 	while (current)
 	{
 		if (current->payload)
 		{
 			UA_list_Element* elem = (UA_list_Element*) current;
 			*session = *((UA_Session*) (elem->payload));
-		 	if(UA_Session_compareById(*session,sessionId))
+		 	if(UA_Session_compareById(*session,sessionId) == UA_EQUAL)
 		 	{
 		 		return UA_SUCCESS;
 		 	}
 		}
+		current = current->next;
 	}
 	*session = UA_NULL;
 	return UA_ERROR;
@@ -65,21 +75,23 @@ UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *sess
 
 UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *session)
 {
-	if(sessionManager->sessions)
+	if(sessionManager->sessions.first)
 	{
-		UA_list_Element* current = sessionManager->sessions->first;
+		UA_list_Element* current = sessionManager->sessions.first;
 		while (current)
 		{
 			if (current->payload)
 			{
 				UA_list_Element* elem = (UA_list_Element*) current;
 				*session = *((UA_Session*) (elem->payload));
-				if(UA_Session_compareByToken(*session,token))
+				if(UA_Session_compareByToken(*session,token) == UA_EQUAL)
 				{
 					return UA_SUCCESS;
 				}
 			}
+			current = current->next;
 		}
+
 	}
 	*session = UA_NULL;
 	return UA_ERROR;
@@ -88,9 +100,14 @@ UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *sessi
 UA_Int32 UA_SessionManager_addSession(UA_Session *session)
 {
 	UA_Int32 retval = UA_SUCCESS;
+	UA_NodeId sessionId;
 	if(!UA_SessionManager_sessionExists(session))
 	{
-		retval |= UA_list_addElementToBack(sessionManager->sessions,(void*)session);
+		retval |= UA_list_addPayloadToBack(&sessionManager->sessions,(void*)session);
+		UA_Session_getId(*session, &sessionId);
+
+		printf("UA_SessionManager_addSession - added session with id = %d \n",sessionId.identifier.numeric);
+
 		return retval;
 	}
 	else

+ 1 - 0
src/ua_stack_session_manager.h

@@ -59,6 +59,7 @@ UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *sessi
 
 UA_Int32 UA_SessionManager_updateSessions();
 
+
 UA_Int32 UA_SessionManager_getSessionLifeTime(UA_DateTime *lifeTime);
 
 //UA_Int32 UA_SessionManager_generateToken(UA_Session session, UA_Int32 requestedLifeTime, SecurityTokenRequestType requestType, UA_ChannelSecurityToken* newToken);

+ 0 - 2
src/ua_transport_binary_secure.h

@@ -18,8 +18,6 @@ revisedLifetime
 
  */
 
-
-
 typedef struct {
 	UA_UInt32 secureChannelId;
 	UA_SymmetricAlgorithmSecurityHeader tokenId;

+ 15 - 0
src/ua_transport_connection.c

@@ -37,11 +37,26 @@ UA_Int32 UA_TL_Connection_delete(UA_TL_Connection1 connection)
 	retval |= UA_free((void*)connection);
 	return retval;
 }
+
 UA_Int32 UA_TL_Connection_close(UA_TL_Connection1 connection)
 {
 	((TL_Connection*)connection)->state = CONNECTIONSTATE_CLOSE;
 	return UA_SUCCESS;
 }
+
+UA_Boolean UA_TL_Connection_compare(UA_TL_Connection1 *connection1, UA_TL_Connection1 *connection2)
+{
+	if(connection1 && connection2)
+	{
+		if ((*(TL_Connection**)connection1)->connectionHandle == (*(TL_Connection**)connection2)->connectionHandle)
+		{
+			return UA_TRUE;
+		}
+	}
+	return UA_FALSE;
+}
+
+
 UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection1 connection, UA_OPCUATcpHelloMessage *helloMessage)
 {
 	UA_Int32 retval = UA_SUCCESS;

+ 1 - 1
src/ua_transport_connection.h

@@ -34,7 +34,7 @@ UA_Int32 UA_TL_Connection_close(UA_TL_Connection1 connection);
 UA_Int32 UA_TL_Connection_new(UA_TL_Connection1 *connection,
 		TL_Buffer localBuffers,TL_Writer writer);
 UA_Int32 UA_TL_Connection_bind(UA_TL_Connection1 connection, UA_Int32 handle);
-
+UA_Boolean UA_TL_Connection_compare(UA_TL_Connection1 *connection1, UA_TL_Connection1 *connection2);
 //getter
 UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection1 connection, UA_UInt32 *connectionId);
 UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection1 connection, UA_UInt32 *protocolVersion);

+ 31 - 10
src/ua_transport_connection_manager.c

@@ -7,9 +7,10 @@
 
 #include "ua_transport_connection_manager.h"
 #include "ua_indexedList.h"
+
 typedef struct UA_TL_ConnectionManager
 {
-	UA_indexedList_List connections;
+	UA_list_List connections;
 	UA_UInt32 maxConnectionCount;
 	UA_UInt32 currentConnectionCount;
 }UA_TL_ConnectionManager;
@@ -38,26 +39,46 @@ UA_Int32 UA_TL_ConnectionManager_addConnection(UA_TL_Connection1 *connection)
 {
 	UA_UInt32 connectionId;
 	UA_TL_Connection_getHandle(*connection, &connectionId);
-	return UA_indexedList_addValue(&(connectionManager->connections), connectionId, connection);
+	printf("UA_TL_ConnectionManager_addConnection - added connection with handle = %d \n", connectionId);
+	return UA_list_addPayloadToBack(&(connectionManager->connections), (void*)connection);
 }
 
 
 UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection1 connection)
 {
-	UA_UInt32 connectionId;
-	UA_TL_Connection_getHandle(connection, &connectionId);
-	UA_TL_Connection1 foundValue = UA_indexedList_findValue(&connectionManager->connections,connectionId);
-	if(foundValue)
+	UA_list_Element *element =  UA_list_find(&connectionManager->connections, (UA_list_PayloadMatcher)UA_TL_Connection_compare);
+
+	if(element)
 	{
-		UA_TL_Connection_delete(connection);//remove connection
+		UA_list_removeElement(element, (UA_list_PayloadVisitor)UA_TL_Connection_delete);
 	}
 	return UA_SUCCESS;
 }
 
-
-UA_Int32 UA_TL_ConnectionManager_getConnectionById(UA_Int32 connectionId, UA_TL_Connection1 *connection)
+UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection1 *connection)
 {
-	return UA_SUCCESS;
+	UA_UInt32 tmpConnectionHandle;
+	if(connectionManager)
+	{
+		UA_list_Element* current = connectionManager->connections.first;
+		while (current)
+		{
+			if (current->payload)
+			{
+				UA_list_Element* elem = (UA_list_Element*) current;
+				*connection = *((UA_TL_Connection1*) (elem->payload));
+				UA_TL_Connection_getHandle(*connection, &tmpConnectionHandle);
+
+				if(tmpConnectionHandle == connectionId)
+				{
+					return UA_SUCCESS;
+				}
+			}
+			current = current->next;
+		}
+	}
+	*connection = UA_NULL;
+	return UA_ERROR;
 }
 
 

+ 2 - 2
src/ua_transport_connection_manager.h

@@ -7,7 +7,7 @@
 
 #ifndef UA_CONNECTION_MANAGER_H_
 #define UA_CONNECTION_MANAGER_H_
-
+#include "stdio.h"
 #include "ua_transport_connection.h"
 
 
@@ -15,6 +15,6 @@
 UA_Int32 UA_TL_ConnectionManager_addConnection(UA_TL_Connection1 *connection);
 UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection1 connection);
 //getter
-UA_Int32 UA_TL_ConnectionManager_getConnectionById(UA_Int32 connectionId, UA_TL_Connection1 *connection);
+UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection1 *connection);
 
 #endif /* UA_CONNECTION_MANAGER_H_ */