Przeglądaj źródła

changed project name

FlorianPalm 11 lat temu
rodzic
commit
c607eb8eaf
80 zmienionych plików z 17507 dodań i 0 usunięć
  1. 81 0
      open62541Stack/.autotools
  2. 509 0
      open62541Stack/.cproject
  3. 48 0
      open62541Stack/.gitignore
  4. 32 0
      open62541Stack/.project
  5. 67 0
      open62541Stack/.settings/org.eclipse.cdt.codan.core.prefs
  6. 163 0
      open62541Stack/.settings/org.eclipse.cdt.core.prefs
  7. 13 0
      open62541Stack/.settings/org.eclipse.cdt.managedbuilder.core.prefs
  8. 3 0
      open62541Stack/.settings/org.eclipse.cdt.ui.prefs
  9. 1 0
      open62541Stack/AUTHORS
  10. 1 0
      open62541Stack/COPYING
  11. 0 0
      open62541Stack/ChangeLog
  12. 365 0
      open62541Stack/INSTALL
  13. 7 0
      open62541Stack/Makefile.am
  14. 1 0
      open62541Stack/NEWS
  15. 1 0
      open62541Stack/README
  16. 4 0
      open62541Stack/autogen.sh
  17. 661 0
      open62541Stack/config.log.orig
  18. 1931 0
      open62541Stack/config.status.orig
  19. 34 0
      open62541Stack/configure.ac
  20. BIN
      open62541Stack/doc/secureLayer/secureLayer.vsdx
  21. BIN
      open62541Stack/doc/transportLayer/transportLayer.vsdx
  22. 5 0
      open62541Stack/examples/src/Makefile.am
  23. 169 0
      open62541Stack/examples/src/opcuaServer.c
  24. BIN
      open62541Stack/opcuaserver-1.0.tar.gz
  25. 1 0
      open62541Stack/opcuaserver-1.0/AUTHORS
  26. 1 0
      open62541Stack/opcuaserver-1.0/COPYING
  27. 0 0
      open62541Stack/opcuaserver-1.0/ChangeLog
  28. 370 0
      open62541Stack/opcuaserver-1.0/INSTALL
  29. 7 0
      open62541Stack/opcuaserver-1.0/Makefile.am
  30. 1 0
      open62541Stack/opcuaserver-1.0/NEWS
  31. 1 0
      open62541Stack/opcuaserver-1.0/README
  32. 29 0
      open62541Stack/opcuaserver-1.0/configure.ac
  33. 5 0
      open62541Stack/opcuaserver-1.0/examples/src/Makefile.am
  34. 153 0
      open62541Stack/opcuaserver-1.0/examples/src/opcuaServer.c
  35. 43 0
      open62541Stack/opcuaserver-1.0/src/Makefile.am
  36. 973 0
      open62541Stack/opcuaserver-1.0/src/opcua_advancedDatatypes.h
  37. 188 0
      open62541Stack/opcuaserver-1.0/src/opcua_binaryEncDec.c
  38. 125 0
      open62541Stack/opcuaserver-1.0/src/opcua_binaryEncDec.h
  39. 11 0
      open62541Stack/opcuaserver-1.0/src/opcua_builtInDatatypes.c
  40. 493 0
      open62541Stack/opcuaserver-1.0/src/opcua_builtInDatatypes.h
  41. 79 0
      open62541Stack/opcuaserver-1.0/src/opcua_connectionHelper.h
  42. 89 0
      open62541Stack/opcuaserver-1.0/src/opcua_encodingLayer.c
  43. 58 0
      open62541Stack/opcuaserver-1.0/src/opcua_encodingLayer.h
  44. 205 0
      open62541Stack/opcuaserver-1.0/src/opcua_secureChannelLayer.c
  45. 78 0
      open62541Stack/opcuaserver-1.0/src/opcua_secureChannelLayer.h
  46. 314 0
      open62541Stack/opcuaserver-1.0/src/opcua_transportLayer.c
  47. 89 0
      open62541Stack/opcuaserver-1.0/src/opcua_transportLayer.h
  48. 1047 0
      open62541Stack/opcuaserver-1.0/src/opcua_types.h
  49. 16 0
      open62541Stack/opcuaserver-1.0/src/tcp_layer.h
  50. 8 0
      open62541Stack/opcuaserver-1.0/tests/Makefile.am
  51. 208 0
      open62541Stack/opcuaserver-1.0/tests/check_stack.c
  52. 69 0
      open62541Stack/src/Makefile.am
  53. 46 0
      open62541Stack/src/Makefile.am.orig
  54. 635 0
      open62541Stack/src/Makefile.in.orig
  55. 973 0
      open62541Stack/src/opcua_advancedDatatypes.h
  56. 1483 0
      open62541Stack/src/opcua_binaryEncDec.c
  57. 1486 0
      open62541Stack/src/opcua_binaryEncDec.c.orig
  58. 355 0
      open62541Stack/src/opcua_binaryEncDec.h
  59. 11 0
      open62541Stack/src/opcua_builtInDatatypes.c
  60. 748 0
      open62541Stack/src/opcua_builtInDatatypes.h
  61. 86 0
      open62541Stack/src/opcua_connectionHelper.h
  62. 10 0
      open62541Stack/src/opcua_encodingLayer.c
  63. 14 0
      open62541Stack/src/opcua_encodingLayer.h
  64. 25 0
      open62541Stack/src/opcua_linkedList.h
  65. 18 0
      open62541Stack/src/opcua_memory.c
  66. 25 0
      open62541Stack/src/opcua_memory.h
  67. 221 0
      open62541Stack/src/opcua_secureChannelLayer.c
  68. 136 0
      open62541Stack/src/opcua_secureChannelLayer.h
  69. 19 0
      open62541Stack/src/opcua_serializationLayer.c
  70. 13 0
      open62541Stack/src/opcua_serializationLayer.h
  71. 28 0
      open62541Stack/src/opcua_serverAPI.h
  72. 22 0
      open62541Stack/src/opcua_time.c
  73. 15 0
      open62541Stack/src/opcua_time.h
  74. 262 0
      open62541Stack/src/opcua_transportLayer.c
  75. 103 0
      open62541Stack/src/opcua_transportLayer.h
  76. 1051 0
      open62541Stack/src/opcua_types.h
  77. 22 0
      open62541Stack/src/opuca_linkedList.c
  78. 16 0
      open62541Stack/src/tcp_layer.h
  79. 6 0
      open62541Stack/tests/Makefile.am
  80. 921 0
      open62541Stack/tests/check_stack.c

+ 81 - 0
open62541Stack/.autotools

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurations>
+<configuration id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728">
+<option id="configure" value="configure"/>
+<option id="configdir" value=""/>
+<option id="cache-file" value=""/>
+<option id="help" value="false"/>
+<option id="no-create" value="false"/>
+<option id="quiet" value="false"/>
+<option id="version" value="false"/>
+<option id="host" value=""/>
+<option id="build" value=""/>
+<option id="target" value=""/>
+<option id="prefix" value=""/>
+<option id="exec-prefix" value=""/>
+<option id="libdir" value=""/>
+<option id="bindir" value=""/>
+<option id="sbindir" value=""/>
+<option id="includedir" value=""/>
+<option id="datadir" value=""/>
+<option id="sysconfdir" value=""/>
+<option id="infodir" value=""/>
+<option id="mandir" value=""/>
+<option id="srcdir" value=""/>
+<option id="localstatedir" value=""/>
+<option id="sharedstatedir" value=""/>
+<option id="libexecdir" value=""/>
+<option id="oldincludedir" value=""/>
+<option id="program-prefix" value=""/>
+<option id="program-suffix" value=""/>
+<option id="program-transform-name" value=""/>
+<option id="enable-maintainer-mode" value="false"/>
+<flag id="CFLAGS">
+<flagvalue id="cflags-debug" value="false"/>
+<flagvalue id="cflags-gprof" value="false"/>
+<flagvalue id="cflags-gcov" value="false"/>
+</flag>
+<option id="user" value=""/>
+<option id="autogen" value="autogen.sh"/>
+<option id="autogenOpts" value=""/>
+</configuration>
+<configuration id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089">
+<option id="configure" value="configure"/>
+<option id="configdir" value=""/>
+<option id="cache-file" value=""/>
+<option id="help" value="false"/>
+<option id="no-create" value="false"/>
+<option id="quiet" value="false"/>
+<option id="version" value="false"/>
+<option id="host" value=""/>
+<option id="build" value=""/>
+<option id="target" value=""/>
+<option id="prefix" value=""/>
+<option id="exec-prefix" value=""/>
+<option id="libdir" value=""/>
+<option id="bindir" value=""/>
+<option id="sbindir" value=""/>
+<option id="includedir" value=""/>
+<option id="datadir" value=""/>
+<option id="sysconfdir" value=""/>
+<option id="infodir" value=""/>
+<option id="mandir" value=""/>
+<option id="srcdir" value=""/>
+<option id="localstatedir" value=""/>
+<option id="sharedstatedir" value=""/>
+<option id="libexecdir" value=""/>
+<option id="oldincludedir" value=""/>
+<option id="program-prefix" value=""/>
+<option id="program-suffix" value=""/>
+<option id="program-transform-name" value=""/>
+<option id="enable-maintainer-mode" value="false"/>
+<flag id="CFLAGS">
+<flagvalue id="cflags-debug" value="false"/>
+<flagvalue id="cflags-gprof" value="false"/>
+<flagvalue id="cflags-gcov" value="false"/>
+</flag>
+<option id="user" value=""/>
+<option id="autogen" value="autogen.sh"/>
+<option id="autogenOpts" value=""/>
+</configuration>
+</configurations>

Plik diff jest za duży
+ 509 - 0
open62541Stack/.cproject


+ 48 - 0
open62541Stack/.gitignore

@@ -0,0 +1,48 @@
+# ignore all bin directories
+# matches "bin" in any subfolder
+bin/
+m4/
+build-test/
+.deps/
+.libs/
+lib/
+# ignore all target directories
+target/
+autom4te.cache/
+#ignore test driver
+test-driver
+#ignore compiled tests
+tests/check_stack
+tests/check_stack.exe
+tests/check_stack.trs
+# ignore Makefiles
+Makefile
+src/Makefile
+tests/Makefile
+Makefile.in
+src/Makefile.in
+tests/Makefile.in
+#ignore autoconf files
+config.log
+config.status
+config.guess
+config.sub
+aclocal.m4
+configure
+libtool
+compile
+depcomp
+missing
+install-sh
+ltmain.sh
+# ignore all files ending with ~
+*.po
+*.o
+*.plo
+*.log
+*.la
+*.sub
+*.status
+*.guess
+*.in 
+*.lo

+ 32 - 0
open62541Stack/.project

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>open62541Stack</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.autotools.core.genmakebuilderV2</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+		<nature>org.eclipse.cdt.autotools.core.autotoolsNatureV2</nature>
+	</natures>
+</projectDescription>

+ 67 - 0
open62541Stack/.settings/org.eclipse.cdt.codan.core.prefs

@@ -0,0 +1,67 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.codan.checkers.errnoreturn=Warning
+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.checkers.errreturnvalue=Error
+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.checkers.noreturn=Error
+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
+org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}

+ 163 - 0
open62541Stack/.settings/org.eclipse.cdt.core.prefs

@@ -0,0 +1,163 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=80
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

+ 13 - 0
open62541Stack/.settings/org.eclipse.cdt.managedbuilder.core.prefs

@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/CPATH/operation=remove
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/C_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/append=true
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728.1003956089/appendContributed=true
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/CPATH/operation=remove
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/C_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/append=true
+environment/buildEnvironmentInclude/org.eclipse.linuxtools.cdt.autotools.core.configuration.build.2007012728/appendContributed=true

+ 3 - 0
open62541Stack/.settings/org.eclipse.cdt.ui.prefs

@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=org.eclipse.cdt.ui.default.allman_profile
+formatter_settings_version=1

+ 1 - 0
open62541Stack/AUTHORS

@@ -0,0 +1 @@
+

+ 1 - 0
open62541Stack/COPYING

@@ -0,0 +1 @@
+<Place your desired license here.>

+ 0 - 0
open62541Stack/ChangeLog


+ 365 - 0
open62541Stack/INSTALL

@@ -0,0 +1,365 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

+ 7 - 0
open62541Stack/Makefile.am

@@ -0,0 +1,7 @@
+if HAVE_CHECK
+    SUBS=src . tests .
+else 
+    SUBS=src .
+endif
+
+SUBDIRS = $(SUBS) examples/src	

+ 1 - 0
open62541Stack/NEWS

@@ -0,0 +1 @@
+Sample NEWS file for OPCUAServer project.

+ 1 - 0
open62541Stack/README

@@ -0,0 +1 @@
+Sample readme file for OPCUAServer project.

+ 4 - 0
open62541Stack/autogen.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+#Script to invoke creation of configure script
+autoreconf -fi

Plik diff jest za duży
+ 661 - 0
open62541Stack/config.log.orig


Plik diff jest za duży
+ 1931 - 0
open62541Stack/config.status.orig


+ 34 - 0
open62541Stack/configure.ac

@@ -0,0 +1,34 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(OPCUAServer, 1.0)
+
+
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE()
+AC_PROG_MAKE_SET
+if test -z $CFLAGS; then
+    CFLAGS='-O2'
+fi
+AC_PROG_CC
+AC_PROG_LN_S
+AM_PROG_CC_C_O
+AC_CHECK_LIB([m],[exp],,AC_MSG_ERROR([Libm missing]))
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.12],[have_check="yes"],AC_MSG_WARN([Check not found or check version lower than 0.9.12; cannot run unit tests!])
+[have_check="no"])
+AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = "xyes"])
+AM_CONDITIONAL([TARGET_WIN],[test "${host_os}" = "mingw32"])
+AM_CONDITIONAL([TARGET_LINUX],[test "${host_os}" = "linux-gnu" || test "${host_os}" = "linux"]) 
+#adding platform-dependent information to compile flags
+AM_COND_IF([TARGET_WIN],
+    AC_DEFINE([WINDOWS])) #define WINDOWS is accessible from pre-processor
+
+AM_COND_IF([TARGET_LINUX],
+    AC_DEFINE([LINUX]))
+    
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile examples/src/Makefile)
+AC_OUTPUT
+

BIN
open62541Stack/doc/secureLayer/secureLayer.vsdx


BIN
open62541Stack/doc/transportLayer/transportLayer.vsdx


+ 5 - 0
open62541Stack/examples/src/Makefile.am

@@ -0,0 +1,5 @@
+
+bin_PROGRAMS= $(top_builddir)/bin/exampleServer
+__top_builddir__bin_exampleServer_LDFLAGS = -all-static
+__top_builddir__bin_exampleServer_SOURCES = opcuaServer.c
+__top_builddir__bin_exampleServer_LDADD= ../../lib/libopen62541.a

+ 169 - 0
open62541Stack/examples/src/opcuaServer.c

@@ -0,0 +1,169 @@
+/*
+ ============================================================================
+ Name        : opcuaServer.c
+ Author      :
+ Version     :
+ Copyright   : Your copyright notice
+ Description :
+ ============================================================================
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+
+#include "../../src/opcua_binaryEncDec.h"
+#include "../../src/opcua_builtInDatatypes.h"
+#include "../../src/opcua_transportLayer.h"
+#include "../../src/opcua_types.h"
+
+#ifdef LINUX
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+void server_init();
+void server_run();
+
+#endif
+
+int main(void)
+{
+
+#ifdef LINUX
+	server_init();
+	server_run();
+#endif
+
+	return EXIT_SUCCESS;
+
+}
+
+#ifdef LINUX
+
+void server_init()
+{
+	puts("starting demo Server");
+	//call listen
+
+}
+void server_run()
+{
+	int server_state = 0;
+	int recv_data = 0;
+	int send_data = 1;
+	int new_client = 2;
+	int new_request = 3;
+	char buf[8192];
+	struct sockaddr_in self;
+	int sockfd;
+	int clientfd;
+
+	struct sockaddr_in client_addr;
+	int addrlen=sizeof(client_addr);
+
+
+	Int32 valreal = 0;
+	Int32 valcalc = 0;
+	UA_DiagnosticInfo diagnosticInfo;
+	diagnosticInfo.EncodingMask |= 0x01 | 0x02 | 0x04 | 0x04 | 0x08 | 0x10 | 0x10;
+	diagnosticInfo.SymbolicId = 30;
+	diagnosticInfo.NamespaceUri = 25;
+	diagnosticInfo.LocalizedText = 22;
+	diagnosticInfo.AdditionalInfo.Data = "OPCUA";
+	diagnosticInfo.AdditionalInfo.Length = 5;
+
+	if (diagnosticInfo_calcSize(&diagnosticInfo) > 10)
+	{
+
+
+	//---Create streaming socket---
+	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+	{
+		puts("socket error");
+	}
+	}
+	bzero(&self, sizeof(self));
+	self.sin_family = AF_INET;
+	self.sin_port = htons(4840);
+	self.sin_addr.s_addr = htonl(INADDR_ANY);
+
+	if( bind(sockfd,(struct sockaddr *)&self , sizeof(self)) < 0)
+	{
+
+
+	   //Fehler bei bind()
+	 }
+
+	//---Make it a "listening socket"---
+	if ( listen(sockfd, 1) != 0 )
+	{
+		puts("listen error");
+	}
+	clientfd = accept(sockfd, (struct sockaddr*)&client_addr, &addrlen);
+	server_state = 0;
+	while(1)
+	{
+		//call recv (nonblocking)
+
+		//call TL_getPacketType
+
+		//if newData
+		//
+		UA_connection connection;
+		AD_RawMessage *rawMessage;
+		rawMessage->message = buf;
+		rawMessage->length = 0;
+		switch(server_state)
+		{
+
+			recv_data :
+			{
+
+				//call receive function
+				rawMessage->length = recv(sockfd,buf,8192,0);
+				if(rawMessage->length > 0)
+				{
+					server_state = new_client;
+				}
+				break;
+			}
+			send_data :
+			{
+				//call send function
+				break;
+			}
+			new_client :
+			{
+				if(connection.transportLayer.connectionState != connectionState_ESTABLISHED)
+				{
+					TL_open(connection,rawMessage);
+				}
+//			else
+//				{
+//					SL_open(connection,rawMessage);
+//
+//				}
+
+			}
+			new_request :
+			{
+
+
+				break;
+			}
+
+		}
+		//if newClient
+
+
+		//TL_processHELMessage(&connection,);
+
+		//--------
+		//call listen
+	}
+
+}
+
+#endif

BIN
open62541Stack/opcuaserver-1.0.tar.gz


+ 1 - 0
open62541Stack/opcuaserver-1.0/AUTHORS

@@ -0,0 +1 @@
+

+ 1 - 0
open62541Stack/opcuaserver-1.0/COPYING

@@ -0,0 +1 @@
+<Place your desired license here.>

+ 0 - 0
open62541Stack/opcuaserver-1.0/ChangeLog


+ 370 - 0
open62541Stack/opcuaserver-1.0/INSTALL

@@ -0,0 +1,370 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

+ 7 - 0
open62541Stack/opcuaserver-1.0/Makefile.am

@@ -0,0 +1,7 @@
+if HAVE_CHECK
+    SUBS=src . tests .
+else 
+    SUBS=src .
+endif
+
+SUBDIRS = $(SUBS) examples/src	

+ 1 - 0
open62541Stack/opcuaserver-1.0/NEWS

@@ -0,0 +1 @@
+Sample NEWS file for OPCUAServer project.

+ 1 - 0
open62541Stack/opcuaserver-1.0/README

@@ -0,0 +1 @@
+Sample readme file for OPCUAServer project.

+ 29 - 0
open62541Stack/opcuaserver-1.0/configure.ac

@@ -0,0 +1,29 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(OPCUAServer, 1.0)
+
+
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE()
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CHECK_LIB([m],[exp],,AC_MSG_ERROR([Libm missing]))
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],[have_check="yes"],AC_MSG_WARN([Check not found; cannot run unit tests!])
+[have_check="no"])
+AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = "xyes"])
+AM_CONDITIONAL([TARGET_WIN],[test "${host_os}" = "mingw32"])
+AM_CONDITIONAL([TARGET_LINUX],[test "${host_os}" = "linux-gnu" || test "${host_os}" = "linux"]) 
+#adding platform-dependent information to compile flags
+AM_COND_IF([TARGET_WIN],
+    AC_DEFINE([WINDOWS])) #define WINDOWS is accessible from pre-processor
+
+AM_COND_IF([TARGET_LINUX],
+    AC_DEFINE([LINUX]))
+    
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile examples/src/Makefile)
+AC_OUTPUT
+

+ 5 - 0
open62541Stack/opcuaserver-1.0/examples/src/Makefile.am

@@ -0,0 +1,5 @@
+
+bin_PROGRAMS= $(top_builddir)/bin/exampleServer.out
+__top_builddir__bin_exampleServer_out_LDFLAGS = -all-static
+__top_builddir__bin_exampleServer_out_SOURCES = opcuaServer.c
+__top_builddir__bin_exampleServer_out_LDADD= ../../src/.libs/libopen62541.la

+ 153 - 0
open62541Stack/opcuaserver-1.0/examples/src/opcuaServer.c

@@ -0,0 +1,153 @@
+/*
+ ============================================================================
+ Name        : opcuaServer.c
+ Author      :
+ Version     :
+ Copyright   : Your copyright notice
+ Description :
+ ============================================================================
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+
+#include "../../src/opcua_binaryEncDec.h"
+#include "../../src/opcua_builtInDatatypes.h"
+#include "../../src/opcua_transportLayer.h"
+#include "../../src/opcua_types.h"
+
+#ifdef LINUX
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+void server_init();
+void server_run();
+
+#endif
+
+int main(void)
+{
+
+#ifdef LINUX
+	server_init();
+	server_run();
+#endif
+
+	return EXIT_SUCCESS;
+
+}
+
+#ifdef LINUX
+
+void server_init()
+{
+	puts("starting demo Server");
+	//call listen
+
+}
+void server_run()
+{
+	int server_state = 0;
+	int recv_data = 0;
+	int send_data = 1;
+	int new_client = 2;
+	int new_request = 3;
+	char buf[8192];
+	struct sockaddr_in self;
+	int sockfd;
+	int clientfd;
+
+	struct sockaddr_in client_addr;
+	int addrlen=sizeof(client_addr);
+
+	//---Create streaming socket---
+    if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 )
+	{
+    	puts("socket error");
+	}
+	bzero(&self, sizeof(self));
+	self.sin_family = AF_INET;
+	self.sin_port = htons(4840);
+	self.sin_addr.s_addr = htonl(INADDR_ANY);
+
+	if( bind(sockfd,(struct sockaddr *)&self , sizeof(self)) < 0)
+	{
+
+
+	   //Fehler bei bind()
+	 }
+
+	//---Make it a "listening socket"---
+	if ( listen(sockfd, 1) != 0 )
+	{
+		puts("listen error");
+	}
+	clientfd = accept(sockfd, (struct sockaddr*)&client_addr, &addrlen);
+	server_state = 0;
+	while(1)
+	{
+		//call recv (nonblocking)
+
+		//call TL_getPacketType
+
+		//if newData
+		//
+		UA_connection connection;
+		AD_RawMessage *rawMessage;
+		rawMessage->message = buf;
+		rawMessage->length = 0;
+		switch(server_state)
+		{
+
+			recv_data :
+			{
+
+				//call receive function
+				rawMessage->length = recv(sockfd,buf,8192,0);
+				if(rawMessage->length > 0)
+				{
+					server_state = new_client;
+				}
+				break;
+			}
+			send_data :
+			{
+				//call send function
+				break;
+			}
+			new_client :
+			{
+				if(connection.transportLayer.connectionState != connectionState_ESTABLISHED)
+				{
+					TL_open(connection,rawMessage);
+				}
+//			else
+//				{
+//					SL_open(connection,rawMessage);
+//
+//				}
+
+			}
+			new_request :
+			{
+
+
+				break;
+			}
+
+		}
+		//if newClient
+
+
+		//TL_processHELMessage(&connection,);
+
+		//--------
+		//call listen
+	}
+
+}
+
+#endif

+ 43 - 0
open62541Stack/opcuaserver-1.0/src/Makefile.am

@@ -0,0 +1,43 @@
+
+
+
+
+
+#__top_builddir__bin_stackTest_out_SOURCES =	opcuaServer.c\
+#											opcua_builtInDatatypes.c\
+#											opcua_binaryEncDec.c\
+#											opcua_transportLayer.c\
+#											opcua_builtInDatatypes.h\
+#											opcua_binaryEncDec.h\
+#											opcua_transportLayer.h\
+#											opcua_advancedDatatypes.h\
+#											opcua_types.h\
+#											opcua_connectionHelper.h\
+#											tcp_layer.h
+
+#lib_LTLIBRARIES = libstack.la
+#libstack_la_SOURCES = opcua_transportLayer.c\
+#					  opcua_transportLayer.h\
+#					  opcua_advancedDatatypes.h\
+#					  opcua_connectionHelper.h	
+lib_LTLIBRARIES =libopen62541.la
+libopen62541_la_LDFLAGS = -avoid-version -no-undefined
+libopen62541_la_SOURCES = opcua_builtInDatatypes.c\
+						opcua_binaryEncDec.c\
+						opcua_transportLayer.c\
+						opcua_encodingLayer.c\
+						opcua_secureChannelLayer.c\
+						opcua_builtInDatatypes.h\
+						opcua_binaryEncDec.h\
+						opcua_transportLayer.h\
+						opcua_advancedDatatypes.h\
+						opcua_types.h\
+						opcua_connectionHelper.h\
+						opcua_encodingLayer.h\
+						opcua_secureChannelLayer.h\
+						tcp_layer.h
+
+#bin_PROGRAMS= $(top_builddir)/bin/open62541.out
+#__top_builddir__bin_libOpen62541_out_SOURCES = opcuaServer.c
+#libOpen62541_la_LIBADD = ../lib/libOpen62541.la		  										
+

+ 973 - 0
open62541Stack/opcuaserver-1.0/src/opcua_advancedDatatypes.h

@@ -0,0 +1,973 @@
+/*
+ * opcua_advancedDatatypes.h
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_ADVANCEDDATATYPES_H_
+#define OPCUA_ADVANCEDDATATYPES_H_
+
+
+typedef struct AD_RawMessage_t AD_RawMessage;
+
+struct AD_RawMessage_t
+{
+	char *message;
+	UInt32 length;
+};
+
+enum BED_ApplicationType {SERVER_0, CLIENT_1, CLIENTANDSERVER_2, DISCOVERYSERVER_3};
+
+
+/**
+* ApplicationDescription
+* Part: 4
+* Chapter: 7.1
+* Page: 103
+*/
+struct BED_ApplicationDescription
+{
+	UA_String applicationUri;
+	UA_String productUri;
+	UA_LocalizedText applicationName;
+	enum BED_ApplicationType applicationType;
+	UA_String gatewayServerUri;
+	UA_String discoveryProfileUri;
+	UA_String discoverUrls[];
+};
+
+
+/**
+* ApplicationInstanceCertificate
+* Part: 4
+* Chapter: 7.2
+* Page: 104
+*/
+struct BED_ApplicationInstanceCertificate
+{
+	UA_String version;
+	UA_ByteString serialNumber;
+	UA_String signatureAlgorithm;
+	UA_ByteString signature;
+//ToDo	struct issuer				//????????????? S. 108 table 104
+	UA_DateTime validFrom;
+	UA_DateTime valdiTo;
+//ToDo	struct subject;				//????????????? S. 108 table 104
+	UA_String applicationUri;
+	UA_String *hostnames;
+	UA_ByteString pubicKey;
+	UA_String keyUsage[];
+
+};
+
+
+/**
+* BrowseResult
+* Part: 4
+* Chapter: 7.3
+* Page: 104
+*/
+struct BED_BrowseResult
+{
+	UA_StatusCode statusCode;
+//	struct BED_ContinuationPoint continuationPoint;
+//	struct BED_ReferenceDescription references[];
+};
+
+
+/**
+* ContentFilter 						//ToDo
+* Part: 4
+* Chapter: 7.4.1
+* Page: 104
+*/
+struct BED_ContentFilter
+{
+//ToDo	struct BED_ContentFilterElement elements[];		//ToDo
+//ToDo	enum BED_FilterOperand filterOperator;			//ToDo table 110
+//ToDo	struct BED_ExtensibleParamterFilterOperand filterOperands[]; //ToDo 7.4.4
+};
+
+
+/**
+* Counter
+* Part: 4
+* Chapter: 7.5
+* Page: 113
+*/
+typedef UInt32 BED_Counter;
+
+
+/**
+* ContinuationPoint 				//ToDo
+* Part: 4
+* Chapter: 7.6
+* Page: 114
+*/
+struct BED_ContinuationPoint
+{
+};
+
+/**
+* DataValue
+* Part: 4
+* Chapter: 7.7.1
+* Page: 114
+*/
+struct BED_DataValue
+{
+	UA_Variant value;	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+	UA_StatusCode statusCode;
+	UA_DateTime sourceTimestamp;
+//ToDo	UInt					//toBeDiscussed: Resolution of PicoSeconds
+	UA_DateTime serverTimestamp;
+//ToDo	UInt					//toBeDiscussed: Resolution of PicoSeconds
+};
+
+
+/**
+* DiagnosticInfo
+* Part: 4
+* Chapter: 7.9*/
+struct BED_DiagnosticInfo
+{
+//ToDo	struct ???? identifier;				//ToDo: what kind of strcuture?
+	Int32 namespaceUri;
+	Int32 symbolicId;
+	Int32 locale;
+	Int32 localizesText;
+	UA_String additionalInfo;
+	UA_StatusCode innerStatusCode;
+//	struct BED_DiagnosticInfo innerDiagnosticInfo;
+};
+
+
+/**
+* EndpointDescription
+* Part: 4
+* Chapter: 7.9
+* Page: 116
+*/
+struct BED_EndpointDescription
+{
+	UA_String endpointUrl;
+	struct BED_ApplicationDescription server;
+	struct BED_ApplicationInstanceCertificate serverCertificate;
+//	enum BED_MessageSecurityMode securityMode;
+	UA_String securityPolicyUri;
+//	struct BED_UserTokenPolicy useridentyTokens[];
+	UA_String transportProfileUri;
+	Byte securtiyLevel;
+};
+
+/**
+* ExpandedNodeId
+* Part: 4
+* Chapter: 7.10
+* Page: 117
+*/
+struct BED_ExpandedNodeId
+{
+//	BED_Index serverIndex;
+	UA_String namespaceUri;
+//	BED_Index namespaveIndex;
+//ToDo	enum BED_IdentifierType identiferType;		//ToDo: Is the enumeration correct?
+//ToDo	UA_NodeIdentifier identifier;		//ToDo -> Part 3: Address Space Model
+};
+
+
+/**
+* ExtensibleParameter
+* Part: 4
+* Chapter: 7.11
+* Page: 117
+*/
+struct BED_ExtensibleParameter
+{
+//	struct UA_NodeId parameterTypeId;
+//ToDo	-- parameterData;			//toBeDiscussed
+};
+
+
+/**
+* Index
+* Part: 4
+* Chapter: 7.12
+* Page: 118
+*/
+typedef UInt32 BED_Index;
+
+
+/**
+* IntegerId
+* Part: 4
+* Chapter: 7.13
+* Page: 118
+*/
+typedef UInt32 BED_IntegerId;
+
+
+/**
+* MessageSecurityMode
+* Part: 4
+* Chapter: 7.14
+* Page: 118
+*/
+enum BED_MessageSecurityMode
+{
+	INVALID_0 = 0,
+	SIGN_1 = 1,
+	SIGNANDENCRYPT_2 = 2
+};
+
+
+/**
+* MonitoringParameters
+* Part: 4
+* Chapter: 7.15
+* Page: 118
+*/
+struct BED_MonitoringParameters
+{
+	BED_IntegerId clientHandle;
+//ToDo	Duration???? samplingInterval;						//ToDo
+//ToDo	struct BED_ExtensibleParameterMonitoringFilter filter			//ToDo
+	BED_Counter queueSize;
+	Boolean discardOldest;
+};
+
+//->ExtensibleParameter ->Part:4 Chapter:7.11 Page:117
+struct BED_ExtensibleParameterMonitoringFilter		//ToDo: Ist die Umsetzung des ExtensibleParameter korrekt?
+{
+//	enum BED_MonitoringFilter parameterTypeId;
+//	struct BED_DataChangeFilter dataChangeFilter;
+//	struct BED_EventFilter eventFilter;
+//	struct BED_AggregateFilter aggregateFilter;
+};
+
+/**
+* MonitoringFilter parameterTypeIds
+* Part: 4
+* Chapter: 7.16.1
+* Page: 119
+*/
+enum BED_MonitoringFilter
+{
+	DATA_CHANGE_FILTER = 1,
+	EVENT_FILTER = 2,
+	AGGREGATE_FILTER = 3
+};
+
+
+/**
+* DataChangeFilter
+* Part: 4
+* Chapter: 7.16.2
+* Page: 119
+*/
+struct BED_DataChangeFilter
+{
+//ToDo	enum BED_MonitoringFilter trigger = BED_MonitoringFilter.DATA_CHANGE_FILTER;
+	UInt32 deadbandType;
+	Double deadbandValue;
+};
+
+
+/**
+* EventFilter
+* Part: 4
+* Chapter: 7.16.3
+* Page: 120
+*/
+struct BED_EventFilter
+{
+//ToDo	SimpleAttributeOperantd selectClauses[]; 		//ToDo
+//ToDo	ContenFilter whereClause;				//ToDo
+};
+
+struct BED_EventFilterResult
+{
+	UA_StatusCode selectClauseResults[3];
+//	struct UA_DiagnosticInfo selectClauseDiagnosticInfos[3];
+//	struct BED_ContentFilterResult whereClauseResult;
+};
+
+
+/**
+* AggregateFilter
+* Part: 4
+* Chapter: 7.16.4
+* Page: 122
+*/
+struct BED_AggregateFilter
+{
+	UA_DateTime startTime;
+//	struct UA_NodeId aggregateType;
+	UA_Duration processingInterval;
+//ToDo	AggregateConfiguration aggregateConfiguration;		//ToDo
+	Boolean useServerCapabilitiesDafaults;
+	Boolean treatUncertainAsBad;
+	Byte percentDataBad;
+	Byte percentDataGood;
+	Boolean steppedSlopedExtrapolation;
+};
+
+struct BED_AggregateFilterResult
+{
+	UA_DateTime revisedStartTime;
+	UA_Duration revisedProcessingInterval;
+};
+
+
+/**
+* MonitoringMode
+* Part: 4
+* Chapter: 7.17
+* Page: 123
+*/
+enum BED_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.
+};
+
+
+/**
+* NodeAttributes parameters
+* Part: 4
+* Chapter: 7.18.1
+* Page: 124
+*/
+enum BED_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.
+};
+
+enum BED_NodeAttributesBitMask
+{
+	AccessLevel = 1, 	//Bit: 0 Indicates if the AccessLevel Attribute is set.
+	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.
+	//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.
+	//Reserved		//Bit:22:32 Reserved for future use. Shall always be zero.
+};
+
+
+/**
+* ObjectAttributes parameters
+* Part: 4
+* Chapter: 7.18.2
+* Page: 125
+*/
+struct BED_ObjectAttributes
+{
+	UInt32 specifiedAttribute;	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Byte eventNotifier;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* VariableAttributes parameters
+* Part: 4
+* Chapter: 7.18.3
+* Page: 125
+*/
+struct BED_VariableAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+//ToDo	DefinedByTheDataTypeAttribte??? value				//ToDo
+//	struct UA_NodeId dataType;
+	Int32 valueRank;
+//	UInt32 arrayDimensions[];
+	Byte accessLevel;
+	Byte userAccesLevel;
+//ToDo	Duration???? minimumSamplingInterval;			//ToDo
+	Boolean historizing;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* MethodAttributes parameters
+* Part: 4
+* Chapter: 7.18.4
+* Page: 125
+*/
+struct BED_MethodAttributes
+{
+	UInt32 specifiedAttributes;	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean executable;
+	Boolean userExecutable;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* ObjectTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.5
+* Page: 125
+*/
+struct BED_ObjectTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	UInt32 wirteMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* VariableTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.6
+* Page: 126
+*/
+struct BED_VariableTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+//ToDo	DefinedByTheDataTypeAttribte??? value			//ToDo
+//	struct UA_NodeId dataType;
+	Int32 valueRank;
+//	UInt32 arrayDimesions[];
+	Boolean isAbstract;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* ReferenceTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.7
+* Page: 126
+*/
+struct BED_ReferenceTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	Boolean symmetric;
+//	struct UA_LocalizedText inverseName;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+
+/**
+* DataTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.8
+* Page: 126
+*/
+struct BED_DataTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+
+/**
+* ViewAttributes parameters
+* Part: 4
+* Chapter: 7.18.9
+* Page: 127
+*/
+struct BED_ViewAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean containsNoLoops;
+	Byte eventNotifier;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* NotificationData parameters
+* Part: 4
+* Chapter: 7.19
+* Page: 127
+*/
+enum BED_NotificationDataParameterTypeIds
+{
+	DATA_CHANGE = 1,
+	EVENT = 2,
+	STATUS_CHANGE = 3
+};
+
+
+/**
+* DataChangeNotification parameter
+* Part: 4
+* Chapter: 7.19.2
+* Page: 127
+*/
+struct BED_DataChangeNotification
+{
+//ToDo	struct BED_MonitoredItemNotification monitoredItems[];		//ToDo
+	BED_IntegerId clientHandle;
+//	struct UA_DataValue value;
+	UA_DiagnosticInfo diagnositcInfos[];
+};
+
+
+/**
+* EventNotificationList parameter
+* Part: 4
+* Chapter: 7.19.3
+* Page: 128
+*/
+struct BED_EventNotificationList
+{
+//ToDo	struct EventFieldList events[];			//ToDo
+	BED_IntegerId clientHandle;
+	UA_Variant eventFields[];	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+};
+
+
+/**
+* StatusChangeNotification parameter
+* Part: 4
+* Chapter: 7.19.4
+* Page: 128
+*/
+struct BED_StatusChangeNotification
+{
+	UA_StatusCode status;
+//	struct UA_DiagnosticInfo diagnosticInfo;
+};
+
+
+/**
+* NotificationMessage
+* Part: 4
+* Chapter: 7.20
+* Page: 129
+*/
+struct BED_NotificationMessage
+{
+	BED_Counter sequenceNumber;
+//	struct UA_DateTime publishTime;
+//	struct ExtensibleParameterNotificationData notificationData[];
+};
+
+//->ExtensibleParameter ->Part:4 Chapter:7.11 Page:117
+struct ExtensibleParameterNotificationData 		//ToDo: Ist die Umsetzung des ExtensibleParameter korrekt?
+{
+	enum BED_NotificationDataParameterTypeIds parameterTypeId;
+	struct BED_DataChangeNotification dataChange;
+	struct BED_EventNotificationList event;
+	struct BED_StatusChangeNotification statusChange;
+};
+
+
+/**
+* NumericRange
+* Part: 4
+* Chapter: 7.21
+* Page: 129
+*/
+typedef UA_String NumericRange;
+
+
+/**
+* QueryDataSet
+* Part: 4
+* Chapter: 7.22
+* Page: 130
+*/
+/*
+struct BED_QueryDataSet
+{
+//	struct UA_ExpandedNodeId nodeId;
+//	struct UA_ExpandedNodeId typeDefinitionNode;
+//	struct UA_Variant values[];	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+};
+*/
+
+/**
+* ReadValueId
+* Part: 4
+* Chapter: 7.23
+* Page: 130
+*/
+struct BED_QueryDataSet
+{
+//	struct UA_NodeId nodeId;
+	BED_IntegerId attributeId;
+//	struct BED_NumericRange indexRange;
+//	struct UA_QualifiedName dataEncoding;
+};
+
+
+/**
+* ReferenceDescription
+* Part: 4
+* Chapter: 7.24
+* Page: 131
+*/
+struct BED_ReferenceDescription
+{
+//	struct UA_NodeId referenceTypeId;
+	Boolean isForward;
+//	struct UA_ExpandedNodeId nodeId;
+//	struct UA_QualifiedName browseName;
+//	struct UA_LocalizedText displayName;
+//ToDo	struct BED_NodeClass nodeClass;			//ToDo
+//	struct UA_ExpandedNodeId typeDefinition;
+};
+
+
+/**
+* RelativePath
+* Part: 4
+* Chapter: 7.25
+* Page: 131
+*/
+struct BED_RelativePath
+{
+//ToDo	struct BED_RelativePathElement elements[];		//ToDo
+//	struct UA_NodeId referenceTypeId;
+	Boolean isInverse;
+	Boolean includeSubtypes;
+//	struct UA_QualifiedName targetName;
+};
+
+
+/**
+* RequestHeader
+* Part: 4
+* Chapter: 7.26
+* Page: 132
+*/
+struct BED_RequestHeader
+{
+	UA_NodeId authenticationToken;		//ToDo
+	UA_DateTime timestamp;
+	BED_IntegerId requestHandle;
+	UInt32 returnDiagnostics;
+	UA_String auditEntryId;
+	UInt32 timeoutHint;
+	UA_ExtensionObject additionalHeader;
+};
+
+
+enum BED_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
+};
+
+
+/**
+* ResponseHeader
+* Part: 4
+* Chapter: 7.27
+* Page: 133
+*/
+struct BED_ResponseHeader
+{
+	UA_DateTime timestamp;
+	BED_IntegerId requestHandle;
+	UA_StatusCode serviceResult;
+	UA_DiagnosticInfo serviceDiagnostics;
+	UA_String stringTable[];
+//ToDo	struct BED_ExtensibleParameterAdditionalHeader additionalHeader;		//ToDo
+};
+
+
+/**
+* ServiceFault
+* Part: 4
+* Chapter: 7.28
+* Page: 133
+*/
+struct BED_ServiceFault
+{
+	struct BED_ResponseHeader responseHeader;
+};
+
+
+//ToDo: Own DataType with typeDef?
+/**
+* SessionAuthenticationToken
+* Part: 4
+* Chapter: 7.29
+* Page: 133
+*/
+
+
+
+/**
+* SignatureData
+* Part: 4
+* Chapter: 7.30
+* Page: 135
+*/
+struct BED_SignatureData
+{
+	UA_ByteString signature;
+	UA_String agorithm;
+};
+
+
+/**
+* SignedSoftwareCertificate
+* Part: 4
+* Chapter: 7.31
+* Page: 135
+*/
+struct BED_SignedSoftwareCertificate
+{
+	UA_String version;
+	UA_ByteString serialNumber;
+	UA_String signatureAlgorithm;
+	UA_ByteString signature;
+//ToDo	struct issuer 					//ToDo: ??? struct?
+	UA_DateTime validFrom;
+	UA_DateTime validTo;
+//ToDo	struct subject;					//ToDo: ??? struct?
+//ToDo	struct subjectAltName[];			//ToDo: ??? struct?
+	UA_ByteString publicKey;
+//	UA_String keyUsage[];
+	UA_ByteString softwareCertificate;
+};
+
+
+/**
+* SoftwareCertificate
+* Part: 4
+* Chapter: 7.32
+* Page: 135
+*/
+struct BED_SoftwareCertificate
+{
+	UA_String productName;
+	UA_String productUri;
+	UA_String vendorName;
+	UA_ByteString vendorProductCertificate;
+	UA_String softwareVersion;
+	UA_String buildNumber;
+	UA_DateTime buildDate;
+	UA_String issuedBy;
+	UA_DateTime issueDate;
+//	UA_ByteString vendorProductCertificate;
+//	struct BED_SupportedProfiles supportedProfiles;
+};
+
+struct BED_SupportedProfiles
+{
+	UA_String oranizationUri;
+	UA_String profileId;
+	UA_String complianceTool;
+	UA_DateTime complianceDate;
+//	enum BED_ComplianceLevel complianceLevel;
+	UA_String unsupportedUnitIds[];
+};
+
+enum BED_ComplianceLevel
+{
+	UNTESTED_0 = 0,		//the profiled capability has not been tested successfully.
+	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
+				//self-test system authorized by the certifying authority.
+	CERTIFIED_3 = 3		//the profiled capability has been successfully tested by a
+				//testing organisation authorized by the certifying authority.
+};
+
+
+/**
+* StatusCode					//ToDo: Do we need them? How do we implement them (enum)?
+* Part: 4
+* Chapter: 7.33
+* Page: 136
+*/
+
+
+/**
+* TimestampsToReturn
+* Part: 4
+* Chapter: 7.34
+* Page: 140
+*/
+enum BED_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.
+			//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.
+			//If used in HistoryRead the source timestamp is used to determine which historical data values are returned.
+	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.
+};
+
+
+/**
+* UserIdentityToken Encrypted Token Format
+* Part: 4
+* Chapter: 7.35.1
+* Page: 140
+*/
+struct BED_UserIdentityTokenEncryptedTokenFormat
+{
+	Byte length[4];
+//	Byte tokenData[];
+//	Byte serverNonce[];
+};
+
+
+/**
+* AnonymousIdentityToken
+* Part: 4
+* Chapter: 7.35.2
+* Page: 141
+*/
+struct BED_AnonymousIdentityToken
+{
+	UA_String policyId;
+};
+
+
+/**
+* UserNameIdentityToken
+* Part: 4
+* Chapter: 7.35.3
+* Page: 141
+*/
+struct BED_UserNameIdentityToken
+{
+	UA_String policyId;
+	UA_String userName;
+	UA_ByteString password;
+	UA_String encryptionAlogrithm;
+};
+
+
+/**
+* X509IdentityTokens
+* Part: 4
+* Chapter: 7.35.4
+* Page: 141
+*/
+struct BED_X509IdentityTokens
+{
+	UA_String policyId;
+	UA_ByteString certificateData;
+};
+
+
+/**
+* IssuedIdentityToken
+* Part: 4
+* Chapter: 7.35.5
+* Page: 142
+*/
+struct BED_IssuedIdentityToken
+{
+	UA_String policyId;
+	UA_ByteString tokenData;
+	UA_String encryptionAlgorithm;
+};
+
+
+
+enum BED_UserIdentityTokenType
+{
+	ANONYMOUS_0 = 0,
+	USERNAME_1 = 1,
+	CERTIFICATE_2 = 2,
+	ISSUEDTOKEN_3 = 3
+};
+
+/**
+* UserTokenPolicy
+* Part: 4
+* Chapter: 7.36
+* Page: 142
+*/
+struct BED_UserTokenPolicy
+{
+	UA_String policyId;
+	enum BED_UserIdentityTokenType tokenType;
+	UA_String issuedTokenType;
+	UA_String issuerEndpointUrl;
+	UA_String securityPolicyUri;
+};
+
+/**
+* ViewDescription
+* Part: 4
+* Chapter: 7.37
+* Page: 143
+*/
+struct BED_ViewDescription
+{
+//	struct UA_NodeId viewId;
+	UA_DateTime timestamp;
+	UInt32 viewVersion;
+};
+
+
+#endif /* OPCUA_ADVANCEDDATATYPES_H_ */

+ 188 - 0
open62541Stack/opcuaserver-1.0/src/opcua_binaryEncDec.c

@@ -0,0 +1,188 @@
+/*
+ * opcua_binaryEncDec.c
+ *
+ *  Created on: Dec 18, 2013
+ *      Author: opcua
+ */
+
+#include "opcua_binaryEncDec.h"
+#include "opcua_types.h"
+
+
+Byte decodeByte(const char *buf, Int32 *pos)
+{
+	*pos = (*pos) + 1;
+	return (Byte) buf[(*pos)-1];
+
+}
+void encodeByte(Byte encodeByte, Int32 *pos, AD_RawMessage *dstBuf)
+{
+	dstBuf->message[*pos] = encodeByte;
+	*pos = (*pos) + 1;
+
+}
+
+UInt16 decodeUInt16(const char* buf, Int32 *pos)
+{
+
+	Byte t1 = buf[*pos];
+	UInt16 t2 = (UInt16) (buf[*pos + 1] << 8);
+	*pos += 2;
+	return t1 + t2;
+}
+
+void encodeUInt16(UInt16 value, Int32 *pos, AD_RawMessage *dstBuf)
+{
+	memcpy(dstBuf->message, &value, sizeof(UInt16));
+	*pos = (*pos) + sizeof(UInt16);
+
+}
+
+Int16 decodeInt16(const char* buf, Int32 *pos)
+{
+
+	Byte t1 = buf[*pos];
+	Int32 t2 = (Int16) (buf[*pos + 1] << 8);
+	*pos += 2;
+	return t1 + t2;
+}
+Int32 decodeInt32(const char* buf, Int32 *pos)
+{
+
+	SByte t1 = buf[*pos];
+	Int32 t2 = (UInt32) (buf[*pos + 1] << 8);
+	Int32 t3 = (UInt32) (buf[*pos + 2] << 16);
+	Int32 t4 = (UInt32) (buf[*pos + 3] << 24);
+	*pos += 4;
+	return t1 + t2 + t3 + t4;
+}
+
+
+UInt32 decodeUInt32(const char* buf, Int32 *pos)
+{
+	Byte t1 = buf[*pos];
+	UInt32 t2 = (UInt32) (buf[*pos + 1] << 8);
+	UInt32 t3 = (UInt32) (buf[*pos + 2] << 16);
+	UInt32 t4 = (UInt32) (buf[*pos + 3] << 24);
+	*pos += 4;
+	return t1 + t2 + t3 + t4;
+}
+
+void encodeUInt32(UInt32 value, char *dstBuf, Int32 *pos)
+{
+	memcpy(&(dstBuf[*pos]), &value, sizeof(value));
+	pos += 4;
+
+}
+
+
+Int64 decodeInt64(const char* buf, Int32 *pos)
+{
+
+	SByte t1 = buf[*pos];
+	UInt64 t2 = (UInt64) (buf[*pos + 1] << 8);
+	UInt64 t3 = (UInt64) (buf[*pos + 2] << 16);
+	UInt64 t4 = (UInt64) (buf[*pos + 3] << 24);
+	UInt64 t5 = (UInt64) (buf[*pos + 4] << 32);
+	UInt64 t6 = (UInt64) (buf[*pos + 5] << 40);
+	UInt64 t7 = (UInt64) (buf[*pos + 6] << 48);
+	UInt64 t8 = (UInt64) (buf[*pos + 7] << 56);
+	pos += 8;
+	return t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
+}
+
+Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString)
+{
+
+	dstUAString->Length = decodeInt32(buf, pos);
+	if (dstUAString->Length > 0)
+	{
+		dstUAString->Data = &(buf[*pos]);
+	}
+	else
+	{
+		dstUAString->Length = 0;
+		dstUAString->Data = NULL;
+	}
+	*pos += dstUAString->Length;
+	return 0;
+}
+
+Int32 decodeUAGuid(const char *buf, Int32 *pos, UA_Guid *dstGUID)
+{
+	dstGUID->Data1 = decodeUInt32(buf, pos);
+	dstGUID->Data2 = decodeUInt16(buf, pos);
+	dstGUID->Data3 = decodeUInt16(buf, pos);
+	decodeUAByteString(buf, pos, &(dstGUID->Data4));
+	return 0;
+}
+
+void decodeUAByteString(const char *buf, Int32* pos, UA_ByteString *dstBytestring)
+{
+
+	decodeUAString(buf,pos,dstBytestring->Data);
+}
+
+UA_DateTime decodeUADateTime(const char *buf, Int32 *pos)
+{
+	return decodeInt64(buf, pos);
+}
+
+UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos)
+{
+	return decodeUInt32(buf, pos);
+}
+
+Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId)
+{
+
+	dstNodeId->EncodingByte = decodeInt32(buf, pos);
+
+
+	switch (dstNodeId->EncodingByte)
+	{
+	case NIEVT_TWO_BYTE:
+	{
+
+		dstNodeId->Identifier.Numeric = decodeByte(buf, pos);
+		break;
+	}
+	case NIEVT_FOUR_BYTE:
+	{
+		dstNodeId->Identifier.Numeric = decodeInt16(buf, pos);
+		break;
+	}
+	case NIEVT_NUMERIC:
+	{
+
+		dstNodeId->Identifier.Numeric = decodeInt32(buf, pos);
+		break;
+	}
+	case NIEVT_STRING:
+	{
+		decodeUAString(buf, pos, &dstNodeId->Identifier.String);
+		break;
+	}
+	case NIEVT_GUID:
+	{
+		decodeUAGuid(buf, pos, &(dstNodeId->Identifier.Guid));
+		break;
+	}
+	case NIEVT_BYTESTRING:
+	{
+
+		decodeUAByteString(buf, pos,&(dstNodeId->Identifier.OPAQUE));
+		break;
+	}
+	case NIEVT_NAMESPACE_URI_FLAG:
+	{
+		//TODO implement
+		break;
+	}
+	default:
+
+		break;
+	}
+	return 0;
+}
+

+ 125 - 0
open62541Stack/opcuaserver-1.0/src/opcua_binaryEncDec.h

@@ -0,0 +1,125 @@
+/*
+ * opcua_BinaryEncDec.h
+ *
+ *  Created on: Dec 18, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_BINARYENCDEC_NEU_H_
+#define OPCUA_BINARYENCDEC_NEU_H_
+
+#include "opcua_builtInDatatypes.h"
+
+#include "opcua_advancedDatatypes.h"
+
+
+
+//functions
+/**
+ *
+ * @param buf  			binary encoded message
+ * @param pos  			position at which the data is located in/out, parser position after the conversion
+ * @return
+ */
+Byte decodeByte(const char* buf, Int32 *pos);
+
+/**
+ *
+ * @param encodeByte 	byte that should be encoded
+ * @param pos 			position at which the data is located in/out, parser position after the conversion
+ * @param dstBuf		rawMessage where the Byte is encoded in
+ */
+void encodeByte(Byte encodeByte, Int32 *pos, AD_RawMessage *dstBuf);
+
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Int16 decodeInt16(const char* buf, Int32 *pos);
+
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeUInt16(UInt16 value, Int32 *pos, AD_RawMessage *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+UInt16 decodeUInt16(const char* buf, Int32 *pos);
+/**
+ *
+ * @param buf  			binary encoded message
+ * @param pos  			position at which the data is located in/out, parser position after the conversion
+ * @return
+ */
+Int32 decodeInt32(const char* buf, Int32 *pos);
+
+/**
+ *
+ * @param buf  			binary encoded message
+ * @param pos  			position at which the data is located in/out, parser position after the conversion
+ * @return				encoded data
+ */
+UInt32 decodeUInt32(const char* buf, Int32 *pos);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Int64 decodeInt64(const char* buf, Int32 *pos);
+/**
+ *
+ * @param buf  			binary encoded message
+ * @param pos  			position at which the data is located in/out, parser position after the conversion
+ * @param dstNodeId		receiver of the nodeid structure
+ * @param return		success = 0
+ */
+Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dstGUID
+ * @return
+ */
+Int32 decodeUAGuid(const char *buf, Int32 *pos, UA_Guid *dstGUID);
+
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+UA_DateTime decodeUADateTime(const char *buf, Int32 *pos);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dstUAString
+ * @return
+ */
+Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString);
+/**
+ *
+ * @param value
+ * @param dstBuf
+ * @param pos
+ */
+void encodeUInt32(UInt32 value, char *dstBuf, Int32 *pos);
+
+#endif /* OPCUA_BINARYENCDEC_NEU_H_ */

+ 11 - 0
open62541Stack/opcuaserver-1.0/src/opcua_builtInDatatypes.c

@@ -0,0 +1,11 @@
+/*
+ * opcua_BuiltInDatatypes.c
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+
+#include "opcua_builtInDatatypes.h"
+
+

+ 493 - 0
open62541Stack/opcuaserver-1.0/src/opcua_builtInDatatypes.h

@@ -0,0 +1,493 @@
+/*
+ * OPCUA_builtInDatatypes.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+#include <stdint.h>
+#include <string.h>
+#ifndef OPCUA_BUILTINDATATYPES_H_
+#define OPCUA_BUILTINDATATYPES_H_
+
+/**
+* Enumerations:
+*	All Enumerations should be encoded as Int32 values
+*
+*
+*/
+
+typedef enum _UA_BuiltInDataTypes
+{
+	BOOLEAN = 	1,
+	SBYTE = 	2,
+	BYTE = 		3,
+	INT16 = 	4,
+	UINT16 = 	5,
+	INT32 = 	6,
+	UINT32 = 	7,
+	INT64 = 	8,
+	UINT64 = 	9,
+	FLOAT = 	10,
+	DOUBLE = 	11,
+	STRING = 	12,
+	DATE_TIME = 13,
+	GUID = 		14,
+	BYTE_STRING = 		15,
+	XML_ELEMENT = 		16,
+	NODE_ID = 			17,
+	EXPANDED_NODE_ID = 	18,
+	STATUS_CODE = 		19,
+	QUALIFIED_NAME = 	20,
+	LOCALIZED_TEXT = 	21,
+	EXTENSION_OBJECT = 	22,
+	DATA_VALUE = 		23,
+	VARIAN = 			24,
+	DIAGNOSTIC_INFO = 	25
+}
+UA_BuiltInDataTypes;
+
+
+/**
+* BasicBuiltInDatatypes
+* Part: 6
+* Chapter: 5.2.2.1 - 5.2.2.3
+* Page: 15
+*/
+typedef _Bool Boolean;
+
+typedef int8_t SByte;
+
+typedef uint8_t Byte;
+
+typedef int16_t Int16;
+
+typedef uint16_t UInt16;
+
+typedef int32_t Int32;
+
+typedef uint32_t UInt32;
+
+typedef int64_t Int64;
+
+typedef uint64_t UInt64;
+
+typedef float Float;
+
+typedef double Double;
+
+
+/**
+* String
+* Part: 6
+* Chapter: 5.2.2.4
+* Page: 16
+*/
+typedef struct _UA_String
+{
+	int Length;
+	char *Data;
+}
+UA_String;
+
+/**
+* DateTime
+* Part: 6
+* Chapter: 5.2.2.5
+* Page: 16
+*/
+typedef Int64 UA_DateTime; //100 nanosecond resolution
+			      //start Date: 1601-01-01 12:00 AM
+
+
+
+
+
+
+/*
+* ByteString
+* Part: 6
+* Chapter: 5.2.2.7
+* Page: 17
+*/
+typedef struct _UA_ByteString
+{
+	Int32 Length;
+	Byte *Data;
+}
+UA_ByteString;
+
+/* GuidType
+* Part: 6
+* Chapter: 5.2.2.6
+* Page: 17
+*/
+typedef struct _UA_Guid
+{
+	UInt32 Data1;
+	UInt16 Data2;
+	UInt16 Data3;
+	UA_ByteString Data4;
+}
+UA_Guid;
+/**
+* XmlElement
+* Part: 6
+* Chapter: 5.2.2.8
+* Page: 17
+*/
+//Überlegung ob man es direkt als ByteString speichert oder als String
+typedef struct _UA_XmlElement
+{
+	UA_String Data;
+}
+UA_XmlElement;
+
+
+typedef struct _UA_XmlElementEncoded
+{
+	UInt32 Length;
+	Byte StartTag[3];
+	Byte *Message;
+	UInt32 EndTag[4];
+}
+UA_XmlElementEncoded;
+
+
+/**
+ * NodeIds
+* Part: 6
+* Chapter: 5.2.2.9
+* Page: 17
+*/
+typedef enum _UA_IdentifierType
+{
+	// Some Values are called the same as previouse Enumerations so we need
+	//names that are unique
+	IT_NUMERIC = 0,
+	IT_STRING = 1,
+	IT_GUID = 2,
+	IT_OPAQUE = 3
+}
+UA_IdentifierType;
+
+typedef enum _UA_NodeIdEncodingValuesType
+{
+	// Some Values are called the same as previous Enumerations so we need
+	// names that are unique
+	NIEVT_TWO_BYTE = 	0x00,
+	NIEVT_FOUR_BYTE = 	0x01,
+	NIEVT_NUMERIC = 	0x02,
+	NIEVT_STRING = 		0x03,
+	NIEVT_GUID = 		0x04,
+	NIEVT_BYTESTRING = 	0x05,
+	NIEVT_NAMESPACE_URI_FLAG = 	0x80, 	//Is only for ExpandedNodeId required
+	NIEVT_SERVERINDEX_FLAG = 	0x40 	//Is only for ExpandedNodeId required
+}
+UA_NodeIdEncodingValuesType;
+
+/**
+* NodeId
+*/
+typedef struct _UA_NodeId
+{
+	Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
+	UInt16 Namespace;
+
+    union
+    {
+        UInt32 Numeric;
+        UA_String String;
+        UA_Guid Guid;
+        UA_ByteString OPAQUE;
+    }
+    Identifier;
+
+}
+UA_NodeId;
+
+
+/**
+* ExpandedNodeId
+* Part: 6
+* Chapter: 5.2.2.10
+* Page: 19
+*/
+typedef struct _UA_ExpandedNodeId
+{
+	Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
+	UInt16 Namespace;
+	UInt32 ServerIndex;
+
+    union
+    {
+        UInt32 Numeric;
+        UA_String String;
+        UA_Guid Guid;
+        UA_ByteString ByteString;
+    }
+    Identifier;
+}
+UA_ExpandedNodeId;
+
+
+/**
+* StatusCodeBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.11
+* Page: 20
+*/
+typedef UInt32 UA_StatusCode;
+
+
+/**
+* DiagnoticInfoBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.12
+* Page: 20
+*/
+typedef struct _UA_DiagnosticInfo
+{
+	Byte EncodingMask; //Type of the Enum UA_DiagnosticInfoEncodingMaskType
+	Int32 SymbolicId;
+	Int32 NamespaceUri;
+	Int32 LocalizedText;
+	Int32 Locale;
+	UA_String AdditionalInfo;
+	UA_StatusCode InnerStatusCode;
+	struct _UA_DiagnosticInfo* InnerDiagnosticInfo;
+}
+UA_DiagnosticInfo;
+
+typedef enum _UA_DiagnosticInfoEncodingMaskType
+{
+	// Some Values are called the same as previouse Enumerations so we need
+	//names that are unique
+	DIEMT_SYMBOLIC_ID = 			0x01,
+	DIEMT_NAMESPACE = 				0x02,
+	DIEMT_LOCALIZED_TEXT = 			0x04,
+	DIEMT_LOCATE = 					0x08,
+	DIEMT_ADDITIONAL_INFO = 		0x10,
+	DIEMT_INNER_STATUS_CODE = 		0x20,
+	DIEMT_INNER_DIAGNOSTIC_INFO = 	0x40
+}
+UA_DiagnosticInfoEncodingMaskType;
+
+
+/**
+* QualifiedNameBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.13
+* Page: 20
+*/
+typedef struct _UA_QualifiedName
+{
+	UInt16 NamespaceIndex;
+	UInt16 Reserved;
+	UA_String Name;
+}
+UA_QualifiedName;
+
+
+/**
+* LocalizedTextBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.14
+* Page: 21
+*/
+typedef struct _UA_LocalizedText
+{
+	Byte EncodingMask;
+	UA_String Locale;
+	UA_String Test;
+}
+UA_LocalizedText;
+
+typedef enum _UA_LocalizedTextEncodingMaskType
+{
+	LTEMT_SYMBOLIC_ID = 0x01,
+	LTEMT_NAMESPACE = 	0x02
+}
+UA_LocalizedTextEncodingMaskType;
+
+
+/**
+* ExtensionObjectBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.15
+* Page: 21
+*/
+typedef struct _UA_ExtensionObject
+{
+	UA_NodeId TypeId;
+	Byte Encoding; //Type of the Enum UA_ExtensionObjectEncodingMaskType
+	Int32 Length;
+	Byte *Body;
+}
+UA_ExtensionObject;
+
+typedef enum _UA_ExtensionObjectEncodingMaskType
+{
+	NO_BODY_IS_ENCODED = 	0x00,
+	BODY_IS_BYTE_STRING = 	0x01,
+	BODY_IS_XML_ELEMENT = 	0x02
+}
+UA_ExtensionObjectEncodingMaskType;
+
+
+/**
+* VariantBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.16
+* Page: 22
+*/
+struct _UA_DataValue;
+struct _UA_Variant;
+typedef union _UA_VariantArrayUnion
+{
+    void*              Array;
+    Boolean*           BooleanArray;
+    SByte*             SByteArray;
+    Byte*              ByteArray;
+    Int16*             Int16Array;
+    UInt16*            UInt16Array;
+    Int32*             Int32Array;
+    UInt32*            UInt32Array;
+    Int64*             Int64Array;
+    UInt64*            UInt64Array;
+    Float*             FloatArray;
+    Double*            DoubleArray;
+    UA_String*            StringArray;
+    UA_DateTime*          DateTimeArray;
+    UA_Guid*              GuidArray;
+    UA_ByteString*        ByteStringArray;
+    UA_ByteString*        XmlElementArray;
+    UA_NodeId*            NodeIdArray;
+    UA_ExpandedNodeId*    ExpandedNodeIdArray;
+    UA_StatusCode*        StatusCodeArray;
+    UA_QualifiedName*     QualifiedNameArray;
+    UA_LocalizedText*     LocalizedTextArray;
+    UA_ExtensionObject*   ExtensionObjectArray;
+    struct _UA_DataValue* DataValueArray;
+    struct _UA_Variant*   VariantArray;
+}
+UA_VariantArrayUnion;
+
+typedef struct _UA_VariantArrayValue
+{
+    Int32  Length;
+    UA_VariantArrayUnion Value;
+}
+UA_VariantArrayValue;
+
+typedef struct _UA_VariantMatrixValue
+{
+    Int32 NoOfDimensions;
+    Int32* Dimensions;
+    UA_VariantArrayUnion Value;
+}
+UA_VariantMatrixValue;
+
+typedef union _UA_VariantUnion
+{
+    Boolean Boolean;
+    SByte SByte;
+    Byte Byte;
+    Int16 Int16;
+    UInt16 UInt16;
+    Int32 Int32;
+    UInt32 UInt32;
+    Int64 Int64;
+    UInt64 UInt64;
+    Float Float;
+    Double Double;
+    UA_DateTime DateTime;
+    UA_String String;
+    UA_Guid* Guid;
+    UA_ByteString ByteString;
+    UA_XmlElement XmlElement;
+    UA_NodeId* NodeId;
+    UA_ExpandedNodeId* ExpandedNodeId;
+    UA_StatusCode StatusCode;
+    UA_QualifiedName* QualifiedName;
+    UA_LocalizedText* LocalizedText;
+    UA_ExtensionObject* ExtensionObject;
+    struct _UA_DataValue* DataValue;
+    UA_VariantArrayValue  Array;
+    UA_VariantMatrixValue Matrix;
+}
+UA_VariantUnion;
+
+typedef struct _UA_Variant
+{
+	Byte EncodingMask; //Type of Enum UA_VariantTypeEncodingMaskType
+	Int32 ArrayLength;
+	UA_VariantUnion *Value;
+}
+UA_Variant;
+
+typedef enum _UA_VariantTypeEncodingMaskType
+{
+	//Bytes 0:5	HEX 0x00 - 0x20
+	VTEMT_BOOLEAN = 			1,
+	VTEMT_SBYTE = 				2,
+	VTEMT_BYTE = 				3,
+	VTEMT_INT16 = 				4,
+	VTEMT_UINT16 = 				5,
+	VTEMT_INT32 = 				6,
+	VTEMT_UINT32 = 				7,
+	VTEMT_INT64 = 				8,
+	VTEMT_UINT64 = 				9,
+	VTEMT_FLOAT = 				10,
+	VTEMT_DOUBLE = 				11,
+	VTEMT_STRING = 				12,
+	VTEMT_DATE_TIME = 			13,
+	VTEMT_GUID = 				14,
+	VTEMT_BYTE_STRING = 		15,
+	VTEMT_XML_ELEMENT = 		16,
+	VTEMT_NODE_ID = 			17,
+	VTEMT_EXPANDED_NODE_ID = 	18,
+	VTEMT_STATUS_CODE = 		19,
+	VTEMT_QUALIFIED_NAME = 		20,
+	VTEMT_LOCALIZED_TEXT = 		21,
+	VTEMT_EXTENSION_OBJECT = 	22,
+	VTEMT_DATA_VALUE = 			23,
+	VTEMT_VARIANT = 			24,
+	VTEMT_DIAGNOSTIC_INFO = 	25,
+	//Byte 6
+	VTEMT_ARRAY_DIMENSIONS_ENCODED = 	0x40,
+	//Byte 7
+	VTEMT_ARRAY_VALUE_ENCODED = 		0x80,
+}
+UA_VariantTypeEncodingMaskType;
+
+
+/**
+* DataValueBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.17
+* Page: 23
+*/
+typedef struct _UA_DataValue
+{
+	Byte EncodingMask;
+	UA_Variant Value;
+	UA_StatusCode Status;
+	UA_DateTime SourceTimestamp;
+	Int16 SourcePicoseconds;
+	UA_DateTime ServerTimestamp;
+	Int16 ServerPicoseconds;
+}
+UA_DataValue;
+
+typedef UInt32 IntegerId;
+
+
+/**
+* Duration
+* Part: 3
+* Chapter: 8.13
+* Page: 74
+*/
+typedef double UA_Duration;
+
+#endif /* OPCUA_BUILTINDATATYPES_H_ */

+ 79 - 0
open62541Stack/opcuaserver-1.0/src/opcua_connectionHelper.h

@@ -0,0 +1,79 @@
+/*
+ * opcua_connectionHelper.h
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_CONNECTIONHELPER_H_
+#define OPCUA_CONNECTIONHELPER_H_
+#include "opcua_builtInDatatypes.h"
+#include "opcua_types.h"
+
+enum packetType
+{
+	packetType_HEL,
+	packetType_ACK,
+	packetType_ERR,
+	packetType_OPN,
+	packetType_MSG,
+	packetType_CLO
+};
+enum connectionState
+{
+	connectionState_CLOSED,
+	connectionState_OPENING,
+	connectionState_ESTABLISHED,
+
+};
+typedef struct
+{
+	UInt32 recvBufferSize;
+	UInt32 sendBufferSize;
+
+	UInt32 protocolVersion;
+	UInt32 maxMessageSize;
+	UInt32 maxChunkCount;
+}TL_buffer;
+
+struct TL_connection
+{
+	Int32 socket;
+	UInt32 connectionState;
+	TL_buffer remoteConf;
+	TL_buffer localConf;
+	UA_String endpointURL;
+};
+
+
+struct SL_connection
+{
+
+	T_ApplicationInstanceCertificate clientCertificate;
+	UInt32 requestType;
+	UA_String secureChannelId;
+	UInt32 UInt32_secureChannelId;
+	UInt32 securityMode;
+	UA_String clientNonce;
+	UA_Duration requestedLifetime; /// life time of the secure channel
+	UA_DateTime requestedAt; /// Point in time in which the secure channel was requested
+	UInt32 connectionState;
+	UInt32 tokenId;
+	UInt32 revisedLifetime;
+};
+
+struct SS_connection
+{
+
+};
+
+typedef struct
+{
+	struct TL_connection transportLayer;
+	struct SL_connection secureLayer;
+	struct SS_connection serviceLayer;
+}UA_connection;
+
+
+
+#endif /* OPCUA_CONNECTIONHELPER_H_ */

+ 89 - 0
open62541Stack/opcuaserver-1.0/src/opcua_encodingLayer.c

@@ -0,0 +1,89 @@
+/*
+ * opcua_encodingLayer.c
+ *
+ *  Created on: Jan 14, 2014
+ *      Author: opcua
+ */
+#include "opcua_encodingLayer.h"
+#include "opcua_binaryEncDec.h"
+#include "opcua_types.h"
+#include "opcua_builtInDatatypes.h"
+
+/**
+ * IntegerId
+ * Part: 4
+ * Chapter: 7.13
+ * Page: 118
+ */
+T_IntegerId decodeIntegerId(char* buf, Int32 *pos)
+{
+	return decodeUInt32(buf, pos);
+}
+
+/**
+ * DiagnosticInfo
+ * Part: 4
+ * Chapter: 7.9
+ * Page: 116
+ */
+Int32 decodeToDiagnosticInfo(char* buf, Int32 *pos, T_DiagnosticInfo* dstDiagnosticInfo)
+{
+
+	dstDiagnosticInfo->namespaceUri = decodeInt32(buf,pos);
+	dstDiagnosticInfo->symbolicId = decodeInt32(buf, pos);
+	dstDiagnosticInfo->locale = decodeInt32(buf, pos);
+	dstDiagnosticInfo->localizesText = decodeInt32(buf, pos);
+
+	decodeUAByteString(buf, pos, dstDiagnosticInfo->additionalInfo);
+	dstDiagnosticInfo->innerStatusCode = decodeUAStatusCode(buf, pos);
+
+	//If the Flag InnerDiagnosticInfo is set, then the DiagnosticInfo will be encoded
+	if ((dstDiagnosticInfo->innerStatusCode & DIEMT_INNER_DIAGNOSTIC_INFO) == 1)
+	{
+		dstDiagnosticInfo->innerDiagnosticInfo = decodeTDiagnosticInfo(buf,
+				pos);
+	}
+
+	return 0;
+}
+
+/**
+ * RequestHeader
+ * Part: 4
+ * Chapter: 7.26
+ * Page: 132
+ */
+
+/** \copydoc decodeRequestHeader */
+Int32 decodeRequestHeader(const AD_RawMessage *srcRaw, Int32 *pos,
+		T_RequestHeader *dstRequestHeader)
+{
+
+	decodeUANodeId(srcRaw->message, pos,&(dstRequestHeader->authenticationToken));
+	dstRequestHeader->timestamp = decodeUADateTime(srcRaw->message, pos);
+	dstRequestHeader->requestHandle = decodeIntegerId(srcRaw->message, pos);
+	dstRequestHeader->returnDiagnostics = decodeUInt32(srcRaw->message, pos);
+	decodeUAString(srcRaw->message, pos, &dstRequestHeader->auditEntryId);
+	dstRequestHeader->timeoutHint = decodeUInt32(srcRaw->message, pos);
+
+
+	// AdditionalHeader will stay empty, need to be changed if there is relevant information
+
+	return 0;
+}
+
+/**
+ * ResponseHeader
+ * Part: 4
+ * Chapter: 7.27
+ * Page: 133
+ */
+/** \copydoc encodeResponseHeader */
+Int32 encodeResponseHeader(const T_ResponseHeader *responseHeader, Int32 *pos, AD_RawMessage *dstBuf)
+{
+
+	return 0;
+}
+
+
+

+ 58 - 0
open62541Stack/opcuaserver-1.0/src/opcua_encodingLayer.h

@@ -0,0 +1,58 @@
+/*
+ * opcua_encodingLayer.h
+ *
+ *  Created on: Jan 14, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_ENCODINGLAYER_H_
+#define OPCUA_ENCODINGLAYER_H_
+
+#include "opcua_builtInDatatypes.h"
+#include "opcua_advancedDatatypes.h"
+#include "opcua_types.h"
+/**
+ * \brief
+ * \param srcRaw             pointer to raw data which holds the encoded data
+ * \param pos
+ * \param dstRequestHeader   pointer to a structure which hold the encoded header
+ * \return                   0 = success
+ */
+Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, T_RequestHeader *dstRequestHeader);
+
+
+
+/**
+ *
+ * @param srcHeader
+ * @param pos
+ * @param dstRaw
+ * @return
+ */
+Int32 encodeRequestHeader(const T_RequestHeader *srcHeader,Int32 *pos,AD_RawMessage *dstRaw);
+
+
+
+/**
+ *
+ * @param srcRaw
+ * @param pos
+ * @param dstResponseHeader
+ * @return
+ */
+Int32 decodeResponseHeader(const AD_RawMessage *srcRaw, Int32 *pos, T_ResponseHeader *dstResponseHeader);
+
+/**
+ *  @brief function to encode a secureChannelRequestHeader
+ *
+ * @param header   a open secure channel header structure which should be encoded to binary format
+ * @param dstBuf   pointer to a structure which hold the encoded header
+ * @return
+ */
+Int32 encodeResponseHeader(const T_ResponseHeader *responseHeader, Int32 *pos, AD_RawMessage *dstBuf);
+
+
+
+
+
+#endif /* OPCUA_ENCODINGLAYER_H_ */

+ 205 - 0
open62541Stack/opcuaserver-1.0/src/opcua_secureChannelLayer.c

@@ -0,0 +1,205 @@
+/*
+ * opcua_secureChannelLayer.c
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+#include "opcua_secureChannelLayer.h"
+
+
+Int32 SL_openSecureChannelRequest_check(const UA_connection *connection, secureChannelMessage)
+{
+	return 0;
+}
+
+
+
+/*
+ * respond the securechannel_open request
+ */
+Int32 SL_secureChannel_ResponseHeader_form(UA_connection *connection, T_ResponseHeader *responseHeader)
+{
+	responseHeader->timestamp = 0;//TODO getCurrentTime();
+	responseHeader->requestHandle = 0;
+	responseHeader->serviceResult = 0; // TODO insert service result code
+
+	responseHeader->serviceDiagnostics.EncodingMask = 0;
+	responseHeader->noOfStringTable = 0;
+
+	responseHeader->additionalHeader.Body = 0;
+	responseHeader->additionalHeader.Encoding = 0;
+	responseHeader->additionalHeader.Length = 0;
+
+	responseHeader->additionalHeader.TypeId.Namespace = 0;
+	responseHeader->additionalHeader.TypeId.Identifier = 0;
+
+
+	responseHeader->requestHandle = 0;
+	return 0;
+}
+/*
+ *
+ */
+Int32 SL_secureChannel_Response_form(UA_connection *connection, SL_Response *response)
+{
+	response->ServerProtocolVersion = connection->transportLayer//TODO must be set
+	response->SecurityToken.ChannelId = connection->secureLayer.UInt32_secureChannelId;
+	response->SecurityToken.CreatedAt = connection->secureLayer.requestedAt;
+	response->SecurityToken.TokenId = connection->secureLayer.tokenId; //TODO  must be generated;
+	response->SecurityToken.RevisedLifeTime = connection->secureLayer.revisedLifetime;
+	response->ServerNonce.Length = 0; // TODO
+	return 0;
+}
+/*
+ * opens a secureChannel (server side)
+ */
+Int32 SL_secureChannel_open(const UA_connection *connection,
+		const AD_RawMessage *secureChannelMessage,
+		const SL_SecureConversationMessageHeader *SCM_Header,
+		const SL_AsymmetricAlgorithmSecurityHeader *AAS_Header)
+{
+	SL_Response response;
+
+
+
+
+	TL_send();
+	//client protocol Version
+
+return 0;
+
+}
+/*
+ void SL_secureChannel_Request_get(AD_RawMessage        *secureChannelMessage,
+ secureChannelRequest *SC_request)
+ {
+
+ }
+
+/*
+ * closes a secureChannel (server side)
+ */
+void SL_secureChannel_formResponse()
+{
+
+}
+void SL_secureChannel_close(UA_connection *connection)
+{
+
+}
+
+/*
+ * receive and process data from underlying layer
+ */
+void SL_receive(UA_connection *connection, AD_RawMessage *serviceMessage)
+{
+	AD_RawMessage* secureChannelMessage;
+	SL_SecureConversationMessageHeader SCM_Header;
+	SL_AsymmetricAlgorithmSecurityHeader AAS_Header;
+	SL_SequenceHeader SequenceHeader;
+
+	//TODO Error Handling, length checking
+	//get data from transport layer
+	TL_receive(UA_connection, secureChannelMessage);
+	Int32 readPosition = 0;
+
+	//get the Secure Channel Message Header
+	SL_secureChannel_SCMHeader_get(connection,secureChannelMessage,
+			&readPosition, &SCM_Header);
+
+	//get the Secure Channel Asymmetric Algorithm Security Header
+	SL_secureChannel_AASHeader_get(connection, secureChannelMessage,
+			&readPosition, &AAS_Header);
+	//get the Sequence Header
+	SL_secureChannel_SequenceHeader_get(connection,secureChannelMessage,
+			readPosition,&SequenceHeader);
+	//get Secure Channel Message
+	SL_secureChannel_Message_get(connection, secureChannelMessage,
+			readPosition,serviceMessage);
+
+	if (secureChannelMessage.length > 0)
+	{
+		switch (SCM_Header.MessageType)
+		{
+		case packetType_MSG:
+			if (connection->secureLayer.connectionState
+					== connectionState_ESTABLISHED)
+			{
+
+			}
+			else //receiving message, without secure channel
+			{
+				//TODO send back Error Message
+			}
+			break;
+		case packetType_OPN:
+			//Server Handling
+			if (openSecureChannelHeader_check(connection, secureChannelMessage))
+			{
+				//check if the request is valid
+				SL_openSecureChannelRequest_check(connection, secureChannelMessage);
+			}
+			SL_secureChannel_open(connection, serviceMessage);
+		}
+		else
+		{
+			//TODO send back Error Message
+		}
+
+		//Client Handling
+
+		//TODO free memory for secureChannelMessage
+
+		break;
+		case packetType_CLO:
+			SL_secureChannel_close(connection, secureChannelMessage);
+
+		//TODO free memory for secureChannelMessage
+		break;
+	}
+
+}
+/*
+ * get the secure channel message header
+ */
+Int32 SL_secureChannel_SCMHeader_get(UA_connection *connection,
+	AD_RawMessage *rawMessage,Int32 *pos, SL_SecureConversationMessageHeader* SC_Header)
+{
+	SC_Header->MessageType = TL_getPacketType(rawMessage);
+	pos += TL_MESSAGE_TYPE_LEN;
+	SC_Header->IsFinal = rawMessage[*pos];
+	SC_Header->MessageSize = decodeUInt32(rawMessage, *pos);
+	SC_Header->SecureChannelId = decodeUInt32(rawMessage, *pos);
+	return 0;
+
+}
+Int32 SL_secureChannel_SequenceHeader_get(UA_connection *connection,
+		AD_RawMessage *rawMessage, Int32 *pos,
+		SL_SequenceHeader *SequenceHeader)
+{
+	SequenceHeader->RequestId = decodeUInt32(rawMessage->message, pos);
+	SequenceHeader->SequenceNumber = decodeUInt32(rawMessage->message, pos);
+	return 0;
+}
+/*
+ * get the asymmetric algorithm security header
+ */
+Int32 SL_secureChannel_AASHeader_get(UA_connection *connection,
+	AD_RawMessage *rawMessage, Int32 *pos,
+	SL_AsymmetricAlgorithmSecurityHeader* AAS_Header)
+{
+	Int32 err = 0;
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->SecurityPolicyUri);
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->SenderCertificate);
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->ReceiverThumbprint);
+	return err;
+}
+void SL_secureChannel_Footer_get()
+{
+
+}
+void SL_secureChannel_Message_get(UA_connection *connection,
+	AD_RawMessage *rawMessage, Int32 *pos, AD_RawMessage *message)
+{
+
+}

+ 78 - 0
open62541Stack/opcuaserver-1.0/src/opcua_secureChannelLayer.h

@@ -0,0 +1,78 @@
+/*
+ * opcua_secureChannelLayer.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_SECURECHANNELLAYER_H_
+#define OPCUA_SECURECHANNELLAYER_H_
+
+#include "opcua_advancedDatatypes.h"
+#include "opcua_encodingLayer.h"
+static const Int32 SL_HEADER_LENGTH = 0;
+typedef struct _SL_ChannelSecurityToken
+{
+	UInt32 ChannelId;
+	UInt32 TokenId;
+	UA_DateTime CreatedAt;
+	Int32 RevisedLifeTime;
+}SL_ChannelSecurityToken;
+
+
+typedef struct _SL_OpenSecureChannelResponse
+{
+	UInt32 ServerProtocolVersion;
+	SL_ChannelSecurityToken SecurityToken;
+	UA_String ServerNonce;
+}SL_Response;
+
+
+typedef struct _SL_SecureConversationMessageHeader
+{
+	UInt32 MessageType;
+	Byte   IsFinal;
+	UInt32 MessageSize;
+	UInt32 SecureChannelId;
+}SL_SecureConversationMessageHeader;
+
+
+typedef struct _SL_AsymmetricAlgorithmSecurityHeader
+{
+	UA_String SecurityPolicyUri;
+	UA_String SenderCertificate;
+	UA_String ReceiverThumbprint;
+}SL_AsymmetricAlgorithmSecurityHeader;
+
+typedef struct _SL_SequenceHeader
+{
+	UInt32 SequenceNumber;
+	UInt32 RequestId;
+}SL_SequenceHeader;
+
+/*
+ * optional, only if there is encryption present
+ */
+typedef struct _SL_AsymmetricAlgorithmSecurityFooter
+{
+	Byte PaddingSize;
+	Byte *Padding;
+
+	UInt32 SignatureSize;
+	Byte *Signature;
+}SL_AsymmetricAlgorithmSecurityFooter;
+
+/*
+typedef struct _SL_ResponseHeader
+{
+	UA_DateTime timestamp;
+    IntegerId requestHandle;
+    UA_StatusCode serviceResult;
+    UA_DiagnosticInfo serviceDiagnostics;
+    UA_String *stringTable;
+    UInt32 stringTableLength;
+    UA_ExtensionObject additionalHeader;
+}SL_ResponseHeader;
+*/
+
+#endif /* OPCUA_SECURECHANNELLAYER_H_ */

+ 314 - 0
open62541Stack/opcuaserver-1.0/src/opcua_transportLayer.c

@@ -0,0 +1,314 @@
+/*
+ * opcua_transportLayer.c
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+#include "opcua_transportLayer.h"
+
+/*
+ * send acknowledge to the client
+ */
+void TL_sendACK(UA_connection *connection)
+{
+	//get memory for message
+	//
+	//build message
+	//connection->transportLayer.localConf.maxChunkCount;
+
+	//call send function
+
+}
+/*
+ * server answer to open message
+ */
+void TL_open(UA_connection *connection, AD_RawMessage *rawMessage)
+{
+	UA_connection tmpConnection;
+	switch(connection->transportLayer.connectionState)
+	{
+		connectionState_CLOSED :
+		{
+			//process the connection values received by the client
+			TL_processHELMessage(&tmpConnection,rawMessage);
+			connection->transportLayer.localConf.protocolVersion = TL_SERVER_PROTOCOL_VERSION;
+
+			connection->transportLayer.localConf.recvBufferSize =
+					tmpConnection.transportLayer.localConf.recvBufferSize;
+
+			connection->transportLayer.localConf.sendBufferSize =
+					tmpConnection.transportLayer.localConf.sendBufferSize;
+
+			connection->transportLayer.localConf.maxMessageSize = TL_SERVER_MAX_MESSAGE_SIZE;
+			connection->transportLayer.localConf.maxChunkCount = TL_SERVER_MAX_CHUNK_COUNT;
+
+		    TL_sendACK(connection);
+			connection->transportLayer.connectionState = connectionState_ESTABLISHED;
+			break;
+		}
+		connectionState_OPENING :
+		{
+		//	TL_sendACK(connection);
+		//	connection->transportLayer.connectionState = connectionState_ESTABLISHED;
+			break;
+		}
+		connectionState_ESTABLISHED :
+		{
+
+			break;
+		}
+	}
+}
+Int32 TL_checkMessage(UA_connection *connection, AD_RawMessage *TL_messsage)
+{
+	Int32 position = 4;
+	TL_getPacketType(TL_messsage);
+
+	Int32 messageLen = decodeUInt32(TL_messsage->message, &position);
+	if (messageLen == TL_messsage->length &&
+		messageLen < (connection->transportLayer.localConf.maxMessageSize))
+	{
+		return 1;
+	}
+	return 0;
+}
+void TL_receive(UA_connection *connection, AD_RawMessage *TL_message)
+{
+	UInt32 bufferSize = connection->transportLayer.localConf.recvBufferSize = 8192;
+	UInt32 length = 0;
+
+	AD_RawMessage tmpRawMessage;
+	struct TL_header tmpHeader;
+	//allocate memory for the message
+//TODO filter double Hello Messages -> generate error message as response
+//TODO build a file which handles the memory allocation
+	tmpRawMessage.message = (char *)malloc(bufferSize);
+
+	if (tmpRawMessage.message != NULL)
+	{
+		//length = tcp_recv(connection, tmpRawMessage.message, bufferSize);
+	}
+
+
+
+	tmpRawMessage.length = length;
+	if(tmpRawMessage.length > 0)
+	{
+		switch(TL_getPacketType(&tmpRawMessage))
+		{
+		packetType_MSG:
+		packetType_OPN:
+		packetType_CLO:
+			//CHECK MESSAGE SIZE
+			if (TL_checkMessage(connection,TL_message))
+			{
+				TL_message->length = tmpRawMessage.length;
+				TL_message->message = tmpRawMessage.message;
+			}
+			else
+			{
+				// SEND BACK ERROR MESSAGE
+			}
+			break;
+		packetType_HEL:
+			TL_message->length = 0;
+			TL_message->message = NULL;
+			TL_open(connection, &tmpRawMessage);
+			break;
+		packetType_ACK:
+			TL_message->length = 0;
+			TL_message->message = NULL;
+			break;
+		packetType_ERR:
+			TL_message->length = 0;
+			TL_message->message = NULL;
+			//TODO ERROR HANDLING
+			break;
+			//TODO ERROR HANDLING
+		}
+		//check in which state the connection is
+
+	}
+
+}
+
+
+/*
+ * get the message header
+ */
+void TL_getMessageHeader(struct TL_header *header, AD_RawMessage *rawMessage)
+{
+	int pos = 0;
+
+	if(rawMessage->message[0] == 'H' &&
+	   rawMessage->message[1] == 'E' &&
+	   rawMessage->message[2] == 'L')
+	{
+		header->MessageType = TL_HEL;
+	}
+	else if(rawMessage->message[0] == 'A' &&
+	        rawMessage->message[1] == 'C' &&
+	        rawMessage->message[2] == 'K')
+	{
+		header->MessageType = TL_ACK;
+	}
+	else if(rawMessage->message[0] == 'E' &&
+			rawMessage->message[1] == 'R' &&
+			rawMessage->message[2] == 'R')
+	{
+		header->MessageType = TL_ERR;
+	}
+	else if(rawMessage->message[0] == 'O' &&
+	        rawMessage->message[1] == 'P' &&
+	        rawMessage->message[2] == 'N')
+	{
+		header->MessageType = TL_OPN;
+	}
+	else if(rawMessage->message[0] == 'C' &&
+	        rawMessage->message[1] == 'L' &&
+	        rawMessage->message[2] == 'O')
+	{
+		header->MessageType = TL_CLO;
+	}
+	else if(rawMessage->message[0] == 'M' &&
+			rawMessage->message[1] == 'S' &&
+			rawMessage->message[2] == 'G')
+	{
+		header->MessageType = TL_MSG;
+	}
+	else
+	{
+		//TODO ERROR no valid message received
+	}
+
+	pos = pos + TL_MESSAGE_TYPE_LEN;
+
+	header->Reserved = decodeByte(rawMessage->message,&pos);
+	pos = pos + TL_RESERVED_LEN;
+	header->MessageSize = decodeUInt32(rawMessage->message,&pos);
+
+}
+Int32 TL_getPacketType(AD_RawMessage *rawMessage)
+{
+	if(rawMessage->message[0] == 'H' &&
+	   rawMessage->message[1] == 'E' &&
+	   rawMessage->message[2] == 'L')
+	{
+		return packetType_HEL;
+	}
+	else if(rawMessage->message[0] == 'A' &&
+	        rawMessage->message[1] == 'C' &&
+	        rawMessage->message[2] == 'K')
+	{
+		return packetType_ACK;
+	}
+	else if(rawMessage->message[0] == 'E' &&
+			rawMessage->message[1] == 'R' &&
+			rawMessage->message[2] == 'R')
+	{
+		return packetType_ERR;
+	}
+	else if(rawMessage->message[0] == 'O' &&
+	        rawMessage->message[1] == 'P' &&
+	        rawMessage->message[2] == 'N')
+	{
+		return packetType_OPN;
+	}
+	else if(rawMessage->message[0] == 'C' &&
+	        rawMessage->message[1] == 'L' &&
+	        rawMessage->message[2] == 'O')
+	{
+		return packetType_CLO;
+	}
+	else if(rawMessage->message[0] == 'M' &&
+			rawMessage->message[1] == 'S' &&
+			rawMessage->message[2] == 'G')
+	{
+		return packetType_MSG;
+	}
+	else
+	{
+		return -1;//TODO ERROR no valid message received
+	}
+}
+void TL_processHELMessage_test()
+{
+	Byte data[] = {0x48,0x45,0x4c,0x46,0x56,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x88,0x13,0x00,0x00,0x36,0x00,0x00,0x00,0x6f,0x70,0x63,0x2e,0x74,0x63,0x70,0x3a,0x2f,0x2f,0x43,0x61,0x6e,0x6f,0x70,0x75,0x73,0x2e,0x70,0x6c,0x74,0x2e,0x72,0x77,0x74,0x68,0x2d,0x61,0x61,0x63,0x68,0x65,0x6e,0x2e,0x64,0x65,0x3a,0x31,0x36,0x36,0x36,0x34,0x2f,0x34,0x43,0x45,0x55,0x41,0x53,0x65,0x72,0x76,0x65,0x72};
+	UA_connection con;
+	AD_RawMessage rawMessage;
+	rawMessage.message = data;
+	rawMessage.length = 86;
+
+
+	struct TL_messageBodyHEL HELmessage;
+
+	struct TL_header header;
+
+	printf("TL_getHELMessage_test");
+
+	header.MessageSize = 86;
+	header.MessageType = TL_HEL; // HEL message
+	header.Reserved = 0x46; // F
+
+	TL_processHELMessage(&con, &rawMessage);
+
+	if(con.transportLayer.remoteConf.protocolVersion == 0 &&
+	   con.transportLayer.remoteConf.recvBufferSize == 65536 &&
+	   con.transportLayer.remoteConf.sendBufferSize == 65536 &&
+	   con.transportLayer.remoteConf.maxMessageSize == 16777216 &&
+	   con.transportLayer.remoteConf.maxChunkCount == 5000)
+	{
+		printf(" - passed \n");
+	}
+	else
+	{
+		printf(" - failed \n");
+	}
+
+
+
+
+}
+/*
+ * gets the TL_messageBody
+ */
+void TL_processHELMessage(UA_connection *connection, AD_RawMessage *rawMessage)
+{
+	UInt32 pos = TL_HEADER_LENGTH;
+	struct TL_header tmpHeader;
+
+	connection->transportLayer.remoteConf.protocolVersion =
+			decodeUInt32(rawMessage->message,&pos);
+	pos = pos + sizeof(UInt32);
+
+	connection->transportLayer.remoteConf.recvBufferSize =
+			decodeUInt32(rawMessage->message,&pos);
+	pos = pos +  sizeof(UInt32);
+
+	connection->transportLayer.remoteConf.sendBufferSize =
+			decodeUInt32(rawMessage->message,&pos);
+	pos = pos +  sizeof(UInt32);
+	connection->transportLayer.remoteConf.maxMessageSize =
+			decodeUInt32(rawMessage->message,&pos);
+	pos = pos +  sizeof(UInt32);
+
+	connection->transportLayer.remoteConf.maxChunkCount =
+			decodeUInt32(rawMessage->message,&pos);
+	pos = pos +  sizeof(UInt32);
+
+	connection->transportLayer.endpointURL.Data = &(rawMessage->message[pos]);
+	connection->transportLayer.endpointURL.Length = tmpHeader.MessageSize - pos;
+}
+/*
+ * respond to client request
+ */
+
+
+TL_send(AD_RawMessage *rawMessage)
+{
+	//call tcp function or callback
+}
+
+
+
+

+ 89 - 0
open62541Stack/opcuaserver-1.0/src/opcua_transportLayer.h

@@ -0,0 +1,89 @@
+/*
+ * opcua_transportLayer.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_TRANSPORTLAYER_H_
+#define OPCUA_TRANSPORTLAYER_H_
+#include <stdio.h>
+
+#include "opcua_binaryEncDec.h"
+#include "opcua_advancedDatatypes.h"
+#include "opcua_connectionHelper.h"
+
+
+//TODO : Implement this interface
+#include "tcp_layer.h"
+
+//constants
+static const UInt32 TL_HEADER_LENGTH = 8;
+static const UInt32 TL_MESSAGE_TYPE_LEN = 3;
+static const UInt32 TL_RESERVED_LEN = 1;
+
+//variables which belong to layer
+static const TL_SERVER_PROTOCOL_VERSION = 0;
+static const TL_SERVER_MAX_CHUNK_COUNT = 1;
+static const TL_SERVER_MAX_MESSAGE_SIZE = 8192;
+
+enum TL_messageType_td
+{
+	TL_HEL,
+	TL_ACK,
+	TL_ERR,
+	TL_OPN,
+	TL_CLO,
+	TL_MSG
+}TL_messageType;
+
+struct TL_header
+{
+	UInt32 MessageType;
+	Byte Reserved;
+	UInt32 MessageSize;
+};
+struct TL_message
+{
+	struct TL_header Header;
+	char *message;
+};
+
+struct TL_messageBodyHEL
+{
+	UInt32 ProtocolVersion;
+	UInt32 ReceiveBufferSize;
+	UInt32 SendBufferSize;
+	UInt32 MaxMessageSize;
+	UInt32 MaxChunkCount;
+	UA_String EndpointUrl;
+};
+
+struct TL_messageBodyACK
+{
+	UInt32 ProtocolVersion;
+	UInt32 ReceiveBufferSize;
+	UInt32 SendBufferSize;
+	UInt32 MaxMessageSize;
+	UInt32 MaxChunkCount;
+	UA_String EndpointUrl;
+};
+
+struct TL_messageBodyERR
+{
+	UInt32 Error;
+	UA_String Reason;
+
+};
+//functions
+void TL_receive(UA_connection *connection, AD_RawMessage *TL_message);
+//Test
+void TL_getMessageHeader_test();
+Int32 TL_getPacketType(AD_RawMessage *rawMessage);
+void TL_getMessageHeader(struct TL_header *messageHeader,AD_RawMessage *rawMessage);
+
+//Test
+void TL_processHELMessage_test();
+
+void TL_processHELMessage(UA_connection *connection, AD_RawMessage *rawMessage);
+#endif /* OPCUA_TRANSPORTLAYER_H_ */

Plik diff jest za duży
+ 1047 - 0
open62541Stack/opcuaserver-1.0/src/opcua_types.h


+ 16 - 0
open62541Stack/opcuaserver-1.0/src/tcp_layer.h

@@ -0,0 +1,16 @@
+/*
+ * tcp_layer.h
+ *
+ *  Created on: Jan 10, 2014
+ *      Author: opcua
+ */
+
+#ifndef TCP_LAYER_H_
+#define TCP_LAYER_H_
+#include "opcua_connectionHelper.h"
+/*
+ * returns the length of read bytes
+ */
+UInt32 receive(UA_connection *connection, AD_RawMessage *message,UInt32 bufferLength);
+
+#endif /* TCP_LAYER_H_ */

+ 8 - 0
open62541Stack/opcuaserver-1.0/tests/Makefile.am

@@ -0,0 +1,8 @@
+TESTS = check_stack
+check_PROGRAMS = check_stack
+check_stack_SOURCES = check_stack.c $(top_builddir)/src/opcua_transportLayer.h\
+						$(top_builddir)/src/opcua_advancedDatatypes.h\
+						$(top_builddir)/src/opcua_connectionHelper.h
+
+check_stack_CFLAGS = @CHECK_CFLAGS@
+check_stack_LDADD = $(top_builddir)/bin/libOpen62541.la @CHECK_LIBS@

+ 208 - 0
open62541Stack/opcuaserver-1.0/tests/check_stack.c

@@ -0,0 +1,208 @@
+/*
+ ============================================================================
+ Name        : opcuaServer.c
+ Author      :
+ Version     :
+ Copyright   : Your copyright notice
+ Description :
+ ============================================================================
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "../src/opcua_transportLayer.h"
+#include "../src/opcua_binaryEncDec.h"
+#include "../src/opcua_encodingLayer.h"
+#include "../src/opcua_advancedDatatypes.h"
+#include "check.h"
+
+START_TEST(test_getPacketType_validParameter)
+{
+
+	char buf[] = {'C','L','O'};
+	AD_RawMessage rawMessage;
+	rawMessage.message = buf;
+	rawMessage.length = 3;
+
+	ck_assert_int_eq(TL_getPacketType(&rawMessage),packetType_CLO);
+
+}
+END_TEST
+
+/*
+START_TEST(decodeRequestHeader_test_validParameter)
+{
+		char testMessage = {0x00,0x00,0x72,0xf1,0xdc,0xc9,0x87,0x0b,
+
+							0xcf,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+							0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,
+							0x00,0x00,0x00,0x00,0x00};
+		AD_RawMessage rawMessage;
+		rawMessage.message = &testMessage;
+		rawMessage.length = 29;
+		Int32 position = 0;
+		T_RequestHeader requestHeader;
+		decodeRequestHeader(rawMessage,&position,&requestHeader);
+
+		ck_assert_int_eq(requestHeader.authenticationToken.EncodingByte,0);
+
+		ck_assert_int_eq(requestHeader.returnDiagnostics,0);
+
+		ck_assert_int_eq(requestHeader.authenticationToken.EncodingByte,0);
+
+}
+END_TEST
+*/
+
+START_TEST(encodeByte_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeByte
+		char *mem = malloc(sizeof(Byte));
+		rawMessage.message = mem;
+		Byte testByte = 0x08;
+		rawMessage.length = 1;
+		position = 0;
+
+		encodeByte(testByte, &position, &rawMessage);
+
+		ck_assert_int_eq(rawMessage.message[0], 0x08);
+		ck_assert_int_eq(rawMessage.length, 1);
+		ck_assert_int_eq(position, 1);
+		free(mem);
+}
+END_TEST
+
+START_TEST(decodeUInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char mem[2] = {0x01,0x00};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 2;
+
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	Int32 p = 0;
+	UInt16 val = decodeUInt16(rawMessage.message,&p);
+	ck_assert_int_eq(val,1);
+	//ck_assert_int_eq(p, 2);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+START_TEST(encodeUInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char *mem = malloc(sizeof(UInt16));
+	rawMessage.message = mem;
+	UInt16 testUInt16 = 1;
+	rawMessage.length = 2;
+	position = 0;
+
+	encodeUInt16(testUInt16, &position, &rawMessage);
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	ck_assert_int_eq(position, 2);
+	Int32 p = 0;
+	Int16 val = decodeUInt16(rawMessage.message,&p);
+	ck_assert_int_eq(val,testUInt16);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+
+
+Suite* TL_testSuite_getPacketType(void)
+{
+	Suite *s = suite_create("getPacketType");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core,test_getPacketType_validParameter);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite* TL_testSuite_decodeUInt16(void)
+{
+	Suite *s = suite_create("decodeUInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeUInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite* TL_testSuite_encodeUInt16(void)
+{
+	Suite *s = suite_create("encodeUInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeUInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite* TL_testSuite_encodeByte(void)
+{
+	Suite *s = suite_create("encodeByte_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeByte_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+/*
+Suite* TL_<TESTSUITENAME>(void)
+{
+	Suite *s = suite_create("<TESTSUITENAME>");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core,<TEST_NAME>);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+*/
+
+int main (void)
+{
+	int number_failed = 0;
+
+	Suite *s = TL_testSuite_getPacketType();
+	SRunner *sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed = srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = TL_testSuite_decodeUInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = TL_testSuite_encodeUInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = TL_testSuite_encodeByte();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	/* <TESTSUITE_TEMPLATE>
+	s =  <TESTSUITENAME>;
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+	*/
+	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+
+}
+
+

+ 69 - 0
open62541Stack/src/Makefile.am

@@ -0,0 +1,69 @@
+
+#__top_builddir__bin_stackTest_out_SOURCES =	opcuaServer.c\
+#											opcua_builtInDatatypes.c\
+#											opcua_binaryEncDec.c\
+#											opcua_transportLayer.c\
+#											opcua_builtInDatatypes.h\
+#											opcua_binaryEncDec.h\
+#											opcua_transportLayer.h\
+#											opcua_advancedDatatypes.h\
+#											opcua_types.h\
+#											opcua_connectionHelper.h\
+#											tcp_layer.h
+
+#lib_LTLIBRARIES = libstack.la
+#libstack_la_SOURCES = opcua_transportLayer.c\
+#					  opcua_transportLayer.h\
+#					  opcua_advancedDatatypes.h\
+#					  opcua_connectionHelper.h	
+lib_LTLIBRARIES = libopen62541.la
+libopen62541_la_LDFLAGS = -avoid-version -no-undefined
+libopen62541_la_SOURCES = opcua_builtInDatatypes.c\
+						opcua_binaryEncDec.c\
+						opcua_transportLayer.c\
+						opcua_encodingLayer.c\
+						opcua_secureChannelLayer.c\
+						opcua_memory.c\
+						opcua_time.c\
+						opcua_builtInDatatypes.h\
+						opcua_binaryEncDec.h\
+						opcua_transportLayer.h\
+						opcua_advancedDatatypes.h\
+						opcua_types.h\
+						opcua_connectionHelper.h\
+						opcua_encodingLayer.h\
+						opcua_secureChannelLayer.h\
+						opcua_memory.h\
+						opcua_time.h\
+						tcp_layer.h						
+
+#bin_PROGRAMS= $(top_builddir)/bin/open62541.out
+#__top_builddir__bin_libOpen62541_out_SOURCES = opcuaServer.c
+#libOpen62541_la_LIBADD = ../lib/libOpen62541.la		  										
+
+.PHONY: convenience-link clean-convenience-link
+
+convenience-link: $(lib_LTLIBRARIES)
+	@test -e $(top_builddir)/lib || mkdir $(top_builddir)/lib
+	@for soname in `echo | $(EGREP) "^dlname=" $^ | $(SED) -e "s|^dlname='\(.*\)'|\1|"`; do  \
+		echo "$$soname: creating convenience link from $(abs_builddir)/.libs to $(top_builddir)/lib"; \
+		rm -f $(top_builddir)/lib/$$soname ; \
+		test -e $(abs_builddir)/.libs/$$soname && \
+		cd $(top_builddir)/lib && \
+		$(LN_S) $(abs_builddir)/.libs/$$soname $$soname || true;\
+	done
+	@for aname in `echo | $(EGREP) "^dlname=" $^ | $(SED) -e "s|^dlname='\(.*\)\.\(.*\)'|\1\.a|"`; do  \
+		echo "$$aname: creating convenience link from $(abs_builddir)/.libs to $(top_builddir)/lib"; \
+		rm -f $(top_builddir)/lib/$$aname ; \
+		test -e $(abs_builddir)/.libs/$$aname && \
+		cd $(top_builddir)/lib && \
+		$(LN_S) $(abs_builddir)/.libs/$$aname $$aname || true;\
+	done
+
+clean-convenience-link:
+	rm -rf $(top_builddir)/lib/ || true;
+
+all-local: convenience-link
+
+clean-local: clean-convenience-link
+

+ 46 - 0
open62541Stack/src/Makefile.am.orig

@@ -0,0 +1,46 @@
+
+
+
+
+
+#__top_builddir__bin_stackTest_out_SOURCES =	opcuaServer.c\
+#											opcua_builtInDatatypes.c\
+#											opcua_binaryEncDec.c\
+#											opcua_transportLayer.c\
+#											opcua_builtInDatatypes.h\
+#											opcua_binaryEncDec.h\
+#											opcua_transportLayer.h\
+#											opcua_advancedDatatypes.h\
+#											opcua_types.h\
+#											opcua_connectionHelper.h\
+#											tcp_layer.h
+
+#lib_LTLIBRARIES = libstack.la
+#libstack_la_SOURCES = opcua_transportLayer.c\
+#					  opcua_transportLayer.h\
+#					  opcua_advancedDatatypes.h\
+#					  opcua_connectionHelper.h	
+<<<<<<< HEAD
+noinst_LTLIBRARIES =$(top_builddir)/bin/libOpen62541.la
+__top_builddir__bin_libOpen62541_la_SOURCES = 	opcua_builtInDatatypes.c\
+=======
+lib_LTLIBRARIES = libOpen62541.la
+libOpen62541_la_LDFLAGS = -no-undefined
+libOpen62541_la_SOURCES = 	opcua_builtInDatatypes.c\
+>>>>>>> 80305c4c1f04ab5845524d50503270a1d2fb2965
+						opcua_binaryEncDec.c\
+						opcua_transportLayer.c\
+						opcua_encodingLayer.c\
+						opcua_builtInDatatypes.h\
+						opcua_binaryEncDec.h\
+						opcua_transportLayer.h\
+						opcua_advancedDatatypes.h\
+						opcua_types.h\
+						opcua_connectionHelper.h\
+						opcua_encodingLayer.h\
+						tcp_layer.h
+
+#bin_PROGRAMS= $(top_builddir)/bin/open62541.out
+#__top_builddir__bin_libOpen62541_out_SOURCES = opcuaServer.c
+#libOpen62541_la_LIBADD = ../lib/libOpen62541.la		  										
+

+ 635 - 0
open62541Stack/src/Makefile.in.orig

@@ -0,0 +1,635 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#__top_builddir__bin_stackTest_out_SOURCES =	opcuaServer.c\
+#											opcua_builtInDatatypes.c\
+#											opcua_binaryEncDec.c\
+#											opcua_transportLayer.c\
+#											opcua_builtInDatatypes.h\
+#											opcua_binaryEncDec.h\
+#											opcua_transportLayer.h\
+#											opcua_advancedDatatypes.h\
+#											opcua_types.h\
+#											opcua_connectionHelper.h\
+#											tcp_layer.h
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = $(top_builddir)/bin/stackTest.out$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libstack_la_LIBADD =
+am_libstack_la_OBJECTS = opcua_builtInDatatypes.lo \
+	opcua_binaryEncDec.lo opcua_transportLayer.lo \
+	opcua_encodingLayer.lo
+libstack_la_OBJECTS = $(am_libstack_la_OBJECTS)
+PROGRAMS = $(bin_PROGRAMS)
+am___top_builddir__bin_stackTest_out_OBJECTS = opcuaServer.$(OBJEXT)
+__top_builddir__bin_stackTest_out_OBJECTS =  \
+	$(am___top_builddir__bin_stackTest_out_OBJECTS)
+__top_builddir__bin_stackTest_out_LDADD = $(LDADD)
+am__dirstamp = $(am__leading_dot)dirstamp
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libstack_la_SOURCES) \
+	$(__top_builddir__bin_stackTest_out_SOURCES)
+DIST_SOURCES = $(libstack_la_SOURCES) \
+	$(__top_builddir__bin_stackTest_out_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+#lib_LTLIBRARIES = libstack.la
+#libstack_la_SOURCES = opcua_transportLayer.c\
+#					  opcua_transportLayer.h\
+#					  opcua_advancedDatatypes.h\
+#					  opcua_connectionHelper.h	
+lib_LTLIBRARIES = libstack.la
+libstack_la_SOURCES = opcua_builtInDatatypes.c\
+						opcua_binaryEncDec.c\
+						opcua_transportLayer.c\
+						opcua_encodingLayer.c\
+						opcua_builtInDatatypes.h\
+						opcua_binaryEncDec.h\
+						opcua_transportLayer.h\
+						opcua_advancedDatatypes.h\
+						opcua_types.h\
+						opcua_connectionHelper.h\
+						opcua_encodingLayer.h\
+						tcp_layer.h
+
+__top_builddir__bin_stackTest_out_SOURCES = opcuaServer.c
+__top_builddir__bin_stackTest_out_LADD = libstack.la		  										
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libstack.la: $(libstack_la_OBJECTS) $(libstack_la_DEPENDENCIES) $(EXTRA_libstack_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libstack_la_OBJECTS) $(libstack_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+$(top_builddir)/bin/$(am__dirstamp):
+	@$(MKDIR_P) $(top_builddir)/bin
+	@: > $(top_builddir)/bin/$(am__dirstamp)
+$(top_builddir)/bin/stackTest.out$(EXEEXT): $(__top_builddir__bin_stackTest_out_OBJECTS) $(__top_builddir__bin_stackTest_out_DEPENDENCIES) $(EXTRA___top_builddir__bin_stackTest_out_DEPENDENCIES) $(top_builddir)/bin/$(am__dirstamp)
+	@rm -f $(top_builddir)/bin/stackTest.out$(EXEEXT)
+	$(LINK) $(__top_builddir__bin_stackTest_out_OBJECTS) $(__top_builddir__bin_stackTest_out_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcuaServer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_binaryEncDec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_builtInDatatypes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_encodingLayer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcua_transportLayer.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf $(top_builddir)/bin/.libs $(top_builddir)/bin/_libs
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(top_builddir)/bin/$(am__dirstamp)" || rm -f $(top_builddir)/bin/$(am__dirstamp)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libLTLIBRARIES clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-libLTLIBRARIES \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS uninstall-libLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

+ 973 - 0
open62541Stack/src/opcua_advancedDatatypes.h

@@ -0,0 +1,973 @@
+/*
+ * opcua_advancedDatatypes.h
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_ADVANCEDDATATYPES_H_
+#define OPCUA_ADVANCEDDATATYPES_H_
+
+#include "opcua_builtInDatatypes.h"
+typedef struct AD_RawMessage_t AD_RawMessage;
+
+struct AD_RawMessage_t
+{
+	char *message;
+	UInt32 length;
+};
+
+enum BED_ApplicationType {SERVER_0, CLIENT_1, CLIENTANDSERVER_2, DISCOVERYSERVER_3};
+
+
+/**
+* ApplicationDescription
+* Part: 4
+* Chapter: 7.1
+* Page: 103
+*/
+struct BED_ApplicationDescription
+{
+	UA_String applicationUri;
+	UA_String productUri;
+	UA_LocalizedText applicationName;
+	enum BED_ApplicationType applicationType;
+	UA_String gatewayServerUri;
+	UA_String discoveryProfileUri;
+	UA_String discoverUrls[];
+};
+
+
+/**
+* ApplicationInstanceCertificate
+* Part: 4
+* Chapter: 7.2
+* Page: 104
+*/
+struct BED_ApplicationInstanceCertificate
+{
+	UA_String version;
+	UA_ByteString serialNumber;
+	UA_String signatureAlgorithm;
+	UA_ByteString signature;
+//ToDo	struct issuer				//????????????? S. 108 table 104
+	UA_DateTime validFrom;
+	UA_DateTime valdiTo;
+//ToDo	struct subject;				//????????????? S. 108 table 104
+	UA_String applicationUri;
+	UA_String *hostnames;
+	UA_ByteString pubicKey;
+	UA_String keyUsage[];
+
+};
+
+
+/**
+* BrowseResult
+* Part: 4
+* Chapter: 7.3
+* Page: 104
+*/
+struct BED_BrowseResult
+{
+	UA_StatusCode statusCode;
+//	struct BED_ContinuationPoint continuationPoint;
+//	struct BED_ReferenceDescription references[];
+};
+
+
+/**
+* ContentFilter 						//ToDo
+* Part: 4
+* Chapter: 7.4.1
+* Page: 104
+*/
+struct BED_ContentFilter
+{
+//ToDo	struct BED_ContentFilterElement elements[];		//ToDo
+//ToDo	enum BED_FilterOperand filterOperator;			//ToDo table 110
+//ToDo	struct BED_ExtensibleParamterFilterOperand filterOperands[]; //ToDo 7.4.4
+};
+
+
+/**
+* Counter
+* Part: 4
+* Chapter: 7.5
+* Page: 113
+*/
+typedef UInt32 BED_Counter;
+
+
+/**
+* ContinuationPoint 				//ToDo
+* Part: 4
+* Chapter: 7.6
+* Page: 114
+*/
+struct BED_ContinuationPoint
+{
+};
+
+/**
+* DataValue
+* Part: 4
+* Chapter: 7.7.1
+* Page: 114
+*/
+struct BED_DataValue
+{
+	UA_Variant value;	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+	UA_StatusCode statusCode;
+	UA_DateTime sourceTimestamp;
+//ToDo	UInt					//toBeDiscussed: Resolution of PicoSeconds
+	UA_DateTime serverTimestamp;
+//ToDo	UInt					//toBeDiscussed: Resolution of PicoSeconds
+};
+
+
+/**
+* DiagnosticInfo
+* Part: 4
+* Chapter: 7.9*/
+struct BED_DiagnosticInfo
+{
+//ToDo	struct ???? identifier;				//ToDo: what kind of strcuture?
+	Int32 namespaceUri;
+	Int32 symbolicId;
+	Int32 locale;
+	Int32 localizesText;
+	UA_String additionalInfo;
+	UA_StatusCode innerStatusCode;
+	struct BED_DiagnosticInfo *innerDiagnosticInfo;
+};
+
+
+/**
+* EndpointDescription
+* Part: 4
+* Chapter: 7.9
+* Page: 116
+*/
+struct BED_EndpointDescription
+{
+	UA_String endpointUrl;
+	struct BED_ApplicationDescription server;
+	struct BED_ApplicationInstanceCertificate serverCertificate;
+//	enum BED_MessageSecurityMode securityMode;
+	UA_String securityPolicyUri;
+//	struct BED_UserTokenPolicy useridentyTokens[];
+	UA_String transportProfileUri;
+	Byte securtiyLevel;
+};
+
+/**
+* ExpandedNodeId
+* Part: 4
+* Chapter: 7.10
+* Page: 117
+*/
+struct BED_ExpandedNodeId
+{
+//	BED_Index serverIndex;
+	UA_String namespaceUri;
+//	BED_Index namespaveIndex;
+//ToDo	enum BED_IdentifierType identiferType;		//ToDo: Is the enumeration correct?
+//ToDo	UA_NodeIdentifier identifier;		//ToDo -> Part 3: Address Space Model
+};
+
+
+/**
+* ExtensibleParameter
+* Part: 4
+* Chapter: 7.11
+* Page: 117
+*/
+struct BED_ExtensibleParameter
+{
+//	struct UA_NodeId parameterTypeId;
+//ToDo	-- parameterData;			//toBeDiscussed
+};
+
+
+/**
+* Index
+* Part: 4
+* Chapter: 7.12
+* Page: 118
+*/
+typedef UInt32 BED_Index;
+
+
+/**
+* IntegerId
+* Part: 4
+* Chapter: 7.13
+* Page: 118
+*/
+typedef UInt32 BED_IntegerId;
+
+
+/**
+* MessageSecurityMode
+* Part: 4
+* Chapter: 7.14
+* Page: 118
+*/
+enum BED_MessageSecurityMode
+{
+	INVALID_0 = 0,
+	SIGN_1 = 1,
+	SIGNANDENCRYPT_2 = 2
+};
+
+
+/**
+* MonitoringParameters
+* Part: 4
+* Chapter: 7.15
+* Page: 118
+*/
+struct BED_MonitoringParameters
+{
+	BED_IntegerId clientHandle;
+//ToDo	Duration???? samplingInterval;						//ToDo
+//ToDo	struct BED_ExtensibleParameterMonitoringFilter filter			//ToDo
+	BED_Counter queueSize;
+	Boolean discardOldest;
+};
+
+//->ExtensibleParameter ->Part:4 Chapter:7.11 Page:117
+struct BED_ExtensibleParameterMonitoringFilter		//ToDo: Ist die Umsetzung des ExtensibleParameter korrekt?
+{
+//	enum BED_MonitoringFilter parameterTypeId;
+//	struct BED_DataChangeFilter dataChangeFilter;
+//	struct BED_EventFilter eventFilter;
+//	struct BED_AggregateFilter aggregateFilter;
+};
+
+/**
+* MonitoringFilter parameterTypeIds
+* Part: 4
+* Chapter: 7.16.1
+* Page: 119
+*/
+enum BED_MonitoringFilter
+{
+	DATA_CHANGE_FILTER = 1,
+	EVENT_FILTER = 2,
+	AGGREGATE_FILTER = 3
+};
+
+
+/**
+* DataChangeFilter
+* Part: 4
+* Chapter: 7.16.2
+* Page: 119
+*/
+struct BED_DataChangeFilter
+{
+//ToDo	enum BED_MonitoringFilter trigger = BED_MonitoringFilter.DATA_CHANGE_FILTER;
+	UInt32 deadbandType;
+	Double deadbandValue;
+};
+
+
+/**
+* EventFilter
+* Part: 4
+* Chapter: 7.16.3
+* Page: 120
+*/
+struct BED_EventFilter
+{
+//ToDo	SimpleAttributeOperantd selectClauses[]; 		//ToDo
+//ToDo	ContenFilter whereClause;				//ToDo
+};
+
+struct BED_EventFilterResult
+{
+	UA_StatusCode selectClauseResults[3];
+//	struct UA_DiagnosticInfo selectClauseDiagnosticInfos[3];
+//	struct BED_ContentFilterResult whereClauseResult;
+};
+
+
+/**
+* AggregateFilter
+* Part: 4
+* Chapter: 7.16.4
+* Page: 122
+*/
+struct BED_AggregateFilter
+{
+	UA_DateTime startTime;
+//	struct UA_NodeId aggregateType;
+	UA_Duration processingInterval;
+//ToDo	AggregateConfiguration aggregateConfiguration;		//ToDo
+	Boolean useServerCapabilitiesDafaults;
+	Boolean treatUncertainAsBad;
+	Byte percentDataBad;
+	Byte percentDataGood;
+	Boolean steppedSlopedExtrapolation;
+};
+
+struct BED_AggregateFilterResult
+{
+	UA_DateTime revisedStartTime;
+	UA_Duration revisedProcessingInterval;
+};
+
+
+/**
+* MonitoringMode
+* Part: 4
+* Chapter: 7.17
+* Page: 123
+*/
+enum BED_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.
+};
+
+
+/**
+* NodeAttributes parameters
+* Part: 4
+* Chapter: 7.18.1
+* Page: 124
+*/
+enum BED_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.
+};
+
+enum BED_NodeAttributesBitMask
+{
+	AccessLevel = 1, 	//Bit: 0 Indicates if the AccessLevel Attribute is set.
+	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.
+	//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.
+	//Reserved		//Bit:22:32 Reserved for future use. Shall always be zero.
+};
+
+
+/**
+* ObjectAttributes parameters
+* Part: 4
+* Chapter: 7.18.2
+* Page: 125
+*/
+struct BED_ObjectAttributes
+{
+	UInt32 specifiedAttribute;	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Byte eventNotifier;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* VariableAttributes parameters
+* Part: 4
+* Chapter: 7.18.3
+* Page: 125
+*/
+struct BED_VariableAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+//ToDo	DefinedByTheDataTypeAttribte??? value				//ToDo
+//	struct UA_NodeId dataType;
+	Int32 valueRank;
+//	UInt32 arrayDimensions[];
+	Byte accessLevel;
+	Byte userAccesLevel;
+//ToDo	Duration???? minimumSamplingInterval;			//ToDo
+	Boolean historizing;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* MethodAttributes parameters
+* Part: 4
+* Chapter: 7.18.4
+* Page: 125
+*/
+struct BED_MethodAttributes
+{
+	UInt32 specifiedAttributes;	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean executable;
+	Boolean userExecutable;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* ObjectTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.5
+* Page: 125
+*/
+struct BED_ObjectTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	UInt32 wirteMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* VariableTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.6
+* Page: 126
+*/
+struct BED_VariableTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+//ToDo	DefinedByTheDataTypeAttribte??? value			//ToDo
+//	struct UA_NodeId dataType;
+	Int32 valueRank;
+//	UInt32 arrayDimesions[];
+	Boolean isAbstract;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* ReferenceTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.7
+* Page: 126
+*/
+struct BED_ReferenceTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	Boolean symmetric;
+//	struct UA_LocalizedText inverseName;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+
+/**
+* DataTypeAttributes parameters
+* Part: 4
+* Chapter: 7.18.8
+* Page: 126
+*/
+struct BED_DataTypeAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean isAbstract;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+
+/**
+* ViewAttributes parameters
+* Part: 4
+* Chapter: 7.18.9
+* Page: 127
+*/
+struct BED_ViewAttributes
+{
+	UInt32 specifiedAttributes; 	//BitMask corresponding to BED_NodeAttributesBitMask
+//	struct UA_LocalizedText displayName;
+//	struct UA_LocalizedText description;
+	Boolean containsNoLoops;
+	Byte eventNotifier;
+	UInt32 writeMask;
+	UInt32 userWriteMask;
+};
+
+
+/**
+* NotificationData parameters
+* Part: 4
+* Chapter: 7.19
+* Page: 127
+*/
+enum BED_NotificationDataParameterTypeIds
+{
+	DATA_CHANGE = 1,
+	EVENT = 2,
+	STATUS_CHANGE = 3
+};
+
+
+/**
+* DataChangeNotification parameter
+* Part: 4
+* Chapter: 7.19.2
+* Page: 127
+*/
+struct BED_DataChangeNotification
+{
+//ToDo	struct BED_MonitoredItemNotification monitoredItems[];		//ToDo
+	BED_IntegerId clientHandle;
+//	struct UA_DataValue value;
+	UA_DiagnosticInfo diagnositcInfos[];
+};
+
+
+/**
+* EventNotificationList parameter
+* Part: 4
+* Chapter: 7.19.3
+* Page: 128
+*/
+struct BED_EventNotificationList
+{
+//ToDo	struct EventFieldList events[];			//ToDo
+	BED_IntegerId clientHandle;
+	UA_Variant eventFields[];	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+};
+
+
+/**
+* StatusChangeNotification parameter
+* Part: 4
+* Chapter: 7.19.4
+* Page: 128
+*/
+struct BED_StatusChangeNotification
+{
+	UA_StatusCode status;
+//	struct UA_DiagnosticInfo diagnosticInfo;
+};
+
+
+/**
+* NotificationMessage
+* Part: 4
+* Chapter: 7.20
+* Page: 129
+*/
+struct BED_NotificationMessage
+{
+	BED_Counter sequenceNumber;
+//	struct UA_DateTime publishTime;
+//	struct ExtensibleParameterNotificationData notificationData[];
+};
+
+//->ExtensibleParameter ->Part:4 Chapter:7.11 Page:117
+struct ExtensibleParameterNotificationData 		//ToDo: Ist die Umsetzung des ExtensibleParameter korrekt?
+{
+	enum BED_NotificationDataParameterTypeIds parameterTypeId;
+	struct BED_DataChangeNotification dataChange;
+	struct BED_EventNotificationList event;
+	struct BED_StatusChangeNotification statusChange;
+};
+
+
+/**
+* NumericRange
+* Part: 4
+* Chapter: 7.21
+* Page: 129
+*/
+typedef UA_String NumericRange;
+
+
+/**
+* QueryDataSet
+* Part: 4
+* Chapter: 7.22
+* Page: 130
+*/
+/*
+struct BED_QueryDataSet
+{
+//	struct UA_ExpandedNodeId nodeId;
+//	struct UA_ExpandedNodeId typeDefinitionNode;
+//	struct UA_Variant values[];	// BaseDataType are mapped to a UA_Variant -> part: 6 chapter: 5.1.5 page: 14
+};
+*/
+
+/**
+* ReadValueId
+* Part: 4
+* Chapter: 7.23
+* Page: 130
+*/
+struct BED_QueryDataSet
+{
+//	struct UA_NodeId nodeId;
+	BED_IntegerId attributeId;
+//	struct BED_NumericRange indexRange;
+//	struct UA_QualifiedName dataEncoding;
+};
+
+
+/**
+* ReferenceDescription
+* Part: 4
+* Chapter: 7.24
+* Page: 131
+*/
+struct BED_ReferenceDescription
+{
+//	struct UA_NodeId referenceTypeId;
+	Boolean isForward;
+//	struct UA_ExpandedNodeId nodeId;
+//	struct UA_QualifiedName browseName;
+//	struct UA_LocalizedText displayName;
+//ToDo	struct BED_NodeClass nodeClass;			//ToDo
+//	struct UA_ExpandedNodeId typeDefinition;
+};
+
+
+/**
+* RelativePath
+* Part: 4
+* Chapter: 7.25
+* Page: 131
+*/
+struct BED_RelativePath
+{
+//ToDo	struct BED_RelativePathElement elements[];		//ToDo
+//	struct UA_NodeId referenceTypeId;
+	Boolean isInverse;
+	Boolean includeSubtypes;
+//	struct UA_QualifiedName targetName;
+};
+
+
+/**
+* RequestHeader
+* Part: 4
+* Chapter: 7.26
+* Page: 132
+*/
+struct BED_RequestHeader
+{
+	UA_NodeId authenticationToken;		//ToDo
+	UA_DateTime timestamp;
+	BED_IntegerId requestHandle;
+	UInt32 returnDiagnostics;
+	UA_String auditEntryId;
+	UInt32 timeoutHint;
+	UA_ExtensionObject additionalHeader;
+};
+
+
+enum BED_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
+};
+
+
+/**
+* ResponseHeader
+* Part: 4
+* Chapter: 7.27
+* Page: 133
+*/
+struct BED_ResponseHeader
+{
+	UA_DateTime timestamp;
+	BED_IntegerId requestHandle;
+	UA_StatusCode serviceResult;
+	UA_DiagnosticInfo *serviceDiagnostics;
+	UA_String stringTable[];
+//ToDo	struct BED_ExtensibleParameterAdditionalHeader additionalHeader;		//ToDo
+};
+
+
+/**
+* ServiceFault
+* Part: 4
+* Chapter: 7.28
+* Page: 133
+*/
+struct BED_ServiceFault
+{
+	struct BED_ResponseHeader responseHeader;
+};
+
+
+//ToDo: Own DataType with typeDef?
+/**
+* SessionAuthenticationToken
+* Part: 4
+* Chapter: 7.29
+* Page: 133
+*/
+
+
+
+/**
+* SignatureData
+* Part: 4
+* Chapter: 7.30
+* Page: 135
+*/
+struct BED_SignatureData
+{
+	UA_ByteString signature;
+	UA_String agorithm;
+};
+
+
+/**
+* SignedSoftwareCertificate
+* Part: 4
+* Chapter: 7.31
+* Page: 135
+*/
+struct BED_SignedSoftwareCertificate
+{
+	UA_String version;
+	UA_ByteString serialNumber;
+	UA_String signatureAlgorithm;
+	UA_ByteString signature;
+//ToDo	struct issuer 					//ToDo: ??? struct?
+	UA_DateTime validFrom;
+	UA_DateTime validTo;
+//ToDo	struct subject;					//ToDo: ??? struct?
+//ToDo	struct subjectAltName[];			//ToDo: ??? struct?
+	UA_ByteString publicKey;
+//	UA_String keyUsage[];
+	UA_ByteString softwareCertificate;
+};
+
+
+/**
+* SoftwareCertificate
+* Part: 4
+* Chapter: 7.32
+* Page: 135
+*/
+struct BED_SoftwareCertificate
+{
+	UA_String productName;
+	UA_String productUri;
+	UA_String vendorName;
+	UA_ByteString vendorProductCertificate;
+	UA_String softwareVersion;
+	UA_String buildNumber;
+	UA_DateTime buildDate;
+	UA_String issuedBy;
+	UA_DateTime issueDate;
+//	UA_ByteString vendorProductCertificate;
+//	struct BED_SupportedProfiles supportedProfiles;
+};
+
+struct BED_SupportedProfiles
+{
+	UA_String oranizationUri;
+	UA_String profileId;
+	UA_String complianceTool;
+	UA_DateTime complianceDate;
+//	enum BED_ComplianceLevel complianceLevel;
+	UA_String unsupportedUnitIds[];
+};
+
+enum BED_ComplianceLevel
+{
+	UNTESTED_0 = 0,		//the profiled capability has not been tested successfully.
+	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
+				//self-test system authorized by the certifying authority.
+	CERTIFIED_3 = 3		//the profiled capability has been successfully tested by a
+				//testing organisation authorized by the certifying authority.
+};
+
+
+/**
+* StatusCode					//ToDo: Do we need them? How do we implement them (enum)?
+* Part: 4
+* Chapter: 7.33
+* Page: 136
+*/
+
+
+/**
+* TimestampsToReturn
+* Part: 4
+* Chapter: 7.34
+* Page: 140
+*/
+enum BED_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.
+			//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.
+			//If used in HistoryRead the source timestamp is used to determine which historical data values are returned.
+	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.
+};
+
+
+/**
+* UserIdentityToken Encrypted Token Format
+* Part: 4
+* Chapter: 7.35.1
+* Page: 140
+*/
+struct BED_UserIdentityTokenEncryptedTokenFormat
+{
+	Byte length[4];
+//	Byte tokenData[];
+//	Byte serverNonce[];
+};
+
+
+/**
+* AnonymousIdentityToken
+* Part: 4
+* Chapter: 7.35.2
+* Page: 141
+*/
+struct BED_AnonymousIdentityToken
+{
+	UA_String policyId;
+};
+
+
+/**
+* UserNameIdentityToken
+* Part: 4
+* Chapter: 7.35.3
+* Page: 141
+*/
+struct BED_UserNameIdentityToken
+{
+	UA_String policyId;
+	UA_String userName;
+	UA_ByteString password;
+	UA_String encryptionAlogrithm;
+};
+
+
+/**
+* X509IdentityTokens
+* Part: 4
+* Chapter: 7.35.4
+* Page: 141
+*/
+struct BED_X509IdentityTokens
+{
+	UA_String policyId;
+	UA_ByteString certificateData;
+};
+
+
+/**
+* IssuedIdentityToken
+* Part: 4
+* Chapter: 7.35.5
+* Page: 142
+*/
+struct BED_IssuedIdentityToken
+{
+	UA_String policyId;
+	UA_ByteString tokenData;
+	UA_String encryptionAlgorithm;
+};
+
+
+
+enum BED_UserIdentityTokenType
+{
+	ANONYMOUS_0 = 0,
+	USERNAME_1 = 1,
+	CERTIFICATE_2 = 2,
+	ISSUEDTOKEN_3 = 3
+};
+
+/**
+* UserTokenPolicy
+* Part: 4
+* Chapter: 7.36
+* Page: 142
+*/
+struct BED_UserTokenPolicy
+{
+	UA_String policyId;
+	enum BED_UserIdentityTokenType tokenType;
+	UA_String issuedTokenType;
+	UA_String issuerEndpointUrl;
+	UA_String securityPolicyUri;
+};
+
+/**
+* ViewDescription
+* Part: 4
+* Chapter: 7.37
+* Page: 143
+*/
+struct BED_ViewDescription
+{
+//	struct UA_NodeId viewId;
+	UA_DateTime timestamp;
+	UInt32 viewVersion;
+};
+
+
+#endif /* OPCUA_ADVANCEDDATATYPES_H_ */

Plik diff jest za duży
+ 1483 - 0
open62541Stack/src/opcua_binaryEncDec.c


Plik diff jest za duży
+ 1486 - 0
open62541Stack/src/opcua_binaryEncDec.c.orig


+ 355 - 0
open62541Stack/src/opcua_binaryEncDec.h

@@ -0,0 +1,355 @@
+/*
+ * opcua_BinaryEncDec.h
+ *
+ *  Created on: Dec 18, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_BINARYENCDEC_NEU_H_
+#define OPCUA_BINARYENCDEC_NEU_H_
+
+#include "opcua_builtInDatatypes.h"
+
+#include "opcua_advancedDatatypes.h"
+#include "opcua_types.h"
+
+
+#define UA_TRUE 1
+#define UA_FALSE 0
+
+#define MAX_PICO_SECONDS 9999
+//functions
+/**
+ *
+ * @param srcBuf
+ * @param type
+ * @param pos
+ * @param dstStructure
+ * @return
+ */
+Int32 decoder_decodeBuiltInDatatype(char *srcBuf, Int32 type, Int32 *pos,
+		void *dstStructure);
+/**
+ *
+ * @param data
+ * @param type
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encoder_encodeBuiltInDatatype(void *data, Int32 type, Int32 *pos, char *dstBuf);
+
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeBoolean(char * const buf, Int32 *pos, Boolean *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeBoolean(Boolean value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeSByte(char * const buf, Int32 *pos, SByte *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeSByte(SByte value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeByte(char *const buf, Int32 *pos,Byte *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeByte(Byte value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Int32 decodeUInt16(char *const buf, Int32 *pos, UInt16 *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeUInt16(UInt16 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeInt16(char *const buf, Int32 *pos, Int16 *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt16(Int16 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeInt32(char *const buf, Int32 *pos, Int32 *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt32(Int32 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeUInt32(char *const buf, Int32 *pos, UInt32 *dst);
+/**
+ *
+ * @param value
+ * @param dstBuf
+ * @param pos
+ */
+void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeInt64(char *const buf, Int32 *pos,Int64 *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt64(Int64 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeUInt64(char *const buf, Int32 *pos, UInt64 *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeUInt64(UInt64 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf  			binary encoded message
+ * @param pos  			position at which the data is located in/out, parser position after the conversion
+ * @param dstNodeId		receiver of the nodeid structure
+ * @param return		success = 0
+ */
+Int32 decodeUANodeId(char *const buf, Int32 *pos, UA_NodeId *dstNodeId);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeFloat(char *buf, Int32 *pos, Float *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeDouble(char *buf, Int32 *pos, Double *dst);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encodeDouble(Double value, Int32 *pos,char *dstBuf);
+/**
+ *
+ * @param srcNodeId
+ * @param pos
+ * @param buf
+ * @return
+ */
+Int32 encodeUANodeId(UA_NodeId *srcNodeId, Int32 *pos, char *buf);
+/**
+ *
+ * @param srcGuid
+ * @param pos
+ * @param buf
+ * @return
+ */
+Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dstGUID
+ * @return
+ */
+Int32 decodeUAGuid(char *const buf, Int32 *pos, UA_Guid *dstGUID);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dst
+ * @return
+ */
+Int32 decodeUAStatusCode(char *const buf, Int32 *pos,UA_StatusCode* dst);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Int32 decodeUADateTime(char *const buf, Int32 *pos,UA_DateTime *dst);
+/**
+ *
+ * @param time
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+void encodeUADateTime(UA_DateTime time, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param dstUAString
+ * @return
+ */
+Int32 decodeUAString(char *const buf, Int32 *pos, UA_String *dstUAString);
+/**
+ *
+ * @param byteString
+ * @return length of the binary encoded data
+ */
+Int32 UAByteString_calcSize(UA_ByteString *byteString);
+/**
+ *
+ * @param xmlElement
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encodeXmlElement(UA_XmlElement *xmlElement, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @param xmlElement
+ * @return
+ */
+Int32 decodeXmlElement(char * const buf, Int32* pos, UA_XmlElement *xmlElement);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Int32 decodeIntegerId(char* buf, Int32 *pos, Int32* dst);
+/**
+ *
+ * @param integerId
+ * @param pos
+ * @param buf
+
+ */
+void encodeIntegerId(T_IntegerId integerId, Int32 *pos, char *buf);
+/**
+ * \brief
+ * \param srcRaw             pointer to raw data which holds the encoded data
+ * \param pos
+ * \param dstRequestHeader   pointer to a structure which hold the encoded header
+ * \return                   0 = success
+ */
+Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, T_RequestHeader *dstRequestHeader);
+/**
+ *
+ * @param srcHeader
+ * @param pos
+ * @param dstRaw
+ * @return
+ */
+Int32 encodeRequestHeader(const T_RequestHeader *srcHeader,Int32 *pos,AD_RawMessage *dstRaw);
+/**
+ *
+ * @param srcRaw
+ * @param pos
+ * @param dstResponseHeader
+ * @return
+ */
+Int32 decodeResponseHeader(const AD_RawMessage *srcRaw, Int32 *pos, T_ResponseHeader *dstResponseHeader);
+/**
+ *  @brief function to encode a secureChannelRequestHeader
+ *
+ * @param header   a open secure channel header structure which should be encoded to binary format
+ * @param dstBuf   pointer to a structure which hold the encoded header
+ * @return
+ */
+Int32 encodeResponseHeader(const T_ResponseHeader *responseHeader, Int32 *pos, AD_RawMessage *dstBuf);
+/**
+ *
+ * @param diagnosticInfo
+ * @return length of the binary encoded data
+ */
+Int32 diagnosticInfo_calcSize(UA_DiagnosticInfo *diagnosticInfo);
+/**
+ *
+ * @param extensionObject
+ * @return length of the binary encoded data
+ */
+Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject);
+
+
+
+#endif /* OPCUA_BINARYENCDEC_NEU_H_ */

+ 11 - 0
open62541Stack/src/opcua_builtInDatatypes.c

@@ -0,0 +1,11 @@
+/*
+ * opcua_BuiltInDatatypes.c
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+
+#include "opcua_builtInDatatypes.h"
+
+

+ 748 - 0
open62541Stack/src/opcua_builtInDatatypes.h

@@ -0,0 +1,748 @@
+/*
+ * OPCUA_builtInDatatypes.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+#include <stdint.h>
+#include <string.h>
+#ifndef OPCUA_BUILTINDATATYPES_H_
+#define OPCUA_BUILTINDATATYPES_H_
+
+/**
+* Enumerations:
+*	All Enumerations should be encoded as Int32 values
+*
+*
+*/
+
+typedef enum
+{
+	BOOLEAN = 	1,
+	SBYTE = 	2,
+	BYTE = 		3,
+	INT16 = 	4,
+	UINT16 = 	5,
+	INT32 = 	6,
+	UINT32 = 	7,
+	INT64 = 	8,
+	UINT64 = 	9,
+	FLOAT = 	10,
+	DOUBLE = 	11,
+	STRING = 	12,
+	DATE_TIME = 13,
+	GUID = 		14,
+	BYTE_STRING = 		15,
+	XML_ELEMENT = 		16,
+	NODE_ID = 			17,
+	EXPANDED_NODE_ID = 	18,
+	STATUS_CODE = 		19,
+	QUALIFIED_NAME = 	20,
+	LOCALIZED_TEXT = 	21,
+	EXTENSION_OBJECT = 	22,
+	DATA_VALUE = 		23,
+	VARIANT = 			24,
+	DIAGNOSTIC_INFO = 	25
+}
+UA_BuiltInDataTypes;
+
+
+
+
+typedef enum
+{
+	BOOLEAN_ARRAY = 	129,
+	SBYTE_ARRAY = 	130,
+	BYTE_ARRAY = 		131,
+	INT16_ARRAY = 	132,
+	UINT16_ARRAY = 	133,
+	INT32_ARRAY = 	134,
+	UINT32_ARRAY = 	135,
+	INT64_ARRAY = 	136,
+	UINT64_ARRAY = 	137,
+	FLOAT_ARRAY = 	138,
+	DOUBLE_ARRAY = 	139,
+	STRING_ARRAY = 	140,
+	DATE_TIME_ARRAY = 141,
+	GUID_ARRAY = 		142,
+	BYTE_STRING_ARRAY = 143,
+	XML_ELEMENT_ARRAY = 144,
+	NODE_ID_ARRAY = 	145,
+	EXPANDED_NODE_ID_ARRAY = 145,
+	STATUS_CODE_ARRAY = 146,
+	QUALIFIED_NAME_ARRAY = 147,
+	LOCALIZED_TEXT_ARRAY = 	148,
+	EXTENSION_OBJECT_ARRAY = 149,
+	DATA_VALUE_ARRAY = 150,
+	VARIANT_ARRAY = 151,
+	DIAGNOSTIC_INFO_ARRAY = 152
+}
+UA_BuiltInDataTypes_Array;
+
+typedef enum
+{
+	BOOLEAN_MATRIX = 193,
+	SBYTE_MATRIX = 	194,
+	BYTE_MATRIX = 	195,
+	INT16_MATRIX = 	196,
+	UINT16_MATRIX = 197,
+	INT32_MATRIX = 	198,
+	UINT32_MATRIX = 199,
+	INT64_MATRIX =  200,
+	UINT64_MATRIX = 201,
+	FLOAT_MATRIX = 	202,
+	DOUBLE_MATRIX = 203,
+	STRING_MATRIX = 204,
+	DATE_TIME_MATRIX = 205,
+	GUID_MATRIX = 206,
+	BYTE_STRING_MATRIX = 207,
+	XML_ELEMENT_MATRIX = 208,
+	NODE_ID_MATRIX = 209,
+	EXPANDED_NODE_ID_MATRIX = 210,
+	STATUS_CODE_MATRIX = 211,
+	QUALIFIED_NAME_MATRIX = 212,
+	LOCALIZED_TEXT_MATRIX = 213,
+	EXTENSION_OBJECT_MATRIX = 214,
+	DATA_VALUE_MATRIX = 215,
+	VARIANT_MATRIX = 216,
+	DIAGNOSTIC_INFO_MATRIX = 217
+}
+UA_BuiltInDataTypes_Matrix;
+
+
+
+/**
+* BasicBuiltInDatatypes
+* Part: 6
+* Chapter: 5.2.2.1 - 5.2.2.3
+* Page: 15
+*/
+typedef _Bool Boolean;
+
+typedef int8_t SByte;
+
+typedef uint8_t Byte;
+
+typedef int16_t Int16;
+
+typedef uint16_t UInt16;
+
+typedef int32_t Int32;
+
+typedef uint32_t UInt32;
+
+typedef int64_t Int64;
+
+typedef uint64_t UInt64;
+
+typedef float Float;
+
+typedef double Double;
+
+
+/**
+* String
+* Part: 6
+* Chapter: 5.2.2.4
+* Page: 16
+*/
+typedef struct _UA_String
+{
+	Int32 Length;
+	char *Data;
+}
+UA_String;
+
+/**
+* DateTime
+* Part: 6
+* Chapter: 5.2.2.5
+* Page: 16
+*/
+typedef Int64 UA_DateTime; //100 nanosecond resolution
+			      //start Date: 1601-01-01 12:00 AM
+
+
+
+
+
+
+/*
+* ByteString
+* Part: 6
+* Chapter: 5.2.2.7
+* Page: 17
+*/
+typedef struct _UA_ByteString
+{
+	Int32 Length;
+	Byte *Data;
+}
+UA_ByteString;
+
+
+/* GuidType
+* Part: 6
+* Chapter: 5.2.2.6
+* Page: 17
+*/
+typedef struct _UA_Guid
+{
+	UInt32 Data1;
+	UInt16 Data2;
+	UInt16 Data3;
+	UA_ByteString Data4;
+
+}
+UA_Guid;
+/**
+* XmlElement
+* Part: 6
+* Chapter: 5.2.2.8
+* Page: 17
+*/
+//Überlegung ob man es direkt als ByteString speichert oder als String
+typedef struct _UA_XmlElement
+{
+	UA_ByteString Data;
+}
+UA_XmlElement;
+
+
+typedef struct _UA_XmlElementEncoded
+{
+	UInt32 Length;
+	Byte StartTag[3];
+	Byte *Message;
+	UInt32 EndTag[4];
+}
+UA_XmlElementEncoded;
+
+
+/**
+ * NodeIds
+* Part: 6
+* Chapter: 5.2.2.9
+* Page: 17
+*/
+typedef enum _UA_IdentifierType
+{
+	// Some Values are called the same as previouse Enumerations so we need
+	//names that are unique
+	IT_NUMERIC = 0,
+	IT_STRING = 1,
+	IT_GUID = 2,
+	IT_OPAQUE = 3
+}
+UA_IdentifierType;
+
+typedef enum _UA_NodeIdEncodingValuesType
+{
+	// Some Values are called the same as previous Enumerations so we need
+	// names that are unique
+	NIEVT_TWO_BYTE = 	0x00,
+	NIEVT_FOUR_BYTE = 	0x01,
+	NIEVT_NUMERIC = 	0x02,
+	NIEVT_STRING = 		0x03,
+	NIEVT_GUID = 		0x04,
+	NIEVT_BYTESTRING = 	0x05,
+	NIEVT_NAMESPACE_URI_FLAG = 	0x80, 	//Is only for ExpandedNodeId required
+	NIEVT_SERVERINDEX_FLAG = 	0x40 	//Is only for ExpandedNodeId required
+}
+UA_NodeIdEncodingValuesType;
+
+/**
+* NodeId
+*/
+typedef struct _UA_NodeId
+{
+	Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
+	UInt16 Namespace;
+
+    union
+    {
+        UInt32 Numeric;
+        UA_String String;
+        UA_Guid Guid;
+        UA_ByteString ByteString;
+    }
+    Identifier;
+
+}
+UA_NodeId;
+
+
+/**
+* ExpandedNodeId
+* Part: 6
+* Chapter: 5.2.2.10
+* Page: 19
+*/
+typedef struct _UA_ExpandedNodeId
+{
+	UA_NodeId NodeId;
+	Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
+	UA_String NamespaceUri;
+	UInt32 ServerIndex;
+}
+UA_ExpandedNodeId;
+
+
+/**
+* StatusCodeBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.11
+* Page: 20
+*/
+typedef UInt32 UA_StatusCode;
+
+
+/**
+* DiagnoticInfoBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.12
+* Page: 20
+*/
+typedef struct _UA_DiagnosticInfo
+{
+	Byte EncodingMask; //Type of the Enum UA_DiagnosticInfoEncodingMaskType
+	Int32 SymbolicId;
+	Int32 NamespaceUri;
+	Int32 LocalizedText;
+	Int32 Locale;
+	UA_String AdditionalInfo;
+	UA_StatusCode InnerStatusCode;
+	struct _UA_DiagnosticInfo* InnerDiagnosticInfo;
+}
+UA_DiagnosticInfo;
+
+typedef enum _UA_DiagnosticInfoEncodingMaskType
+{
+	// Some Values are called the same as previouse Enumerations so we need
+	//names that are unique
+	DIEMT_SYMBOLIC_ID = 			0x01,
+	DIEMT_NAMESPACE = 				0x02,
+	DIEMT_LOCALIZED_TEXT = 			0x04,
+	DIEMT_LOCALE = 					0x08,
+	DIEMT_ADDITIONAL_INFO = 		0x10,
+	DIEMT_INNER_STATUS_CODE = 		0x20,
+	DIEMT_INNER_DIAGNOSTIC_INFO = 	0x40
+}
+UA_DiagnosticInfoEncodingMaskType;
+
+
+/**
+* QualifiedNameBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.13
+* Page: 20
+*/
+typedef struct _UA_QualifiedName
+{
+	UInt16 NamespaceIndex;
+	UInt16 Reserved;
+	UA_String Name;
+}
+UA_QualifiedName;
+
+
+/**
+* LocalizedTextBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.14
+* Page: 21
+*/
+typedef struct _UA_LocalizedText
+{
+	Byte EncodingMask;
+	UA_String Locale;
+	UA_String Text;
+}
+UA_LocalizedText;
+
+typedef enum _UA_LocalizedTextEncodingMaskType
+{
+	LTEMT_SYMBOLIC_ID = 0x01,
+	LTEMT_NAMESPACE = 	0x02
+}
+UA_LocalizedTextEncodingMaskType;
+
+
+/**
+* ExtensionObjectBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.15
+* Page: 21
+*/
+typedef struct _UA_ExtensionObject
+{
+	UA_NodeId TypeId;
+	Byte Encoding; //Type of the Enum UA_ExtensionObjectEncodingMaskType
+	Int32 Length;
+	UA_ByteString Body;
+}
+UA_ExtensionObject;
+
+typedef enum _UA_ExtensionObjectEncodingMaskType
+{
+	NO_BODY_IS_ENCODED = 	0x00,
+	BODY_IS_BYTE_STRING = 	0x01,
+	BODY_IS_XML_ELEMENT = 	0x02
+}
+UA_ExtensionObjectEncodingMaskType;
+
+
+/**
+* VariantBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.16
+* Page: 22
+*/
+struct _UA_DataValue;
+struct _UA_Variant;
+
+
+typedef struct
+{
+	Int32 *data;
+	Int32 length;
+}IntegerString;
+
+typedef struct
+{
+	Int32 *data;
+	Int32 arrayLength;
+	IntegerString dimensions;
+}Int32_Array;
+
+
+// Array types of builtInDatatypes
+typedef struct
+{
+	SByte *data;
+	Int32 arrayLength;
+	IntegerString dimensions;
+}SBYte_Array;
+
+typedef struct
+{
+	Boolean *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Boolean_Array;
+
+typedef struct
+{
+	SByte *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}SByte_Array;
+
+typedef struct
+{
+	Byte *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Byte_Array;
+
+typedef struct
+{
+	Int16 *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Int16_Array;
+
+typedef struct
+{
+	UInt16 *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}UInt16_Array;
+
+
+typedef struct
+{
+	UInt32 *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}UInt32_Array;
+
+typedef struct
+{
+	Int64 *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Int64_Array;
+
+typedef struct
+{
+	UInt64 *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}UInt64_Array;
+typedef struct
+{
+	Float *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Float_Array;
+
+typedef struct
+{
+	Double *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Double_Array;
+
+typedef struct
+{
+	UA_String *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}String_Array;
+
+typedef struct
+{
+	UA_DateTime *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}DateTime_Array;
+
+typedef struct
+{
+	UA_Guid *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Guid_Array;
+
+typedef struct
+{
+	UA_ByteString *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}ByteString_Array;
+
+typedef struct
+{
+	UA_XmlElement *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}XmlElement_Array;
+
+typedef struct
+{
+	UA_NodeId *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}NodeId_Array;
+
+typedef struct
+{
+	UA_ExpandedNodeId *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}ExpandedNodeId_Array;
+
+
+typedef struct
+{
+	UA_StatusCode *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}StatusCode_Array;
+
+typedef struct
+{
+	UA_QualifiedName *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}QualifiedName_Array;
+
+typedef struct
+{
+	UA_LocalizedText *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}LocalizedText_Array;
+
+typedef struct
+{
+	UA_ExtensionObject *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}ExtensionObject_Array;
+
+typedef struct
+{
+	struct UA_DataValue *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}DataValue_Array;
+
+typedef struct
+{
+	struct UA_Variant *data;
+	Int32 arrayLength;
+	IntegerString  dimensions;
+}Variant_Array;
+
+typedef struct
+{
+	UA_DiagnosticInfo *data;
+	Int32 arrayLength;
+	IntegerString dimensions;
+}DiagnosticInfo_Array;
+
+
+typedef union _UA_VariantArrayUnion
+{
+    void*         Array;
+    Boolean_Array BooleanArray;
+    SByte_Array   SByteArray;
+    Byte_Array    ByteArray;
+    Int16_Array   Int16Array;
+    UInt16_Array  UInt16Array;
+    Int32_Array   Int32Array;
+    UInt32_Array  UInt32Array;
+    Int64_Array   Int64Array;
+    UInt64_Array  UInt64Array;
+    Float_Array   FloatArray;
+    Double_Array            DoubleArray;
+    String_Array            StringArray;
+    DateTime_Array          DateTimeArray;
+    Guid_Array              GuidArray;
+    ByteString_Array        ByteStringArray;
+    ByteString_Array        XmlElementArray;
+    NodeId_Array            NodeIdArray;
+    ExpandedNodeId_Array    ExpandedNodeIdArray;
+    StatusCode_Array        StatusCodeArray;
+    QualifiedName_Array     QualifiedNameArray;
+    LocalizedText_Array     LocalizedTextArray;
+    ExtensionObject_Array   ExtensionObjectArray;
+    DataValue_Array DataValueArray;
+    Variant_Array   VariantArray;
+}
+UA_VariantArrayUnion;
+
+typedef struct _UA_VariantArrayValue
+{
+	//Byte TypeEncoding;
+    Int32  Length;
+    UA_VariantArrayUnion Value;
+}
+UA_VariantArrayValue;
+
+typedef struct _UA_VariantMatrixValue
+{
+    Int32 NoOfDimensions;
+    Int32* Dimensions;
+    UA_VariantArrayUnion Value;
+}
+UA_VariantMatrixValue;
+
+typedef union _UA_VariantUnion
+{
+    Boolean Boolean;
+    SByte SByte;
+    Byte Byte;
+    Int16 Int16;
+    UInt16 UInt16;
+    Int32 Int32;
+    UInt32 UInt32;
+    Int64 Int64;
+    UInt64 UInt64;
+    Float Float;
+    Double Double;
+    UA_DateTime DateTime;
+    UA_String String;
+    UA_Guid* Guid;
+    UA_ByteString ByteString;
+    UA_XmlElement XmlElement;
+    UA_NodeId* NodeId;
+    UA_ExpandedNodeId* ExpandedNodeId;
+    UA_StatusCode StatusCode;
+    UA_QualifiedName* QualifiedName;
+    UA_LocalizedText* LocalizedText;
+    UA_ExtensionObject* ExtensionObject;
+    struct _UA_DataValue* DataValue;
+    UA_VariantArrayValue  Array;
+    UA_VariantMatrixValue Matrix;
+}
+UA_VariantUnion;
+
+typedef struct _UA_Variant
+{
+	Byte EncodingMask; //Type of Enum UA_VariantTypeEncodingMaskType
+	Int32 ArrayLength;
+	UA_VariantUnion *Value;
+}
+UA_Variant;
+
+typedef enum _UA_VariantTypeEncodingMaskType
+{
+	//Bytes 0:5	HEX 0x00 - 0x20
+	VTEMT_BOOLEAN = 			1,
+	VTEMT_SBYTE = 				2,
+	VTEMT_BYTE = 				3,
+	VTEMT_INT16 = 				4,
+	VTEMT_UINT16 = 				5,
+	VTEMT_INT32 = 				6,
+	VTEMT_UINT32 = 				7,
+	VTEMT_INT64 = 				8,
+	VTEMT_UINT64 = 				9,
+	VTEMT_FLOAT = 				10,
+	VTEMT_DOUBLE = 				11,
+	VTEMT_STRING = 				12,
+	VTEMT_DATE_TIME = 			13,
+	VTEMT_GUID = 				14,
+	VTEMT_BYTE_STRING = 		15,
+	VTEMT_XML_ELEMENT = 		16,
+	VTEMT_NODE_ID = 			17,
+	VTEMT_EXPANDED_NODE_ID = 	18,
+	VTEMT_STATUS_CODE = 		19,
+	VTEMT_QUALIFIED_NAME = 		20,
+	VTEMT_LOCALIZED_TEXT = 		21,
+	VTEMT_EXTENSION_OBJECT = 	22,
+	VTEMT_DATA_VALUE = 			23,
+	VTEMT_VARIANT = 			24,
+	VTEMT_DIAGNOSTIC_INFO = 	25,
+	//Byte 6
+	VTEMT_ARRAY_DIMENSIONS_ENCODED = 	0x40,
+	//Byte 7
+	VTEMT_ARRAY_VALUE_ENCODED = 		0x80,
+}
+UA_VariantTypeEncodingMaskType;
+
+
+/**
+* DataValueBinaryEncoding
+* Part: 6
+* Chapter: 5.2.2.17
+* Page: 23
+*/
+typedef struct _UA_DataValue
+{
+	Byte EncodingMask;
+	UA_Variant Value;
+	UA_StatusCode Status;
+	UA_DateTime SourceTimestamp;
+	Int16 SourcePicoseconds;
+	UA_DateTime ServerTimestamp;
+	Int16 ServerPicoseconds;
+}
+UA_DataValue;
+
+typedef UInt32 IntegerId;
+
+
+/**
+* Duration
+* Part: 3
+* Chapter: 8.13
+* Page: 74
+*/
+typedef double UA_Duration;
+
+
+
+#endif /* OPCUA_BUILTINDATATYPES_H_ */

+ 86 - 0
open62541Stack/src/opcua_connectionHelper.h

@@ -0,0 +1,86 @@
+/*
+ * opcua_connectionHelper.h
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_CONNECTIONHELPER_H_
+#define OPCUA_CONNECTIONHELPER_H_
+#include "opcua_builtInDatatypes.h"
+#include "opcua_types.h"
+
+enum packetType
+{
+	packetType_HEL,
+	packetType_ACK,
+	packetType_ERR,
+	packetType_OPN,
+	packetType_MSG,
+	packetType_CLO
+};
+enum connectionState
+{
+	connectionState_CLOSED,
+	connectionState_OPENING,
+	connectionState_ESTABLISHED,
+
+};
+
+typedef struct
+{
+	UInt32 secureChannelId;
+	UInt32 tokenId;
+	UA_DateTime createdAt;
+	Int32 revisedLifetime;
+}SL_ChannelSecurityToken;
+
+typedef struct
+{
+	UInt32 recvBufferSize;
+	UInt32 sendBufferSize;
+
+	UInt32 protocolVersion;
+	UInt32 maxMessageSize;
+	UInt32 maxChunkCount;
+}TL_buffer;
+
+struct TL_connection
+{
+	Int32 socket;
+	UInt32 connectionState;
+	TL_buffer remoteConf;
+	TL_buffer localConf;
+	UA_String endpointURL;
+};
+
+
+struct SL_connection
+{
+
+	T_ApplicationInstanceCertificate clientCertificate;
+	UInt32 requestType;
+	UA_String secureChannelId;
+	UInt32 UInt32_secureChannelId;
+	UInt32 securityMode;
+	UA_ByteString clientNonce;
+	UInt32 connectionState;
+	SL_ChannelSecurityToken securityToken;
+
+};
+
+struct SS_connection
+{
+
+};
+
+typedef struct
+{
+	struct TL_connection transportLayer;
+	struct SL_connection secureLayer;
+	struct SS_connection serviceLayer;
+}UA_connection;
+
+
+
+#endif /* OPCUA_CONNECTIONHELPER_H_ */

+ 10 - 0
open62541Stack/src/opcua_encodingLayer.c

@@ -0,0 +1,10 @@
+/*
+ * opcua_encodingLayer.c
+ *
+ *  Created on: Jan 14, 2014
+ *      Author: opcua
+ */
+#include "opcua_encodingLayer.h"
+#include "opcua_binaryEncDec.h"
+#include "opcua_types.h"
+#include "opcua_builtInDatatypes.h"

+ 14 - 0
open62541Stack/src/opcua_encodingLayer.h

@@ -0,0 +1,14 @@
+/*
+ * opcua_encodingLayer.h
+ *
+ *  Created on: Jan 14, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_ENCODINGLAYER_H_
+#define OPCUA_ENCODINGLAYER_H_
+
+#include "opcua_builtInDatatypes.h"
+#include "opcua_advancedDatatypes.h"
+#include "opcua_types.h"
+#endif

+ 25 - 0
open62541Stack/src/opcua_linkedList.h

@@ -0,0 +1,25 @@
+/*
+ * opcua_linkedList.h
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_LINKEDLIST_H_
+#define OPCUA_LINKEDLIST_H_
+
+#include "opcua_advancedDatatypes.h";
+#include "opcua_types.h"
+#include "opcua_builtInDatatypes.h";
+
+typedef struct T_element
+{
+   AD_RawMessage *binaryData;
+   int(*serviceImplementation)(AD_RawMessage *data, AD_RawMessage *response);
+   struct T_linkedList * next;
+};
+
+typedef struct T_element element;
+
+#endif /* OPCUA_LINKEDLIST_H_ */
+

+ 18 - 0
open62541Stack/src/opcua_memory.c

@@ -0,0 +1,18 @@
+/*
+ * opcua_memory.c
+ *
+ *  Created on: Jan 30, 2014
+ *      Author: opcua
+ */
+
+#include "opcua_memory.h"
+void *opcua_malloc(size_t size)
+{
+	return malloc(size);
+}
+
+
+void opcua_free(void *pointer)
+{
+	free(pointer);
+}

+ 25 - 0
open62541Stack/src/opcua_memory.h

@@ -0,0 +1,25 @@
+/*
+ * opcua_memory.h
+ *
+ *  Created on: Jan 30, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_MEMORY_H_
+#define OPCUA_MEMORY_H_
+#include <stdint.h>
+#include <stdlib.h>
+/**
+ *
+ * @param size
+ */
+void* opcua_malloc(size_t size);
+
+/**
+ *
+ * @param pointer
+ */
+void opcua_free(void* pointer);
+
+
+#endif /* OPCUA_MEMORY_H_ */

+ 221 - 0
open62541Stack/src/opcua_secureChannelLayer.c

@@ -0,0 +1,221 @@
+/*
+ * opcua_secureChannelLayer.c
+ *
+ *  Created on: Jan 13, 2014
+ *      Author: opcua
+ */
+#include "opcua_secureChannelLayer.h"
+
+
+
+
+/*
+ * opens a secureChannel (server side)
+ */
+Int32 SL_secureChannel_open(const UA_connection *connection,
+		const AD_RawMessage *secureChannelMessage,
+		const SL_SecureConversationMessageHeader *SCMHeader,
+		const SL_AsymmetricAlgorithmSecurityHeader *AASHeader,
+		const SL_SequenceHeader *SequenceHeader)
+{
+
+	T_ResponseHeader responseHeader;
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//SL_secureChannel_ResponseHeader_get(connection,&responseHeader);
+	Int32 size = responseHeader_calcSize(&responseHeader);
+	rawMessage.message = (char*)opcua_malloc(size);
+
+	encodeResponseHeader(&responseHeader, &position, &rawMessage);
+
+	rawMessage.length = position;
+
+	return UA_NO_ERROR;
+}
+
+Int32 SL_openSecureChannel_responseMessage_get(UA_connection *connection,SL_Response *response, Int32* sizeInOut)
+{
+
+	response->ServerNonce.Length =0; // TODO set a valid value for the Server Nonce
+	response->ServerProtocolVersion = UA_PROTOCOL_VERSION; //
+	response->SecurityToken.createdAt = opcua_getTime(); //
+	response->SecurityToken.revisedLifetime = 300000; //TODO set Lifetime of Security Token
+	response->SecurityToken.secureChannelId = connection->secureLayer.UInt32_secureChannelId; //TODO set a valid value for secureChannel id
+	return UA_NO_ERROR;
+}
+
+Int32 SL_openSecureChannel_responseMessage_calcSize(SL_Response *response, Int32* sizeInOut)
+{
+	Int32 length = 0;
+	length += sizeof(response->SecurityToken);
+	length += UAString_calcSize(response->ServerNonce);
+	length += sizeof(response->ServerProtocolVersion);
+	return length;
+}
+
+/*
+ * closes a secureChannel (server side)
+ */
+void SL_secureChannel_close(UA_connection *connection)
+{
+
+}
+
+/*
+ * receive and process data from underlying layer
+ */
+void SL_receive(UA_connection *connection, AD_RawMessage *serviceMessage)
+{
+	AD_RawMessage* secureChannelMessage;
+	SL_SecureConversationMessageHeader SCM_Header;
+	SL_AsymmetricAlgorithmSecurityHeader AAS_Header;
+	SL_SequenceHeader SequenceHeader;
+
+	//TODO Error Handling, length checking
+	//get data from transport layer
+
+	TL_receive(connection, secureChannelMessage);
+
+	Int32 readPosition = 0;
+
+	//get the Secure Channel Message Header
+	decodeSCMHeader(secureChannelMessage,
+			&readPosition, &SCM_Header);
+
+	//get the Secure Channel Asymmetric Algorithm Security Header
+	decodeAASHeader(secureChannelMessage,
+			&readPosition, &AAS_Header);
+
+	//get the Sequence Header
+	decodeSequenceHeader(secureChannelMessage,
+			&readPosition, &SequenceHeader);
+
+	//get Secure Channel Message
+	//SL_secureChannel_Message_get(connection, secureChannelMessage,
+//			&readPosition,serviceMessage);
+
+	if (secureChannelMessage->length > 0)
+	{
+		switch (SCM_Header.MessageType)
+		{
+		case packetType_MSG:
+			if (connection->secureLayer.connectionState
+					== connectionState_ESTABLISHED)
+			{
+
+			}
+			else //receiving message, without secure channel
+			{
+				//TODO send back Error Message
+			}
+			break;
+		case packetType_OPN:
+			//Server Handling
+	//		if (openSecureChannelHeader_check(connection, secureChannelMessage))
+	//		{
+				//check if the request is valid
+			//	SL_openSecureChannelRequest_check(connection, secureChannelMessage);
+	//		}
+	//		else
+	//		{
+	//			//TODO send back Error Message
+	//		}
+		//Client Handling
+
+		//TODO free memory for secureChannelMessage
+
+		break;
+		case packetType_CLO:
+
+
+		//TODO free memory for secureChannelMessage
+		break;
+		}
+
+	}
+
+}
+/*
+ * get the secure channel message header
+ */
+Int32 decodeSCMHeader(AD_RawMessage *rawMessage,Int32 *pos,
+		SL_SecureConversationMessageHeader* SC_Header)
+{
+	SC_Header->MessageType = TL_getPacketType(rawMessage);
+	*pos += 3;//TL_MESSAGE_TYPE_LEN;
+	SC_Header->IsFinal = rawMessage->message[*pos];
+	SC_Header->MessageSize = decodeUInt32(rawMessage, *pos);
+	SC_Header->SecureChannelId = decodeUInt32(rawMessage, *pos);
+	return UA_NO_ERROR;
+
+}
+Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header,
+		 Int32 *pos,AD_RawMessage *rawMessage)
+{
+	const char *type = "ERR";
+	switch(SC_Header->MessageType)
+	{
+	case packetType_ACK:
+		type = "ACK";
+		break;
+	case packetType_CLO:
+		type = "CLO";
+		break;
+	case packetType_ERR:
+		type = "ERR";
+		break;
+	case packetType_HEL:
+		type = "HEL";
+		break;
+	case packetType_MSG:
+		type = "MSG";
+		break;
+	case packetType_OPN:
+		type = "OPN";
+		break;
+	default:
+		return UA_ERROR;
+	}
+
+	memcpy(&(rawMessage->message[*pos]), &type, 3);
+
+	return UA_NO_ERROR;
+}
+Int32 decodeSequenceHeader(AD_RawMessage *rawMessage, Int32 *pos,
+		SL_SequenceHeader *SequenceHeader)
+{
+	SequenceHeader->RequestId = decodeUInt32(rawMessage->message, pos);
+	SequenceHeader->SequenceNumber = decodeUInt32(rawMessage->message, pos);
+	return UA_NO_ERROR;
+}
+Int32 encodeSequenceHeader(SL_SequenceHeader *sequenceHeader,Int32 *pos,
+		AD_RawMessage *dstRawMessage)
+{
+	encodeUInt32(sequenceHeader->SequenceNumber,pos,&dstRawMessage->message[*pos]);
+	return UA_NO_ERROR;
+}
+/*
+ * get the asymmetric algorithm security header
+ */
+Int32 decodeAASHeader(AD_RawMessage *rawMessage, Int32 *pos,
+	SL_AsymmetricAlgorithmSecurityHeader* AAS_Header)
+{
+	Int32 err = 0;
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->SecurityPolicyUri);
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->SenderCertificate);
+	err += decodeUAByteString(rawMessage->message,pos,AAS_Header->ReceiverThumbprint);
+	return err;
+}
+Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
+		Int32 *pos, AD_RawMessage* dstRawMessage)
+{
+	encodeUAString(AAS_Header->SecurityPolicyUri,pos,&dstRawMessage->message[*pos]);
+	encodeUAString(AAS_Header->SenderCertificate,pos,&dstRawMessage->message[*pos]);
+	encodeUAString(AAS_Header->ReceiverThumbprint,pos,&dstRawMessage->message[*pos]);
+	return UA_NO_ERROR;
+}
+
+void SL_secureChannel_Footer_get()
+{
+
+}

+ 136 - 0
open62541Stack/src/opcua_secureChannelLayer.h

@@ -0,0 +1,136 @@
+/*
+ * opcua_secureChannelLayer.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_SECURECHANNELLAYER_H_
+#define OPCUA_SECURECHANNELLAYER_H_
+
+#include "opcua_advancedDatatypes.h"
+#include "opcua_encodingLayer.h"
+#include "opcua_connectionHelper.h"
+
+static const Int32 SL_HEADER_LENGTH = 0;
+
+
+
+typedef struct
+{
+	UInt32 ServerProtocolVersion;
+	SL_ChannelSecurityToken SecurityToken;
+	UA_String ServerNonce;
+}SL_Response;
+
+
+typedef struct
+{
+	UInt32 MessageType;
+	Byte   IsFinal;
+	UInt32 MessageSize;
+	UInt32 SecureChannelId;
+}SL_SecureConversationMessageHeader;
+
+
+typedef struct
+{
+	UA_String SecurityPolicyUri;
+	UA_String SenderCertificate;
+	UA_String ReceiverThumbprint;
+}SL_AsymmetricAlgorithmSecurityHeader;
+
+typedef struct _SL_SequenceHeader
+{
+	UInt32 SequenceNumber;
+	UInt32 RequestId;
+}SL_SequenceHeader;
+
+/*
+ * optional, only if there is encryption present
+ */
+typedef struct _SL_AsymmetricAlgorithmSecurityFooter
+{
+	Byte PaddingSize;
+	Byte *Padding;
+
+	UInt32 SignatureSize;
+	Byte *Signature;
+}SL_AsymmetricAlgorithmSecurityFooter;
+
+/*
+typedef struct _SL_ResponseHeader
+{
+	UA_DateTime timestamp;
+    IntegerId requestHandle;
+    UA_StatusCode serviceResult;
+    UA_DiagnosticInfo serviceDiagnostics;
+    UA_String *stringTable;
+    UInt32 stringTableLength;
+    UA_ExtensionObject additionalHeader;
+}SL_ResponseHeader;
+*/
+Int32 SL_openSecureChannel_responseMessage_get(UA_connection *connection,
+		SL_Response *response, Int32* sizeInOut);
+
+/**
+ *
+ * @param connection
+ * @param rawMessage
+ * @param pos
+ * @param SC_Header
+ * @return
+ */
+Int32 decodeSCMHeader(AD_RawMessage *rawMessage,Int32 *pos,
+		SL_SecureConversationMessageHeader* SC_Header);
+
+/**
+ *
+ * @param SC_Header
+ * @param pos
+ * @param rawMessage
+ * @return
+ */
+Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header,
+	 Int32 *pos,AD_RawMessage *rawMessage);
+
+/**
+ *
+ * @param rawMessage
+ * @param pos
+ * @param SequenceHeader
+ * @return
+ */
+Int32 decodeSequenceHeader(AD_RawMessage *rawMessage, Int32 *pos,
+		SL_SequenceHeader *sequenceHeader);
+/**
+ *
+ * @param sequenceHeader
+ * @param pos
+ * @param dstRawMessage
+ * @return
+ */
+Int32 encodeSequenceHeader(SL_SequenceHeader *sequenceHeader,Int32 *pos,
+		AD_RawMessage *dstRawMessage);
+/**
+ *
+ * @param rawMessage
+ * @param pos
+ * @param AAS_Header
+ * @return
+ */
+Int32 decodeAASHeader(AD_RawMessage *rawMessage, Int32 *pos,
+	SL_AsymmetricAlgorithmSecurityHeader* AAS_Header);
+
+/**
+ *
+ * @param AAS_Header
+ * @param pos
+ * @param dstRawMessage
+ * @return
+ */
+Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
+		Int32 *pos, AD_RawMessage* dstRawMessage);
+
+
+#endif /* OPCUA_SECURECHANNELLAYER_H_ */

+ 19 - 0
open62541Stack/src/opcua_serializationLayer.c

@@ -0,0 +1,19 @@
+/*
+ * opcua_serializationLayer.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+#include "opcua_serializationLayer.h"
+
+serviceManager_registerServiceImplementation()
+{
+
+}
+serviceManager(Int32 serviceRequest)
+{
+	if(serviceManager_serviceAvailable(serviceRequest))
+	{
+
+	}
+}

+ 13 - 0
open62541Stack/src/opcua_serializationLayer.h

@@ -0,0 +1,13 @@
+/*
+ * opcua_serializationLayer.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_SERIALIZATIONLAYER_H_
+#define OPCUA_SERIALIZATIONLAYER_H_
+
+
+
+#endif /* OPCUA_SERIALIZATIONLAYER_H_ */

+ 28 - 0
open62541Stack/src/opcua_serverAPI.h

@@ -0,0 +1,28 @@
+/*
+ * opcua_serverAPI.h
+ *
+ *  Created on: Jan 10, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_SERVERAPI_H_
+#define OPCUA_SERVERAPI_H_
+
+// startServer(parameters)
+
+// stopServer(parameters)
+
+
+
+
+// registerServiceCallback(NodeTypeIde,)
+// sessionId = AcceptSecureChannel()
+
+// serviceRequest = receiveServiceRequest(sessionId)
+
+// sendServiceResponse(sessionId, serviceResponse)
+
+// closeSecureChannel(sessionId)
+
+
+#endif /* OPCUA_SERVERAPI_H_ */

+ 22 - 0
open62541Stack/src/opcua_time.c

@@ -0,0 +1,22 @@
+/*
+ * opcua_time.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+#include "opcua_builtInDatatypes.h"
+#include "opcua_advancedDatatypes.h"
+#include <time.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+
+//get the current Server Time
+UA_DateTime opcua_getTime()
+{
+	//TODO call System Time function
+	UA_DateTime time = 10000000;
+	return time;
+}
+
+

+ 15 - 0
open62541Stack/src/opcua_time.h

@@ -0,0 +1,15 @@
+/*
+ * opcua_time.h
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_TIME_H_
+#define OPCUA_TIME_H_
+
+
+
+#endif /* OPCUA_TIME_H_ */
+
+UA_DateTime opcua_getTime();

+ 262 - 0
open62541Stack/src/opcua_transportLayer.c

@@ -0,0 +1,262 @@
+/*
+ * opcua_transportLayer.c
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#include "opcua_transportLayer.h"
+
+
+
+/*
+ * server answer to open message
+ */
+void TL_open(UA_connection *connection, AD_RawMessage *rawMessage)
+{
+	UA_connection tmpConnection;
+	switch(connection->transportLayer.connectionState)
+	{
+		connectionState_CLOSED :
+		{
+			//process the connection values received by the client
+			TL_processHELMessage(&tmpConnection,rawMessage);
+			connection->transportLayer.localConf.protocolVersion = TL_SERVER_PROTOCOL_VERSION;
+
+			connection->transportLayer.localConf.recvBufferSize =
+					tmpConnection.transportLayer.localConf.recvBufferSize;
+
+			connection->transportLayer.localConf.sendBufferSize =
+					tmpConnection.transportLayer.localConf.sendBufferSize;
+
+			connection->transportLayer.localConf.maxMessageSize = TL_SERVER_MAX_MESSAGE_SIZE;
+			connection->transportLayer.localConf.maxChunkCount = TL_SERVER_MAX_CHUNK_COUNT;
+
+		    TL_sendACK(connection);
+			connection->transportLayer.connectionState = connectionState_ESTABLISHED;
+			break;
+		}
+		connectionState_OPENING :
+		{
+		//	TL_sendACK(connection);
+		//	connection->transportLayer.connectionState = connectionState_ESTABLISHED;
+			break;
+		}
+		connectionState_ESTABLISHED :
+		{
+
+			break;
+		}
+	}
+}
+
+Int32 TL_check(UA_connection *connection, AD_RawMessage *TL_messsage)
+{
+	Int32 position = 4;
+	UInt32 messageLength = 0;
+	Int32 pos = 0;
+	TL_getPacketType(&pos,TL_messsage);
+	decoder_decodeBuiltInDatatype(TL_messsage->message,UINT32,&position,&messageLength);
+
+	if (messageLength == TL_messsage->length &&
+			messageLength < (connection->transportLayer.localConf.maxMessageSize))
+	{
+		return UA_ERROR;
+	}
+	return UA_NO_ERROR;
+}
+
+
+Int32 TL_receive(UA_connection *connection, AD_RawMessage *TL_message)
+{
+	UInt32 bufferSize = connection->transportLayer.localConf.recvBufferSize = 8192;
+	UInt32 length = 0;
+	Int32 pos = 0;
+
+	AD_RawMessage tmpRawMessage;
+	struct TL_header tmpHeader;
+	//TODO call socket receive function
+	tmpRawMessage.message = (char *)opcua_malloc(bufferSize);
+	tmpRawMessage.length = bufferSize;
+
+	if(TL_check(connection,TL_message) == UA_NO_ERROR)
+	{
+		Int32 packetType = TL_getPacketType(&pos,TL_message);
+		switch(packetType)
+		{
+		packetType_MSG:
+		packetType_OPN:
+		packetType_CLO:
+
+			break;
+		packetType_HEL:
+		packetType_ACK:
+			TL_process(connection,TL_message,packetType);
+			break;
+		packetType_ERR:
+			TL_message->length = 0;
+			TL_message->message = NULL;
+
+			//TODO ERROR HANDLING
+
+			return UA_ERROR_RCV_ERROR;
+			break;
+		}
+	}
+	else
+	{
+		//length error: send error message to communication partner
+		//TL_send()
+	}
+	return UA_NO_ERROR;
+}
+
+
+/*
+ * get the message header
+ */
+void TL_getMessageHeader(struct TL_header *header, AD_RawMessage *rawMessage)
+{
+	int pos = 0;
+
+	if(rawMessage->message[0] == 'H' &&
+	   rawMessage->message[1] == 'E' &&
+	   rawMessage->message[2] == 'L')
+	{
+		header->MessageType = TL_HEL;
+	}
+	else if(rawMessage->message[0] == 'A' &&
+	        rawMessage->message[1] == 'C' &&
+	        rawMessage->message[2] == 'K')
+	{
+		header->MessageType = TL_ACK;
+	}
+	else if(rawMessage->message[0] == 'E' &&
+			rawMessage->message[1] == 'R' &&
+			rawMessage->message[2] == 'R')
+	{
+		header->MessageType = TL_ERR;
+	}
+	else if(rawMessage->message[0] == 'O' &&
+	        rawMessage->message[1] == 'P' &&
+	        rawMessage->message[2] == 'N')
+	{
+		header->MessageType = TL_OPN;
+	}
+	else if(rawMessage->message[0] == 'C' &&
+	        rawMessage->message[1] == 'L' &&
+	        rawMessage->message[2] == 'O')
+	{
+		header->MessageType = TL_CLO;
+	}
+	else if(rawMessage->message[0] == 'M' &&
+			rawMessage->message[1] == 'S' &&
+			rawMessage->message[2] == 'G')
+	{
+		header->MessageType = TL_MSG;
+	}
+	else
+	{
+		//TODO ERROR no valid message received
+	}
+
+	pos = pos + TL_MESSAGE_TYPE_LEN;
+
+	decoder_decodeBuiltInDatatype(rawMessage->message,BYTE,&pos,&(header->Reserved));
+	decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,&(header->MessageSize));
+}
+Int32 TL_getPacketType(Int32 *pos,AD_RawMessage *rawMessage)
+{
+
+	if(rawMessage->message[*pos] == 'H' &&
+	   rawMessage->message[*pos+1] == 'E' &&
+	   rawMessage->message[*pos+2] == 'L')
+	{
+		return packetType_HEL;
+	}
+	else if(rawMessage->message[*pos] == 'A' &&
+	        rawMessage->message[*pos+1] == 'C' &&
+	        rawMessage->message[*pos+2] == 'K')
+	{
+		return packetType_ACK;
+	}
+	else if(rawMessage->message[*pos] == 'E' &&
+			rawMessage->message[*pos+1] == 'R' &&
+			rawMessage->message[*pos+2] == 'R')
+	{
+		return packetType_ERR;
+	}
+	else if(rawMessage->message[*pos] == 'O' &&
+	        rawMessage->message[*pos+1] == 'P' &&
+	        rawMessage->message[*pos+2] == 'N')
+	{
+		return packetType_OPN;
+	}
+	else if(rawMessage->message[*pos] == 'C' &&
+	        rawMessage->message[*pos+1] == 'L' &&
+	        rawMessage->message[*pos+2] == 'O')
+	{
+		return packetType_CLO;
+	}
+	else if(rawMessage->message[*pos] == 'M' &&
+			rawMessage->message[*pos+1] == 'S' &&
+			rawMessage->message[*pos+2] == 'G')
+	{
+		return packetType_MSG;
+	}
+	else
+	{
+		return -1;//TODO ERROR no valid message received
+	}
+}
+
+
+Int32 TL_process(UA_connection *connection,Int32 packetType, Int32 *pos, AD_RawMessage *rawMessage)
+{
+	struct TL_header tmpHeader;
+	switch(packetType)
+	{
+	packetType_HEL :
+		if(connection->transportLayer.connectionState == connectionState_CLOSED)
+		{
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,
+					(void*)(&(connection->transportLayer.remoteConf.protocolVersion)));
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,
+					(void*)(&(connection->transportLayer.remoteConf.recvBufferSize)));
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,
+					(void*)(&(connection->transportLayer.remoteConf.sendBufferSize)));
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,
+					(void*)(&(connection->transportLayer.remoteConf.maxMessageSize)));
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,UINT32,&pos,
+					(void*)(&(connection->transportLayer.remoteConf.maxChunkCount)));
+
+
+			decoder_decodeBuiltInDatatype(rawMessage->message,STRING,&pos,
+					(void*)(&(connection->transportLayer.endpointURL)));
+
+		}
+		else
+		{
+			return UA_ERROR_MULTIPLY_HEL;
+		}
+	}
+	return UA_NO_ERROR;
+}
+/*
+ * respond to client request
+ */
+
+
+TL_send(AD_RawMessage *rawMessage)
+{
+	//call tcp function or callback
+}
+
+
+
+

+ 103 - 0
open62541Stack/src/opcua_transportLayer.h

@@ -0,0 +1,103 @@
+/*
+ * opcua_transportLayer.h
+ *
+ *  Created on: Dec 19, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_TRANSPORTLAYER_H_
+#define OPCUA_TRANSPORTLAYER_H_
+#include <stdio.h>
+
+#include "opcua_binaryEncDec.h"
+#include "opcua_advancedDatatypes.h"
+#include "opcua_connectionHelper.h"
+
+
+//TODO : Implement this interface
+#include "tcp_layer.h"
+//transport errors begin at 1000
+#define UA_ERROR_MULTIPLY_HEL 1000
+#define UA_ERROR_RCV_ERROR 1001
+
+//constants
+static const UInt32 TL_HEADER_LENGTH = 8;
+static const UInt32 TL_MESSAGE_TYPE_LEN = 3;
+static const UInt32 TL_RESERVED_LEN = 1;
+
+//variables which belong to layer
+static const TL_SERVER_PROTOCOL_VERSION = 0;
+static const TL_SERVER_MAX_CHUNK_COUNT = 1;
+static const TL_SERVER_MAX_MESSAGE_SIZE = 8192;
+
+enum TL_messageType_td
+{
+	TL_HEL,
+	TL_ACK,
+	TL_ERR,
+	TL_OPN,
+	TL_CLO,
+	TL_MSG
+}TL_messageType;
+
+struct TL_header
+{
+	UInt32 MessageType;
+	Byte Reserved;
+	UInt32 MessageSize;
+};
+struct TL_message
+{
+	struct TL_header Header;
+	char *message;
+};
+
+struct TL_messageBodyHEL
+{
+	UInt32 ProtocolVersion;
+	UInt32 ReceiveBufferSize;
+	UInt32 SendBufferSize;
+	UInt32 MaxMessageSize;
+	UInt32 MaxChunkCount;
+	UA_String EndpointUrl;
+};
+
+struct TL_messageBodyACK
+{
+	UInt32 ProtocolVersion;
+	UInt32 ReceiveBufferSize;
+	UInt32 SendBufferSize;
+	UInt32 MaxMessageSize;
+	UInt32 MaxChunkCount;
+	UA_String EndpointUrl;
+};
+
+struct TL_messageBodyERR
+{
+	UInt32 Error;
+	UA_String Reason;
+
+};
+//functions
+/**
+ *
+ * @param connection connection object
+ * @param TL_message
+ * @return
+ */
+Int32 TL_check(UA_connection *connection, AD_RawMessage *TL_message);
+/**
+ *
+ * @param connection
+ * @param TL_message
+ */
+Int32 TL_receive(UA_connection *connection, AD_RawMessage *TL_message);
+
+Int32 TL_getPacketType(Int32 *pos, AD_RawMessage *rawMessage);
+void TL_getMessageHeader(struct TL_header *messageHeader,AD_RawMessage *rawMessage);
+
+//Test
+void TL_processHELMessage_test();
+
+void TL_processHELMessage(UA_connection *connection, AD_RawMessage *rawMessage);
+#endif /* OPCUA_TRANSPORTLAYER_H_ */

Plik diff jest za duży
+ 1051 - 0
open62541Stack/src/opcua_types.h


+ 22 - 0
open62541Stack/src/opuca_linkedList.c

@@ -0,0 +1,22 @@
+/*
+ * opuca_linkedList.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+
+#include<stdlib.h>
+#include<stdio.h>
+
+
+
+list_add(element *list,element *elementToAdd)
+{
+	element *nElement;
+	while(list->next != NULL)
+	{
+		nElement = list->next;
+	}
+
+}

+ 16 - 0
open62541Stack/src/tcp_layer.h

@@ -0,0 +1,16 @@
+/*
+ * tcp_layer.h
+ *
+ *  Created on: Jan 10, 2014
+ *      Author: opcua
+ */
+
+#ifndef TCP_LAYER_H_
+#define TCP_LAYER_H_
+#include "opcua_connectionHelper.h"
+/*
+ * returns the length of read bytes
+ */
+UInt32 receive(UA_connection *connection, AD_RawMessage *message,UInt32 bufferLength);
+
+#endif /* TCP_LAYER_H_ */

+ 6 - 0
open62541Stack/tests/Makefile.am

@@ -0,0 +1,6 @@
+TESTS = check_stack
+check_PROGRAMS = check_stack
+check_stack_SOURCES = check_stack.c
+
+check_stack_CFLAGS = @CHECK_CFLAGS@
+check_stack_LDADD = $(top_builddir)/src/libopen62541.la @CHECK_LIBS@

+ 921 - 0
open62541Stack/tests/check_stack.c

@@ -0,0 +1,921 @@
+/*
+ ============================================================================
+ Name        : opcuaServer.c
+ Author      :
+ Version     :
+ Copyright   : Your copyright notice
+ Description :
+ ============================================================================
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "../src/opcua_transportLayer.h"
+#include "../src/opcua_binaryEncDec.h"
+#include "../src/opcua_encodingLayer.h"
+#include "../src/opcua_advancedDatatypes.h"
+//#include "check_stdint.h"
+#include "check.h"
+
+
+
+START_TEST(test_getPacketType_validParameter)
+{
+
+	char buf[] = {'C','L','O'};
+	Int32 pos = 0;
+	AD_RawMessage rawMessage;
+	rawMessage.message = buf;
+	rawMessage.length = 3;
+
+	ck_assert_int_eq(TL_getPacketType(&pos,&rawMessage),packetType_CLO);
+
+}
+END_TEST
+
+START_TEST(encodeByte_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeByte
+		char *mem = malloc(sizeof(Byte));
+		rawMessage.message = mem;
+		Byte testByte = 0x08;
+		rawMessage.length = 1;
+		position = 0;
+
+		encodeByte(testByte, &position, rawMessage.message);
+
+		ck_assert_int_eq(rawMessage.message[0], 0x08);
+		ck_assert_int_eq(rawMessage.length, 1);
+		ck_assert_int_eq(position, 1);
+		free(mem);
+}
+END_TEST
+
+/*
+START_TEST(decodeRequestHeader_test_validParameter)
+{
+		char testMessage = {0x00,0x00,0x72,0xf1,0xdc,0xc9,0x87,0x0b,
+
+							0xcf,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+							0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,
+							0x00,0x00,0x00,0x00,0x00};
+		AD_RawMessage rawMessage;
+		rawMessage.message = &testMessage;
+		rawMessage.length = 29;
+		Int32 position = 0;
+		T_RequestHeader requestHeader;
+		decodeRequestHeader(rawMessage,&position,&requestHeader);
+
+		ck_assert_int_eq(requestHeader.authenticationToken.EncodingByte,0);
+
+		ck_assert_int_eq(requestHeader.returnDiagnostics,0);
+
+		ck_assert_int_eq(requestHeader.authenticationToken.EncodingByte,0);
+
+}
+END_TEST
+*/
+
+START_TEST(decodeInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char mem[2] = {0x01,0x00};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 2;
+
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	Int32 p = 0;
+	Int16 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message,INT16,&p,&val);
+	ck_assert_int_eq(val,1);
+	//ck_assert_int_eq(p, 2);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+START_TEST(encodeInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char *mem = malloc(sizeof(UInt16));
+	rawMessage.message = mem;
+	UInt16 testUInt16 = 1;
+	rawMessage.length = 2;
+	position = 0;
+
+	encodeUInt16(testUInt16, &position, rawMessage.message);
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	ck_assert_int_eq(position, 2);
+	Int32 p = 0;
+	Int16 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, INT16, &p, &val);
+	ck_assert_int_eq(val,testUInt16);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+
+START_TEST(decodeUInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char mem[2] = {0x01,0x00};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 2;
+
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	Int32 p = 0;
+	UInt16 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message,UINT16,&p,&val);
+
+	ck_assert_int_eq(val,1);
+	//ck_assert_int_eq(p, 2);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+START_TEST(encodeUInt16_test)
+{
+
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char *mem = malloc(sizeof(UInt16));
+	rawMessage.message = mem;
+	UInt16 testUInt16 = 1;
+	rawMessage.length = 2;
+	position = 0;
+
+	encodeUInt16(testUInt16, &position, rawMessage.message);
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	ck_assert_int_eq(position, 2);
+	Int32 p = 0;
+	UInt16 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, UINT16, &p, &val);
+	ck_assert_int_eq(val,testUInt16);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
+
+}
+END_TEST
+
+
+START_TEST(decodeUInt32_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char mem[4] = {0xFF,0x00,0x00,0x00};
+
+	rawMessage.message = mem;
+	rawMessage.length = 4;
+
+	Int32 p = 0;
+	UInt32 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, UINT32, &p, &val);
+	ck_assert_uint_eq(val,255);
+
+}
+END_TEST
+START_TEST(encodeUInt32_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	UInt32 value = 0x0101FF00;
+	//EncodeUInt16
+
+	rawMessage.message = (char*)opcua_malloc(sizeof(UInt32));
+
+	rawMessage.length = 4;
+
+	Int32 p = 0;
+	encodeUInt32(value, &p,rawMessage.message);
+
+	ck_assert_uint_eq((Byte)rawMessage.message[0],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[1],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[2],0x01);
+	ck_assert_uint_eq((Byte)rawMessage.message[3],0x01);
+
+}
+END_TEST
+
+START_TEST(decodeInt32_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	//EncodeUInt16
+	char mem[4] = {0x00,0xCA,0x9A,0x3B};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 4;
+
+
+	Int32 p = 0;
+	Int32 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, INT32, &p, &val);
+	ck_assert_int_eq(val,1000000000);
+}
+END_TEST
+START_TEST(encodeInt32_test)
+{
+
+}
+END_TEST
+
+
+START_TEST(decodeUInt64_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	UInt64 expectedVal = 0xFF;
+	expectedVal = expectedVal << 56;
+	char mem[8] = {00,00,00,00,0x00,0x00,0x00,0xFF};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 8;
+
+	Int32 p = 0;
+	UInt64 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, UINT64, &p, &val);
+	ck_assert_uint_eq(val, expectedVal);
+}
+END_TEST
+START_TEST(encodeUInt64_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	UInt64 value = 0x0101FF00FF00FF00;
+	//EncodeUInt16
+
+	rawMessage.message = (char*)opcua_malloc(sizeof(UInt32));
+
+	rawMessage.length = 8;
+
+	Int32 p = 0;
+	encodeUInt64(value, &p,rawMessage.message);
+
+	ck_assert_uint_eq((Byte)rawMessage.message[0],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[1],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[2],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[3],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[4],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[5],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[6],0x01);
+	ck_assert_uint_eq((Byte)rawMessage.message[7],0x01);
+}
+END_TEST
+
+START_TEST(decodeInt64_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	Int64 expectedVal = 0xFF;
+	expectedVal = expectedVal << 56;
+	char mem[8] = {00,00,00,00,0x00,0x00,0x00,0xFF};
+
+	rawMessage.message = mem;
+
+	rawMessage.length = 8;
+
+	Int32 p = 0;
+	Int64 val;
+	decoder_decodeBuiltInDatatype(rawMessage.message, INT64, &p, &val);
+	ck_assert_uint_eq(val, expectedVal);
+}
+END_TEST
+START_TEST(encodeInt64_test)
+{
+	AD_RawMessage rawMessage;
+	Int32 position = 0;
+	UInt64 value = 0x0101FF00FF00FF00;
+	//EncodeUInt16
+
+	rawMessage.message = (char*)opcua_malloc(sizeof(UInt32));
+
+	rawMessage.length = 8;
+
+	Int32 p = 0;
+	encodeUInt64(value, &p,rawMessage.message);
+
+	ck_assert_uint_eq((Byte)rawMessage.message[0],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[1],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[2],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[3],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[4],0x00);
+	ck_assert_uint_eq((Byte)rawMessage.message[5],0xFF);
+	ck_assert_uint_eq((Byte)rawMessage.message[6],0x01);
+	ck_assert_uint_eq((Byte)rawMessage.message[7],0x01);
+}
+END_TEST
+
+
+START_TEST(decodeFloat_test)
+{
+	Float expectedValue = -6.5;
+	Int32 pos = 0;
+	char buf[4] = {0x00,0x00,0xD0,0xC0};
+
+
+	Float calcVal;
+
+	decoder_decodeBuiltInDatatype(buf, FLOAT, &pos, &calcVal);
+	//val should be -6.5
+
+	Int32 val = (calcVal > -6.501 && calcVal < -6.499);
+
+
+	ck_assert_int_gt(val,0);
+
+	opcua_free(buf);
+}
+END_TEST
+START_TEST(encodeFloat_test)
+{
+	Float value = -6.5;
+	Int32 pos = 0;
+	char *buf = (char*)opcua_malloc(sizeof(Float));
+
+	encodeFloat(value,&pos,buf);
+
+	ck_assert_uint_eq((Byte)buf[2],0xD0);
+	ck_assert_uint_eq((Byte)buf[3],0xC0);
+	opcua_free(buf);
+
+}
+END_TEST
+
+START_TEST(decodeDouble_test)
+{
+
+}
+END_TEST
+START_TEST(encodeDouble_test)
+{
+	Float value = -6.5;
+	Int32 pos = 0;
+	char *buf = (char*)opcua_malloc(sizeof(Float));
+
+	encodeDouble(value,&pos,buf);
+
+	ck_assert_uint_eq((Byte)buf[6],0xD0);
+	ck_assert_uint_eq((Byte)buf[7],0xC0);
+	opcua_free(buf);
+}
+END_TEST
+
+
+START_TEST(encodeUAString_test)
+{
+
+	Int32 pos = 0;
+	UA_String string;
+	Int32 l = 11;
+	char mem[11] = "ACPLT OPCUA";
+	char *dstBuf = (char*) malloc(sizeof(Int32)+l);
+	string.Data =  mem;
+	string.Length = 11;
+
+	encodeUAString(&string, &pos, dstBuf);
+
+	ck_assert_int_eq(dstBuf[0],11);
+	ck_assert_int_eq(dstBuf[0+sizeof(Int32)],'A');
+
+
+}
+END_TEST
+START_TEST(decodeUAString_test)
+{
+
+	Int32 pos = 0;
+	UA_String string;
+	Int32 l = 11;
+	char binString[15] = {11,0x00,0x00,0x00,'A','C','P','L','T',' ','U','A'};
+
+	char *dstBuf = (char*) malloc(l-sizeof(Int32));
+	string.Data = dstBuf;
+	string.Length = 0;
+	decodeUAString(binString, &pos, &string);
+
+
+	ck_assert_int_eq(string.Length,11);
+	ck_assert_int_eq(string.Data[3],'L');
+
+
+}
+END_TEST
+
+START_TEST(diagnosticInfo_calcSize_test)
+{
+
+	Int32 valreal = 0;
+	Int32 valcalc = 0;
+	UA_DiagnosticInfo diagnosticInfo;
+	diagnosticInfo.EncodingMask = 0x01 | 0x02 | 0x04 | 0x08 | 0x10;
+	diagnosticInfo.SymbolicId = 30;
+	diagnosticInfo.NamespaceUri = 25;
+	diagnosticInfo.LocalizedText = 22;
+	diagnosticInfo.AdditionalInfo.Data = "OPCUA";
+	diagnosticInfo.AdditionalInfo.Length = 5;
+
+	valcalc = diagnosticInfo_calcSize(&diagnosticInfo);
+	valreal = 26;
+	ck_assert_int_eq(valcalc,valreal);
+
+}
+END_TEST
+START_TEST(extensionObject_calcSize_test)
+{
+
+	Int32 valreal = 0;
+	Int32 valcalc = 0;
+	Byte data[3] = {1,2,3};
+	UA_ExtensionObject extensionObject;
+
+	extensionObject.TypeId.EncodingByte = NIEVT_TWO_BYTE;; // Numeric TWO BYTES
+	extensionObject.TypeId.Identifier.Numeric = 0;
+
+	extensionObject.Encoding = 0x00;
+	extensionObject.Length = 0;
+	//extensionObject.Body = &data;
+
+	valcalc = extensionObject_calcSize(&extensionObject);
+	valreal = 3;
+	ck_assert_int_eq(valcalc, valreal);
+
+}
+END_TEST
+
+START_TEST(responseHeader_calcSize_test)
+{
+	Int32 valreal = 0;
+	Int32 valcalc = 0;
+	T_ResponseHeader responseHeader;
+	UA_DiagnosticInfo diagnosticInfo;
+	UA_ExtensionObject extensionObject;
+
+	//Should have the size of 16 Bytes
+	responseHeader.timestamp = 150014;
+	responseHeader.requestHandle = 514;
+	responseHeader.serviceResult = 504;
+
+	//Should have the size of 26 Bytes
+	diagnosticInfo.EncodingMask = 0x01 | 0x02 | 0x04 | 0x08 | 0x10;
+	diagnosticInfo.SymbolicId = 30;
+	diagnosticInfo.NamespaceUri = 25;
+	diagnosticInfo.LocalizedText = 22;
+	diagnosticInfo.AdditionalInfo.Data = "OPCUA";
+	diagnosticInfo.AdditionalInfo.Length = 5;
+	responseHeader.serviceDiagnostics = &diagnosticInfo;
+	//Should have the size of 4 Bytes
+	responseHeader.noOfStringTable = 0;
+	//Should have the size of 3 Bytes
+	extensionObject.TypeId.EncodingByte = NIEVT_TWO_BYTE;
+	extensionObject.TypeId.Identifier.Numeric = 0;
+	extensionObject.Encoding = 0x00; //binaryBody = false, xmlBody = false
+	responseHeader.additionalHeader = extensionObject;
+
+	valcalc = responseHeader_calcSize(&responseHeader);
+	valreal = 49;
+
+	ck_assert_int_eq(valcalc,valreal);
+
+}
+END_TEST
+
+START_TEST(encodeDataValue_test)
+{
+	UA_DataValue dataValue;
+	Int32 pos = 0;
+	char *buf = (char*)opcua_malloc(15);
+	UA_DateTime dateTime;
+	dateTime = 80;
+	dataValue.ServerTimestamp = dateTime;
+
+	//--without Variant
+	dataValue.EncodingMask = 0x08; //Only the SourvePicoseconds
+	encodeDataValue(&dataValue, &pos, buf);
+
+	ck_assert_int_eq(pos, 9);// represents the length
+	ck_assert_int_eq(buf[0], 0x08);
+	ck_assert_int_eq(buf[1], 80);
+	ck_assert_int_eq(buf[2], 0);
+	ck_assert_int_eq(buf[3], 0);
+	ck_assert_int_eq(buf[4], 0);
+	ck_assert_int_eq(buf[5], 0);
+	ck_assert_int_eq(buf[6], 0);
+	ck_assert_int_eq(buf[7], 0);
+	ck_assert_int_eq(buf[8], 0);
+
+	//TestCase for a DataValue with a Variant!
+	//ToDo: Need to be checked after the function for encoding variants has been implemented
+	pos = 0;
+	dataValue.EncodingMask = 0x01 || 0x08; //Variant & SourvePicoseconds
+	UA_Variant variant;
+	variant.ArrayLength = 0;
+	variant.EncodingMask = VTEMT_INT32;
+	UA_VariantUnion variantUnion;
+	variantUnion.Int32 = 45;
+	variant.Value = &variantUnion;
+	dataValue.Value = variant;
+	encodeDataValue(&dataValue, &pos, buf);
+
+	ck_assert_int_eq(pos, 14);// represents the length
+	ck_assert_int_eq(buf[0], 0x08);
+	ck_assert_int_eq(buf[1], 0x06);
+	ck_assert_int_eq(buf[2], 45);
+	ck_assert_int_eq(buf[3], 0);
+	ck_assert_int_eq(buf[4], 0);
+	ck_assert_int_eq(buf[5], 0);
+	ck_assert_int_eq(buf[6], 80);
+	ck_assert_int_eq(buf[7], 0);
+
+}
+END_TEST
+
+Suite *testSuite_getPacketType(void)
+{
+	Suite *s = suite_create("getPacketType");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core,test_getPacketType_validParameter);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite *testSuite_encodeByte(void)
+{
+	Suite *s = suite_create("encodeByte_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeByte_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+
+Suite *testSuite_decodeInt16(void)
+{
+	Suite *s = suite_create("decodeInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeInt16(void)
+{
+	Suite *s = suite_create("encodeInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+
+Suite *testSuite_decodeUInt16(void)
+{
+	Suite *s = suite_create("decodeUInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeUInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeUInt16(void)
+{
+	Suite *s = suite_create("encodeUInt16_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeUInt16_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite*testSuite_decodeUInt32(void)
+{
+	Suite *s = suite_create("decodeUInt32_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeUInt32_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeUInt32(void)
+{
+	Suite *s = suite_create("encodeUInt32_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeUInt32_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite*testSuite_decodeInt32(void)
+{
+	Suite *s = suite_create("decodeInt32_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeInt32_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeInt32(void)
+{
+	Suite *s = suite_create("encodeInt32_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeInt32_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+
+
+
+Suite*testSuite_decodeUInt64(void)
+{
+	Suite *s = suite_create("decodeUInt64_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeUInt64_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeUInt64(void)
+{
+	Suite *s = suite_create("encodeUInt64_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeUInt64_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite*testSuite_decodeInt64(void)
+{
+	Suite *s = suite_create("decodeInt64_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeInt64_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite*testSuite_encodeInt64(void)
+{
+	Suite *s = suite_create("encodeInt64_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeInt64_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite *testSuite_encodeFloat(void)
+{
+	Suite *s = suite_create("encodeFloat_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeFloat_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite *testSuite_decodeFloat(void)
+{
+	Suite *s = suite_create("decodeFloat_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeFloat_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite *testSuite_encodeDouble(void)
+{
+	Suite *s = suite_create("encodeDouble_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeDouble_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite *testSuite_decodeDouble(void)
+{
+	Suite *s = suite_create("decodeDouble_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeDouble_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite * testSuite_encodeUAString(void)
+{
+	Suite *s = suite_create("encodeUAString_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeUAString_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite * testSuite_decodeUAString(void)
+{
+	Suite *s = suite_create("decodeUAString_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, decodeUAString_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+Suite* testSuite_encodeDataValue()
+{
+	Suite *s = suite_create("encodeDataValue");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeDataValue_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+/*
+Suite* TL_<TESTSUITENAME>(void)
+{
+	Suite *s = suite_create("<TESTSUITENAME>");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core,<TEST_NAME>);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+*/
+Suite* testSuite_diagnosticInfo_calcSize()
+{
+	Suite *s = suite_create("diagnosticInfo_calcSize");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, diagnosticInfo_calcSize_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite* testSuite_extensionObject_calcSize()
+{
+	Suite *s = suite_create("extensionObject_calcSize");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, extensionObject_calcSize_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite* testSuite_responseHeader_calcSize()
+{
+	Suite *s = suite_create("responseHeader_calcSize");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, responseHeader_calcSize_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+
+int main (void)
+{
+	int number_failed = 0;
+
+	Suite *s = testSuite_getPacketType();
+	SRunner *sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed = srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeUInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeUInt16();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeUInt32();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeUInt32();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeInt32();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeInt32();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeUInt64();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeUInt64();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeInt64();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeInt64();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+
+	s = testSuite_encodeFloat();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeDouble();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+
+	s = testSuite_encodeByte();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeUAString();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_decodeUAString();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_diagnosticInfo_calcSize();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_extensionObject_calcSize();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_responseHeader_calcSize();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeDataValue();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	/* <TESTSUITE_TEMPLATE>
+	s =  <TESTSUITENAME>;
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+	*/
+	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+
+}
+
+