Переглянути джерело

corrected errors, now it is possible to compile again

FlorianPalm 11 роки тому
батько
коміт
c6fe86c2b5

+ 19 - 19
OPCUAServer/autom4te.cache/requests

@@ -64,8 +64,8 @@
                         'AM_SET_LEADING_DOT' => 1,
                         'AM_SET_DEPDIR' => 1,
                         '_AM_DEPENDENCIES' => 1,
-                        'AM_PROG_INSTALL_SH' => 1,
                         'm4_include' => 1,
+                        'AM_PROG_INSTALL_SH' => 1,
                         '_AC_AM_CONFIG_HEADER_HOOK' => 1,
                         'AU_DEFUN' => 1,
                         'AM_MAKE_INCLUDE' => 1
@@ -83,55 +83,55 @@
                         'configure.ac'
                       ],
                       {
-                        '_LT_AC_TAGCONFIG' => 1,
                         'AM_PROG_F77_C_O' => 1,
-                        'm4_pattern_forbid' => 1,
+                        '_LT_AC_TAGCONFIG' => 1,
                         'AC_INIT' => 1,
-                        '_AM_COND_IF' => 1,
+                        'm4_pattern_forbid' => 1,
                         'AC_CANONICAL_TARGET' => 1,
-                        'AC_SUBST' => 1,
+                        '_AM_COND_IF' => 1,
                         'AC_CONFIG_LIBOBJ_DIR' => 1,
-                        'AC_FC_SRCEXT' => 1,
+                        'AC_SUBST' => 1,
                         'AC_CANONICAL_HOST' => 1,
+                        'AC_FC_SRCEXT' => 1,
                         'AC_PROG_LIBTOOL' => 1,
                         'AM_INIT_AUTOMAKE' => 1,
-                        'AM_PATH_GUILE' => 1,
                         'AC_CONFIG_SUBDIRS' => 1,
+                        'AM_PATH_GUILE' => 1,
                         'AM_AUTOMAKE_VERSION' => 1,
                         'LT_CONFIG_LTDL_DIR' => 1,
-                        'AC_REQUIRE_AUX_FILE' => 1,
                         'AC_CONFIG_LINKS' => 1,
-                        'm4_sinclude' => 1,
+                        'AC_REQUIRE_AUX_FILE' => 1,
                         'LT_SUPPORTED_TAG' => 1,
+                        'm4_sinclude' => 1,
                         'AM_MAINTAINER_MODE' => 1,
                         'AM_NLS' => 1,
                         'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
-                        'AM_MAKEFILE_INCLUDE' => 1,
                         '_m4_warn' => 1,
+                        'AM_MAKEFILE_INCLUDE' => 1,
                         'AM_PROG_CXX_C_O' => 1,
-                        '_AM_COND_ENDIF' => 1,
                         '_AM_MAKEFILE_INCLUDE' => 1,
+                        '_AM_COND_ENDIF' => 1,
                         'AM_ENABLE_MULTILIB' => 1,
                         'AM_SILENT_RULES' => 1,
                         'AM_PROG_MOC' => 1,
                         'AC_CONFIG_FILES' => 1,
-                        'LT_INIT' => 1,
                         'include' => 1,
-                        'AM_PROG_AR' => 1,
+                        'LT_INIT' => 1,
                         'AM_GNU_GETTEXT' => 1,
+                        'AM_PROG_AR' => 1,
                         'AC_LIBSOURCE' => 1,
-                        'AM_PROG_FC_C_O' => 1,
                         'AC_CANONICAL_BUILD' => 1,
+                        'AM_PROG_FC_C_O' => 1,
                         'AC_FC_FREEFORM' => 1,
                         'AH_OUTPUT' => 1,
-                        '_AM_SUBST_NOTMAKE' => 1,
                         'AC_CONFIG_AUX_DIR' => 1,
-                        'sinclude' => 1,
-                        'AM_PROG_CC_C_O' => 1,
+                        '_AM_SUBST_NOTMAKE' => 1,
                         'm4_pattern_allow' => 1,
-                        'AM_XGETTEXT_OPTION' => 1,
-                        'AC_CANONICAL_SYSTEM' => 1,
+                        'AM_PROG_CC_C_O' => 1,
+                        'sinclude' => 1,
                         'AM_CONDITIONAL' => 1,
+                        'AC_CANONICAL_SYSTEM' => 1,
+                        'AM_XGETTEXT_OPTION' => 1,
                         'AC_CONFIG_HEADERS' => 1,
                         'AC_DEFINE_TRACE_LITERAL' => 1,
                         'AM_POT_TOOLS' => 1,

+ 2 - 2
OPCUAServer/config.log

@@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake.
 It was created by OPCUAServer configure 1.0, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
-  $ /home/opcua/git/opcUaStack/OPCUAServer/configure 
+  $ ./configure 
 
 ## --------- ##
 ## Platform. ##
@@ -126,7 +126,7 @@ configure:3195: checking for style of include used by make
 configure:3223: result: GNU
 configure:3249: checking dependency style of gcc
 configure:3360: result: gcc3
-configure:3545: creating ./config.status
+configure:3544: creating ./config.status
 
 ## ---------------------- ##
 ## Running config.status. ##

+ 9 - 9
OPCUAServer/config.status

@@ -436,14 +436,14 @@ Report bugs to the package provider."
 ac_cs_config=""
 ac_cs_version="\
 OPCUAServer config.status 1.0
-configured by /home/opcua/git/OPCUAStack/OPCUAServer/configure, generated by GNU Autoconf 2.68,
+configured by ./configure, generated by GNU Autoconf 2.68,
   with options \"$ac_cs_config\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
-ac_pwd='/home/opcua/git/OPCUAStack/OPCUAServer'
+ac_pwd='/home/opcua/git/opcUaStack/OPCUAServer'
 srcdir='.'
 INSTALL='/usr/bin/install -c'
 MKDIR_P='/bin/mkdir -p'
@@ -514,7 +514,7 @@ if $ac_cs_silent; then
 fi
 
 if $ac_cs_recheck; then
-  set X '/bin/bash' '/home/opcua/git/OPCUAStack/OPCUAServer/configure'  $ac_configure_extra_args --no-create --no-recursion
+  set X '/bin/bash' './configure'  $ac_configure_extra_args --no-create --no-recursion
   shift
   $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
   CONFIG_SHELL='/bin/bash'
@@ -639,12 +639,12 @@ S["mkdir_p"]="/bin/mkdir -p"
 S["MKDIR_P"]="/bin/mkdir -p"
 S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s"
 S["STRIP"]=""
-S["install_sh"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/install-sh"
-S["MAKEINFO"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/missing --run makeinfo"
-S["AUTOHEADER"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/missing --run autoheader"
-S["AUTOMAKE"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/missing --run automake-1.11"
-S["AUTOCONF"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/missing --run autoconf"
-S["ACLOCAL"]="${SHELL} /home/opcua/git/OPCUAStack/OPCUAServer/missing --run aclocal-1.11"
+S["install_sh"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/install-sh"
+S["MAKEINFO"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run makeinfo"
+S["AUTOHEADER"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run autoheader"
+S["AUTOMAKE"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run automake-1.11"
+S["AUTOCONF"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run autoconf"
+S["ACLOCAL"]="${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run aclocal-1.11"
 S["VERSION"]="1.0"
 S["PACKAGE"]="opcuaserver"
 S["CYGPATH_W"]="echo"

+ 48 - 5
OPCUAServer/src/.deps/opcuaServer.Po

@@ -25,13 +25,24 @@ opcuaServer.o: opcuaServer.c /usr/include/stdio.h /usr/include/features.h \
  /usr/include/i386-linux-gnu/bits/select2.h \
  /usr/include/i386-linux-gnu/sys/sysmacros.h \
  /usr/include/i386-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
- /usr/include/i386-linux-gnu/bits/stdlib.h opcua_binaryEncDec.h \
- opcua_builtInDatatypes.h \
+ /usr/include/i386-linux-gnu/bits/stdlib.h opcua_builtInDatatypes.h \
  /usr/lib/gcc/i686-linux-gnu/4.6/include/stdint.h /usr/include/stdint.h \
  /usr/include/i386-linux-gnu/bits/wchar.h /usr/include/string.h \
  /usr/include/xlocale.h /usr/include/i386-linux-gnu/bits/string.h \
  /usr/include/i386-linux-gnu/bits/string2.h \
- /usr/include/i386-linux-gnu/bits/string3.h opcua_types.h
+ /usr/include/i386-linux-gnu/bits/string3.h opcua_transportLayer.h \
+ opcua_binaryEncDec.h opcua_advancedDatatypes.h opcua_connectionHelper.h \
+ opcua_types.h tcp_layer.h /usr/include/i386-linux-gnu/sys/socket.h \
+ /usr/include/i386-linux-gnu/sys/uio.h \
+ /usr/include/i386-linux-gnu/bits/uio.h \
+ /usr/include/i386-linux-gnu/bits/socket.h \
+ /usr/include/i386-linux-gnu/bits/sockaddr.h \
+ /usr/include/i386-linux-gnu/asm/socket.h \
+ /usr/include/asm-generic/socket.h \
+ /usr/include/i386-linux-gnu/asm/sockios.h \
+ /usr/include/asm-generic/sockios.h \
+ /usr/include/i386-linux-gnu/bits/socket2.h /usr/include/netinet/in.h \
+ /usr/include/i386-linux-gnu/bits/in.h
 
 /usr/include/stdio.h:
 
@@ -103,8 +114,6 @@ opcuaServer.o: opcuaServer.c /usr/include/stdio.h /usr/include/features.h \
 
 /usr/include/i386-linux-gnu/bits/stdlib.h:
 
-opcua_binaryEncDec.h:
-
 opcua_builtInDatatypes.h:
 
 /usr/lib/gcc/i686-linux-gnu/4.6/include/stdint.h:
@@ -123,4 +132,38 @@ opcua_builtInDatatypes.h:
 
 /usr/include/i386-linux-gnu/bits/string3.h:
 
+opcua_transportLayer.h:
+
+opcua_binaryEncDec.h:
+
+opcua_advancedDatatypes.h:
+
+opcua_connectionHelper.h:
+
 opcua_types.h:
+
+tcp_layer.h:
+
+/usr/include/i386-linux-gnu/sys/socket.h:
+
+/usr/include/i386-linux-gnu/sys/uio.h:
+
+/usr/include/i386-linux-gnu/bits/uio.h:
+
+/usr/include/i386-linux-gnu/bits/socket.h:
+
+/usr/include/i386-linux-gnu/bits/sockaddr.h:
+
+/usr/include/i386-linux-gnu/asm/socket.h:
+
+/usr/include/asm-generic/socket.h:
+
+/usr/include/i386-linux-gnu/asm/sockios.h:
+
+/usr/include/asm-generic/sockios.h:
+
+/usr/include/i386-linux-gnu/bits/socket2.h:
+
+/usr/include/netinet/in.h:
+
+/usr/include/i386-linux-gnu/bits/in.h:

+ 10 - 7
OPCUAServer/src/Makefile

@@ -48,9 +48,8 @@ CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
 am___top_builddir__bin_stackTest_out_OBJECTS = opcuaServer.$(OBJEXT) \
-	opcua_builtInDatatypes.$(OBJEXT) \
-	opcua_transportLayer.$(OBJEXT) \
-	opcua_byteArrayConverter.$(OBJEXT)
+	opcua_builtInDatatypes.$(OBJEXT) opcua_binaryEncDec.$(OBJEXT) \
+	opcua_transportLayer.$(OBJEXT)
 __top_builddir__bin_stackTest_out_OBJECTS =  \
 	$(am___top_builddir__bin_stackTest_out_OBJECTS)
 __top_builddir__bin_stackTest_out_LDADD = $(LDADD)
@@ -76,7 +75,7 @@ AUTOMAKE = ${SHELL} /home/opcua/git/opcUaStack/OPCUAServer/missing --run automak
 AWK = mawk
 CC = gcc
 CCDEPMODE = depmode=gcc3
-CFLAGS = -g -O0
+CFLAGS = -g -O2
 CPPFLAGS = 
 CYGPATH_W = echo
 DEFS = -DPACKAGE_NAME=\"OPCUAServer\" -DPACKAGE_TARNAME=\"opcuaserver\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"OPCUAServer\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"opcuaserver\" -DVERSION=\"1.0\"
@@ -165,11 +164,15 @@ top_builddir = ..
 top_srcdir = ..
 __top_builddir__bin_stackTest_out_SOURCES = opcuaServer.c\
 											opcua_builtInDatatypes.c\
+											opcua_binaryEncDec.c\
 											opcua_transportLayer.c\
-											opcua_byteArrayConverter.c\
 											opcua_builtInDatatypes.h\
+											opcua_binaryEncDec.h\
 											opcua_transportLayer.h\
-											opcua_byteArrayConverter.h
+											opcua_advancedDatatypes.h\
+											opcua_types.h\
+											opcua_connectionHelper.h\
+											tcp_layer.h
 
 all: all-am
 
@@ -256,8 +259,8 @@ distclean-compile:
 	-rm -f *.tab.c
 
 include ./$(DEPDIR)/opcuaServer.Po
+include ./$(DEPDIR)/opcua_binaryEncDec.Po
 include ./$(DEPDIR)/opcua_builtInDatatypes.Po
-include ./$(DEPDIR)/opcua_byteArrayConverter.Po
 include ./$(DEPDIR)/opcua_transportLayer.Po
 
 .c.o:

+ 7 - 1
OPCUAServer/src/Makefile.am

@@ -4,5 +4,11 @@ bin_PROGRAMS= $(top_builddir)/bin/stackTest.out
 __top_builddir__bin_stackTest_out_SOURCES=	opcuaServer.c\
 											opcua_builtInDatatypes.c\
 											opcua_binaryEncDec.c\
+											opcua_transportLayer.c\
 											opcua_builtInDatatypes.h\
-											opcua_binaryEncDec.h
+											opcua_binaryEncDec.h\
+											opcua_transportLayer.h\
+											opcua_advancedDatatypes.h\
+											opcua_types.h\
+											opcua_connectionHelper.h\
+											tcp_layer.h

+ 10 - 2
OPCUAServer/src/Makefile.in

@@ -48,7 +48,8 @@ CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
 am___top_builddir__bin_stackTest_out_OBJECTS = opcuaServer.$(OBJEXT) \
-	opcua_builtInDatatypes.$(OBJEXT) opcua_binaryEncDec.$(OBJEXT)
+	opcua_builtInDatatypes.$(OBJEXT) opcua_binaryEncDec.$(OBJEXT) \
+	opcua_transportLayer.$(OBJEXT)
 __top_builddir__bin_stackTest_out_OBJECTS =  \
 	$(am___top_builddir__bin_stackTest_out_OBJECTS)
 __top_builddir__bin_stackTest_out_LDADD = $(LDADD)
@@ -164,8 +165,14 @@ top_srcdir = @top_srcdir@
 __top_builddir__bin_stackTest_out_SOURCES = opcuaServer.c\
 											opcua_builtInDatatypes.c\
 											opcua_binaryEncDec.c\
+											opcua_transportLayer.c\
 											opcua_builtInDatatypes.h\
-											opcua_binaryEncDec.h
+											opcua_binaryEncDec.h\
+											opcua_transportLayer.h\
+											opcua_advancedDatatypes.h\
+											opcua_types.h\
+											opcua_connectionHelper.h\
+											tcp_layer.h
 
 all: all-am
 
@@ -254,6 +261,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcuaServer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_binaryEncDec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_builtInDatatypes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_transportLayer.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<

+ 4 - 4
OPCUAServer/src/opcuaServer.c

@@ -17,9 +17,9 @@
 #include "opcua_transportLayer.h"
 #include "opcua_types.h"
 
-/*#include <sys/socket.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
-*/
+
 
 int main(void)
 {
@@ -28,7 +28,7 @@ int main(void)
 	//UA_String s;
 	puts("running tests...");
 	TL_getMessageHeader_test();
-	TL_getHELMessage_test();
+	//TL_getHELMessage_test();
 	puts("...done");
 
 	server_init();
@@ -78,7 +78,7 @@ void server_run()
 			}
 			new_client :
 			{
-				if(connection->transportLayer.connectionState != connectionState_ESTABLISHED)
+				if(connection.transportLayer.connectionState != connectionState_ESTABLISHED)
 				{
 					TL_open(connection,rawMessage);
 				}

+ 19 - 19
OPCUAServer/src/opcua_binaryEncDec.c

@@ -80,49 +80,48 @@ Int64 convertToInt64(char* buf, int pos)
 convertToUAString(char* buf, int pos,UA_String *dstUAString)
 {
 
-	dstUAString.Length = convertToInt32(buf,pos);
-	if(dstUAString.Length > 0)
+	dstUAString->Length = convertToInt32(buf,pos);
+	if(dstUAString->Length > 0)
 	{
-		dstUAString.Data = &(buf[sizeof(UInt32)]);
+		dstUAString->Data = &(buf[sizeof(UInt32)]);
 	}
 	else
 	{
-		dstUAString.Length = 0;
+		dstUAString->Length = 0;
 		dstUAString->Data = NULL;
 	}
 }
 
-UA_Guid* convertToUAGuid(char* buf, int pos)
+convertToUAGuid(char* buf, int pos,UA_Guid* dstGUID)
 {
-	UA_Guid tmpUAGuid;
+
 	int counter = 0;
 	UInt32 i = 0;
 	for(i = 1; i <= 4; i++)
 	{
-		tmpUAGuid.Data1[i] = convertToUInt32(*buf, pos+counter);
+		dstGUID->Data1[i] = convertToUInt32(*buf, pos+counter);
 		counter += sizeof(UInt32);
 	}
 	for(i = 1; i <= 2; i++)
 	{
-		tmpUAGuid.Data2[i] = convertToUInt16(*buf, pos+counter);
+		dstGUID->Data2[i] = convertToUInt16(*buf, pos+counter);
 		counter += sizeof(UInt16);
 	}
 	for(i = 1; i <= 2; i++)
 	{
-		tmpUAGuid.Data3[i] = convertToUInt16(*buf, pos+counter);
+		dstGUID->Data3[i] = convertToUInt16(*buf, pos+counter);
 		counter += sizeof(UInt16);
 	}
 	for(i = 1; i <= 8; i++)
 	{
-		tmpUAGuid.Data4[i] = convertToByte(*buf, pos+counter);
+		dstGUID->Data4[i] = convertToByte(*buf, pos+counter);
 		counter += sizeof(Byte);
 	}
-	return tmpUAGuid;
 }
 
 void convertToUANodeId(char* buf, int pos, UA_NodeId* dstNodeId){
 
-	dstNodeId->EncodingByte = convertToInt32(*buf, 0);
+	dstNodeId->EncodingByte = convertToInt32(buf, 0);
 	int counter = sizeof(UInt32);
 
 	UA_NodeIdEncodingValuesType encodingType = dstNodeId->EncodingByte;
@@ -131,32 +130,33 @@ void convertToUANodeId(char* buf, int pos, UA_NodeId* dstNodeId){
 	{
 		case NIEVT_TWO_BYTE:
 		{
-			dstNodeId->Identifier.Numeric = convertToInt32(*buf, counter);
+			dstNodeId->Identifier.Numeric = convertToInt32(buf, counter);
 			counter += sizeof(UInt16);
 			break;
 		}
 		case NIEVT_FOUR_BYTE:
 		{
-			dstNodeId->Identifier.Numeric = convertToInt32(*buf, counter);
+			dstNodeId->Identifier.Numeric = convertToInt32(buf, counter);
 			counter += sizeof(Int64);
 			break;
 		}
 		case NIEVT_NUMERIC:
 		{
-			dstNodeId->Identifier.Numeric = convertToInt32(*buf, counter);
+			dstNodeId->Identifier.Numeric = convertToInt32(buf, counter);
 			counter += sizeof(UInt32);
 			break;
 		}
 		case NIEVT_STRING:
 		{
-			dstNodeId->Identifier.String = convertToUAString(*buf, counter);
-			counter += sizeof(sizeof(UInt32) + dstNodeId->Identifier.String.Length*sizeof(char));
+
+			convertToUAString(buf, counter,&dstNodeId->Identifier.String);
+			counter += sizeof(sizeof(UInt32) + dstNodeId->Identifier.String.Length);
 			break;
 		}
 		case NIEVT_GUID:
 		{
-			UA_Guid tempGuid = convertToUAGuid(*buf, counter);
-			dstNodeId->Identifier.Guid = &tempGuid;
+
+			convertToUAGuid(buf, counter,&dstNodeId->Identifier.Guid);
 			counter += sizeof(UA_Guid);
 			break;
 		}

+ 1 - 0
OPCUAServer/src/opcua_connectionHelper.h

@@ -8,6 +8,7 @@
 #ifndef OPCUA_CONNECTIONHELPER_H_
 #define OPCUA_CONNECTIONHELPER_H_
 #include "opcua_builtInDatatypes.h"
+#include "opcua_types.h"
 
 enum packetType
 {

+ 7 - 9
OPCUAServer/src/opcua_secureChannelLayer.c

@@ -16,17 +16,19 @@ SL_getRequestHeader()
 void SL_secureChannel_open(UA_connection     *connection,
 		AD_RawMessage                        *secureChannelMessage,
 		SL_SecureConversationMessageHeader   *SCM_Header,
-		SL_AsymmetricAlgorithmSecurityHeader *AAS_Header
-		SL_openSecureChannelResponse *response )
+		SL_AsymmetricAlgorithmSecurityHeader *AAS_Header)
 {
 
+	TL_send();
 	//connection->secureLayer.
 }
+/*
 void SL_secureChannel_Request_get(AD_RawMessage        *secureChannelMessage,
 		                          secureChannelRequest *SC_request)
 {
 
 }
+*/
 /*
  * closes a secureChannel (server side)
  */
@@ -47,10 +49,13 @@ void SL_receive(UA_connection *connection,
 	//get data from transport layer
 	TL_receive(UA_connection, secureChannelMessage);
 
+	//get the Secure Channel Message Header
 	UInt32 readPosition = SL_secureChannel_SCMHeader_get(connection,secureChannelMessage,&SCM_Header);
 
+	//get the Secure Channel Asymmetric Algorithm Security Header
 	readPosition = SL_secureChannel_AASHeader_get(connection,secureChannelMessage,readPosition,&AAS_Header);
 
+	//get Secure Channel Message
 	SL_secureChannel_Message_get(connection,secureChannelMessage,readPosition,serviceMessage);
 
 
@@ -59,7 +64,6 @@ void SL_receive(UA_connection *connection,
 		switch (SCM_Header.MessageType)
 		{
 		case packetType_MSG:
-		{
 			if (connection->secureLayer.connectionState
 					== connectionState_ESTABLISHED)
 			{
@@ -70,9 +74,7 @@ void SL_receive(UA_connection *connection,
 				//TODO send back Error Message
 			}
 			break;
-		}
 		case packetType_OPN:
-		{
 			if (openSecureChannelHeader_check(connection, secureChannelMessage))
 			{
 				SL_secureChannel_open(connection, serviceMessage);
@@ -83,15 +85,11 @@ void SL_receive(UA_connection *connection,
 			}
 			//TODO free memory for secureChannelMessage
 			break;
-		}
 		case packetType_CLO:
-		{
 			SL_secureChannel_close(connection, secureChannelMessage);
 
 			//TODO free memory for secureChannelMessage
 			break;
-		}
-		}
 	}
 
 }

+ 4 - 5
OPCUAServer/src/opcua_transportLayer.c

@@ -34,10 +34,10 @@ void TL_open(UA_connection *connection, AD_RawMessage *rawMessage)
 			connection->transportLayer.serverBuffers.protocolVersion = TL_SERVER_PROTOCOL_VERSION;
 
 			connection->transportLayer.serverBuffers.recvBufferSize =
-					tmpConnection->transportLayer.serverBuffers.recvBufferSize;
+					tmpConnection.transportLayer.serverBuffers.recvBufferSize;
 
 			connection->transportLayer.serverBuffers.sendBufferSize =
-					tmpConnection->transportLayer.serverBuffers.sendBufferSize;
+					tmpConnection.transportLayer.serverBuffers.sendBufferSize;
 
 			connection->transportLayer.serverBuffers.maxMessageSize = TL_SERVER_MAX_MESSAGE_SIZE;
 			connection->transportLayer.serverBuffers.maxChunkCount = TL_SERVER_MAX_CHUNK_COUNT;
@@ -74,7 +74,7 @@ void TL_receive(UA_connection *connection, AD_RawMessage *TL_message)
 
 	if (tmpRawMessage.message != NULL)
 	{
-		length = tcp_recv(connection, tmpRawMessage.message, bufferSize);
+		//length = tcp_recv(connection, tmpRawMessage.message, bufferSize);
 	}
 
 
@@ -92,7 +92,7 @@ void TL_receive(UA_connection *connection, AD_RawMessage *TL_message)
 		packetType_HEL:
 			TL_message->length = 0;
 			TL_message->message = NULL;
-			TL_open(connection, tmpRawMessage);
+			TL_open(connection, &tmpRawMessage);
 			break;
 		packetType_ACK:
 			TL_message->length = 0;
@@ -103,7 +103,6 @@ void TL_receive(UA_connection *connection, AD_RawMessage *TL_message)
 			TL_message->message = NULL;
 			//TODO ERROR HANDLING
 			break;
-		default:
 			//TODO ERROR HANDLING
 		}
 		//check in which state the connection is

+ 61 - 61
OPCUAServer/src/opcua_types.h

@@ -12,10 +12,10 @@
 
 typedef enum _T_ApplicationType
 {
-	SERVER_0,
-	CLIENT_1,
-	CLIENTANDSERVER_2,
-	DISCOVERYSERVER_3
+	ApplicationType_SERVER_0,
+	ApplicationType_CLIENT_1,
+	ApplicationType_CLIENTANDSERVER_2,
+	ApplicationType_DISCOVERYSERVER_3
 }
 T_ApplicationType;
 
@@ -185,9 +185,9 @@ T_DiagnosticInfo;
 */
 typedef enum _T_MessageSecurityMode
 {
-	INVALID_0 = 0,
-	SIGN_1 = 1,
-	SIGNANDENCRYPT_2 = 2
+	MessageSecurityMode_INVALID_0 = 0,
+	MessageSecurityMode_SIGN_1 = 1,
+	MessageSecurityMode_SIGNANDENCRYPT_2 = 2
 }
 T_MessageSecurityMode;
 
@@ -376,9 +376,9 @@ T_ExtensibleParameterMonitoringFilter;
 */
 typedef enum _T_MonitoringFilter
 {
-	DATA_CHANGE_FILTER = 1,
-	EVENT_FILTER = 2,
-	AGGREGATE_FILTER = 3
+	MonitoringFilter_DATA_CHANGE_FILTER = 1,
+	MonitoringFilter_EVENT_FILTER = 2,
+	MonitoringFilter_AGGREGATE_FILTER = 3
 }
 T_MonitoringFilter;
 
@@ -393,9 +393,9 @@ T_MonitoringFilter;
 */
 typedef enum _T_MonitoringModeValues
 {
-	DISABLED_0 = 0,	//The item being monitored is not sampled or evaluated, and Notifications are not generated or queued. Notification reporting is disabled.
-	SAMPLING_1 = 1,	//The item being monitored is sampled and evaluated, and Notifications are generated and queued. Notification reporting is disabled.
-	REPORTING_2 = 2	//The item being monitored is sampled and evaluated, and Notifications are generated and queued. Notification reporting is enabled.
+	MonitoringModeValues_DISABLED_0 = 0,	//The item being monitored is not sampled or evaluated, and Notifications are not generated or queued. Notification reporting is disabled.
+	MonitoringModeValues_SAMPLING_1 = 1,	//The item being monitored is sampled and evaluated, and Notifications are generated and queued. Notification reporting is disabled.
+	MonitoringModeValues_REPORTING_2 = 2	//The item being monitored is sampled and evaluated, and Notifications are generated and queued. Notification reporting is enabled.
 }
 T_MonitoringModeValues;
 
@@ -408,41 +408,41 @@ T_MonitoringModeValues;
 */
 typedef enum _T_NodeAttributesParamterTypeIds
 {
-	ObjectAttributes,	//Defines the Attributes for the Object NodeClass.
-	VariableAttributes,	//Defines the Attributes for the Variable NodeClass.
-	MethodAttributes,	//Defines the Attributes for the Method NodeClass.
-	ObjectTypeAttributes,	//Defines the Attributes for the ObjectType NodeClass.
-	VariableTypeAttributes,	//Defines the Attributes for the VariableType NodeClass.
-	ReferenceTypeAttributes,//Defines the Attributes for the ReferenceType NodeClass.
-	DataTypeAttributes,	//Defines the Attributes for the DataType NodeClass.
-	ViewAttributes		//Defines the Attributes for the View NodeClass.
+	NodeAttributesParamterTypeIds_ObjectAttributes,	//Defines the Attributes for the Object NodeClass.
+	NodeAttributesParamterTypeIds_VariableAttributes,	//Defines the Attributes for the Variable NodeClass.
+	NodeAttributesParamterTypeIds_MethodAttributes,	//Defines the Attributes for the Method NodeClass.
+	NodeAttributesParamterTypeIds_ObjectTypeAttributes,	//Defines the Attributes for the ObjectType NodeClass.
+	NodeAttributesParamterTypeIds_VariableTypeAttributes,	//Defines the Attributes for the VariableType NodeClass.
+	NodeAttributesParamterTypeIds_ReferenceTypeAttributes,//Defines the Attributes for the ReferenceType NodeClass.
+	NodeAttributesParamterTypeIds_DataTypeAttributes,	//Defines the Attributes for the DataType NodeClass.
+	NodeAttributesParamterTypeIds_ViewAttributes		//Defines the Attributes for the View NodeClass.
 }
 T_NodeAttributesParamterTypeIds;
 
 typedef enum _T_NodeAttributesBitMask
 {
-	AccessLevel = 1, 	//Bit: 0 Indicates if the AccessLevel Attribute is set.
-	ArrayDimensions = 2,	//Bit: 1 Indicates if the ArrayDimensions Attribute is set.
+	NodeAttributesBitMask_AccessLevel = 1, 	//Bit: 0 Indicates if the AccessLevel Attribute is set.
+	NodeAttributesBitMask_ArrayDimensions = 2,	//Bit: 1 Indicates if the ArrayDimensions Attribute is set.
 	//Reserved = 4, 	//Bit: 2 Reserved to be consistent with WriteMask defined in IEC 62541-3.
-	ContainsNoLoops = 8,	//Bit: 3 Indicates if the ContainsNoLoops Attribute is set.
-	DataType = 16,		//Bit: 4 Indicates if the DataType Attribute is set.
-	Description = 32,	//Bit: 5 Indicates if the Description Attribute is set.
-	DisplayName = 64,	//Bit: 6 Indicates if the DisplayName Attribute is set.
-	EventNotifier = 128,	//Bit: 7 Indicates if the EventNotifier Attribute is set.
-	Executable = 256,	//Bit: 8 Indicates if the Executable Attribute is set.
-	Historizing = 512,	//Bit: 9 Indicates if the Historizing Attribute is set.
-	InverseName = 1024,	//Bit:10 Indicates if the InverseName Attribute is set.
-	IsAbstract = 2048,	//Bit:11 Indicates if the IsAbstract Attribute is set.
-	MinimumSamplingInterval = 4096, //Bit:12 Indicates if the MinimumSamplingInterval Attribute is set.
+	NodeAttributesBitMask_ContainsNoLoops = 8,	//Bit: 3 Indicates if the ContainsNoLoops Attribute is set.
+	NodeAttributesBitMask_DataType = 16,		//Bit: 4 Indicates if the DataType Attribute is set.
+	NodeAttributesBitMask_Description = 32,	//Bit: 5 Indicates if the Description Attribute is set.
+	NodeAttributesBitMask_DisplayName = 64,	//Bit: 6 Indicates if the DisplayName Attribute is set.
+	NodeAttributesBitMask_EventNotifier = 128,	//Bit: 7 Indicates if the EventNotifier Attribute is set.
+	NodeAttributesBitMask_Executable = 256,	//Bit: 8 Indicates if the Executable Attribute is set.
+	NodeAttributesBitMask_Historizing = 512,	//Bit: 9 Indicates if the Historizing Attribute is set.
+	NodeAttributesBitMask_InverseName = 1024,	//Bit:10 Indicates if the InverseName Attribute is set.
+	NodeAttributesBitMask_IsAbstract = 2048,	//Bit:11 Indicates if the IsAbstract Attribute is set.
+	NodeAttributesBitMask_MinimumSamplingInterval = 4096, //Bit:12 Indicates if the MinimumSamplingInterval Attribute is set.
 	//Reserved = 8192,	//Bit:13 Reserved to be consistent with WriteMask defined in IEC 62541-3.
 	//Reserved = 16384,	//Bit:14 Reserved to be consistent with WriteMask defined in IEC 62541-3.
-	Symmetric = 32768,	//Bit:15 Indicates if the Symmetric Attribute is set.
-	UserAccessLevel = 65536,//Bit:16 Indicates if the UserAccessLevel Attribute is set.
-	UserExecutable = 131072,//Bit:17 Indicates if the UserExecutable Attribute is set.
-	UserWriteMask = 262144, //Bit:18 Indicates if the UserWriteMask Attribute is set.
-	ValueRank = 524288,	//Bit:19 Indicates if the ValueRank Attribute is set.
-	WriteMask = 1048576,	//Bit:20 Indicates if the WriteMask Attribute is set.
-	Value = 2097152		//Bit:21 Indicates if the Value Attribute is set.
+	NodeAttributesBitMask_Symmetric = 32768,	//Bit:15 Indicates if the Symmetric Attribute is set.
+	NodeAttributesBitMask_UserAccessLevel = 65536,//Bit:16 Indicates if the UserAccessLevel Attribute is set.
+	NodeAttributesBitMask_UserExecutable = 131072,//Bit:17 Indicates if the UserExecutable Attribute is set.
+	NodeAttributesBitMask_UserWriteMask = 262144, //Bit:18 Indicates if the UserWriteMask Attribute is set.
+	NodeAttributesBitMask_ValueRank = 524288,	//Bit:19 Indicates if the ValueRank Attribute is set.
+	NodeAttributesBitMask_WriteMask = 1048576,	//Bit:20 Indicates if the WriteMask Attribute is set.
+	NodeAttributesBitMask_Value = 2097152		//Bit:21 Indicates if the Value Attribute is set.
 	//Reserved		//Bit:22:32 Reserved for future use. Shall always be zero.
 }
 T_NodeAttributesBitMask;
@@ -619,9 +619,9 @@ T_ViewAttributes;
 */
 typedef enum _T_NotificationDataParameterTypeIds
 {
-	DATA_CHANGE = 1,
-	EVENT = 2,
-	STATUS_CHANGE = 3
+	NotificationDataParameterTypeIds_DATA_CHANGE = 1,
+	NotificationDataParameterTypeIds_EVENT = 2,
+	NotificationDataParameterTypeIds_STATUS_CHANGE = 3
 }
 T_NotificationDataParameterTypeIds;
 
@@ -780,16 +780,16 @@ T_RequestHeader;
 
 typedef enum _T_RequestReturnDiagnositcs
 {
-	SERVICE_LEVEL_SYMBOLIC_ID = 1,				//Hex 0x01
-	SERVICE_LEVEL_LOCALIZED_TEXT= 2,			//Hex 0x02
-	SERVICE_LEVEL_ADDITIONAL_INFO = 4,			//Hex 0x04
-	SERVICE_LEVEL_INNER_STATUS_CODE = 8,		//Hex 0x08
-	SERVICE_LEVEL_INNER_DIAGNOSTICS = 16,		//Hex 0x10
-	OPERATION_LEVEL_SYMBOLIC_ID = 32,			//Hex 0x20
-	OPERATION_LEVEL_LOCALIZED_TEXT= 64,			//Hex 0x40
-	OPERATION_LEVEL_ADDITIONAL_INFO = 128,		//Hex 0x80
-	OPERATION_LEVEL_INNER_STATUS_CODE = 256,	//Hex 0x100
-	OPERATION_LEVEL_INNER_DIAGNOSTICS = 512		//Hex 0x200
+	RequestReturnDiagnositcs_SERVICE_LEVEL_SYMBOLIC_ID = 1,				//Hex 0x01
+	RequestReturnDiagnositcs_SERVICE_LEVEL_LOCALIZED_TEXT= 2,			//Hex 0x02
+	RequestReturnDiagnositcs_SERVICE_LEVEL_ADDITIONAL_INFO = 4,			//Hex 0x04
+	RequestReturnDiagnositcs_SERVICE_LEVEL_INNER_STATUS_CODE = 8,		//Hex 0x08
+	RequestReturnDiagnositcs_SERVICE_LEVEL_INNER_DIAGNOSTICS = 16,		//Hex 0x10
+	RequestReturnDiagnositcs_OPERATION_LEVEL_SYMBOLIC_ID = 32,			//Hex 0x20
+	RequestReturnDiagnositcs_OPERATION_LEVEL_LOCALIZED_TEXT= 64,			//Hex 0x40
+	RequestReturnDiagnositcs_OPERATION_LEVEL_ADDITIONAL_INFO = 128,		//Hex 0x80
+	RequestReturnDiagnositcs_OPERATION_LEVEL_INNER_STATUS_CODE = 256,	//Hex 0x100
+	RequestReturnDiagnositcs_OPERATION_LEVEL_INNER_DIAGNOSTICS = 512		//Hex 0x200
 }
 T_RequestReturnDiagnositcs;
 
@@ -883,12 +883,12 @@ T_SignedSoftwareCertificate;
 */
 typedef enum _T_ComplianceLevel
 {
-	UNTESTED_0 = 0,		//the profiled capability has not been tested successfully.
-	PARTIAL_1 = 1,		//the profiled capability has been partially tested and has
+	ComplianceLevel_UNTESTED_0 = 0,		//the profiled capability has not been tested successfully.
+	ComplianceLevel_PARTIAL_1 = 1,		//the profiled capability has been partially tested and has
 				//passed critical tests, as defined by the certifying authority.
-	SELFTESTED_2 = 2,	//the profiled capability has been successfully tested using a
+	ComplianceLevel_SELFTESTED_2 = 2,	//the profiled capability has been successfully tested using a
 				//self-test system authorized by the certifying authority.
-	CERTIFIED_3 = 3		//the profiled capability has been successfully tested by a
+	ComplianceLevel_CERTIFIED_3 = 3		//the profiled capability has been successfully tested by a
 				//testing organisation authorized by the certifying authority.
 }
 T_ComplianceLevel;
@@ -938,13 +938,13 @@ T_SoftwareCertificate;
 */
 typedef enum _T_TimestampsToReturn
 {
-	SOURCE_0 = 1,	//Return the source timestamp.
+	TimestampsToReturn_SOURCE_0 = 1,	//Return the source timestamp.
 			//If used in HistoryRead the source timestamp is used to determine which historical data values are returned.
-	SERVER_1 = 1,	//Return the Server timestamp.
+	TimestampsToReturn_SERVER_1 = 1,	//Return the Server timestamp.
 			//If used in HistoryRead the Server timestamp is used to determine which historical data values are returned.
-	BOTH_2 = 2,	//Return both the source and Server timestamps.
+	TimestampsToReturn_BOTH_2 = 2,	//Return both the source and Server timestamps.
 			//If used in HistoryRead the source timestamp is used to determine which historical data values are returned.
-	NEITHER_3 = 3	//Return neither timestamp.
+	TimestampsToReturn_NEITHER_3 = 3	//Return neither timestamp.
 			//This is the default value for MonitoredItems if a Variable value is not being accessed.
 			//For HistoryRead this is not a valid setting.
 }