Procházet zdrojové kódy

changed type names of "object"-structs

Florian Palm před 10 roky
rodič
revize
60d1dd2326

+ 59 - 59
src/ua_stack_channel.c

@@ -9,7 +9,7 @@
 #include <time.h>
 #include <stdlib.h>
 
-typedef struct SL_ChannelStruct {
+typedef struct SL_Channel {
 	SL_channelState state;
 	UA_UInt32 channelId;
 	//TL_Connection* tlConnection;
@@ -31,40 +31,40 @@ typedef struct SL_ChannelStruct {
 	UA_ByteString localNonce;
 	SL_ChannelSecurityTokenProvider tokenProvider;
 	SL_ChannelIdProvider channelIdProvider;
-} SL_ChannelType;
+};
 
 UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel channel,
 		UA_AsymmetricAlgorithmSecurityHeader *asymSecHeader,
 		UA_SequenceHeader *sequenceHeader) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_AsymmetricAlgorithmSecurityHeader_copy(asymSecHeader,
-			&((SL_ChannelType*) channel)->remoteAsymAlgSettings);
+			&channel->remoteAsymAlgSettings);
 	//set starting sequence number from remote partner
-	((SL_ChannelType*) channel)->sequenceNumber =
+	channel->sequenceNumber =
 			sequenceHeader->sequenceNumber;
 	//set starting request id from remote partner
-	((SL_ChannelType*) channel)->requestId = sequenceHeader->requestId;
+	channel->requestId = sequenceHeader->requestId;
 	return retval;
 }
 /*
 UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel channel)
 {
 	UA_Int32 retval = UA_SUCCESS;
-	((SL_ChannelType*) channel)->localAsymAlgSettings.receiverCertificateThumbprint.data = UA_NULL;
-	((SL_ChannelType*) channel)->localAsymAlgSettings.receiverCertificateThumbprint.length = 0;
+	channel->localAsymAlgSettings.receiverCertificateThumbprint.data = UA_NULL;
+	channel->localAsymAlgSettings.receiverCertificateThumbprint.length = 0;
 
-	retval |= UA_String_copycstring("http://opcfoundation.org/UA/SecurityPolicy#None",(UA_String*)&((SL_ChannelType*) channel)->localAsymAlgSettings.securityPolicyUri);
+	retval |= UA_String_copycstring("http://opcfoundation.org/UA/SecurityPolicy#None",(UA_String*)&channel->localAsymAlgSettings.securityPolicyUri);
 
-	((SL_ChannelType*) channel)->localAsymAlgSettings.senderCertificate.data = UA_NULL;
-	((SL_ChannelType*) channel)->localAsymAlgSettings.senderCertificate.length = 0;
+	channel->localAsymAlgSettings.senderCertificate.data = UA_NULL;
+	channel->localAsymAlgSettings.senderCertificate.length = 0;
 	return retval;
 }
 */
 UA_Int32 SL_Channel_new(SL_Channel **channel) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_alloc((void** )channel, sizeof(SL_Channel));
-	SL_ChannelType *thisChannel = UA_NULL;
-	retval |= UA_alloc((void** )&thisChannel, sizeof(SL_ChannelType));
+	SL_Channel *thisChannel = UA_NULL;
+	retval |= UA_alloc((void** )&thisChannel, sizeof(SL_Channel));
 	**channel = (SL_Channel) thisChannel;
 	return retval;
 }
@@ -84,41 +84,41 @@ UA_Int32 SL_Channel_init(SL_Channel channel, UA_TL_Connection connection,
 
 	UA_Int32 retval = UA_SUCCESS;
 
-	((SL_ChannelType*) channel)->channelIdProvider = channelIdProvider;
-	((SL_ChannelType*) channel)->tokenProvider = tokenProvider;
+	channel->channelIdProvider = channelIdProvider;
+	channel->tokenProvider = tokenProvider;
 
-	((SL_ChannelType*) channel)->connection = connection;
+	channel->connection = connection;
 	//generate secure channel id
-	((SL_ChannelType*) channel)->channelIdProvider(
-			&((SL_ChannelType*) channel)->channelId);
+	channel->channelIdProvider(
+			&channel->channelId);
 
 	//generate local nonce
 	SL_Channel_generateNonce(&channel->localNonce);
 	//TODO get this from the local configuration file MOCK UP ---start
-	((SL_ChannelType*) channel)->localAsymAlgSettings.receiverCertificateThumbprint.data = UA_NULL;
-	((SL_ChannelType*) channel)->localAsymAlgSettings.receiverCertificateThumbprint.length = 0;
+	channel->localAsymAlgSettings.receiverCertificateThumbprint.data = UA_NULL;
+	channel->localAsymAlgSettings.receiverCertificateThumbprint.length = 0;
 
-	retval |= UA_String_copycstring("http://opcfoundation.org/UA/SecurityPolicy#None",(UA_String*)&((SL_ChannelType*) channel)->localAsymAlgSettings.securityPolicyUri);
+	retval |= UA_String_copycstring("http://opcfoundation.org/UA/SecurityPolicy#None",(UA_String*)&channel->localAsymAlgSettings.securityPolicyUri);
 
-	((SL_ChannelType*) channel)->localAsymAlgSettings.senderCertificate.data = UA_NULL;
-	((SL_ChannelType*) channel)->localAsymAlgSettings.senderCertificate.length = 0;
+	channel->localAsymAlgSettings.senderCertificate.data = UA_NULL;
+	channel->localAsymAlgSettings.senderCertificate.length = 0;
 	// MOCK UP ---end
 
 
-	((SL_ChannelType*) channel)->state = UA_SL_CHANNEL_CLOSED;
+	channel->state = UA_SL_CHANNEL_CLOSED;
 	return retval;
 }
 
 UA_Int32 SL_Channel_registerTokenProvider(SL_Channel channel,
 		SL_ChannelSecurityTokenProvider provider) {
-	((SL_ChannelType*) channel)->tokenProvider = provider;
+	channel->tokenProvider = provider;
 	return UA_SUCCESS;
 }
 
 UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel channel, UA_Int32 *lifetime) {
 	if (channel) {
 		UA_Int64 diffInMS =
-				(((SL_ChannelType*) channel)->securityToken.createdAt
+				(channel->securityToken.createdAt
 						- UA_DateTime_now()) / 1e7;
 		if (diffInMS > UA_INT32_MAX) {
 			*lifetime = UA_INT32_MAX;
@@ -135,7 +135,7 @@ UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel channel, UA_Int32 *lifetime)
 
 UA_Int32 SL_Channel_getChannelId(SL_Channel channel, UA_UInt32 *channelId) {
 	if (channel) {
-		*channelId = ((SL_ChannelType*) channel)->channelId;
+		*channelId = channel->channelId;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -143,7 +143,7 @@ UA_Int32 SL_Channel_getChannelId(SL_Channel channel, UA_UInt32 *channelId) {
 
 UA_Int32 SL_Channel_getTokenId(SL_Channel channel, UA_UInt32 *tokenId) {
 	if (channel) {
-		*tokenId = ((SL_ChannelType*) channel)->securityToken.tokenId;
+		*tokenId = channel->securityToken.tokenId;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -158,15 +158,15 @@ UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel channel,
 
 	retval |=
 			UA_ByteString_copy(
-					&(((SL_ChannelType*) channel)->localAsymAlgSettings.receiverCertificateThumbprint),
+					&(channel->localAsymAlgSettings.receiverCertificateThumbprint),
 					&(*asymAlgSettings)->receiverCertificateThumbprint);
 	retval |=
 			UA_ByteString_copy(
-					&(((SL_ChannelType*) channel)->localAsymAlgSettings.securityPolicyUri),
+					&(channel->localAsymAlgSettings.securityPolicyUri),
 					&(*asymAlgSettings)->securityPolicyUri);
 	retval |=
 			UA_ByteString_copy(
-					&(((SL_ChannelType*) channel)->localAsymAlgSettings.senderCertificate),
+					&(channel->localAsymAlgSettings.senderCertificate),
 					&(*asymAlgSettings)->senderCertificate);
 
 	return UA_SUCCESS;
@@ -175,14 +175,14 @@ UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel channel,
 UA_Int32 SL_Channel_getConnection(SL_Channel channel,
 		UA_TL_Connection *connection) {
 	if (channel) {
-		*connection = ((SL_ChannelType*) channel)->connection;
+		*connection = channel->connection;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
 }
 UA_Int32 SL_Channel_getRequestId(SL_Channel channel, UA_UInt32 *requestId) {
 	if (channel) {
-		*requestId = ((SL_ChannelType*) channel)->requestId;
+		*requestId = channel->requestId;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -190,14 +190,14 @@ UA_Int32 SL_Channel_getRequestId(SL_Channel channel, UA_UInt32 *requestId) {
 UA_Int32 SL_Channel_getSequenceNumber(SL_Channel channel,
 		UA_UInt32 *sequenceNumber) {
 	if (channel) {
-		*sequenceNumber = ((SL_ChannelType*) channel)->sequenceNumber;
+		*sequenceNumber = channel->sequenceNumber;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
 }
 UA_Int32 SL_Channel_getState(SL_Channel channel, SL_channelState *channelState) {
 	if (channel) {
-		*channelState = ((SL_ChannelType*) channel)->state;
+		*channelState = channel->state;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -207,7 +207,7 @@ UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel channel,
 		UA_UInt32 *revisedLifetime) {
 	if (channel) {
 		*revisedLifetime =
-				((SL_ChannelType*) channel)->securityToken.revisedLifetime;
+				channel->securityToken.revisedLifetime;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -215,28 +215,28 @@ UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel channel,
 
 //setters
 UA_Int32 SL_Channel_setId(SL_Channel channel, UA_UInt32 id) {
-	((SL_ChannelType*) channel)->channelId = id;
+	channel->channelId = id;
 	return UA_SUCCESS;
 }
 
 //private function
 UA_Int32 SL_Channel_setState(SL_Channel channel, SL_channelState channelState) {
-	((SL_ChannelType*) channel)->state = channelState;
+	channel->state = channelState;
 	return UA_SUCCESS;
 }
 
 
 
 UA_Boolean SL_Channel_compare(SL_Channel channel1, SL_Channel channel2) {
-	return (((SL_ChannelType*) channel1)->channelId
-			== ((SL_ChannelType*) channel2)->channelId) ?
+	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) {
 	if (channel && connection) {
-		((SL_ChannelType*) channel)->connection = connection;
+		channel->connection = connection;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -245,15 +245,15 @@ UA_Int32 SL_Channel_bind(SL_Channel channel, UA_TL_Connection connection) {
 UA_Int32 SL_Channel_deleteMembers(SL_Channel channel) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(
-			&((SL_ChannelType*) channel)->localAsymAlgSettings);
+			&channel->localAsymAlgSettings);
 	retval |= UA_ByteString_deleteMembers(
-			&((SL_ChannelType*) channel)->localNonce);
+			&channel->localNonce);
 	retval |= UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(
-			&((SL_ChannelType*) channel)->remoteAsymAlgSettings);
+			&channel->remoteAsymAlgSettings);
 	retval |= UA_ByteString_deleteMembers(
-			&((SL_ChannelType*) channel)->remoteNonce);
+			&channel->remoteNonce);
 	retval |= UA_ChannelSecurityToken_deleteMembers(
-			&((SL_ChannelType*) channel)->securityToken);
+			&channel->securityToken);
 	return retval;
 }
 UA_Int32 SL_Channel_delete(SL_Channel *channel) {
@@ -265,10 +265,10 @@ UA_Int32 SL_Channel_delete(SL_Channel *channel) {
 
 UA_Int32 SL_Channel_processTokenRequest(SL_Channel channel,
 		UA_UInt32 requestedLifetime, UA_SecurityTokenRequestType requestType) {
-	if (((SL_ChannelType*) channel)->tokenProvider) {
-		return ((SL_ChannelType*) channel)->tokenProvider(channel,
+	if (channel->tokenProvider) {
+		return channel->tokenProvider(channel,
 				requestedLifetime, requestType,
-				&((SL_ChannelType*) channel)->securityToken);
+				&channel->securityToken);
 
 	}
 	printf("SL_Channel_processTokenRequest - no Token provider registered");
@@ -276,9 +276,9 @@ UA_Int32 SL_Channel_processTokenRequest(SL_Channel channel,
 }
 UA_Int32 SL_Channel_renewToken(SL_Channel channel, UA_UInt32 tokenId,
 		UA_DateTime revisedLifetime, UA_DateTime createdAt) {
-	((SL_ChannelType*) channel)->securityToken.tokenId = tokenId;
-	((SL_ChannelType*) channel)->securityToken.createdAt = createdAt;
-	((SL_ChannelType*) channel)->securityToken.revisedLifetime =
+	channel->securityToken.tokenId = tokenId;
+	channel->securityToken.createdAt = createdAt;
+	channel->securityToken.revisedLifetime =
 			revisedLifetime;
 	return UA_SUCCESS;
 }
@@ -286,28 +286,28 @@ UA_Int32 SL_Channel_renewToken(SL_Channel channel, UA_UInt32 tokenId,
 UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel channel,
 		UA_UInt32 sequenceNumber) {
 	//TODO review checking of sequence
-	if (((SL_ChannelType*) channel)->sequenceNumber+1  == sequenceNumber) {
-		((SL_ChannelType*) channel)->sequenceNumber++;
+	if (channel->sequenceNumber+1  == sequenceNumber) {
+		channel->sequenceNumber++;
 
 		return UA_SUCCESS;
 	}
 	printf(
 			"SL_Channel_checkSequenceNumber - ERROR, wrong SequenceNumber expected: %i, received: %i",
-			((SL_ChannelType*) channel)->sequenceNumber + 1, sequenceNumber);
+			channel->sequenceNumber + 1, sequenceNumber);
 	return UA_ERROR;
 
 }
 
 UA_Int32 SL_Channel_checkRequestId(SL_Channel channel, UA_UInt32 requestId) {
 	//TODO review checking of request id
-	if (((SL_ChannelType*) channel)->requestId+1  == requestId) {
-		((SL_ChannelType*) channel)->requestId++;
+	if (channel->requestId+1  == requestId) {
+		channel->requestId++;
 
 		return UA_SUCCESS;
 	}
 	printf(
 			"SL_Channel_requestId - ERROR, wrong requestId expected: %i, received: %i",
-			((SL_ChannelType*) channel)->requestId + 1, requestId);
+			channel->requestId + 1, requestId);
 	return UA_ERROR;
 
 }
@@ -316,7 +316,7 @@ UA_Int32 SL_Channel_processOpenRequest(SL_Channel channel,
 		const UA_OpenSecureChannelRequest* request,
 		UA_OpenSecureChannelResponse* response) {
 	UA_UInt32 protocolVersion;
-	SL_ChannelType *thisChannel = (SL_ChannelType*) channel;
+	SL_Channel* thisChannel = channel;
 	UA_Int32 retval = UA_SUCCESS;
 
 	UA_TL_Connection_getProtocolVersion(thisChannel->connection,
@@ -399,7 +399,7 @@ UA_Int32 SL_Channel_processOpenRequest(SL_Channel channel,
 
 	response->serverProtocolVersion = protocolVersion;
 
-	UA_ChannelSecurityToken_copy(&((SL_ChannelType*) (channel))->securityToken,
+	UA_ChannelSecurityToken_copy(&channel->securityToken,
 			&(response->securityToken));
 
 	UA_ByteString_copy(&thisChannel->localNonce, &response->serverNonce);

+ 4 - 1
src/ua_stack_channel.h

@@ -19,8 +19,11 @@ typedef enum ChannelState {
 	UA_SL_CHANNEL_OPENING,
 	UA_SL_CHANNEL_OPEN
 } SL_channelState;
+
 //hide object behind typedef
-typedef struct SL_ChannelStruct *SL_Channel;
+struct SL_Channel;
+typedef struct SL_Channel SL_Channel;
+
 
 typedef UA_Int32 (*SL_ChannelSecurityTokenProvider)(SL_Channel, UA_Int32,
 		SecurityTokenRequestType, UA_ChannelSecurityToken*);

+ 1 - 1
src/ua_stack_channel_manager.c

@@ -17,7 +17,7 @@ typedef struct SL_ChannelManager {
 	UA_String endpointUrl;
 	UA_DateTime channelLifeTime;
 	UA_UInt32 lastTokenId;
-}SL_ChannelManager;
+};
 static SL_ChannelManager *channelManager;
 
 UA_Int32 SL_ChannelManager_init(UA_UInt32 maxChannelCount,UA_UInt32 tokenLifetime, UA_UInt32 startChannelId, UA_UInt32 startTokenId, UA_String *endpointUrl)

+ 2 - 1
src/ua_stack_channel_manager.h

@@ -13,7 +13,8 @@
 
 
 
-
+struct SL_ChannelManager;
+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);

+ 27 - 27
src/ua_stack_session.c

@@ -8,7 +8,7 @@
 #include <stdlib.h>
 
 #include "ua_stack_session.h"
-typedef struct UA_SessionStruct
+struct UA_Session
 {
 	UA_NodeId authenticationToken;
 	UA_NodeId sessionId;
@@ -21,7 +21,7 @@ typedef struct UA_SessionStruct
 	UA_Int64 timeout;
 	UA_DateTime validTill;
 
-}UA_SessionType;
+};
 
 /* mock up function to generate tokens for authentication */
 UA_Int32 UA_Session_generateToken(UA_NodeId *newToken)
@@ -59,7 +59,7 @@ UA_Int32 UA_Session_bind(UA_Session session, SL_Channel channel)
 
 	if(channel && session)
 	{
-		((UA_SessionType*)session)->channel = channel;
+		session->channel = channel;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -72,7 +72,7 @@ UA_Int32 UA_Session_new(UA_Session **newSession)
 
 	retval |= UA_alloc((void**)&session,sizeof(UA_Session));
 
-	retval |= UA_alloc((void**)session,sizeof(UA_SessionType));
+	retval |= UA_alloc((void**)session,sizeof(UA_Session));
 	*newSession = session;
 	**newSession = *session;
 	//get memory for request list
@@ -81,16 +81,16 @@ UA_Int32 UA_Session_new(UA_Session **newSession)
 UA_Int32 UA_Session_deleteMembers(UA_Session session)
 {
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_NodeId_deleteMembers(&((UA_SessionType*)session)->authenticationToken);
-	retval |= UA_String_deleteMembers(&((UA_SessionType*)session)->name);
-	retval |= UA_NodeId_deleteMembers(&((UA_SessionType*)session)->sessionId);
+	retval |= UA_NodeId_deleteMembers(&session->authenticationToken);
+	retval |= UA_String_deleteMembers(&session->name);
+	retval |= UA_NodeId_deleteMembers(&session->sessionId);
 	return retval;
 }
 UA_Int32 UA_Session_delete(UA_Session *session)
 {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Session_deleteMembers(*session);
-	retval |= UA_free((UA_SessionType*)(*session));
+	retval |= UA_free((UA_Session*)(*session));
 	return retval;
 }
 UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
@@ -99,14 +99,14 @@ UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double r
 		UA_Session_idProvider idProvider,
 		UA_Int64 timeout){
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_String_copy(sessionName, &((UA_SessionType*)session)->name);
-	((UA_SessionType*)session)->maxRequestMessageSize = maxRequestMessageSize;
-	((UA_SessionType*)session)->maxResponseMessageSize = maxResponseMessageSize;
+	retval |= UA_String_copy(sessionName, &session->name);
+	session->maxRequestMessageSize = maxRequestMessageSize;
+	session->maxResponseMessageSize = maxResponseMessageSize;
 
-	UA_Session_generateToken(&((UA_SessionType*)session)->authenticationToken);
+	UA_Session_generateToken(&session->authenticationToken);
 
-	idProvider(&((UA_SessionType*)session)->sessionId);
-	((UA_SessionType*)session)->timeout = requestedSessionTimeout > timeout ? timeout : requestedSessionTimeout;
+	idProvider(&session->sessionId);
+	session->timeout = requestedSessionTimeout > timeout ? timeout : requestedSessionTimeout;
 
 	UA_Session_updateLifetime(session);
 	return retval;
@@ -116,8 +116,8 @@ UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2)
 {
 	if(session1 && session2){
 
-		if (UA_NodeId_equal(&((UA_SessionType*)session1)->sessionId,
-				&((UA_SessionType*)session2)->sessionId) == UA_EQUAL){
+		if (UA_NodeId_equal(&session1->sessionId,
+				&session2->sessionId) == UA_EQUAL){
 			return UA_TRUE;
 		}
 	}
@@ -127,7 +127,7 @@ UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2)
 UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token)
 {
 	if(session && token){
-		return UA_NodeId_equal(&((UA_SessionType*)session)->authenticationToken, token);
+		return UA_NodeId_equal(&session->authenticationToken, token);
 	}
 	return UA_NOT_EQUAL;
 }
@@ -135,7 +135,7 @@ UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token)
 UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId)
 {
 	if(session && sessionId){
-		return UA_NodeId_equal(&((UA_SessionType*)session)->sessionId, sessionId);
+		return UA_NodeId_equal(&session->sessionId, sessionId);
 	}
 	return UA_NOT_EQUAL;
 }
@@ -144,7 +144,7 @@ UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId)
 {
 	if(session)
 	{
-		return UA_NodeId_copy(&((UA_SessionType*)session)->sessionId, sessionId);
+		return UA_NodeId_copy(&session->sessionId, sessionId);
 	}
 	return UA_ERROR;
 }
@@ -153,7 +153,7 @@ UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken)
 {
 	if(session)
 	{
-		return UA_NodeId_copy(&((UA_SessionType*)session)->authenticationToken, authenticationToken);
+		return UA_NodeId_copy(&session->authenticationToken, authenticationToken);
 	}
 	return UA_ERROR;
 }
@@ -161,8 +161,8 @@ UA_Int32 UA_Session_updateLifetime(UA_Session session)
 {
 	if(session)
 	{
-		((UA_SessionType*)session)->validTill = UA_DateTime_now() +
-				((UA_SessionType*)session)->timeout * 100000; //timeout in ms
+		session->validTill = UA_DateTime_now() +
+				session->timeout * 100000; //timeout in ms
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -171,7 +171,7 @@ UA_Int32 UA_Session_getChannel(UA_Session session, SL_Channel *channel)
 {
 	if(session)
 	{
-		*channel = ((UA_SessionType*)session)->channel;
+		*channel = session->channel;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -180,7 +180,7 @@ UA_Int32 UA_Session_getPendingLifetime(UA_Session session, UA_Double *pendingLif
 {
 	if(session)
 	{
-		*pendingLifetime_ms = (((UA_SessionType*)session)->validTill- UA_DateTime_now() ) / 10000000; //difference in ms
+		*pendingLifetime_ms = (session->validTill- UA_DateTime_now() ) / 10000000; //difference in ms
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;
@@ -190,7 +190,7 @@ UA_Boolean UA_Session_verifyChannel(UA_Session session, SL_Channel channel)
 {
 	if(session && channel)
 	{
-		if(SL_Channel_compare(((UA_SessionType*)session)->channel, channel) == UA_TRUE) {
+		if(SL_Channel_compare(session->channel, channel) == UA_TRUE) {
 				return UA_TRUE;
 		}
 	}
@@ -200,7 +200,7 @@ UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** appl
 {
 	if(session)
 	{
-		*application = ((UA_SessionType*)session)->application;
+		*application = session->application;
 		return UA_SUCCESS;
 	}
 	*application = UA_NULL;
@@ -211,7 +211,7 @@ UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* appli
 {
 	if(session)
 	{
-		((UA_SessionType*)session)->application = application;
+		session->application = application;
 		return UA_SUCCESS;
 	}
 	return UA_ERROR;

+ 2 - 2
src/ua_stack_session.h

@@ -11,8 +11,8 @@
 
 #include "ua_stack_channel.h"
 
-
-typedef struct UA_SessionStruct *UA_Session;
+struct UA_Session;
+typedef struct UA_Session UA_Session;
 typedef UA_Int32(*UA_Session_idProvider)(UA_NodeId *newSessionId);
 /**
  * @brief creates a session object

+ 4 - 5
src/ua_stack_session_manager.c

@@ -8,7 +8,7 @@
 #include "ua_stack_session_manager.h"
 
 
-typedef struct UA_SessionManagerType
+struct UA_SessionManager
 {
 	UA_list_List sessions;
 	UA_UInt32 maxSessionCount;
@@ -17,9 +17,9 @@ typedef struct UA_SessionManagerType
 	UA_DateTime maxSessionLifeTime;
 
 	UA_DateTime sessionTimeout;
-}UA_SessionManagerType;
+};
 
-static UA_SessionManagerType *sessionManager;
+static UA_SessionManager *sessionManager;
 
 UA_Int32 UA_SessionManager_generateSessionId(UA_NodeId *sessionId)
 {
@@ -32,10 +32,9 @@ UA_Int32 UA_SessionManager_generateSessionId(UA_NodeId *sessionId)
 UA_Int32 UA_SessionManager_init(UA_UInt32 maxSessionCount,UA_UInt32 sessionTimeout, UA_UInt32 startSessionId)
 {
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_alloc((void**)&sessionManager,sizeof(UA_SessionManagerType));
+	retval |= UA_alloc((void**)&sessionManager,sizeof(UA_SessionManager));
 
 	retval |= UA_list_init(&sessionManager->sessions);
-
 	sessionManager->maxSessionCount = maxSessionCount;
 	sessionManager->lastSessionId = startSessionId;
 	sessionManager->sessionTimeout = sessionTimeout;

+ 4 - 1
src/ua_stack_session_manager.h

@@ -15,7 +15,10 @@
 
 
 //hide internal data of channelManager
-typedef struct UA_SessionManagerType *UA_SessionManager;
+struct UA_SessionManager;
+typedef struct UA_SessionManager UA_SessionManager;
+
+//typedef struct UA_SessionManagerType *UA_SessionManager;
 
 /**
  * @brief initializes the session manager

+ 29 - 29
src/ua_transport_connection.c

@@ -7,7 +7,7 @@
 
 #include "ua_transport_connection.h"
 #include "ua_transport.h"
-typedef struct TL_ConnectionStruct{
+typedef struct UA_TL_Connection{
 	UA_Int32 connectionHandle;
 	UA_UInt32 state;
 	TL_Buffer localConf;
@@ -17,21 +17,21 @@ typedef struct TL_ConnectionStruct{
 	UA_String remoteEndpointUrl;
 	TL_Closer closeCallback;
 	void *networkLayerData;
-} TL_ConnectionType;
+};
 
 
 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(TL_ConnectionType));
+	retval |= UA_alloc((void**)connection,sizeof(UA_TL_Connection));
 	if(retval == UA_SUCCESS)
 	{
-		(*((TL_ConnectionType**)connection))->connectionHandle = handle;
-		(*((TL_ConnectionType**)connection))->localConf = localBuffers;
-		(*((TL_ConnectionType**)connection))->writer = writer;
-		(*((TL_ConnectionType**)connection))->closeCallback = closeCallback;
-		(*((TL_ConnectionType**)connection))->state = CONNECTIONSTATE_CLOSED;
-		(*((TL_ConnectionType**)connection))->networkLayerData = networkLayerData;
+		connection->connectionHandle = handle;
+		connection->localConf = localBuffers;
+		connection->writer = writer;
+		connection->closeCallback = closeCallback;
+		connection->state = CONNECTIONSTATE_CLOSED;
+		connection->networkLayerData = networkLayerData;
 	}
 	return retval;
 }
@@ -45,8 +45,8 @@ UA_Int32 UA_TL_Connection_delete(UA_TL_Connection connection)
 
 UA_Int32 UA_TL_Connection_close(UA_TL_Connection connection)
 {
-	((TL_ConnectionType*)connection)->state = CONNECTIONSTATE_CLOSE;
-	((TL_ConnectionType*)connection)->closeCallback(connection);
+	connection->state = CONNECTIONSTATE_CLOSED;
+	connection->closeCallback(connection);
 	return UA_SUCCESS;
 }
 
@@ -54,7 +54,7 @@ UA_Boolean UA_TL_Connection_compare(UA_TL_Connection *connection1, UA_TL_Connect
 {
 	if(connection1 && connection2)
 	{
-		if ((*(TL_ConnectionType**)connection1)->connectionHandle == (*(TL_ConnectionType**)connection2)->connectionHandle)
+		if ((*(UA_TL_Connection**)connection1)->connectionHandle == (*(UA_TL_Connection**)connection2)->connectionHandle)
 		{
 			return UA_TRUE;
 		}
@@ -66,32 +66,32 @@ 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 retval = UA_SUCCESS;
-	((TL_ConnectionType*)connection)->remoteConf.maxChunkCount = helloMessage->maxChunkCount;
-	((TL_ConnectionType*)connection)->remoteConf.maxMessageSize = helloMessage->maxMessageSize;
-	((TL_ConnectionType*)connection)->remoteConf.protocolVersion = helloMessage->protocolVersion;
-	((TL_ConnectionType*)connection)->remoteConf.recvBufferSize = helloMessage->receiveBufferSize;
-	((TL_ConnectionType*)connection)->remoteConf.sendBufferSize = helloMessage->sendBufferSize;
-	((TL_ConnectionType*)connection)->state = CONNECTIONSTATE_ESTABLISHED;
-	retval |= UA_String_copy(&helloMessage->endpointUrl,&((TL_ConnectionType*)connection)->remoteEndpointUrl);
+	connection->remoteConf.maxChunkCount = helloMessage->maxChunkCount;
+	connection->remoteConf.maxMessageSize = helloMessage->maxMessageSize;
+	connection->remoteConf.protocolVersion = helloMessage->protocolVersion;
+	connection->remoteConf.recvBufferSize = helloMessage->receiveBufferSize;
+	connection->remoteConf.sendBufferSize = helloMessage->sendBufferSize;
+	connection->state = CONNECTIONSTATE_ESTABLISHED;
+	retval |= UA_String_copy(&helloMessage->endpointUrl,&connection->remoteEndpointUrl);
 
 	return UA_SUCCESS;
 }
 
 UA_Int32 UA_TL_Connection_callWriter(UA_TL_Connection connection, const UA_ByteString** gather_bufs, UA_Int32 gather_len)
 {
-	return ((TL_ConnectionType*)connection)->writer(((TL_ConnectionType*)connection)->connectionHandle,gather_bufs, 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)
 {
-	((TL_ConnectionType*)connection)->writer = writer;
+	connection->writer = writer;
 	return UA_SUCCESS;
 }
 /*
 UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection connection, UA_Int32 connectionHandle)
 {
-	((TL_ConnectionType*)connection)->connectionHandle = connectionHandle;
+	connection->connectionHandle = connectionHandle;
 	return UA_SUCCESS;
 }
 */
@@ -99,7 +99,7 @@ UA_Int32 UA_TL_Connection_setState(UA_TL_Connection connection, UA_Int32 connect
 {
 	if(connection)
 	{
-		((TL_ConnectionType*)connection)->state = connectionState;
+		connection->state = connectionState;
 		return UA_SUCCESS;
 	}else{
 		return UA_ERROR;
@@ -110,7 +110,7 @@ UA_Int32 UA_TL_Connection_getState(UA_TL_Connection connection, UA_Int32 *connec
 {
 	if(connection)
 	{
-		*connectionState = ((TL_ConnectionType*)connection)->state;
+		*connectionState = connection->state;
 		return UA_SUCCESS;
 	}else{
 		*connectionState = -1;
@@ -122,7 +122,7 @@ UA_Int32 UA_TL_Connection_getNetworkLayerData(UA_TL_Connection connection,void**
 {
 	if(connection)
 	{
-		*networkLayerData = ((TL_ConnectionType*)connection)->networkLayerData;
+		*networkLayerData = connection->networkLayerData;
 		return UA_SUCCESS;
 	}else{
 		*networkLayerData = UA_NULL;
@@ -134,7 +134,7 @@ UA_Int32 UA_TL_Connection_getProtocolVersion(UA_TL_Connection connection, UA_UIn
 {
 	if(connection)
 	{
-		*protocolVersion = ((TL_ConnectionType*)connection)->localConf.protocolVersion;
+		*protocolVersion = connection->localConf.protocolVersion;
 		return UA_SUCCESS;
 	}else{
 		*protocolVersion = 0xFF;
@@ -145,7 +145,7 @@ UA_Int32 UA_TL_Connection_getLocalConfig(UA_TL_Connection connection, TL_Buffer
 {
 	if(connection)
 	{
-		return UA_memcpy(localConfiguration,&((TL_ConnectionType*)connection)->localConf, sizeof(TL_Buffer));
+		return UA_memcpy(localConfiguration,&connection->localConf, sizeof(TL_Buffer));
 
 	}else{
 		localConfiguration = UA_NULL;
@@ -156,7 +156,7 @@ UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection connection, UA_UInt32 *conn
 {
 	if(connection)
 	{
-		*connectionHandle = ((TL_ConnectionType*)connection)->connectionHandle;
+		*connectionHandle = connection->connectionHandle;
 		return UA_SUCCESS;
 	}else{
 			connectionHandle = 0;
@@ -168,7 +168,7 @@ UA_Int32 UA_TL_Connection_bind(UA_TL_Connection connection, UA_Int32 handle)
 {
 	if(connection)
 	{
-		((TL_ConnectionType*)connection)->connectionHandle = handle;
+		connection->connectionHandle = handle;
 		return UA_SUCCESS;
 	}else{
 

+ 2 - 2
src/ua_transport_connection.h

@@ -18,8 +18,8 @@ typedef struct TL_Buffer{
 	UA_UInt32 maxMessageSize;
 	UA_UInt32 maxChunkCount;
 } TL_Buffer;
-
-typedef struct UA_ConnectionStruct *UA_TL_Connection;
+struct UA_TL_Connection;
+typedef struct UA_TL_Connection 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)