Browse Source

2nd part: changed type names of "object"-structs

Florian Palm 10 years ago
parent
commit
4a342593e8

+ 4 - 4
examples/networklayer.c

@@ -155,8 +155,8 @@ void* NL_TCP_reader(NL_Connection *c) {
 		}
 	}
 	UA_TL_Connection_getState(c->connection, &connectionState);
-	if (connectionState == CONNECTIONSTATE_CLOSE) {
-		UA_TL_Connection_close(c->connection);
+	if (connectionState == CONNECTIONSTATE_CLOSED) {
+		//UA_TL_Connection_close(c->connection);
 
 		//c->state  = CONNECTIONSTATE_CLOSED;
 
@@ -230,7 +230,7 @@ UA_Int32 NL_TCP_writer(UA_Int32 connectionHandle, UA_ByteString const * const *
 	return UA_SUCCESS;
 }
 //callback function which is called when the UA_TL_Connection_close() function is initiated
-UA_Int32 NL_Connection_close(UA_TL_Connection connection)
+UA_Int32 NL_Connection_close(UA_TL_Connection *connection)
 {
 	NL_Connection *networkLayerData = UA_NULL;
 	UA_TL_Connection_getNetworkLayerData(connection, (void**)&networkLayerData);
@@ -247,7 +247,7 @@ UA_Int32 NL_Connection_close(UA_TL_Connection connection)
 }
 void* NL_Connection_init(NL_Connection* c, NL_data* tld, UA_Int32 connectionHandle, NL_Reader reader, TL_Writer writer)
 {
-	UA_TL_Connection connection = UA_NULL;
+	UA_TL_Connection *connection = UA_NULL;
 	//create new connection object
 	UA_TL_Connection_new(&connection, tld->tld->localConf, writer, NL_Connection_close,connectionHandle,c);
 

+ 2 - 2
examples/networklayer.h

@@ -44,7 +44,7 @@ typedef struct NL_data {
 struct NL_Connection;
 typedef void* (*NL_Reader)(struct NL_Connection *c);
 typedef struct NL_Connection {
-	UA_TL_Connection connection;
+	UA_TL_Connection *connection;
 	UA_Int32 state;
 	UA_UInt32 connectionHandle;
 	NL_Reader reader;
@@ -55,7 +55,7 @@ typedef struct NL_Connection {
 } NL_Connection;
 
 NL_data* NL_init(NL_Description* tlDesc, UA_Int32 port);
-UA_Int32 NL_Connection_close(UA_TL_Connection connection);
+UA_Int32 NL_Connection_close(UA_TL_Connection *connection);
 UA_Int32 NL_msgLoop(NL_data* nl, struct timeval *tv, UA_Int32(*worker)(void*), void *arg, UA_Boolean *running);
 UA_Int32 NL_TCP_writer(UA_Int32 connectionHandle, UA_ByteString const * const * gather_buf, UA_UInt32 gather_len);
 

+ 16 - 16
src/ua_services.h

@@ -36,7 +36,7 @@
  * the configuration information required to establish a SecureChannel and a
  * Session.
  */
-UA_Int32 Service_GetEndpoints(SL_Channel channel, const UA_GetEndpointsRequest* request, UA_GetEndpointsResponse *response);
+UA_Int32 Service_GetEndpoints(SL_Channel *channel, const UA_GetEndpointsRequest* request, UA_GetEndpointsResponse *response);
 // Service_RegisterServer
 /** @} */
 
@@ -55,12 +55,12 @@ UA_Int32 Service_GetEndpoints(SL_Channel channel, const UA_GetEndpointsRequest*
  * to ensure Confidentiality and Integrity for Message exchange during a
  * Session.
  */
-UA_Int32 Service_OpenSecureChannel(SL_Channel channel, const UA_OpenSecureChannelRequest* request, UA_OpenSecureChannelResponse* response);
+UA_Int32 Service_OpenSecureChannel(SL_Channel *channel, const UA_OpenSecureChannelRequest* request, UA_OpenSecureChannelResponse* response);
 
 /**
  * @brief This Service is used to terminate a SecureChannel.
  */
-UA_Int32 Service_CloseSecureChannel(SL_Channel channel, const UA_CloseSecureChannelRequest *request, UA_CloseSecureChannelResponse *response);
+UA_Int32 Service_CloseSecureChannel(SL_Channel *channel, const UA_CloseSecureChannelRequest *request, UA_CloseSecureChannelResponse *response);
 /** @} */
 
 /**
@@ -79,7 +79,7 @@ UA_Int32 Service_CloseSecureChannel(SL_Channel channel, const UA_CloseSecureChan
  * logs and in the Server’s address space. The second is the authenticationToken
  * which is used to associate an incoming request with a Session.
  */
-UA_Int32 Service_CreateSession(SL_Channel channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response);
+UA_Int32 Service_CreateSession(SL_Channel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response);
 
 /**
  * @brief This Service is used by the Client to submit its SoftwareCertificates
@@ -88,12 +88,12 @@ UA_Int32 Service_CreateSession(SL_Channel channel, const UA_CreateSessionRequest
  * Client before it issues any other Service request after CreateSession.
  * Failure to do so shall cause the Server to close the Session.
  */
-UA_Int32 Service_ActivateSession(SL_Channel channel, UA_Session session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response);
+UA_Int32 Service_ActivateSession(SL_Channel *channel, UA_Session *session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response);
 
 /**
  * @brief This Service is used to terminate a Session.
  */
-UA_Int32 Service_CloseSession(UA_Session session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response);
+UA_Int32 Service_CloseSession(UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response);
 // Service_Cancel
 /** @} */
 
@@ -110,12 +110,12 @@ UA_Int32 Service_CloseSession(UA_Session session, const UA_CloseSessionRequest *
 /**
  * @brief This Service is used to add one or more Nodes into the AddressSpace hierarchy.
  */
-UA_Int32 Service_AddNodes(UA_Session session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response);
+UA_Int32 Service_AddNodes(UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response);
 
 /**
  * @brief This Service is used to add one or more References to one or more Nodes
  */
-UA_Int32 Service_AddReferences(UA_Session session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response);
+UA_Int32 Service_AddReferences(UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response);
 
 // Service_DeleteNodes
 // Service_DeleteReferences
@@ -135,12 +135,12 @@ UA_Int32 Service_AddReferences(UA_Session session, const UA_AddReferencesRequest
  * The browse can be further limited by the use of a View. This Browse Service
  * also supports a primitive filtering capability.
  */ 
-UA_Int32 Service_Browse(UA_Session session, const UA_BrowseRequest *request, UA_BrowseResponse *response);
+UA_Int32 Service_Browse(UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response);
 
 /**
  * @brief This Service is used to translate textual node paths to their respective ids.
  */
-UA_Int32 Service_TranslateBrowsePathsToNodeIds(UA_Session session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response);
+UA_Int32 Service_TranslateBrowsePathsToNodeIds(UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response);
 // Service_BrowseNext
 // Service_TranslateBrowsePathsToNodeIds
 // Service_RegisterNodes
@@ -183,7 +183,7 @@ UA_Int32 Service_TranslateBrowsePathsToNodeIds(UA_Session session, const UA_Tran
  * values as a composite, to read individual elements or to read ranges of
  * elements of the composite.
  */
-UA_Int32 Service_Read(UA_Session session, const UA_ReadRequest *request, UA_ReadResponse *response);
+UA_Int32 Service_Read(UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response);
 // Service_HistoryRead
 /**
  * @brief This Service is used to write one or more Attributes of one or more
@@ -192,7 +192,7 @@ UA_Int32 Service_Read(UA_Session session, const UA_ReadRequest *request, UA_Read
  *  values as a composite, to write individual elements or to write ranges of
  *  elements of the composite.
  */
-UA_Int32 Service_Write(UA_Session session, const UA_WriteRequest *request,UA_WriteResponse *response);
+UA_Int32 Service_Write(UA_Session *session, const UA_WriteRequest *request,UA_WriteResponse *response);
 // Service_HistoryUpdate
 /** @} */
 
@@ -224,7 +224,7 @@ a component of an Object.
  * triggered item links to be deleted, but has no effect on the MonitoredItems
  * referenced by the triggered items.
  */
-UA_Int32 Service_CreateMonitoredItems(UA_Session session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response);
+UA_Int32 Service_CreateMonitoredItems(UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response);
 // Service_ModifyMonitoredItems
 // Service_SetMonitoringMode
 // Service_SetTriggering
@@ -239,14 +239,14 @@ UA_Int32 Service_CreateMonitoredItems(UA_Session session, const UA_CreateMonitor
  * @{
  */
 // Service_CreateSubscription
-UA_Int32 Service_CreateSubscription(UA_Session session, const UA_CreateSubscriptionRequest *request,
+UA_Int32 Service_CreateSubscription(UA_Session *session, const UA_CreateSubscriptionRequest *request,
                                    UA_CreateSubscriptionResponse *response);
 // Service_ModifySubscription
 // Service_SetPublishingMode
-UA_Int32 Service_SetPublishingMode(UA_Session session, const UA_SetPublishingModeRequest *request,
+UA_Int32 Service_SetPublishingMode(UA_Session *session, const UA_SetPublishingModeRequest *request,
                                    UA_SetPublishingModeResponse *response);
 
-UA_Int32 Service_Publish(UA_Session session, const UA_PublishRequest *request,
+UA_Int32 Service_Publish(UA_Session *session, const UA_PublishRequest *request,
                                    UA_PublishResponse *response);
 
 // Service_Republish

+ 2 - 2
src/ua_services_attribute.c

@@ -223,7 +223,7 @@ static UA_DataValue service_read_node(Application *app, const UA_ReadValueId *id
 
 	return v;
 }
-UA_Int32 Service_Read(UA_Session session, const UA_ReadRequest *request,
+UA_Int32 Service_Read(UA_Session *session, const UA_ReadRequest *request,
                       UA_ReadResponse *response) {
 	Application *application = UA_NULL;
 	UA_Int32 readsize;
@@ -444,7 +444,7 @@ UA_Int32 Service_Write_writeNode(Application *app, UA_WriteValue *writeValue, UA
 	return retval;
 
 }
-UA_Int32 Service_Write(UA_Session session, const UA_WriteRequest *request,
+UA_Int32 Service_Write(UA_Session *session, const UA_WriteRequest *request,
                       UA_WriteResponse *response) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 i;

+ 1 - 1
src/ua_services_discovery.c

@@ -1,5 +1,5 @@
 #include "ua_services.h"
-UA_Int32 Service_GetEndpoints(SL_Channel channel,
+UA_Int32 Service_GetEndpoints(SL_Channel *channel,
 		const UA_GetEndpointsRequest* request,
 		UA_GetEndpointsResponse *response) {
 #ifdef DEBUG

+ 1 - 1
src/ua_services_monitoreditems.c

@@ -4,7 +4,7 @@
 //#if 0
 /* Activate once the infrastructure for pushing events is in place. */
 
-UA_Int32 Service_CreateMonitoredItems(UA_Session session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response) {
+UA_Int32 Service_CreateMonitoredItems(UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response) {
 	if (request->itemsToCreateSize > 0) {
 		response->resultsSize = request->itemsToCreateSize;
 

+ 2 - 2
src/ua_services_nodemanagement.c

@@ -65,7 +65,7 @@ static UA_AddNodesResult addSingleNode(Application *app, UA_AddNodesItem *item)
 	return result;
 }
 
-UA_Int32 Service_AddNodes(UA_Session session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response) {
+UA_Int32 Service_AddNodes(UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response) {
 
 	Application *application;
 	if(session == UA_NULL)
@@ -140,6 +140,6 @@ UA_Int32 AddReference(UA_Node *node, UA_ReferenceNode *reference, Namespace *tar
 	return retval;
 }
 
-UA_Int32 Service_AddReferences(UA_Session session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response) {
+UA_Int32 Service_AddReferences(UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response) {
 	return UA_ERROR;
 }

+ 2 - 2
src/ua_services_securechannel.c

@@ -1,7 +1,7 @@
 #include "ua_services.h"
 #include "ua_transport_binary_secure.h"
 
-UA_Int32 Service_OpenSecureChannel(SL_Channel channel,
+UA_Int32 Service_OpenSecureChannel(SL_Channel *channel,
 const UA_OpenSecureChannelRequest* request,
 UA_OpenSecureChannelResponse* response)
 {
@@ -13,7 +13,7 @@ UA_OpenSecureChannelResponse* response)
 	return retval;
 }
 
-UA_Int32 Service_CloseSecureChannel(SL_Channel channel, const UA_CloseSecureChannelRequest *request,
+UA_Int32 Service_CloseSecureChannel(SL_Channel *channel, const UA_CloseSecureChannelRequest *request,
 UA_CloseSecureChannelResponse *response)
 {
 	UA_Int32 retval = UA_SUCCESS;

+ 6 - 6
src/ua_services_session.c

@@ -2,7 +2,7 @@
 #include "ua_application.h"
 
 
-UA_Int32 Service_CreateSession(SL_Channel channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response) {
+UA_Int32 Service_CreateSession(SL_Channel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response) {
 #ifdef DEBUG
 	UA_String_printf("CreateSession Service - endpointUrl=", &(request->endpointUrl));
 #endif
@@ -12,7 +12,7 @@ UA_Int32 Service_CreateSession(SL_Channel channel, const UA_CreateSessionRequest
 	UA_SessionManager_getSessionTimeout(&timeout);
 	UA_Session_new(&newSession);
 	//TODO get maxResponseMessageSize
-	UA_Session_init(*newSession, (UA_String*)&request->sessionName,
+	UA_Session_init(newSession, (UA_String*)&request->sessionName,
 	request->requestedSessionTimeout,
 	request->maxResponseMessageSize,
 	9999,
@@ -20,14 +20,14 @@ UA_Int32 Service_CreateSession(SL_Channel channel, const UA_CreateSessionRequest
 	timeout);
 
 	UA_SessionManager_addSession(newSession);
-	UA_Session_getId(*newSession, &response->sessionId);
-	UA_Session_getToken(*newSession, &(response->authenticationToken));
+	UA_Session_getId(newSession, &response->sessionId);
+	UA_Session_getToken(newSession, &(response->authenticationToken));
 	response->revisedSessionTimeout = timeout;
 	//TODO fill results
 	return UA_SUCCESS;
 }
 
-UA_Int32 Service_ActivateSession(SL_Channel channel,UA_Session session,
+UA_Int32 Service_ActivateSession(SL_Channel *channel, UA_Session *session,
 		const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response)
 {
 
@@ -44,7 +44,7 @@ UA_Int32 Service_ActivateSession(SL_Channel channel,UA_Session session,
 	return UA_SUCCESS;
 }
 
-UA_Int32 Service_CloseSession(UA_Session session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response) {
+UA_Int32 Service_CloseSession(UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response) {
 	UA_NodeId sessionId;
 	UA_Session_getId(session,&sessionId);
 

+ 3 - 3
src/ua_services_subscription.c

@@ -7,7 +7,7 @@
 #include "ua_services.h"
 #include "ua_statuscodes.h"
 
-UA_Int32 Service_CreateSubscription(UA_Session session, const UA_CreateSubscriptionRequest *request,
+UA_Int32 Service_CreateSubscription(UA_Session *session, const UA_CreateSubscriptionRequest *request,
                                    UA_CreateSubscriptionResponse *response)
 {
 
@@ -18,7 +18,7 @@ UA_Int32 Service_CreateSubscription(UA_Session session, const UA_CreateSubscript
 	return UA_SUCCESS;
 }
 
-UA_Int32 Service_Publish(UA_Session session, const UA_PublishRequest *request,
+UA_Int32 Service_Publish(UA_Session *session, const UA_PublishRequest *request,
                                    UA_PublishResponse *response)
 {
 
@@ -28,7 +28,7 @@ UA_Int32 Service_Publish(UA_Session session, const UA_PublishRequest *request,
 	return UA_SUCCESS;
 }
 
-UA_Int32 Service_SetPublishingMode(UA_Session session, const UA_SetPublishingModeRequest *request,
+UA_Int32 Service_SetPublishingMode(UA_Session *session, const UA_SetPublishingModeRequest *request,
                                    UA_SetPublishingModeResponse *response)
 {
 	response->diagnosticInfos = UA_NULL;

+ 2 - 2
src/ua_services_view.c

@@ -184,7 +184,7 @@ static void Service_Browse_getBrowseResult(Namespace *ns, UA_BrowseDescription *
 	UA_Array_delete(relevantReferenceTypes, relevantReferenceTypesCount, &UA_.types[UA_NODEID]);
 }
 
-UA_Int32 Service_Browse(UA_Session session, const UA_BrowseRequest *request, UA_BrowseResponse *response) {
+UA_Int32 Service_Browse(UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response) {
 	UA_Int32 retval = UA_SUCCESS;
 	Application *application;
 	if(session == UA_NULL)
@@ -222,7 +222,7 @@ UA_Int32 Service_Browse(UA_Session session, const UA_BrowseRequest *request, UA_
 }
 
 
-UA_Int32 Service_TranslateBrowsePathsToNodeIds(UA_Session session, const UA_TranslateBrowsePathsToNodeIdsRequest *request,
+UA_Int32 Service_TranslateBrowsePathsToNodeIds(UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request,
 											   UA_TranslateBrowsePathsToNodeIdsResponse *response) {
 	UA_Int32 retval = UA_SUCCESS;
 	DBG_VERBOSE(printf("TranslateBrowsePathsToNodeIdsService - %i path(s)", request->browsePathsSize));

+ 30 - 30
src/ua_stack_channel.c

@@ -9,12 +9,12 @@
 #include <time.h>
 #include <stdlib.h>
 
-typedef struct SL_Channel {
+struct SL_Channel {
 	SL_channelState state;
 	UA_UInt32 channelId;
 	//TL_Connection* tlConnection;
 
-	UA_TL_Connection connection;
+	UA_TL_Connection *connection;
 	UA_UInt32 requestId;
 	//UA_UInt32 lastRequestId;
 
@@ -33,7 +33,7 @@ typedef struct SL_Channel {
 	SL_ChannelIdProvider channelIdProvider;
 };
 
-UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel channel,
+UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel *channel,
 		UA_AsymmetricAlgorithmSecurityHeader *asymSecHeader,
 		UA_SequenceHeader *sequenceHeader) {
 	UA_Int32 retval = UA_SUCCESS;
@@ -47,7 +47,7 @@ UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel channel,
 	return retval;
 }
 /*
-UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel channel)
+UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel *channel)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	channel->localAsymAlgSettings.receiverCertificateThumbprint.data = UA_NULL;
@@ -65,7 +65,7 @@ UA_Int32 SL_Channel_new(SL_Channel **channel) {
 	retval |= UA_alloc((void** )channel, sizeof(SL_Channel));
 	SL_Channel *thisChannel = UA_NULL;
 	retval |= UA_alloc((void** )&thisChannel, sizeof(SL_Channel));
-	**channel = (SL_Channel) thisChannel;
+	*channel = thisChannel;
 	return retval;
 }
 
@@ -78,7 +78,7 @@ UA_Int32 SL_Channel_generateNonce(UA_ByteString *nonce) {
 	return UA_SUCCESS;
 }
 
-UA_Int32 SL_Channel_init(SL_Channel channel, UA_TL_Connection connection,
+UA_Int32 SL_Channel_init(SL_Channel *channel, UA_TL_Connection *connection,
 		SL_ChannelIdProvider channelIdProvider,
 		SL_ChannelSecurityTokenProvider tokenProvider) {
 
@@ -109,13 +109,13 @@ UA_Int32 SL_Channel_init(SL_Channel channel, UA_TL_Connection connection,
 	return retval;
 }
 
-UA_Int32 SL_Channel_registerTokenProvider(SL_Channel channel,
+UA_Int32 SL_Channel_registerTokenProvider(SL_Channel *channel,
 		SL_ChannelSecurityTokenProvider provider) {
 	channel->tokenProvider = provider;
 	return UA_SUCCESS;
 }
 
-UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel channel, UA_Int32 *lifetime) {
+UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel *channel, UA_Int32 *lifetime) {
 	if (channel) {
 		UA_Int64 diffInMS =
 				(channel->securityToken.createdAt
@@ -133,7 +133,7 @@ UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel channel, UA_Int32 *lifetime)
 	}
 }
 
-UA_Int32 SL_Channel_getChannelId(SL_Channel channel, UA_UInt32 *channelId) {
+UA_Int32 SL_Channel_getChannelId(SL_Channel *channel, UA_UInt32 *channelId) {
 	if (channel) {
 		*channelId = channel->channelId;
 		return UA_SUCCESS;
@@ -141,7 +141,7 @@ UA_Int32 SL_Channel_getChannelId(SL_Channel channel, UA_UInt32 *channelId) {
 	return UA_ERROR;
 }
 
-UA_Int32 SL_Channel_getTokenId(SL_Channel channel, UA_UInt32 *tokenId) {
+UA_Int32 SL_Channel_getTokenId(SL_Channel *channel, UA_UInt32 *tokenId) {
 	if (channel) {
 		*tokenId = channel->securityToken.tokenId;
 		return UA_SUCCESS;
@@ -149,7 +149,7 @@ UA_Int32 SL_Channel_getTokenId(SL_Channel channel, UA_UInt32 *tokenId) {
 	return UA_ERROR;
 }
 
-UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel channel,
+UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel *channel,
 		UA_AsymmetricAlgorithmSecurityHeader **asymAlgSettings) {
 	UA_Int32 retval = 0;
 
@@ -172,22 +172,22 @@ UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel channel,
 	return UA_SUCCESS;
 }
 
-UA_Int32 SL_Channel_getConnection(SL_Channel channel,
-		UA_TL_Connection *connection) {
+UA_Int32 SL_Channel_getConnection(SL_Channel *channel,
+		UA_TL_Connection **connection) {
 	if (channel) {
 		*connection = channel->connection;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
 }
-UA_Int32 SL_Channel_getRequestId(SL_Channel channel, UA_UInt32 *requestId) {
+UA_Int32 SL_Channel_getRequestId(SL_Channel *channel, UA_UInt32 *requestId) {
 	if (channel) {
 		*requestId = channel->requestId;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
 }
-UA_Int32 SL_Channel_getSequenceNumber(SL_Channel channel,
+UA_Int32 SL_Channel_getSequenceNumber(SL_Channel *channel,
 		UA_UInt32 *sequenceNumber) {
 	if (channel) {
 		*sequenceNumber = channel->sequenceNumber;
@@ -195,7 +195,7 @@ UA_Int32 SL_Channel_getSequenceNumber(SL_Channel channel,
 	}
 	return UA_ERROR;
 }
-UA_Int32 SL_Channel_getState(SL_Channel channel, SL_channelState *channelState) {
+UA_Int32 SL_Channel_getState(SL_Channel *channel, SL_channelState *channelState) {
 	if (channel) {
 		*channelState = channel->state;
 		return UA_SUCCESS;
@@ -203,7 +203,7 @@ UA_Int32 SL_Channel_getState(SL_Channel channel, SL_channelState *channelState)
 	return UA_ERROR;
 }
 
-UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel channel,
+UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel *channel,
 		UA_UInt32 *revisedLifetime) {
 	if (channel) {
 		*revisedLifetime =
@@ -214,27 +214,27 @@ UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel channel,
 }
 
 //setters
-UA_Int32 SL_Channel_setId(SL_Channel channel, UA_UInt32 id) {
+UA_Int32 SL_Channel_setId(SL_Channel *channel, UA_UInt32 id) {
 	channel->channelId = id;
 	return UA_SUCCESS;
 }
 
 //private function
-UA_Int32 SL_Channel_setState(SL_Channel channel, SL_channelState channelState) {
+UA_Int32 SL_Channel_setState(SL_Channel *channel, SL_channelState channelState) {
 	channel->state = channelState;
 	return UA_SUCCESS;
 }
 
 
 
-UA_Boolean SL_Channel_compare(SL_Channel channel1, SL_Channel channel2) {
+UA_Boolean SL_Channel_compare(SL_Channel *channel1, SL_Channel *channel2) {
 	return (((SL_Channel*) channel1)->channelId
 			== ((SL_Channel*) channel2)->channelId) ?
 	UA_TRUE :
 															UA_FALSE;
 }
 
-UA_Int32 SL_Channel_bind(SL_Channel channel, UA_TL_Connection connection) {
+UA_Int32 SL_Channel_bind(SL_Channel *channel, UA_TL_Connection *connection) {
 	if (channel && connection) {
 		channel->connection = connection;
 		return UA_SUCCESS;
@@ -242,7 +242,7 @@ UA_Int32 SL_Channel_bind(SL_Channel channel, UA_TL_Connection connection) {
 	return UA_ERROR;
 }
 
-UA_Int32 SL_Channel_deleteMembers(SL_Channel channel) {
+UA_Int32 SL_Channel_deleteMembers(SL_Channel *channel) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(
 			&channel->localAsymAlgSettings);
@@ -258,12 +258,12 @@ UA_Int32 SL_Channel_deleteMembers(SL_Channel channel) {
 }
 UA_Int32 SL_Channel_delete(SL_Channel *channel) {
 	UA_Int32 retval = UA_SUCCESS;
-	retval = SL_Channel_deleteMembers(*channel);
-	retval = UA_free(*channel);
+	retval = SL_Channel_deleteMembers(channel);
+	retval = UA_free(channel);
 	return retval;
 }
 
-UA_Int32 SL_Channel_processTokenRequest(SL_Channel channel,
+UA_Int32 SL_Channel_processTokenRequest(SL_Channel *channel,
 		UA_UInt32 requestedLifetime, UA_SecurityTokenRequestType requestType) {
 	if (channel->tokenProvider) {
 		return channel->tokenProvider(channel,
@@ -274,7 +274,7 @@ UA_Int32 SL_Channel_processTokenRequest(SL_Channel channel,
 	printf("SL_Channel_processTokenRequest - no Token provider registered");
 	return UA_ERROR;
 }
-UA_Int32 SL_Channel_renewToken(SL_Channel channel, UA_UInt32 tokenId,
+UA_Int32 SL_Channel_renewToken(SL_Channel *channel, UA_UInt32 tokenId,
 		UA_DateTime revisedLifetime, UA_DateTime createdAt) {
 	channel->securityToken.tokenId = tokenId;
 	channel->securityToken.createdAt = createdAt;
@@ -283,7 +283,7 @@ UA_Int32 SL_Channel_renewToken(SL_Channel channel, UA_UInt32 tokenId,
 	return UA_SUCCESS;
 }
 
-UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel channel,
+UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel *channel,
 		UA_UInt32 sequenceNumber) {
 	//TODO review checking of sequence
 	if (channel->sequenceNumber+1  == sequenceNumber) {
@@ -298,7 +298,7 @@ UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel channel,
 
 }
 
-UA_Int32 SL_Channel_checkRequestId(SL_Channel channel, UA_UInt32 requestId) {
+UA_Int32 SL_Channel_checkRequestId(SL_Channel *channel, UA_UInt32 requestId) {
 	//TODO review checking of request id
 	if (channel->requestId+1  == requestId) {
 		channel->requestId++;
@@ -312,7 +312,7 @@ UA_Int32 SL_Channel_checkRequestId(SL_Channel channel, UA_UInt32 requestId) {
 
 }
 
-UA_Int32 SL_Channel_processOpenRequest(SL_Channel channel,
+UA_Int32 SL_Channel_processOpenRequest(SL_Channel *channel,
 		const UA_OpenSecureChannelRequest* request,
 		UA_OpenSecureChannelResponse* response) {
 	UA_UInt32 protocolVersion;
@@ -407,7 +407,7 @@ UA_Int32 SL_Channel_processOpenRequest(SL_Channel channel,
 	return retval;
 }
 
-UA_Int32 SL_Channel_processCloseRequest(SL_Channel channel,
+UA_Int32 SL_Channel_processCloseRequest(SL_Channel *channel,
 		const UA_CloseSecureChannelRequest* request) {
 	SL_Channel_setState(channel, UA_SL_CHANNEL_CLOSED);
 	return UA_SUCCESS;

+ 25 - 25
src/ua_stack_channel.h

@@ -25,58 +25,58 @@ struct SL_Channel;
 typedef struct SL_Channel SL_Channel;
 
 
-typedef UA_Int32 (*SL_ChannelSecurityTokenProvider)(SL_Channel, UA_Int32,
+typedef UA_Int32 (*SL_ChannelSecurityTokenProvider)(SL_Channel*, UA_Int32,
 		SecurityTokenRequestType, UA_ChannelSecurityToken*);
 typedef UA_Int32 (*SL_ChannelIdProvider)(UA_UInt32*);
 UA_Int32 SL_Channel_new(SL_Channel **channel);
 
-UA_Int32 SL_Channel_init(SL_Channel channel, UA_TL_Connection connection,
+UA_Int32 SL_Channel_init(SL_Channel *channel, UA_TL_Connection *connection,
 		SL_ChannelIdProvider channelIdProvider,
 		SL_ChannelSecurityTokenProvider tokenProvider);
 
-UA_Int32 SL_Channel_bind(SL_Channel channel, UA_TL_Connection connection);
-UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel channel,
+UA_Int32 SL_Channel_bind(SL_Channel *channel, UA_TL_Connection *connection);
+UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel *channel,
 		UA_AsymmetricAlgorithmSecurityHeader *asymSecHeader,
 		UA_SequenceHeader *sequenceHeader);
-UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel channel);
+UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel *channel);
 
 UA_Int32 SL_Channel_delete(SL_Channel *channel);
-UA_Int32 SL_Channel_deleteMembers(SL_Channel channel);
-UA_Int32 SL_Channel_renewToken(SL_Channel channel, UA_UInt32 tokenId,
+UA_Int32 SL_Channel_deleteMembers(SL_Channel *channel);
+UA_Int32 SL_Channel_renewToken(SL_Channel *channel, UA_UInt32 tokenId,
 		UA_DateTime revisedLifetime, UA_DateTime createdAt);
-UA_Int32 SL_Channel_processOpenRequest(SL_Channel channel,
+UA_Int32 SL_Channel_processOpenRequest(SL_Channel *channel,
 		const UA_OpenSecureChannelRequest* request,
 		UA_OpenSecureChannelResponse* response);
-UA_Int32 SL_Channel_processCloseRequest(SL_Channel channel,
+UA_Int32 SL_Channel_processCloseRequest(SL_Channel *channel,
 		const UA_CloseSecureChannelRequest* request);
-UA_Int32 SL_Channel_registerTokenProvider(SL_Channel channel,
+UA_Int32 SL_Channel_registerTokenProvider(SL_Channel *channel,
 		SL_ChannelSecurityTokenProvider provider);
 UA_Int32 SL_Channel_registerChannelIdProvider(SL_ChannelIdProvider provider);
-UA_Int32 SL_Channel_checkRequestId(SL_Channel channel, UA_UInt32 requestId);
+UA_Int32 SL_Channel_checkRequestId(SL_Channel *channel, UA_UInt32 requestId);
 
-UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel channel,
+UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel *channel,
 		UA_UInt32 sequenceNumber);
-UA_Boolean SL_Channel_compare(SL_Channel channel1, SL_Channel channel2);
+UA_Boolean SL_Channel_compare(SL_Channel *channel1, SL_Channel *channel2);
 //getters
-UA_Int32 SL_Channel_getChannelId(SL_Channel channel, UA_UInt32 *channelId);
-UA_Int32 SL_Channel_getTokenId(SL_Channel channel, UA_UInt32 *tokenlId);
-UA_Int32 SL_Channel_getSequenceNumber(SL_Channel channel,
+UA_Int32 SL_Channel_getChannelId(SL_Channel *channel, UA_UInt32 *channelId);
+UA_Int32 SL_Channel_getTokenId(SL_Channel *channel, UA_UInt32 *tokenlId);
+UA_Int32 SL_Channel_getSequenceNumber(SL_Channel *channel,
 		UA_UInt32 *sequenceNumber);
-UA_Int32 SL_Channel_getRequestId(SL_Channel channel, UA_UInt32 *requestId);
-UA_Int32 SL_Channel_getConnectionId(SL_Channel channel,
+UA_Int32 SL_Channel_getRequestId(SL_Channel *channel, UA_UInt32 *requestId);
+UA_Int32 SL_Channel_getConnectionId(SL_Channel *channel,
 		UA_UInt32 *connectionId);
-UA_Int32 SL_Channel_getConnection(SL_Channel channel,
-		UA_TL_Connection *connection);
-UA_Int32 SL_Channel_getState(SL_Channel channel, SL_channelState *channelState);
-UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel channel,
+UA_Int32 SL_Channel_getConnection(SL_Channel *channel,
+		UA_TL_Connection **connection);
+UA_Int32 SL_Channel_getState(SL_Channel *channel, SL_channelState *channelState);
+UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel *channel,
 		UA_AsymmetricAlgorithmSecurityHeader **asymAlgSettings);
-UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel channel,
+UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel *channel,
 		UA_Int32 *lifetime);
 
-UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel channel,
+UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel *channel,
 		UA_UInt32 *revisedLifetime);
 
 //setters
-UA_Int32 SL_Channel_setId(SL_Channel channel, UA_UInt32 id);
+UA_Int32 SL_Channel_setId(SL_Channel *channel, UA_UInt32 id);
 
 #endif /* UA_STACK_CHANNEL_H_ */

+ 5 - 5
src/ua_stack_channel_manager.c

@@ -8,7 +8,7 @@
 
 #include "ua_stack_channel_manager.h"
 
-typedef struct SL_ChannelManager {
+struct SL_ChannelManager {
 	UA_Int32 maxChannelCount;
 	UA_Int32 lastChannelId;
 	UA_DateTime maxChannelLifeTime;
@@ -69,7 +69,7 @@ UA_UInt32 SL_ChannelManager_generateNewTokenId()
 	return channelManager->lastTokenId++;
 }
 
-UA_Int32 SL_ChannelManager_generateToken(SL_Channel channel, UA_Int32 requestedLifeTime,
+UA_Int32 SL_ChannelManager_generateToken(SL_Channel *channel, UA_Int32 requestedLifeTime,
 		SecurityTokenRequestType requestType,
 		UA_ChannelSecurityToken* newToken)
 {
@@ -102,7 +102,7 @@ UA_Int32 SL_ChannelManager_generateToken(SL_Channel channel, UA_Int32 requestedL
 UA_Int32 SL_ChannelManager_removeChannel(UA_Int32 channelId)
 {
 	//TODO lock access
-	SL_Channel channel;
+	SL_Channel *channel;
 	UA_Int32 retval = UA_SUCCESS;
 	SL_ChannelManager_getChannel(channelId, &channel);
 
@@ -127,7 +127,7 @@ UA_Int32 SL_ChannelManager_getChannelLifeTime(UA_DateTime *lifeTime)
 	return UA_SUCCESS;UA_list_Element
 }
 */
-UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel *channel)
+UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel **channel)
 {
 	UA_UInt32 tmpChannelId;
 	if(channelManager==UA_NULL){
@@ -140,7 +140,7 @@ UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel *channel)
 		if (current->payload)
 		{
 			UA_list_Element* elem = (UA_list_Element*) current;
-			*channel = *((SL_Channel*) (elem->payload));
+			*channel = ((SL_Channel*) (elem->payload));
 			SL_Channel_getChannelId(*channel, &tmpChannelId);
 		 	if(tmpChannelId == channelId)
 		 	{

+ 2 - 12
src/ua_stack_channel_manager.h

@@ -19,20 +19,10 @@ typedef struct SL_ChannelManager SL_ChannelManager;
 
 UA_Int32 SL_ChannelManager_init(UA_UInt32 maxChannelCount,UA_UInt32 tokenLifetime, UA_UInt32 startChannelId, UA_UInt32 startTokenId, UA_String *endpointUrl);
 UA_Int32 SL_ChannelManager_addChannel(SL_Channel *channel);
-//UA_Int32 SL_ChannelManager_renewChannelToken(UA_Int32 channelId, UA_DateTime requestedLifeTime);
-//UA_Int32 SL_ChannelManager_createChannelToken(SL_secureChannel channel);
-//UA_Int32 SL_ChannelManager_renewChannelToken(SL_secureChannel channel);
-
-//UA_Int32 SL_ChannelManager_bindChannel(UA_Int32 channelId, TL_Connection *connection);
 UA_Int32 SL_ChannelManager_removeChannel(UA_Int32 channelId);
-UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel *channel);
-
-
-
+UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel **channel);
 UA_Int32 SL_ChannelManager_getChannelLifeTime(UA_DateTime *lifeTime);
-
-UA_Int32 SL_ChannelManager_generateToken(SL_Channel channel, UA_Int32 requestedLifeTime, SecurityTokenRequestType requestType, UA_ChannelSecurityToken* newToken);
-
+UA_Int32 SL_ChannelManager_generateToken(SL_Channel *channel, UA_Int32 requestedLifeTime, SecurityTokenRequestType requestType, UA_ChannelSecurityToken* newToken);
 UA_Int32 SL_ChannelManager_generateChannelId(UA_UInt32 *newChannelId);
 
 

+ 17 - 17
src/ua_stack_session.c

@@ -15,7 +15,7 @@ struct UA_Session
 	UA_String name;
 	Application *application;
 //	UA_list_List pendingRequests;
-	SL_Channel channel;
+	SL_Channel *channel;
 	UA_UInt32 maxRequestMessageSize;
 	UA_UInt32 maxResponseMessageSize;
 	UA_Int64 timeout;
@@ -54,7 +54,7 @@ UA_Int32 UA_Session_generateToken(UA_NodeId *newToken)
 	return retval;
 }
 
-UA_Int32 UA_Session_bind(UA_Session session, SL_Channel channel)
+UA_Int32 UA_Session_bind(UA_Session *session, SL_Channel *channel)
 {
 
 	if(channel && session)
@@ -78,7 +78,7 @@ UA_Int32 UA_Session_new(UA_Session **newSession)
 	//get memory for request list
 	return retval;
 }
-UA_Int32 UA_Session_deleteMembers(UA_Session session)
+UA_Int32 UA_Session_deleteMembers(UA_Session *session)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_deleteMembers(&session->authenticationToken);
@@ -89,11 +89,11 @@ UA_Int32 UA_Session_deleteMembers(UA_Session session)
 UA_Int32 UA_Session_delete(UA_Session *session)
 {
 	UA_Int32 retval = UA_SUCCESS;
-	UA_Session_deleteMembers(*session);
-	retval |= UA_free((UA_Session*)(*session));
+	UA_Session_deleteMembers(session);
+	retval |= UA_free(session);
 	return retval;
 }
-UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
+UA_Int32 UA_Session_init(UA_Session *session, UA_String *sessionName, UA_Double requestedSessionTimeout,
 		UA_UInt32 maxRequestMessageSize,
 		UA_UInt32 maxResponseMessageSize,
 		UA_Session_idProvider idProvider,
@@ -112,7 +112,7 @@ UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double r
 	return retval;
 }
 
-UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2)
+UA_Boolean UA_Session_compare(UA_Session *session1, UA_Session *session2)
 {
 	if(session1 && session2){
 
@@ -124,7 +124,7 @@ UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2)
 	return UA_FALSE;
 }
 
-UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token)
+UA_Boolean UA_Session_compareByToken(UA_Session *session, UA_NodeId *token)
 {
 	if(session && token){
 		return UA_NodeId_equal(&session->authenticationToken, token);
@@ -132,7 +132,7 @@ UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token)
 	return UA_NOT_EQUAL;
 }
 
-UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId)
+UA_Boolean UA_Session_compareById(UA_Session *session, UA_NodeId *sessionId)
 {
 	if(session && sessionId){
 		return UA_NodeId_equal(&session->sessionId, sessionId);
@@ -140,7 +140,7 @@ UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId)
 	return UA_NOT_EQUAL;
 }
 
-UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId)
+UA_Int32 UA_Session_getId(UA_Session *session, UA_NodeId *sessionId)
 {
 	if(session)
 	{
@@ -149,7 +149,7 @@ 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)
+UA_Int32 UA_Session_getToken(UA_Session *session, UA_NodeId *authenticationToken)
 {
 	if(session)
 	{
@@ -157,7 +157,7 @@ UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken)
 	}
 	return UA_ERROR;
 }
-UA_Int32 UA_Session_updateLifetime(UA_Session session)
+UA_Int32 UA_Session_updateLifetime(UA_Session *session)
 {
 	if(session)
 	{
@@ -167,7 +167,7 @@ UA_Int32 UA_Session_updateLifetime(UA_Session session)
 	}
 	return UA_ERROR;
 }
-UA_Int32 UA_Session_getChannel(UA_Session session, SL_Channel *channel)
+UA_Int32 UA_Session_getChannel(UA_Session *session, SL_Channel **channel)
 {
 	if(session)
 	{
@@ -176,7 +176,7 @@ UA_Int32 UA_Session_getChannel(UA_Session session, SL_Channel *channel)
 	}
 	return UA_ERROR;
 }
-UA_Int32 UA_Session_getPendingLifetime(UA_Session session, UA_Double *pendingLifetime_ms)
+UA_Int32 UA_Session_getPendingLifetime(UA_Session *session, UA_Double *pendingLifetime_ms)
 {
 	if(session)
 	{
@@ -186,7 +186,7 @@ UA_Int32 UA_Session_getPendingLifetime(UA_Session session, UA_Double *pendingLif
 	return UA_ERROR;
 }
 
-UA_Boolean UA_Session_verifyChannel(UA_Session session, SL_Channel channel)
+UA_Boolean UA_Session_verifyChannel(UA_Session *session, SL_Channel *channel)
 {
 	if(session && channel)
 	{
@@ -196,7 +196,7 @@ UA_Boolean UA_Session_verifyChannel(UA_Session session, SL_Channel channel)
 	}
 	return UA_FALSE;
 }
-UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** application)
+UA_Int32 UA_Session_getApplicationPointer(UA_Session *session, Application** application)
 {
 	if(session)
 	{
@@ -207,7 +207,7 @@ UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** appl
 	return UA_ERROR;
 }
 
-UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* application)
+UA_Int32 UA_Session_setApplicationPointer(UA_Session *session, Application* application)
 {
 	if(session)
 	{

+ 13 - 13
src/ua_stack_session.h

@@ -31,7 +31,7 @@ UA_Int32 UA_Session_new(UA_Session **newSession);
  * @param timeout
  * @return error code
  */
-UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
+UA_Int32 UA_Session_init(UA_Session *session, UA_String *sessionName, UA_Double requestedSessionTimeout,
 		UA_UInt32 maxRequestMessageSize,
 		UA_UInt32 maxResponseMessageSize,
 		UA_Session_idProvider idProvider,
@@ -43,83 +43,83 @@ UA_Int32 UA_Session_delete(UA_Session *session);
  * @param session2
  * @return UA_TRUE if it is the same session, UA_FALSE else
  */
-UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2);
+UA_Boolean UA_Session_compare(UA_Session *session1, UA_Session *session2);
 /**
  * @brief compares two sessions by their authentication token
  * @param session
  * @param token
  * @return UA_EQUAL if the session token matches the session UA_NOT_EQUAL
  */
-UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token);
+UA_Boolean UA_Session_compareByToken(UA_Session *session, UA_NodeId *token);
 /**
  * @brief compares two sessions by their session id
  * @param session
  * @param sessionId
  * @return UA_EQUAL if the session identifier matches the session UA_NOT_EQUAL
  */
-UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId);
+UA_Boolean UA_Session_compareById(UA_Session *session, UA_NodeId *sessionId);
 /**
  * @brief binds a channel to a session
  * @param session
  * @param channel
  * @return error code
  */
-UA_Int32 UA_Session_bind(UA_Session session, SL_Channel channel);
+UA_Int32 UA_Session_bind(UA_Session *session, SL_Channel *channel);
 /**
  * @brief checks if the given channel is related to the session
  * @param session
  * @param channel
  * @return UA_TRUE if there is a relation between session and given channel
  */
-UA_Boolean UA_Session_verifyChannel(UA_Session session, SL_Channel channel);
+UA_Boolean UA_Session_verifyChannel(UA_Session *session, SL_Channel *channel);
 /**
  * @brief If any activity on a session happens, the timeout must be extended
  * @param session
  * @return error code
  */
-UA_Int32 UA_Session_updateLifetime(UA_Session session);
+UA_Int32 UA_Session_updateLifetime(UA_Session *session);
 /**
  * @brief Gets the session identifier (UA_NodeId)
  * @param session session from which the identifier should be returned
  * @param sessionId return value
  * @return error code
  */
-UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId);
+UA_Int32 UA_Session_getId(UA_Session *session, UA_NodeId *sessionId);
 /**
  * @brief Gets the session authentication token
  * @param session session from which the token should be returned
  * @param authenticationToken return value
  * @return error code
  */
-UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken);
+UA_Int32 UA_Session_getToken(UA_Session *session, UA_NodeId *authenticationToken);
 /**
  * @brief Gets the channel on which the session is currently running
  * @param session session from which the channel should be returned
  * @param channel return value
  * @return
  */
-UA_Int32 UA_Session_getChannel(UA_Session session, SL_Channel *channel);
+UA_Int32 UA_Session_getChannel(UA_Session *session, SL_Channel **channel);
 /**
  * @brief Gets the sessions pending lifetime (calculated from the timeout which was set)
  * @param session session from which the lifetime should be returned
  * @param pendingLifetime return value
  * @return error code
  */
-UA_Int32 UA_Session_getPendingLifetime(UA_Session session,UA_Double *pendingLifetime);
+UA_Int32 UA_Session_getPendingLifetime(UA_Session *session,UA_Double *pendingLifetime);
 /**
  * @brief Gets the pointer to the application
  * @param session session from which the application pointer should be returned
  * @param application return value
  * @return  error code
  */
-UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** application);
+UA_Int32 UA_Session_getApplicationPointer(UA_Session *session, Application** application);
 /**
  * @brief Sets the application pointer to the application
  * @param session session of which the application pointer should be set
  * @param application return value
  * @return error code
  */
-UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* application);
+UA_Int32 UA_Session_setApplicationPointer(UA_Session *session, Application* application);
 
 
 #endif /* UA_STACK_SESSION_H_ */

+ 10 - 10
src/ua_stack_session_manager.c

@@ -52,19 +52,19 @@ UA_Boolean UA_SessionManager_sessionExists(UA_Session *session)
 	if(UA_list_search(&sessionManager->sessions,(UA_list_PayloadComparer)UA_Session_compare,(void*)session))
 	{
 		UA_Double pendingLifetime;
-		UA_Session_getPendingLifetime(*session,&pendingLifetime);
+		UA_Session_getPendingLifetime(session,&pendingLifetime);
 		if(pendingLifetime>0){
 			return UA_TRUE;
 		}
 		//timeout of session reached so remove it
 		UA_NodeId sessionId;
-		UA_Session_getId(*session,&sessionId);
+		UA_Session_getId(session,&sessionId);
 		UA_SessionManager_removeSession(&sessionId);
 	}
 	return UA_FALSE;
 }
 
-UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *session)
+UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session **session)
 {
 	if(sessionManager == UA_NULL)
 	{
@@ -78,7 +78,7 @@ UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *sess
 		if (current->payload)
 		{
 			UA_list_Element* elem = (UA_list_Element*) current;
-			*session = *((UA_Session*) (elem->payload));
+			*session = ((UA_Session*) (elem->payload));
 			if(UA_Session_compareById(*session,sessionId) == UA_EQUAL){
 				UA_Double pendingLifetime;
 				UA_Session_getPendingLifetime(*session, &pendingLifetime);
@@ -97,7 +97,7 @@ UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *sess
 	return UA_ERROR;
 }
 
-UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *session)
+UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session **session)
 {
 	if(sessionManager == UA_NULL)
 	{
@@ -111,7 +111,7 @@ UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *sessi
 		if (current->payload)
 		{
 			UA_list_Element* elem = (UA_list_Element*) current;
-			*session = *((UA_Session*) (elem->payload));
+			*session = ((UA_Session*) (elem->payload));
 
 			if(UA_Session_compareByToken(*session,token) == UA_EQUAL){
 				UA_Double pendingLifetime;
@@ -138,7 +138,7 @@ UA_Int32 UA_SessionManager_addSession(UA_Session *session)
 	if(!UA_SessionManager_sessionExists(session))
 	{
 		retval |= UA_list_addPayloadToBack(&sessionManager->sessions,(void*)session);
-		UA_Session_getId(*session, &sessionId);
+		UA_Session_getId(session, &sessionId);
 
 		printf("UA_SessionManager_addSession - added session with id = %d \n",sessionId.identifier.numeric);
 		printf("UA_SessionManager_addSession - current session count: %i \n",sessionManager->sessions.size);
@@ -162,7 +162,7 @@ UA_Int32 UA_SessionManager_removeSession(UA_NodeId *sessionId)
 
 	return retval;
 }
-
+/*
 UA_Int32 UA_SessionManager_updateSessions()
 {
 	if(sessionManager == UA_NULL)
@@ -175,7 +175,7 @@ UA_Int32 UA_SessionManager_updateSessions()
 		if (current->payload)
 		{
 			UA_list_Element* elem = (UA_list_Element*) current;
-			UA_Session session = *((UA_Session*) (elem->payload));
+			UA_Session *session = ((UA_Session*) (elem->payload));
 			UA_Double pendingLifetime;
 			UA_Session_getPendingLifetime(session, &pendingLifetime);
 
@@ -189,7 +189,7 @@ UA_Int32 UA_SessionManager_updateSessions()
 	}
 	return UA_SUCCESS;
 }
-
+*/
 UA_Int32 UA_SessionManager_getSessionTimeout(UA_Int64 *timeout_ms)
 {
 	if(sessionManager)

+ 2 - 2
src/ua_stack_session_manager.h

@@ -50,7 +50,7 @@ UA_Int32 UA_SessionManager_removeSession(UA_NodeId *sessionId);
  * @param session the session object is returned if no error occurs
  * @return error code
  */
-UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *session);
+UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session **session);
 
 /**
  * @brief
@@ -58,7 +58,7 @@ UA_Int32 UA_SessionManager_getSessionById(UA_NodeId *sessionId, UA_Session *sess
  * @param session output, session object which is identified by the authentication token
  * @return error code
  */
-UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *session);
+UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session **session);
 
 
 /**

+ 13 - 14
src/ua_transport_binary.c

@@ -1,15 +1,16 @@
+#include "ua_transport_connection.h"
 #include <memory.h>
 #include "ua_transport_binary.h"
 #include "ua_transport.h"
 #include "ua_transport_binary_secure.h"
-#include "ua_transport_connection.h"
 
 
-static UA_Int32 TL_handleHello(UA_TL_Connection connection, const UA_ByteString* msg, UA_UInt32* pos){
+static UA_Int32 TL_handleHello(UA_TL_Connection *connection, const UA_ByteString* msg, UA_UInt32* pos){
 	UA_Int32 retval = UA_SUCCESS;
 	UA_UInt32 tmpPos = 0;
 	UA_Int32 connectionState;
 	UA_OPCUATcpHelloMessage helloMessage;
+
 	UA_TL_Connection_getState(connection, &connectionState);
 	if (connectionState == CONNECTIONSTATE_CLOSED){
 		DBG_VERBOSE(printf("TL_handleHello - extracting header information \n"));
@@ -58,12 +59,12 @@ static UA_Int32 TL_handleHello(UA_TL_Connection connection, const UA_ByteString*
 	return retval;
 }
 
-static UA_Int32 TL_handleOpen(UA_TL_Connection connection, const UA_ByteString* msg, UA_UInt32* pos) {
+static UA_Int32 TL_handleOpen(UA_TL_Connection *connection, const UA_ByteString* msg, UA_UInt32* pos) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 state;
-	SL_Channel channel;
+	SL_Channel *channel;
 	UA_UInt32 secureChannelId;
-	retval |= UA_TL_Connection_getState(connection,&state);
+	retval |= UA_TL_Connection_getState(connection, &state);
 	if (state == CONNECTIONSTATE_ESTABLISHED) {
 		UA_UInt32_decodeBinary(msg, pos, &secureChannelId);
 		SL_ChannelManager_getChannel(secureChannelId, &channel);
@@ -72,11 +73,9 @@ static UA_Int32 TL_handleOpen(UA_TL_Connection connection, const UA_ByteString*
 			SL_Channel *newChannel;
 			//create new channel
 			retval |= SL_Channel_new(&newChannel);//just create channel
-			retval |= SL_Channel_init(*newChannel,connection,
-					SL_ChannelManager_generateChannelId,
-				SL_ChannelManager_generateToken);
-			retval |= SL_Channel_bind(*newChannel,connection);
-			retval |= SL_ProcessOpenChannel(*newChannel, msg, pos);
+			retval |= SL_Channel_init(newChannel, connection,SL_ChannelManager_generateChannelId, SL_ChannelManager_generateToken);
+			retval |= SL_Channel_bind(newChannel,connection);
+			retval |= SL_ProcessOpenChannel(newChannel, msg, pos);
 			retval |= SL_ChannelManager_addChannel(newChannel);
 			return retval;
 		}
@@ -90,7 +89,7 @@ static UA_Int32 TL_handleOpen(UA_TL_Connection connection, const UA_ByteString*
 	return UA_ERR_INVALID_VALUE;
 }
 
-static UA_Int32 TL_handleMsg(UA_TL_Connection connection, const UA_ByteString* msg, UA_UInt32* pos) {
+static UA_Int32 TL_handleMsg(UA_TL_Connection *connection, const UA_ByteString* msg, UA_UInt32* pos) {
 	UA_Int32 state;
 	UA_TL_Connection_getState(connection,&state);
 	if (state == CONNECTIONSTATE_ESTABLISHED) {
@@ -99,7 +98,7 @@ static UA_Int32 TL_handleMsg(UA_TL_Connection connection, const UA_ByteString* m
 	return UA_ERR_INVALID_VALUE;
 }
 
-static UA_Int32 TL_handleClo(UA_TL_Connection connection, const UA_ByteString* msg, UA_UInt32* pos) {
+static UA_Int32 TL_handleClo(UA_TL_Connection *connection, const UA_ByteString* msg, UA_UInt32* pos) {
 	UA_Int32 retval = UA_SUCCESS;
 	SL_Process(msg,pos);
 
@@ -107,7 +106,7 @@ static UA_Int32 TL_handleClo(UA_TL_Connection connection, const UA_ByteString* m
 	return retval;
 }
 
-UA_Int32 TL_Process(UA_TL_Connection connection, const UA_ByteString* msg) {
+UA_Int32 TL_Process(UA_TL_Connection *connection, const UA_ByteString* msg) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_UInt32 pos = 0;
 	UA_OPCUATcpMessageHeader tcpMessageHeader;
@@ -162,7 +161,7 @@ UA_Int32 TL_Process(UA_TL_Connection connection, const UA_ByteString* msg) {
 }
 
 /** respond to client request */
-UA_Int32 TL_Send(UA_TL_Connection connection, const UA_ByteString** gather_buf, UA_UInt32 gather_len) {
+UA_Int32 TL_Send(UA_TL_Connection *connection, const UA_ByteString** gather_buf, UA_UInt32 gather_len) {
 	UA_Int32 retval = UA_SUCCESS;
 
 

+ 2 - 2
src/ua_transport_binary.h

@@ -34,7 +34,7 @@ typedef struct TL_Connection_T {
 } TL_Connection;
 */
 
-UA_Int32 TL_Send(UA_TL_Connection connection, const UA_ByteString** gather_buf, UA_UInt32 gather_len);
-UA_Int32 TL_Process(UA_TL_Connection connection, const UA_ByteString* msg);
+UA_Int32 TL_Send(UA_TL_Connection *connection, const UA_ByteString** gather_buf, UA_UInt32 gather_len);
+UA_Int32 TL_Process(UA_TL_Connection *connection, const UA_ByteString* msg);
 
 #endif /* OPCUA_TRANSPORT_BINARY_H_ */

+ 7 - 7
src/ua_transport_binary_secure.c

@@ -12,7 +12,7 @@
 #define SIZE_SECURECHANNEL_HEADER 12
 #define SIZE_SEQHEADER_HEADER 8
 
-static UA_Int32 SL_Send(SL_Channel channel,
+static UA_Int32 SL_Send(SL_Channel *channel,
 		const UA_ByteString * responseMessage, UA_Int32 type)
 {
 	UA_UInt32 pos = 0;
@@ -20,8 +20,8 @@ static UA_Int32 SL_Send(SL_Channel channel,
 	UA_UInt32 channelId;
 	UA_UInt32 sequenceNumber;
 	UA_UInt32 requestId;
-	UA_TL_Connection connection;
 	UA_NodeId resp_nodeid;
+	UA_TL_Connection *connection;
 	UA_AsymmetricAlgorithmSecurityHeader *asymAlgSettings = UA_NULL;
 
 	resp_nodeid.encodingByte = UA_NODEIDTYPE_FOURBYTE;
@@ -129,7 +129,7 @@ static void init_response_header(UA_RequestHeader const * p,
 #define RESPONSE_PREPARE(TYPE) \
 	UA_##TYPE##Request p; \
 	UA_##TYPE##Response r; \
-	UA_Session session = UA_NULL; \
+	UA_Session *session = UA_NULL; \
 	UA_##TYPE##Request_decodeBinary(msg, &recvOffset, &p); \
 	UA_##TYPE##Response_init(&r); \
 	init_response_header(&p.requestHeader, &r.responseHeader); \
@@ -167,7 +167,7 @@ static void init_response_header(UA_RequestHeader const * p,
 	UA_##TYPE##Response_deleteMembers(&r); \
 
 
-UA_Int32 SL_handleRequest(SL_Channel channel, const UA_ByteString* msg,
+UA_Int32 SL_handleRequest(SL_Channel *channel, const UA_ByteString* msg,
 		UA_UInt32 *pos)
 {
 	UA_Int32 retval = UA_SUCCESS;
@@ -399,7 +399,7 @@ UA_Int32 SL_handleRequest(SL_Channel channel, const UA_ByteString* msg,
 	return retval;
 }
 
-UA_Int32 SL_ProcessOpenChannel(SL_Channel channel, const UA_ByteString* msg,
+UA_Int32 SL_ProcessOpenChannel(SL_Channel *channel, const UA_ByteString* msg,
 		UA_UInt32 *pos)
 {
 	UA_Int32 retval = UA_SUCCESS;
@@ -413,7 +413,7 @@ UA_Int32 SL_ProcessOpenChannel(SL_Channel channel, const UA_ByteString* msg,
 	return SL_handleRequest(channel, msg, pos) | retval;
 }
 /* not used anymore */
-//UA_Int32 SL_ProcessCloseChannel(SL_Channel channel, const UA_ByteString* msg,
+//UA_Int32 SL_ProcessCloseChannel(SL_Channel *channel, const UA_ByteString* msg,
 //		UA_UInt32 *pos)
 //{
 //	return SL_handleRequest(channel, msg, pos);
@@ -425,7 +425,7 @@ UA_Int32 SL_Process(const UA_ByteString* msg,
 	DBG_VERBOSE(printf("SL_process - entered \n"));
 	UA_UInt32 secureChannelId;
 	UA_UInt32 foundChannelId;
-	SL_Channel channel;
+	SL_Channel *channel;
 	UA_SequenceHeader sequenceHeader;
 
 

+ 2 - 2
src/ua_transport_binary_secure.h

@@ -28,8 +28,8 @@ UA_Int32 SL_Process(const UA_ByteString* msg, UA_UInt32* pos);
  * @return Returns UA_SUCCESS if successful executed, UA_ERROR in any other case
 
  */
-UA_Int32 SL_ProcessOpenChannel(SL_Channel channel, const UA_ByteString* msg,
+UA_Int32 SL_ProcessOpenChannel(SL_Channel *channel, const UA_ByteString* msg,
 		UA_UInt32 *pos);
-UA_Int32 SL_ProcessCloseChannel(SL_Channel channel, const UA_ByteString* msg,
+UA_Int32 SL_ProcessCloseChannel(SL_Channel *channel, const UA_ByteString* msg,
 		UA_UInt32 *pos);
 #endif /* OPCUA_TRANSPORT_BINARY_SECURE_H_ */

+ 21 - 21
src/ua_transport_connection.c

@@ -7,7 +7,7 @@
 
 #include "ua_transport_connection.h"
 #include "ua_transport.h"
-typedef struct UA_TL_Connection{
+struct UA_TL_Connection{
 	UA_Int32 connectionHandle;
 	UA_UInt32 state;
 	TL_Buffer localConf;
@@ -20,30 +20,30 @@ typedef struct UA_TL_Connection{
 };
 
 
-UA_Int32 UA_TL_Connection_new(UA_TL_Connection *connection, TL_Buffer localBuffers,TL_Writer writer, TL_Closer closeCallback,UA_Int32 handle, void* networkLayerData)
+UA_Int32 UA_TL_Connection_new(UA_TL_Connection **connection, TL_Buffer localBuffers,TL_Writer writer, TL_Closer closeCallback,UA_Int32 handle, void* networkLayerData)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_alloc((void**)connection,sizeof(UA_TL_Connection));
 	if(retval == UA_SUCCESS)
 	{
-		connection->connectionHandle = handle;
-		connection->localConf = localBuffers;
-		connection->writer = writer;
-		connection->closeCallback = closeCallback;
-		connection->state = CONNECTIONSTATE_CLOSED;
-		connection->networkLayerData = networkLayerData;
+		(*connection)->connectionHandle = handle;
+		(*connection)->localConf = localBuffers;
+		(*connection)->writer = writer;
+		(*connection)->closeCallback = closeCallback;
+		(*connection)->state = CONNECTIONSTATE_CLOSED;
+		(*connection)->networkLayerData = networkLayerData;
 	}
 	return retval;
 }
 
-UA_Int32 UA_TL_Connection_delete(UA_TL_Connection connection)
+UA_Int32 UA_TL_Connection_delete(UA_TL_Connection *connection)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_free((void*)connection);
 	return retval;
 }
 
-UA_Int32 UA_TL_Connection_close(UA_TL_Connection connection)
+UA_Int32 UA_TL_Connection_close(UA_TL_Connection *connection)
 {
 	connection->state = CONNECTIONSTATE_CLOSED;
 	connection->closeCallback(connection);
@@ -63,7 +63,7 @@ UA_Boolean UA_TL_Connection_compare(UA_TL_Connection *connection1, UA_TL_Connect
 }
 
 
-UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection connection, UA_OPCUATcpHelloMessage *helloMessage)
+UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection *connection, UA_OPCUATcpHelloMessage *helloMessage)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	connection->remoteConf.maxChunkCount = helloMessage->maxChunkCount;
@@ -77,25 +77,25 @@ UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection connection, UA_OPCUATcp
 	return UA_SUCCESS;
 }
 
-UA_Int32 UA_TL_Connection_callWriter(UA_TL_Connection connection, const UA_ByteString** gather_bufs, UA_Int32 gather_len)
+UA_Int32 UA_TL_Connection_callWriter(UA_TL_Connection *connection, const UA_ByteString** gather_bufs, UA_Int32 gather_len)
 {
 	return connection->writer(connection->connectionHandle,gather_bufs, gather_len);
 }
 
 //setters
-UA_Int32 UA_TL_Connection_setWriter(UA_TL_Connection connection, TL_Writer writer)
+UA_Int32 UA_TL_Connection_setWriter(UA_TL_Connection *connection, TL_Writer writer)
 {
 	connection->writer = writer;
 	return UA_SUCCESS;
 }
 /*
-UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection connection, UA_Int32 connectionHandle)
+UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection *connection, UA_Int32 connectionHandle)
 {
 	connection->connectionHandle = connectionHandle;
 	return UA_SUCCESS;
 }
 */
-UA_Int32 UA_TL_Connection_setState(UA_TL_Connection connection, UA_Int32 connectionState)
+UA_Int32 UA_TL_Connection_setState(UA_TL_Connection *connection, UA_Int32 connectionState)
 {
 	if(connection)
 	{
@@ -106,7 +106,7 @@ UA_Int32 UA_TL_Connection_setState(UA_TL_Connection connection, UA_Int32 connect
 	}
 }
 //getters
-UA_Int32 UA_TL_Connection_getState(UA_TL_Connection connection, UA_Int32 *connectionState)
+UA_Int32 UA_TL_Connection_getState(UA_TL_Connection *connection, UA_Int32 *connectionState)
 {
 	if(connection)
 	{
@@ -118,7 +118,7 @@ UA_Int32 UA_TL_Connection_getState(UA_TL_Connection connection, UA_Int32 *connec
 	}
 }
 
-UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection connection,void** networkLayerData)
+UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection *connection,void** networkLayerData)
 {
 	if(connection)
 	{
@@ -130,7 +130,7 @@ UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection connection,void**
 	}
 }
 
-UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection connection, UA_UInt32 *protocolVersion)
+UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection *connection, UA_UInt32 *protocolVersion)
 {
 	if(connection)
 	{
@@ -141,7 +141,7 @@ UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection connection, UA_UIn
 		return UA_ERROR;
 	}
 }
-UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection connection, TL_Buffer *localConfiguration)
+UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection *connection, TL_Buffer *localConfiguration)
 {
 	if(connection)
 	{
@@ -152,7 +152,7 @@ UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection connection, TL_Buffer
 		return UA_ERROR;
 	}
 }
-UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection connection, UA_UInt32 *connectionHandle)
+UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection *connection, UA_UInt32 *connectionHandle)
 {
 	if(connection)
 	{
@@ -164,7 +164,7 @@ UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection connection, UA_UInt32 *conn
 		}
 }
 
-UA_Int32 UA_TL_Connection_bind(UA_TL_Connection connection, UA_Int32 handle)
+UA_Int32 UA_TL_Connection_bind(UA_TL_Connection *connection, UA_Int32 handle)
 {
 	if(connection)
 	{

+ 15 - 15
src/ua_transport_connection.h

@@ -21,31 +21,31 @@ typedef struct TL_Buffer{
 struct UA_TL_Connection;
 typedef struct UA_TL_Connection UA_TL_Connection;
 
-typedef UA_Int32 (*TL_Closer)(UA_TL_Connection);
+typedef UA_Int32 (*TL_Closer)(UA_TL_Connection*);
 typedef UA_Int32 (*TL_Writer)(UA_Int32 connectionHandle, const UA_ByteString** gather_bufs, UA_Int32 gather_len); // send mutiple buffer concatenated into one msg (zero copy)
 
 
-UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection connection, UA_OPCUATcpHelloMessage *helloMessage);
+UA_Int32 UA_TL_Connection_configByHello(UA_TL_Connection *connection, UA_OPCUATcpHelloMessage *helloMessage);
 
-UA_Int32 UA_TL_Connection_delete(UA_TL_Connection connection);
-UA_Int32 UA_TL_Connection_callWriter(UA_TL_Connection connection, const UA_ByteString** gather_bufs, UA_Int32 gather_len);
+UA_Int32 UA_TL_Connection_delete(UA_TL_Connection *connection);
+UA_Int32 UA_TL_Connection_callWriter(UA_TL_Connection *connection, const UA_ByteString** gather_bufs, UA_Int32 gather_len);
 
-UA_Int32 UA_TL_Connection_close(UA_TL_Connection connection);
-UA_Int32 UA_TL_Connection_new(UA_TL_Connection *connection, TL_Buffer localBuffers,TL_Writer writer, TL_Closer closeCallback,UA_Int32 handle, void* networkLayerData);
-UA_Int32 UA_TL_Connection_bind(UA_TL_Connection connection, UA_Int32 handle);
+UA_Int32 UA_TL_Connection_close(UA_TL_Connection *connection);
+UA_Int32 UA_TL_Connection_new(UA_TL_Connection **connection, TL_Buffer localBuffers,TL_Writer writer, TL_Closer closeCallback,UA_Int32 handle, void* networkLayerData);
+UA_Int32 UA_TL_Connection_bind(UA_TL_Connection *connection, UA_Int32 handle);
 UA_Boolean UA_TL_Connection_compare(UA_TL_Connection *connection1, UA_TL_Connection *connection2);
 
 //setters
-UA_Int32 UA_TL_Connection_setState(UA_TL_Connection connection, UA_Int32 connectionState);
-UA_Int32 UA_TL_Connection_setWriter(UA_TL_Connection connection, TL_Writer writer);
-//UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection connection, UA_Int32 connectionHandle);
+UA_Int32 UA_TL_Connection_setState(UA_TL_Connection *connection, UA_Int32 connectionState);
+UA_Int32 UA_TL_Connection_setWriter(UA_TL_Connection *connection, TL_Writer writer);
+//UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection *connection, UA_Int32 connectionHandle);
 
 //getters
-UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection connection, UA_UInt32 *connectionId);
-UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection connection, UA_UInt32 *protocolVersion);
-UA_Int32 UA_TL_Connection_getState(UA_TL_Connection connection, UA_Int32 *connectionState);
-UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection connection, TL_Buffer *localConfiguration);
-UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection connection,void** networkLayerData);
+UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection *connection, UA_UInt32 *connectionId);
+UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection *connection, UA_UInt32 *protocolVersion);
+UA_Int32 UA_TL_Connection_getState(UA_TL_Connection *connection, UA_Int32 *connectionState);
+UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection *connection, TL_Buffer *localConfiguration);
+UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection *connection,void** networkLayerData);
 
 
 #endif /* UA_TRANSPORT_CONNECTION_H_ */

+ 4 - 4
src/ua_transport_connection_manager.c

@@ -36,13 +36,13 @@ UA_Int32 UA_TL_ConnectionManager_init(UA_UInt32 maxConnectionCount)
 UA_Int32 UA_TL_ConnectionManager_addConnection(UA_TL_Connection *connection)
 {
 	UA_UInt32 connectionId;
-	UA_TL_Connection_getHandle(*connection, &connectionId);
+	UA_TL_Connection_getHandle(connection, &connectionId);
 	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_Connection connection)
+UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection *connection)
 {
 	UA_list_Element *element =  UA_list_find(&connectionManager->connections, (UA_list_PayloadMatcher)UA_TL_Connection_compare);
 
@@ -53,7 +53,7 @@ UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection connection)
 	return UA_SUCCESS;
 }
 
-UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection *connection)
+UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection **connection)
 {
 	UA_UInt32 tmpConnectionHandle;
 	if(connectionManager)
@@ -64,7 +64,7 @@ UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, U
 			if (current->payload)
 			{
 				UA_list_Element* elem = (UA_list_Element*) current;
-				*connection = *((UA_TL_Connection*) (elem->payload));
+				*connection = ((UA_TL_Connection*) (elem->payload));
 				UA_TL_Connection_getHandle(*connection, &tmpConnectionHandle);
 
 				if(tmpConnectionHandle == connectionId)

+ 2 - 2
src/ua_transport_connection_manager.h

@@ -13,8 +13,8 @@
 
 UA_Int32 UA_TL_ConnectionManager_init(UA_UInt32 maxConnectionCount);
 UA_Int32 UA_TL_ConnectionManager_addConnection(UA_TL_Connection *connection);
-UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection connection);
+UA_Int32 UA_TL_ConnectionManager_removeConnection(UA_TL_Connection *connection);
 //getter
-UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection *connection);
+UA_Int32 UA_TL_ConnectionManager_getConnectionByHandle(UA_UInt32 connectionId, UA_TL_Connection **connection);
 
 #endif /* UA_CONNECTION_MANAGER_H_ */