Forráskód Böngészése

removed opcuaserverMini from build, tests working again

Florian Palm 10 éve
szülő
commit
973720f35f

+ 5 - 5
examples/src/Makefile.am

@@ -20,8 +20,8 @@ __top_builddir__bin_exampleServerMT_CFLAGS = -I$(top_builddir)/src -I$(top_build
 __top_builddir__bin_exampleServerMT_SOURCES = opcuaServerMT.c networklayer.c
 __top_builddir__bin_exampleServerMT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
 else
-bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT $(top_builddir)/bin/exampleServerMini
-
+#bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT $(top_builddir)/bin/exampleServerMini
+bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
 __top_builddir__bin_exampleServer_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServer_SOURCES = opcuaServer.c networklayer.c
 __top_builddir__bin_exampleServer_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
@@ -30,8 +30,8 @@ __top_builddir__bin_exampleServerACPLT_CFLAGS = -I$(top_builddir)/src -I$(top_bu
 __top_builddir__bin_exampleServerACPLT_SOURCES = opcuaServerACPLT.c networklayer.c
 __top_builddir__bin_exampleServerACPLT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
 
-__top_builddir__bin_exampleServerMini_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_exampleServerMini_SOURCES = opcuaServerMini.c 
-__top_builddir__bin_exampleServerMini_LDADD= $(GLOBAL_AM_LDADD)
+#__top_builddir__bin_exampleServerMini_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
+#__top_builddir__bin_exampleServerMini_SOURCES = opcuaServerMini.c 
+#__top_builddir__bin_exampleServerMini_LDADD= $(GLOBAL_AM_LDADD)
 
 endif

+ 3 - 20
examples/src/networklayer.c

@@ -115,9 +115,8 @@ void* NL_TCP_reader(NL_Connection *c) {
 
 	TL_Buffer localBuffers;
 	UA_Int32 connectionState;
-	UA_UInt32 connectionHandle;
+
 	UA_TL_Connection_getLocalConfig(c->connection, &localBuffers);
-	UA_TL_Connection_getHandle(c->connection, &connectionHandle);
 	UA_alloc((void**)&(readBuffer.data),localBuffers.recvBufferSize);
 
 
@@ -125,7 +124,7 @@ void* NL_TCP_reader(NL_Connection *c) {
 		DBG_VERBOSE(printf("NL_TCP_reader - enter read\n"));
 
 
-		readBuffer.length = read(connectionHandle, readBuffer.data, localBuffers.recvBufferSize);
+		readBuffer.length = read(c->connectionHandle, readBuffer.data, localBuffers.recvBufferSize);
 		DBG_VERBOSE(printf("NL_TCP_reader - leave read\n"));
 
 		DBG_VERBOSE(printf("NL_TCP_reader - src={%*.s}, ",c->connection.remoteEndpointUrl.length,c->connection.remoteEndpointUrl.data));
@@ -248,28 +247,12 @@ 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;
 	//create new connection object
-	UA_TL_Connection_new(&connection, tld->tld->localConf, writer, NL_Connection_close,c);
-	//add connection object to list, so stack is aware of its connections
-	UA_TL_Connection_setConnectionHandle(connection,connectionHandle);
-
-//	UA_TL_ConnectionManager_addConnection(&connection);
+	UA_TL_Connection_new(&connection, tld->tld->localConf, writer, NL_Connection_close,connectionHandle,c);
 
-	// connection layer of UA stackwriteLock
 	c->connection = connection;
 	c->connectionHandle = connectionHandle;
-
-
-	//c->connection.connectionHandle = connectionHandle;
-	//c->connection.connectionState = CONNECTIONSTATE_CLOSED;
-	//c->connection.writerCallback = writer;
-	//memcpy(&(c->connection.localConf),&(tld->tld->localConf),sizeof(TL_Buffer));
-	//memset(&(c->connection.remoteConf),0,sizeof(TL_Buffer));
-	//UA_String_copy(&(tld->endpointUrl), &(c->connection.localEndpointUrl));
-
 	// network layer
 	c->reader = reader;
 #ifdef MULTITHREADING

+ 6 - 3
examples/src/opcuaServer.c

@@ -38,15 +38,18 @@ UA_Int32 serverCallback(void * arg) {
 }
 
 
-int main(int argc, char** arsgv) {
+int main(int argc, char** argv) {
 
 	/* gets called at ctrl-c */
 	signal(SIGINT, stopHandler);
 	
 	appMockup_init();
 	NL_data* nl = NL_init(&NL_Description_TcpBinary, 16664);
-
+	UA_String endpointUrl;
+	UA_String_copycstring("no endpoint url",&endpointUrl);
+	SL_ChannelManager_init(4,36000,244,2,&endpointUrl);
+	UA_SessionManager_init(10,3600000,25);
 	struct timeval tv = {1, 0}; // 1 second
-  	NL_msgLoop(nl, &tv, serverCallback, argv[0]);
+	NL_msgLoop(nl, &tv, serverCallback, argv[0], &running);
 
 }

+ 7 - 1
examples/src/opcuaServerACPLT.c

@@ -8,6 +8,7 @@
 #include "networklayer.h"
 #include "ua_stack_channel_manager.h"
 #include "ua_transport_connection.h"
+#include "ua_transport_connection_manager.h"
 #include "ua_stack_session_manager.h"
 
 #ifdef LINUX
@@ -26,6 +27,8 @@ void server_run();
 #define MAXMSG 512
 #define BUFFER_SIZE 8192
 
+
+
 int main(void) {
 
 #ifdef LINUX
@@ -39,10 +42,13 @@ int main(void) {
 #ifdef LINUX
 void tmpTestFunction()
 {
+
 }
 void server_run() {
 	//just for debugging
 #ifdef DEBUG
+
+
 	tmpTestFunction();
 #endif
 	UA_TL_Connection connection;// = UA_NULL;
@@ -112,7 +118,7 @@ void server_run() {
 		UA_TL_ConnectionManager_getConnectionByHandle(newsockfd, &tmpConnection);
 		if(tmpConnection == UA_NULL)
 		{
-			UA_TL_Connection_new(&connection, localBuffers, (TL_Writer)NL_TCP_writer,NL_Connection_close,UA_NULL);
+			UA_TL_Connection_new(&connection, localBuffers, (TL_Writer)NL_TCP_writer,NL_Connection_close,newsockfd,UA_NULL);
 		}
 		UA_TL_Connection_getState(connection, &connectionState);
 

+ 0 - 1
src/Makefile.am

@@ -15,7 +15,6 @@ libopen62541_la_SOURCES = ua_types.c \
 						  ua_transport.c \
 						  ua_transport_binary.c \
 						  ua_transport_binary_secure.c \
-						  ua_namespace.c \
 						  ua_services_attribute.c \
 						  ua_services_session.c \
 						  ua_services_discovery.c \

+ 0 - 140
src/ua_application.c

@@ -82,11 +82,7 @@ void appMockup_init() {
 	references->description = UA_LOCALIZEDTEXT_STATIC("References");
 	references->isAbstract = UA_TRUE;
 	references->symmetric = UA_TRUE;
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&references, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&references, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hierarchicalreferences;
 	UA_ReferenceTypeNode_new(&hierarchicalreferences);
@@ -99,11 +95,7 @@ void appMockup_init() {
 	hierarchicalreferences->symmetric = UA_FALSE;
 	AddReference((UA_Node*)hierarchicalreferences, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_References, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *nonhierarchicalreferences;
 	UA_ReferenceTypeNode_new(&nonhierarchicalreferences);
@@ -116,11 +108,7 @@ void appMockup_init() {
 	nonhierarchicalreferences->symmetric = UA_FALSE;
 	AddReference((UA_Node*)nonhierarchicalreferences, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_References, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&nonhierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&nonhierarchicalreferences, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *haschild;
 	UA_ReferenceTypeNode_new(&haschild);
@@ -133,11 +121,7 @@ void appMockup_init() {
 	haschild->symmetric = UA_FALSE;
 	AddReference((UA_Node*)haschild, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&haschild, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&haschild, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *organizes;
 	UA_ReferenceTypeNode_new(&organizes);
@@ -151,11 +135,7 @@ void appMockup_init() {
 	organizes->inverseName = UA_LOCALIZEDTEXT_STATIC("OrganizedBy");
 	AddReference((UA_Node*)organizes, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&organizes, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&organizes, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *haseventsource;
 	UA_ReferenceTypeNode_new(&haseventsource);
@@ -169,11 +149,7 @@ void appMockup_init() {
 	haseventsource->inverseName = UA_LOCALIZEDTEXT_STATIC("EventSourceOf");
 	AddReference((UA_Node*)haseventsource, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&haseventsource, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&haseventsource, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasmodellingrule;
 	UA_ReferenceTypeNode_new(&hasmodellingrule);
@@ -187,11 +163,7 @@ void appMockup_init() {
 	hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_STATIC("ModellingRuleOf");
 	AddReference((UA_Node*)hasmodellingrule, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasmodellingrule, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasmodellingrule, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasencoding;
 	UA_ReferenceTypeNode_new(&hasencoding);
@@ -205,11 +177,7 @@ void appMockup_init() {
 	hasencoding->inverseName = UA_LOCALIZEDTEXT_STATIC("EncodingOf");
 	AddReference((UA_Node*)hasencoding, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasencoding, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasencoding, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasdescription;
 	UA_ReferenceTypeNode_new(&hasdescription);
@@ -223,11 +191,7 @@ void appMockup_init() {
 	hasdescription->inverseName = UA_LOCALIZEDTEXT_STATIC("DescriptionOf");
 	AddReference((UA_Node*)hasdescription, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasdescription, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasdescription, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hastypedefinition;
 	UA_ReferenceTypeNode_new(&hastypedefinition);
@@ -241,11 +205,7 @@ void appMockup_init() {
 	hastypedefinition->inverseName = UA_LOCALIZEDTEXT_STATIC("TypeDefinitionOf");
 	AddReference((UA_Node*)hastypedefinition, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hastypedefinition, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hastypedefinition, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *generatesevent;
 	UA_ReferenceTypeNode_new(&generatesevent);
@@ -259,11 +219,7 @@ void appMockup_init() {
 	generatesevent->inverseName = UA_LOCALIZEDTEXT_STATIC("GeneratedBy");
 	AddReference((UA_Node*)generatesevent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&generatesevent, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&generatesevent, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *aggregates;
 	UA_ReferenceTypeNode_new(&aggregates);
@@ -276,11 +232,7 @@ void appMockup_init() {
 	aggregates->symmetric = UA_FALSE;
 	AddReference((UA_Node*)aggregates, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HasChild, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&aggregates, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&aggregates, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hassubtype;
 	UA_ReferenceTypeNode_new(&hassubtype);
@@ -294,11 +246,7 @@ void appMockup_init() {
 	hassubtype->inverseName = UA_LOCALIZEDTEXT_STATIC("SubtypeOf");
 	AddReference((UA_Node*)hassubtype, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HasChild, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hassubtype, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hassubtype, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasproperty;
 	UA_ReferenceTypeNode_new(&hasproperty);
@@ -312,11 +260,7 @@ void appMockup_init() {
 	hasproperty->inverseName = UA_LOCALIZEDTEXT_STATIC("PropertyOf");
 	AddReference((UA_Node*)hasproperty, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasproperty, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasproperty, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hascomponent;
 	UA_ReferenceTypeNode_new(&hascomponent);
@@ -330,11 +274,7 @@ void appMockup_init() {
 	hascomponent->inverseName = UA_LOCALIZEDTEXT_STATIC("ComponentOf");
 	AddReference((UA_Node*)hascomponent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hascomponent, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hascomponent, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasnotifier;
 	UA_ReferenceTypeNode_new(&hasnotifier);
@@ -348,11 +288,7 @@ void appMockup_init() {
 	hasnotifier->inverseName = UA_LOCALIZEDTEXT_STATIC("NotifierOf");
 	AddReference((UA_Node*)hasnotifier, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HasEventSource, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasnotifier, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasnotifier, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasorderedcomponent;
 	UA_ReferenceTypeNode_new(&hasorderedcomponent);
@@ -366,11 +302,7 @@ void appMockup_init() {
 	hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_STATIC("OrderedComponentOf");
 	AddReference((UA_Node*)hasorderedcomponent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_HasComponent, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasorderedcomponent, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasorderedcomponent, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hasmodelparent;
 	UA_ReferenceTypeNode_new(&hasmodelparent);
@@ -384,11 +316,7 @@ void appMockup_init() {
 	hasmodelparent->inverseName = UA_LOCALIZEDTEXT_STATIC("ModelParentOf");
 	AddReference((UA_Node*)hasmodelparent, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hasmodelparent, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hasmodelparent, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *fromstate;
 	UA_ReferenceTypeNode_new(&fromstate);
@@ -402,11 +330,7 @@ void appMockup_init() {
 	fromstate->inverseName = UA_LOCALIZEDTEXT_STATIC("ToTransition");
 	AddReference((UA_Node*)fromstate, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&fromstate, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&fromstate, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *tostate;
 	UA_ReferenceTypeNode_new(&tostate);
@@ -420,11 +344,7 @@ void appMockup_init() {
 	tostate->inverseName = UA_LOCALIZEDTEXT_STATIC("FromTransition");
 	AddReference((UA_Node*)tostate, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&tostate, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&tostate, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hascause;
 	UA_ReferenceTypeNode_new(&hascause);
@@ -438,11 +358,7 @@ void appMockup_init() {
 	hascause->inverseName = UA_LOCALIZEDTEXT_STATIC("MayBeCausedBy");
 	AddReference((UA_Node*)hascause, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hascause, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hascause, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *haseffect;
 	UA_ReferenceTypeNode_new(&haseffect);
@@ -456,11 +372,7 @@ void appMockup_init() {
 	haseffect->inverseName = UA_LOCALIZEDTEXT_STATIC("MayBeEffectedBy");
 	AddReference((UA_Node*)haseffect, &(UA_ReferenceNode){RefTypeId_HasSubtype, UA_TRUE,
 		(UA_ExpandedNodeId){RefTypeId_NonHierarchicalReferences, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&haseffect, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&haseffect, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	UA_ReferenceTypeNode *hashistoricalconfiguration;
 	UA_ReferenceTypeNode_new(&hashistoricalconfiguration);
@@ -474,11 +386,7 @@ void appMockup_init() {
 	hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_STATIC("HistoricalConfigurationOf");
 	AddReference((UA_Node*)hashistoricalconfiguration, &(UA_ReferenceNode){RefTypeId_HasSubtype,
 		UA_TRUE, (UA_ExpandedNodeId){RefTypeId_Aggregates, UA_STRING_NULL, 0}}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&hashistoricalconfiguration, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&hashistoricalconfiguration, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 
 	// ObjectTypes (Ids only)
@@ -503,11 +411,7 @@ void appMockup_init() {
 	folderType->browseName = UA_QUALIFIEDNAME_STATIC("FolderType");
 	folderType->displayName = UA_LOCALIZEDTEXT_STATIC("FolderType");
 	folderType->description = UA_LOCALIZEDTEXT_STATIC("FolderType");
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&folderType, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&folderType, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// Root
 	UA_ObjectNode *root;
@@ -522,11 +426,7 @@ void appMockup_init() {
 	AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_TypesFolder}, ns0);
 	AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_ViewsFolder}, ns0);
 	/* root becomes a managed node. we need to release it at the end.*/
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&root, NAMESPACE_INSERT_UNIQUE | NAMESPACE_INSERT_GETMANAGED);
-=======
 	Namespace_insert(ns0,(UA_Node**)&root, NAMESPACE_INSERT_UNIQUE | NAMESPACE_INSERT_GETMANAGED);
->>>>>>> origin/master
 
 	// Objects
 	UA_ObjectNode *objects;
@@ -538,11 +438,7 @@ void appMockup_init() {
 	objects->description = UA_LOCALIZEDTEXT_STATIC("Objects");
 	AddReference((UA_Node*)objects, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
 	AddReference((UA_Node*)objects, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_Server}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&objects, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&objects, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// Types
 	UA_ObjectNode *types;
@@ -553,11 +449,7 @@ void appMockup_init() {
 	types->displayName = UA_LOCALIZEDTEXT_STATIC("Types");
 	types->description = UA_LOCALIZEDTEXT_STATIC("Types");
 	AddReference((UA_Node*)types, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&types, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&types, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// Views
 	UA_ObjectNode *views;
@@ -568,11 +460,7 @@ void appMockup_init() {
 	views->displayName = UA_LOCALIZEDTEXT_STATIC("Views");
 	views->description = UA_LOCALIZEDTEXT_STATIC("Views");
 	AddReference((UA_Node*)views, &(UA_ReferenceNode){RefTypeId_HasTypeDefinition, UA_FALSE, ObjTypeId_FolderType}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&views, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&views, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// Server
 	UA_ObjectNode *server;
@@ -586,11 +474,7 @@ void appMockup_init() {
 	AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasComponent, UA_FALSE, ObjId_NamespaceArray}, ns0);
 	AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasProperty, UA_FALSE, ObjId_ServerStatus}, ns0);
 	AddReference((UA_Node*)server, &(UA_ReferenceNode){RefTypeId_HasProperty, UA_FALSE, ObjId_ServerArray}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&server, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&server, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// NamespaceArray
 	UA_VariableNode *namespaceArray;
@@ -614,11 +498,7 @@ void appMockup_init() {
 	namespaceArray->valueRank = 1;
 	namespaceArray->minimumSamplingInterval = 1.0;
 	namespaceArray->historizing = UA_FALSE;
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&namespaceArray, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&namespaceArray, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// ServerStatus
 	UA_VariableNode *serverstatus;
@@ -645,11 +525,7 @@ void appMockup_init() {
 	serverstatus->value.vt = &UA_.types[UA_SERVERSTATUSDATATYPE]; // gets encoded as an extensionobject
 	serverstatus->value.arrayLength = 1;
 	serverstatus->value.data = status;
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&serverstatus, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&serverstatus, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	// State (Component of ServerStatus)
 	UA_VariableNode *state;
@@ -662,11 +538,7 @@ void appMockup_init() {
 	state->value.vt = &UA_borrowed_.types[UA_SERVERSTATE];
 	state->value.arrayLength = 1;
 	state->value.data = &status->state; // points into the other object.
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&state, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&state, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 	//TODO: free(namespaceArray->value.data) later or forget it
 
@@ -712,11 +584,7 @@ void appMockup_init() {
 	tmpNodeValue->vt = &UA_.types[UA_FLOAT];
 
 	AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_temperature1}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&temperature1, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&temperature1, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 
 	UA_ExpandedNodeId ObjId_redLED = (UA_ExpandedNodeId){.nodeId = (UA_NodeId){.encodingByte = UA_NODEIDTYPE_TWOBYTE, .namespace = 0, .identifier.numeric = 109}, .namespaceUri = {-1, ((void *)0)}, .serverIndex = 0};
@@ -741,11 +609,7 @@ void appMockup_init() {
 	tmpNodeValue1->vt = &UA_.types[UA_BOOLEAN];
 
 	AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_redLED}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&redLED, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&redLED, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 
 
 	UA_ExpandedNodeId ObjId_yellowLED = (UA_ExpandedNodeId){.nodeId = (UA_NodeId){.encodingByte = UA_NODEIDTYPE_TWOBYTE, .namespace = 0, .identifier.numeric = 110}, .namespaceUri = {-1, ((void *)0)}, .serverIndex = 0};
@@ -770,11 +634,7 @@ void appMockup_init() {
 	tmpNodeValue2->vt = &UA_.types[UA_BOOLEAN];
 
 	AddReference((UA_Node*)root, &(UA_ReferenceNode){RefTypeId_Organizes, UA_FALSE, ObjId_yellowLED}, ns0);
-<<<<<<< HEAD
-	Namespace_insert(ns0,(const UA_Node**)&yellowLED, NAMESPACE_INSERT_UNIQUE);
-=======
 	Namespace_insert(ns0,(UA_Node**)&yellowLED, NAMESPACE_INSERT_UNIQUE);
->>>>>>> origin/master
 	
 	Namespace_releaseManagedNode((const UA_Node*)root);
 

+ 0 - 4
src/ua_namespace.c

@@ -263,11 +263,7 @@ UA_Int32 Namespace_delete(Namespace * ns) {
 	return UA_SUCCESS;
 }
 
-<<<<<<< HEAD
-UA_Int32 Namespace_insert(Namespace *ns, const UA_Node **node, UA_Byte flags) {
-=======
 UA_Int32 Namespace_insert(Namespace *ns, UA_Node **node, UA_Byte flags) {
->>>>>>> origin/master
 	if(ns == UA_NULL || node == UA_NULL || *node == UA_NULL)
 		return UA_ERROR;
 	

+ 44 - 55
src/ua_namespace.h

@@ -5,72 +5,61 @@
 #include "ua_types_generated.h"
 #include "util/ua_list.h"
 
-#ifdef MULTITHREADING
-#define _XOPEN_SOURCE 500
-#define __USE_UNIX98
-#include <pthread.h>
-#endif
-
-/** @brief Namespace entries point to an UA_Node. But the actual data structure
-	is opaque outside of ua_namespace.c */
-
-typedef struct Namespace_Entry {
-	UA_UInt64 status;	/* 2 bits status | 14 bits checkout count | 48 bits timestamp */
-	const UA_Node *node;	/* Nodes are immutable. It is not recommended to change nodes in place */
-} Namespace_Entry;
-
-/** @brief Namespace datastructure. It mainly serves as a hashmap to UA_Nodes. */
-typedef struct Namespace {
-	UA_UInt32 namespaceId;
-	Namespace_Entry *entries;
-	UA_UInt32 size;
-	UA_UInt32 count;
-	UA_UInt32 sizePrimeIndex;	/* Current size, as an index into the table of primes.  */
-} Namespace;
-
-/** Namespace locks indicate that a thread currently operates on an entry. */
-struct Namespace_Entry_Lock;
-typedef struct Namespace_Entry_Lock Namespace_Entry_Lock;
-
-/** @brief Release a lock on a namespace entry. */
-void Namespace_Entry_Lock_release(Namespace_Entry_Lock * lock);
+/**
+   @defgroup namespace Namespace
 
-/** @brief Create a new namespace */
-UA_Int32 Namespace_new(Namespace ** result, UA_UInt32 size, UA_UInt32 namespaceId);
+   @brief The namespace is the central storage for nodes in the UA address
+   space. Internally, the namespace is realised as hash-map where nodes are
+   stored and retrieved with their nodeid.
+
+   The nodes in the namespace are immutable. To change the content of a node, it
+   needs to be replaced as a whole. When a node is inserted into the namespace,
+   it gets replaced with a pointer to a managed node. Managed nodes shall never
+   be freed by the user. This is done by the namespace when the node is removed
+   and no readers (in other threads) access the node.
+
+   @{
+ */
 
-/** @brief Delete all nodes in the namespace */
-void Namespace_empty(Namespace * ns);
+/** @brief Namespace datastructure. Mainly a hashmap to UA_Nodes */
+struct Namespace;
+typedef struct Namespace Namespace;
+
+/** @brief Create a new namespace */
+UA_Int32 Namespace_new(Namespace **result, UA_UInt32 namespaceId);
 
 /** @brief Delete the namespace and all nodes in it */
-void Namespace_delete(Namespace * ns);
+UA_Int32 Namespace_delete(Namespace *ns);
 
-/** @brief Insert a new node into the namespace. Abort an entry with the same
-	NodeId is already present */
-UA_Int32 Namespace_insert(Namespace * ns, const UA_Node * node);
+#define NAMESPACE_INSERT_UNIQUE 1
+#define NAMESPACE_INSERT_GETMANAGED 2
+/** @brief Insert a new node into the namespace
 
-/** @brief Insert a new node or replace an existing node if an entry has the same NodeId. */
-// UA_Int32 Namespace_insertOrReplace(Namespace * ns, const UA_Node * node);
+    With the UNIQUE flag, the node is only inserted if the nodeid does not
+    already exist. With the GETMANAGED flag, the node pointer is replaced with
+    the managed pointer. Otherwise, it is set to UA_NULL. */
+UA_Int32 Namespace_insert(Namespace *ns, UA_Node **node, UA_Byte flags);
 
-/** @brief Find an unused (numeric) NodeId in the namespace and insert the node.
-	The node is modified to contain the new nodeid after insertion. */
-UA_Int32 Namespace_insertUnique(Namespace * ns, UA_Node * node);
+/** @brief Remove a node from the namespace. Always succeeds, even if the node
+	was not found. */
+UA_Int32 Namespace_remove(Namespace *ns, const UA_NodeId *nodeid);
 
-/** @brief Remove a node from the namespace */
-UA_Int32 Namespace_remove(Namespace * ns, const UA_NodeId * nodeid);
+/** @brief Retrieve a node (read-only) from the namespace. Nodes are immutable.
+    They can only be replaced. After the Node is no longer used, the locked
+    entry needs to be released. */
+UA_Int32 Namespace_get(const Namespace *ns, const UA_NodeId *nodeid, const UA_Node **managedNode);
 
-/** @brief Tests whether the namespace contains an entry for a given NodeId */
-UA_Int32 Namespace_contains(const Namespace * ns, const UA_NodeId * nodeid);
+/** @brief Release a managed node. Do never insert a node that isn't stored in a
+	namespace. */
+void Namespace_releaseManagedNode(const UA_Node *managed);
 
-/** @brief Retrieve a node (read-only) from the namespace. Nodes are identified
-	by their NodeId. After the Node is no longer used, the lock needs to be
-	released. */
-UA_Int32 Namespace_get(const Namespace *ns, const UA_NodeId * nodeid, const UA_Node **result,
-					   Namespace_Entry_Lock ** lock);
+/** @brief A function that can be evaluated on all entries in a namespace via
+	Namespace_iterate. Note that the visitor is read-only on the nodes. */
+typedef void (*Namespace_nodeVisitor)(const UA_Node *node);
 
-/** @brief A function that can be evaluated on all entries in a namespace via Namespace_iterate */
-typedef void (*Namespace_nodeVisitor) (const UA_Node *node);
+/** @brief Iterate over all nodes in a namespace. */
+UA_Int32 Namespace_iterate(const Namespace *ns, Namespace_nodeVisitor visitor);
 
-/** @brief Iterate over all nodes in a namespace */
-UA_Int32 Namespace_iterate(const Namespace * ns, Namespace_nodeVisitor visitor);
+/// @} /* end of group */
 
 #endif /* __NAMESPACE_H */

+ 15 - 19
src/ua_stack_channel_manager.c

@@ -9,9 +9,8 @@
 #include "ua_stack_channel_manager.h"
 
 typedef struct SL_ChannelManager {
-	UA_UInt32 maxChannelCount;
+	UA_Int32 maxChannelCount;
 	UA_Int32 lastChannelId;
-	UA_UInt32 currentChannelCount;
 	UA_DateTime maxChannelLifeTime;
 	UA_list_List channels;
 	UA_MessageSecurityMode securityMode;
@@ -36,18 +35,13 @@ UA_Int32 SL_ChannelManager_init(UA_UInt32 maxChannelCount,UA_UInt32 tokenLifetim
 
 UA_Int32 SL_ChannelManager_addChannel(SL_Channel *channel)
 {
-	if (channelManager->maxChannelCount > channelManager->currentChannelCount)
+	if (channelManager && (channelManager->maxChannelCount > channelManager->channels.size))
 	{
 
 //TODO lock access (mulitthreading)------------
-	//	UA_list_Element *element;
-	//	UA_alloc((void**)&element, sizeof(UA_list_Element));
-	//	UA_list_initElement(element);
-	//	element->payload =(void*) channel;
 		UA_list_addPayloadToBack(&channelManager->channels,(void*)channel);
-	//	UA_list_addElementToBack(&channelManager->channels,element);
 		return UA_SUCCESS;
-		//set id in channel object which was added
+
 //TODO lock access------------
 	}
 	return UA_ERROR;
@@ -192,16 +186,18 @@ UA_Int32 SL_ChannelManager_getChannel(UA_UInt32 channelId, SL_Channel *channel)
 		}
 		current = current->next;
 	}
-	SL_Channel c1 = *(SL_Channel*)(channelManager->channels.first->payload);
-	SL_Channel c2 = *(SL_Channel*)(channelManager->channels.last->payload);
-	UA_UInt32 id1,id2;
-
-	SL_Channel_getChannelId(c1,&id1);
-	SL_Channel_getChannelId(c2,&id2);
-
-	printf("SL_ChannelManager_getChannel c1: %i \n",id1);
-	printf("SL_ChannelManager_getChannel c2: %i \n",id2);
-
+#ifdef DEBUG
+
+//	SL_Channel c1 = *(SL_Channel*)(channelManager->channels.first->payload);
+//	SL_Channel c2 = *(SL_Channel*)(channelManager->channels.last->payload);
+//	UA_UInt32 id1,id2;
+
+//	SL_Channel_getChannelId(c1,&id1);
+//	SL_Channel_getChannelId(c2,&id2);
+//
+//	printf("SL_ChannelManager_getChannel c1: %i \n",id1);
+//	printf("SL_ChannelManager_getChannel c2: %i \n",id2);
+#endif
 	*channel = UA_NULL;
 	return UA_ERROR;
 }

+ 2 - 2
src/ua_stack_channel_manager.h

@@ -12,8 +12,8 @@
 
 
 
-//hide internal data of channelManager
-typedef struct SL_ChannelManager *SL_secureChannelManager;
+
+
 
 
 UA_Int32 SL_ChannelManager_init(UA_UInt32 maxChannelCount,UA_UInt32 tokenLifetime, UA_UInt32 startChannelId, UA_UInt32 startTokenId, UA_String *endpointUrl);

+ 3 - 5
src/ua_stack_session_manager.h

@@ -65,11 +65,9 @@ UA_Int32 UA_SessionManager_getSessionByToken(UA_NodeId *token, UA_Session *sessi
  * @return error code
  */
 UA_Int32 UA_SessionManager_getSessionTimeout(UA_Int64 *timeout_ms);
-/**
- * @brief updates all session
- * @return
- */
-UA_Int32 UA_SessionManager_updateSessions();
+
+
+//UA_Int32 UA_SessionManager_updateSessions();
 
 
 //UA_Int32 UA_SessionManager_generateToken(UA_Session session, UA_Int32 requestedLifeTime, SecurityTokenRequestType requestType, UA_ChannelSecurityToken* newToken);

+ 0 - 22
src/ua_transport_binary_secure.h

@@ -18,28 +18,6 @@ revisedLifetime
 
  */
 
-typedef struct {
-	UA_UInt32 secureChannelId;
-	UA_SymmetricAlgorithmSecurityHeader tokenId;
-	UA_DateTime createdAt;
-	UA_Int32 revisedLifetime;
-} SL_ChannelSecurityToken;
-/*
-typedef struct SL_Channel_T {
-	UA_String secureChannelId;
-	UA_TL_Connection1 tlConnection;
-	Session *session; // equals UA_Null if no session is active
-	UA_AsymmetricAlgorithmSecurityHeader remoteAsymAlgSettings;
-	UA_AsymmetricAlgorithmSecurityHeader localAsymAlgSettings;
-	UA_SequenceHeader sequenceHeader;
-	UA_UInt32 securityMode;
-	UA_ByteString remoteNonce;
-	UA_ByteString localNonce;
-	UA_UInt32 connectionState;
-	SL_ChannelSecurityToken securityToken;
-} SL_secureChannel;
-
-*/
 UA_Int32 SL_Process(const UA_ByteString* msg, UA_UInt32* pos);
 
 /**

+ 4 - 1
src/ua_transport_connection.c

@@ -20,12 +20,13 @@ typedef struct TL_ConnectionStruct{
 } TL_ConnectionType;
 
 
-UA_Int32 UA_TL_Connection_new(UA_TL_Connection *connection, TL_Buffer localBuffers,TL_Writer writer, TL_Closer closeCallback, 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(TL_ConnectionType));
 	if(retval == UA_SUCCESS)
 	{
+		(*((TL_ConnectionType**)connection))->connectionHandle = handle;
 		(*((TL_ConnectionType**)connection))->localConf = localBuffers;
 		(*((TL_ConnectionType**)connection))->writer = writer;
 		(*((TL_ConnectionType**)connection))->closeCallback = closeCallback;
@@ -87,11 +88,13 @@ UA_Int32 UA_TL_Connection_setWriter(UA_TL_Connection connection, TL_Writer write
 	((TL_ConnectionType*)connection)->writer = writer;
 	return UA_SUCCESS;
 }
+/*
 UA_Int32 UA_TL_Connection_setConnectionHandle(UA_TL_Connection connection, UA_Int32 connectionHandle)
 {
 	((TL_ConnectionType*)connection)->connectionHandle = connectionHandle;
 	return UA_SUCCESS;
 }
+*/
 UA_Int32 UA_TL_Connection_setState(UA_TL_Connection connection, UA_Int32 connectionState)
 {
 	if(connection)

+ 2 - 2
src/ua_transport_connection.h

@@ -31,14 +31,14 @@ 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, 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 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_setConnectionHandle(UA_TL_Connection connection, UA_Int32 connectionHandle);
 
 //getters
 UA_Int32 UA_TL_Connection_getHandle(UA_TL_Connection connection, UA_UInt32 *connectionId);

+ 0 - 6
src/util/ua_list.c

@@ -108,16 +108,10 @@ UA_Int32 UA_list_removeLast(UA_list_List* list, UA_list_PayloadVisitor visitor){
 	UA_list_Element* temp = UA_NULL;
 	if(list->last){
 		temp = list->last->prev;
-		if(temp == UA_NULL)
-		{
-			return UA_ERROR;
-		}
-
 		if(visitor){
 			(*visitor)(list->last->payload);
 		}
 		UA_free(list->last);
-		temp->next = UA_NULL;
 		list->last = temp;
 		if(temp){
 			temp->next = UA_NULL;

+ 0 - 75
tests/check_namespace.c

@@ -7,10 +7,7 @@
 #include "check.h"
 
 #ifdef MULTITHREADING
-<<<<<<< HEAD
-=======
 #include <pthread.h>
->>>>>>> origin/master
 #include <urcu.h>
 #endif
 
@@ -32,23 +29,12 @@ START_TEST(test_Namespace) {
 }
 END_TEST
 
-<<<<<<< HEAD
-UA_Int32 createNode(const UA_Node** p, UA_Int16 nsid, UA_Int32 id) {
-	UA_VariableNode * p2;
-	UA_VariableNode_new(&p2);
-	p2->nodeId.encodingByte = UA_NODEIDTYPE_FOURBYTE;
-	p2->nodeId.namespace = nsid;
-	p2->nodeId.identifier.numeric = id;
-	p2->nodeClass = UA_NODECLASS_VARIABLE;
-	*p = (const UA_Node *)p2;
-=======
 UA_Int32 createNode(UA_Node** p, UA_Int16 nsid, UA_Int32 id) {
 	UA_VariableNode_new((UA_VariableNode **)p);
 	(*p)->nodeId.encodingByte = UA_NODEIDTYPE_FOURBYTE;
 	(*p)->nodeId.namespace = nsid;
 	(*p)->nodeId.identifier.numeric = id;
 	(*p)->nodeClass = UA_NODECLASS_VARIABLE;
->>>>>>> origin/master
 	return UA_SUCCESS;
 }
 
@@ -59,20 +45,12 @@ START_TEST(findNodeInNamespaceWithSingleEntry) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n1; createNode(&n1,0,2253);
-=======
 	UA_Node* n1; createNode(&n1,0,2253);
->>>>>>> origin/master
 	Namespace_insert(ns, &n1, NAMESPACE_INSERT_UNIQUE | NAMESPACE_INSERT_GETMANAGED);
 	const UA_Node* nr = UA_NULL;
 	UA_Int32 retval;
 	// when
-<<<<<<< HEAD
-	retval = Namespace_get(ns,&(n1->nodeId),&nr);
-=======
 	retval = Namespace_get(ns,&n1->nodeId,&nr);
->>>>>>> origin/master
 	// then
 	ck_assert_int_eq(retval, UA_SUCCESS);
 	ck_assert_ptr_eq(nr,n1);
@@ -94,20 +72,6 @@ START_TEST(failToFindNodeInOtherNamespace) {
 	Namespace *ns = UA_NULL;
 	Namespace_new(&ns, 0);
 
-<<<<<<< HEAD
-	const UA_Node* n1 = UA_NULL; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
-	const UA_Node* n2 = UA_NULL; createNode(&n1,0,2253); Namespace_insert(ns, &n2, 0);
-
-	const UA_Node* nr = UA_NULL;
-	UA_Int32 retval;
-	// when
-	const UA_Node* n; createNode(&n,1,2255);
-	retval = Namespace_get(ns,&(n->nodeId), &nr);
-	// then
-	ck_assert_int_ne(retval, UA_SUCCESS);
-	// finally
-	UA_free((void *)n);
-=======
 	UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
 	UA_Node* n2; createNode(&n2,0,2253); Namespace_insert(ns, &n2, 0);
 
@@ -119,7 +83,6 @@ START_TEST(failToFindNodeInOtherNamespace) {
 	ck_assert_int_ne(retval, UA_SUCCESS);
 	// finally
 	UA_Node_delete(n);
->>>>>>> origin/master
 	Namespace_releaseManagedNode(nr);
 	Namespace_delete(ns);
 #ifdef MULTITHREADING
@@ -135,21 +98,12 @@ START_TEST(findNodeInNamespaceWithSeveralEntries) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
-	const UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
-	const UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, NAMESPACE_INSERT_GETMANAGED);
-	const UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
-	const UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
-	const UA_Node* n6; createNode(&n6,0,12); Namespace_insert(ns, &n6, 0);
-=======
 	UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
 	UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
 	UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, NAMESPACE_INSERT_GETMANAGED);
 	UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
 	UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
 	UA_Node* n6; createNode(&n6,0,12); Namespace_insert(ns, &n6, 0);
->>>>>>> origin/master
 
 	const UA_Node* nr = UA_NULL;
 	UA_Int32 retval;
@@ -175,21 +129,12 @@ START_TEST(iterateOverNamespaceShallNotVisitEmptyNodes) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
-	const UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
-	const UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, 0);
-	const UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
-	const UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
-	const UA_Node* n6; createNode(&n6,0,12); Namespace_insert(ns, &n6, 0);
-=======
 	UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
 	UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
 	UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, 0);
 	UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
 	UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
 	UA_Node* n6; createNode(&n6,0,12); Namespace_insert(ns, &n6, 0);
->>>>>>> origin/master
 
 	UA_Int32 retval;
 	// when
@@ -215,11 +160,7 @@ START_TEST(findNodeInExpandedNamespace) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n;
-=======
 	UA_Node* n;
->>>>>>> origin/master
 	UA_Int32 i=0;
 	for (; i<200; i++) {
 		createNode(&n,0,i); Namespace_insert(ns, &n, 0);
@@ -249,11 +190,7 @@ START_TEST(iterateOverExpandedNamespaceShallNotVisitEmptyNodes) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n;
-=======
 	UA_Node* n;
->>>>>>> origin/master
 	UA_Int32 i=0;
 	for (; i<200; i++) {
 		createNode(&n,0,i); Namespace_insert(ns, &n, 0);
@@ -282,21 +219,12 @@ START_TEST(failToFindNonExistantNodeInNamespaceWithSeveralEntries) {
 	// given
 	Namespace *ns;
 	Namespace_new(&ns, 0);
-<<<<<<< HEAD
-	const UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
-	const UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
-	const UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, 0);
-	const UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
-	const UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
-	const UA_Node* n6; createNode(&n6,0,12); 
-=======
 	UA_Node* n1; createNode(&n1,0,2253); Namespace_insert(ns, &n1, 0);
 	UA_Node* n2; createNode(&n2,0,2255); Namespace_insert(ns, &n2, 0);
 	UA_Node* n3; createNode(&n3,0,2257); Namespace_insert(ns, &n3, 0);
 	UA_Node* n4; createNode(&n4,0,2200); Namespace_insert(ns, &n4, 0);
 	UA_Node* n5; createNode(&n5,0,1); Namespace_insert(ns, &n5, 0);
 	UA_Node* n6; createNode(&n6,0,12); 
->>>>>>> origin/master
 
 	const UA_Node* nr = UA_NULL;
 	UA_Int32 retval;
@@ -310,8 +238,6 @@ START_TEST(failToFindNonExistantNodeInNamespaceWithSeveralEntries) {
 #ifdef MULTITHREADING
 	rcu_unregister_thread();
 #endif
-<<<<<<< HEAD
-=======
 }
 END_TEST
 
@@ -393,7 +319,6 @@ START_TEST(profileGetDelete) {
 #ifdef MULTITHREADING
 	rcu_unregister_thread();
 #endif
->>>>>>> origin/master
 }
 END_TEST
 

+ 50 - 33
tests/check_stack.c

@@ -5,6 +5,9 @@
 #include "ua_transport.h"
 #include "ua_transport_binary.h"
 #include "ua_transport_binary_secure.h"
+#include "ua_transport_connection.h"
+#include "ua_stack_channel_manager.h"
+#include "ua_stack_session_manager.h"
 #include "check.h"
 
 #define MAXMSG 512
@@ -17,7 +20,8 @@ typedef struct stackTestFixture {
 	/** @brief the management structure (initialized to point to respMsgBuffer in create */
 	UA_ByteString respMsg;
 	/** @brief the management data structure for the fake connection */
-	TL_Connection connection;
+	UA_TL_Connection connection;
+
 } stackTestFixture;
 
 
@@ -50,23 +54,31 @@ UA_Int32 stackTestFixture_markHandleAsFree(UA_Int32 fixtureHandle) {
 	}
 	return UA_ERR_INVALID_VALUE;
 }
-
+UA_Int32 closerCallback(UA_TL_Connection connection)
+{
+	return UA_SUCCESS;
+}
 /** @brief get a handle to a free slot and create a new stackTestFixture */
-UA_Int32 stackTestFixture_create(TL_Writer writerCallback) {
+UA_Int32 stackTestFixture_create(TL_Writer writerCallback, TL_Closer closerCallback) {
+	UA_String endpointUrl;
+	UA_String_copycstring("no url",&endpointUrl);
+	SL_ChannelManager_init(4,36000,25,22,&endpointUrl);
+	UA_SessionManager_init(4,220000,222);
+
 	UA_UInt32 fixtureHandle = stackTestFixture_getAndMarkFreeHandle();
 	if(fixtureHandle < MAX_FIXTURES) {
 		UA_alloc((void **)&fixtures[fixtureHandle], sizeof(stackTestFixture));
 		stackTestFixture *fixture = fixtures[fixtureHandle];
 		fixture->respMsg.data   = fixture->respMsgBuffer;
 		fixture->respMsg.length = 0;
-		fixture->connection.connectionState = CONNECTIONSTATE_CLOSED;
-		fixture->connection.writerCallback  = writerCallback;
-		fixture->connection.localConf.maxChunkCount   = 1;
-		fixture->connection.localConf.maxMessageSize  = BUFFER_SIZE;
-		fixture->connection.localConf.protocolVersion = 0;
-		fixture->connection.localConf.recvBufferSize  = BUFFER_SIZE;
-		fixture->connection.localConf.recvBufferSize  = BUFFER_SIZE;
-		fixture->connection.connectionHandle = fixtureHandle;
+		TL_Buffer buffer;
+		buffer.maxChunkCount   = 1;
+		buffer.maxMessageSize  = BUFFER_SIZE;
+		buffer.protocolVersion = 0;
+		buffer.recvBufferSize  = BUFFER_SIZE;
+		buffer.recvBufferSize  = BUFFER_SIZE;
+		UA_TL_Connection_new(&fixture->connection,buffer,writerCallback,closerCallback,fixtureHandle,UA_NULL);
+
 	}
 	return fixtureHandle;
 }
@@ -88,8 +100,9 @@ stackTestFixture *stackTestFixture_getFixture(UA_UInt32 fixtureHandle) {
 }
 
 /** @brief write message provided in the gather buffers to the buffer of the fixture */
-UA_Int32 responseMsg(struct TL_Connection *c, UA_ByteString const **gather_buf, UA_Int32 gather_len) {
-	stackTestFixture *fixture = stackTestFixture_getFixture(c->connectionHandle);
+UA_Int32 responseMsg(UA_Int32 connectionHandle, UA_ByteString const **gather_buf, UA_Int32 gather_len) {
+
+	stackTestFixture *fixture = stackTestFixture_getFixture(connectionHandle);
 	UA_Int32  retval    = UA_SUCCESS;
 	UA_UInt32 total_len = 0;
 
@@ -105,7 +118,8 @@ UA_Int32 responseMsg(struct TL_Connection *c, UA_ByteString const **gather_buf,
 }
 
 void indicateMsg(UA_Int32 handle, UA_ByteString *slMessage) {
-	printf("indicate: %d", TL_Process(&(stackTestFixture_getFixture(handle)->connection), slMessage));
+
+	printf("indicate: %d", TL_Process((stackTestFixture_getFixture(handle)->connection), slMessage));
 }
 
 UA_Byte pkt_HEL[] = {
@@ -333,7 +347,7 @@ UA_Byte pkt_MSG_CreateSession[] = {
 
 START_TEST(emptyIndicationShallYieldNoResponse) {
 	// given
-	UA_Int32 handle = stackTestFixture_create(responseMsg);
+	UA_Int32 handle = stackTestFixture_create(responseMsg, closerCallback);
 	UA_ByteString message = { -1, (UA_Byte *)UA_NULL };
 
 	// when
@@ -350,7 +364,7 @@ END_TEST
 
 START_TEST(validHELIndicationShallYieldACKResponse) {
 	// given
-	UA_Int32 handle = stackTestFixture_create(responseMsg);
+	UA_Int32 handle = stackTestFixture_create(responseMsg, closerCallback);
 	UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
 
 	// when
@@ -369,20 +383,20 @@ END_TEST
 
 START_TEST(validOpeningSequenceShallCreateChannel) {
 	// given
-	UA_Int32 handle = stackTestFixture_create(responseMsg);
+	UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
 
 	UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
 	UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
-
+	UA_Int32 connectionState;
 	// when
 	indicateMsg(handle, &message_001);
 	indicateMsg(handle, &message_002);
-
+	UA_TL_Connection_getState(stackTestFixture_getFixture(handle)->connection, &connectionState);
 	// then
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[0], 'O');
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[1], 'P');
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[2], 'N');
-	ck_assert_int_eq(stackTestFixture_getFixture(handle)->connection.connectionState, CONNECTIONSTATE_ESTABLISHED);
+	ck_assert_int_eq(connectionState, CONNECTIONSTATE_ESTABLISHED);
 
 	// finally
 	stackTestFixture_delete(handle);
@@ -391,19 +405,19 @@ END_TEST
 
 START_TEST(validOpeningCloseSequence) {
 	// given
-	UA_Int32 handle = stackTestFixture_create(responseMsg);
+	UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
 
 	UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
 	UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
 	UA_ByteString message_003 = { sizeof(pkt_CLO), pkt_CLO };
-
+	UA_Int32 connectionState;
 	// when
 	indicateMsg(handle, &message_001);
 	indicateMsg(handle, &message_002);
 	indicateMsg(handle, &message_003);
-
+	UA_TL_Connection_getState(stackTestFixture_getFixture(handle)->connection, &connectionState);
 	// then
-	ck_assert_int_eq(stackTestFixture_getFixture(handle)->connection.connectionState, CONNECTIONSTATE_CLOSE);
+	ck_assert_int_eq(connectionState, CONNECTIONSTATE_CLOSE);
 
 	// finally
 	stackTestFixture_delete(handle);
@@ -412,8 +426,8 @@ END_TEST
 
 START_TEST(validCreateSessionShallCreateSession) {
 	// given
-	UA_Int32 handle = stackTestFixture_create(responseMsg);
-
+	UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
+	SL_Channel channel;
 	UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
 	UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
 	UA_ByteString message_003 = { sizeof(pkt_MSG_CreateSession), pkt_MSG_CreateSession };
@@ -421,19 +435,21 @@ START_TEST(validCreateSessionShallCreateSession) {
 	// when
 	indicateMsg(handle, &message_001);
 	indicateMsg(handle, &message_002);
-	UA_UInt32 pos = 8;
-	UA_UInt32 secureChannelId =
-	    stackTestFixture_getFixture(handle)->connection.secureChannel->securityToken.secureChannelId;
-	UA_UInt32_encodeBinary(&secureChannelId, &message_003, &pos);
 	indicateMsg(handle, &message_003);
 
 	// then
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[0], 'M');
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[1], 'S');
 	ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[2], 'G');
-	ck_assert_ptr_ne(stackTestFixture_getFixture(handle)->connection.secureChannel, UA_NULL);
+
+
+	SL_ChannelManager_getChannel(25,&channel);
+	ck_assert_ptr_ne(channel,UA_NULL);
+
+
 
 	// finally
+	SL_ChannelManager_removeChannel(25);
 	stackTestFixture_delete(handle);
 }
 END_TEST
@@ -466,7 +482,7 @@ START_TEST(UA_AsymmetricAlgorithmSecurityHeader_copyShallWorkOnInputExample) {
 	src.receiverCertificateThumbprint = (UA_String){10, (UA_Byte*)"thumbprint"};
 	src.securityPolicyUri = (UA_String){6, (UA_Byte*)"policy"};
 	src.senderCertificate = (UA_String){8, (UA_Byte*)"tEsT123!"};
-	src.requestId = 99;
+
 	const UA_AsymmetricAlgorithmSecurityHeader srcConst = src;
 
 	UA_AsymmetricAlgorithmSecurityHeader dst;
@@ -482,7 +498,7 @@ START_TEST(UA_AsymmetricAlgorithmSecurityHeader_copyShallWorkOnInputExample) {
 	ck_assert_int_eq(6, dst.securityPolicyUri.length);
 	ck_assert_int_eq('t', dst.senderCertificate.data[0]);
 	ck_assert_int_eq(8, dst.senderCertificate.length);
-	ck_assert_int_eq(99, dst.requestId);
+
 }
 END_TEST
 START_TEST(UA_SecureConversationMessageHeader_copyShallWorkOnInputExample) {
@@ -653,6 +669,7 @@ int main(void) {
 	s  = testSuite();
 	sr = srunner_create(s);
 	//srunner_set_fork_status (sr, CK_NOFORK);
+	//srunner_run_all(sr, CK_NOFORK);
 	srunner_run_all(sr, CK_NORMAL);
 	number_failed += srunner_ntests_failed(sr);
 	srunner_free(sr);