Преглед на файлове

added encoding and test functions for various builtInDatatypes

FlorianPalm преди 11 години
родител
ревизия
81f4be501c

+ 6 - 0
OPCUAServer/.settings/org.eclipse.cdt.managedbuilder.core.prefs

@@ -1,4 +1,10 @@
 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=\:

+ 4 - 4
OPCUAServer/INSTALL

@@ -1,7 +1,7 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
 Inc.
 
    Copying and distribution of this file, with or without modification,
@@ -309,10 +309,9 @@ 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 limitation.  Until the limitation is lifted, you can use
-this workaround:
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
 
-     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
 
 `configure' Invocation
 ======================
@@ -368,3 +367,4 @@ operates.
 
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
+

+ 1 - 1
OPCUAServer/configure.ac

@@ -14,7 +14,7 @@ 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.4],[have_check="yes"],AC_MSG_WARN([Check not found; cannot run unit tests!])
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.12],[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"])

+ 25 - 15
OPCUAServer/m4/libtool.m4

@@ -1324,14 +1324,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    case `/usr/bin/file conftest.o` in
-	      *x86-64*)
-		LD="${LD-ld} -m elf32_x86_64"
-		;;
-	      *)
-		LD="${LD-ld} -m elf_i386"
-		;;
-	    esac
+	    LD="${LD-ld} -m elf_i386"
 	    ;;
 	  ppc64-*linux*|powerpc64-*linux*)
 	    LD="${LD-ld} -m elf32ppclinux"
@@ -1695,8 +1688,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len" && \
-	test undefined != "$lt_cv_sys_max_cmd_len"; then
+    if test -n "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
@@ -2520,6 +2512,17 @@ freebsd* | dragonfly*)
   esac
   ;;
 
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
 haiku*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
@@ -2636,7 +2639,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
@@ -3252,6 +3255,10 @@ freebsd* | dragonfly*)
   fi
   ;;
 
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 haiku*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3290,7 +3297,7 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -4042,7 +4049,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4341,7 +4348,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -6234,6 +6241,9 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=yes
         ;;
 
+      gnu*)
+        ;;
+
       haiku*)
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6395,7 +6405,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler

+ 46 - 34
OPCUAServer/src/opcua_binaryEncDec.c

@@ -14,7 +14,7 @@
 #include "opcua_advancedDatatypes.h"
 
 
-Byte decodeByte(const char *buf, Int32 *pos)
+Byte decodeByte(char *const buf, Int32 *pos)
 {
 	*pos = (*pos) + 1;
 	return (Byte) buf[(*pos) - 1];
@@ -28,7 +28,7 @@ void encodeByte(Byte encodeByte, Int32 *pos, char *dstBuf)
 
 }
 
-UInt16 decodeUInt16(const char* buf, Int32 *pos)
+UInt16 decodeUInt16(char *const buf, Int32 *pos)
 {
 
 	Byte t1 = buf[*pos];
@@ -36,56 +36,49 @@ UInt16 decodeUInt16(const char* buf, Int32 *pos)
 	*pos += 2;
 	return t1 + t2;
 }
-
 void encodeUInt16(UInt16 value, Int32 *pos, char* dstBuf)
 {
 	memcpy(dstBuf, &value, sizeof(UInt16));
 	*pos = (*pos) + sizeof(UInt16);
-
 }
 
-Int16 decodeInt16(const char* buf, Int32 *pos)
+Int16 decodeInt16(char *const buf, Int32 *pos)
 {
-
-	Byte t1 = buf[*pos];
+	SByte t1 = buf[*pos];
 	Int32 t2 = (Int16) (buf[*pos + 1] << 8);
 	*pos += 2;
 	return t1 + t2;
 }
-
 void encodeInt16(Int16 value, Int32 *pos, char *dstBuf)
 {
 	memcpy(dstBuf, &value, sizeof(Int16));
 	*pos = (*pos) + sizeof(Int16);
 }
 
-Int32 decodeInt32(const char* buf, Int32 *pos)
+Int32 decodeInt32(char *const 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;
+	Int32 t1 = (SByte)buf[*pos];
+	Int32 t2 = (Int32) (((SByte)(buf[*pos + 1]) & 0xFF) << 8);
+	Int32 t3 = (Int32) (((SByte)(buf[*pos + 2]) & 0xFF) << 16);
+	Int32 t4 = (Int32) (((SByte)(buf[*pos + 3]) & 0xFF) << 24);
+	*pos += sizeof(Int32);
 	return t1 + t2 + t3 + t4;
 }
-
 void encodeInt32(Int32 value, Int32 *pos, char *dstBuf)
 {
 	memcpy(dstBuf, &value, sizeof(Int32));
 	*pos = (*pos) + sizeof(Int32);
 }
 
-UInt32 decodeUInt32(const char* buf, Int32 *pos)
+UInt32 decodeUInt32(char *const 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;
+	*pos += sizeof(UInt32);
 	return t1 + t2 + t3 + t4;
 }
-
 void encodeUInt32(UInt32 value, Int32 *pos,char *dstBuf)
 {
 	memcpy(&(dstBuf[*pos]), &value, sizeof(value));
@@ -93,38 +86,57 @@ void encodeUInt32(UInt32 value, Int32 *pos,char *dstBuf)
 
 }
 
-Int64 decodeInt64(const char* buf, Int32 *pos)
+Int64 decodeInt64(char *const 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);
+	Int64 t2 = (Int64)buf[*pos + 1]  << 8;
+	Int64 t3 = (Int64)buf[*pos + 2]  << 16;
+	Int64 t4 = (Int64)buf[*pos + 3]  << 24;
+	Int64 t5 = (Int64)buf[*pos + 4]  << 32;
+	Int64 t6 = (Int64)buf[*pos + 5]  << 40;
+	Int64 t7 = (Int64)buf[*pos + 6]  << 48;
+	Int64 t8 = (Int64)buf[*pos + 7]  << 56;
 	pos += 8;
 	return t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
 }
-
 void encodeInt64(Int64 value, Int32 *pos, char *dstBuf)
 {
 	memcpy(dstBuf, &value, sizeof(Int64));
 	*pos = (*pos) + sizeof(Int64);
 }
 
+UInt64 decodeUInt64(char *const buf, Int32 *pos)
+{
+
+	Byte 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;
+}
+void encodeUInt64(UInt64 value, Int32 *pos, char *dstBuf)
+{
+	memcpy(dstBuf, &value, sizeof(UInt64));
+	*pos = (*pos) + sizeof(UInt64);
+}
+
 Float decodeFloat(char *buf, Int32 *pos)
 {
 	Float tmpFloat;
-	tmpFloat = (Float)(buf[*pos]);
+	memcpy(&tmpFloat,&(buf[*pos]),sizeof(Float));
 	*pos += sizeof(Float);
 	return tmpFloat;
 }
 Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf)
 {
 	memcpy(&(dstBuf[*pos]), &value, sizeof(Float));
-	*pos *= sizeof(Float);
+	*pos += sizeof(Float);
 	return UA_NO_ERROR;
 }
 Double decodeDouble(char *buf, Int32 *pos)
@@ -187,7 +199,7 @@ Int32 UAString_calcSize(UA_String *string)
 	}
 }
 
-Int32 decodeUAGuid(const char *buf, Int32 *pos, UA_Guid *dstGUID)
+Int32 decodeUAGuid(char *const buf, Int32 *pos, UA_Guid *dstGUID)
 {
 	dstGUID->Data1 = decodeUInt32(buf, pos);
 	dstGUID->Data2 = decodeUInt16(buf, pos);
@@ -211,7 +223,7 @@ Int32 UAGuid_calcSize(UA_Guid *guid)
 	return sizeof(guid->Data1) + sizeof(guid->Data2) + sizeof(guid->Data3) + UAByteString_calcSize(&(guid->Data4));
 }
 
-Int32 decodeUAByteString(const char *buf, Int32* pos,
+Int32 decodeUAByteString(char *const buf, Int32* pos,
 		UA_ByteString *dstBytestring)
 {
 
@@ -232,12 +244,12 @@ Int32 UAByteString_calcSize(UA_ByteString *byteString)
 	return UAString_calcSize((UA_String*)byteString);
 }
 
-UA_DateTime decodeUADateTime(const char *buf, Int32 *pos)
+UA_DateTime decodeUADateTime(char *const buf, Int32 *pos)
 {
 	return decodeInt64(buf, pos);
 }
 
-UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos)
+UA_StatusCode decodeUAStatusCode(char *const buf, Int32 *pos)
 {
 	return decodeUInt32(buf, pos);
 }

+ 23 - 9
OPCUAServer/src/opcua_binaryEncDec.h

@@ -22,7 +22,7 @@
  * @param pos  			position at which the data is located in/out, parser position after the conversion
  * @return
  */
-Byte decodeByte(const char* buf, Int32 *pos);
+Byte decodeByte(char *const buf, Int32 *pos);
 /**
  *
  * @param encodeByte 	byte that should be encoded
@@ -36,7 +36,7 @@ void encodeByte(Byte encodeByte, Int32 *pos, char *dstBuf);
  * @param pos
  * @return
  */
-UInt16 decodeUInt16(const char* buf, Int32 *pos);
+UInt16 decodeUInt16(char *const buf, Int32 *pos);
 /**
  *
  * @param value
@@ -50,7 +50,7 @@ void encodeUInt16(UInt16 value, Int32 *pos, char *dstBuf);
  * @param pos
  * @return
  */
-Int16 decodeInt16(const char* buf, Int32 *pos);
+Int16 decodeInt16(char *const buf, Int32 *pos);
 /**
  *
  * @param value
@@ -64,7 +64,7 @@ void encodeInt16(Int16 value, Int32 *pos, char *dstBuf);
  * @param pos  			position at which the data is located in/out, parser position after the conversion
  * @return
  */
-Int32 decodeInt32(const char* buf, Int32 *pos);
+Int32 decodeInt32(char *const buf, Int32 *pos);
 /**
  *
  * @param value
@@ -78,7 +78,7 @@ void encodeInt32(Int32 value, Int32 *pos, char *dstBuf);
  * @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);
+UInt32 decodeUInt32(char *const buf, Int32 *pos);
 /**
  *
  * @param value
@@ -92,7 +92,7 @@ void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
  * @param pos
  * @return
  */
-Int64 decodeInt64(const char* buf, Int32 *pos);
+Int64 decodeInt64(char *const buf, Int32 *pos);
 /**
  *
  * @param value
@@ -100,6 +100,20 @@ Int64 decodeInt64(const char* buf, Int32 *pos);
  * @param dstBuf
  */
 void encodeInt64(Int64 value, Int32 *pos, char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+UInt64 decodeUInt64(char *const buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeUInt64(UInt64 value, Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf  			binary encoded message
@@ -161,21 +175,21 @@ Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf);
  * @param dstGUID
  * @return
  */
-Int32 decodeUAGuid(const char *buf, Int32 *pos, UA_Guid *dstGUID);
+Int32 decodeUAGuid(char *const buf, Int32 *pos, UA_Guid *dstGUID);
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos);
+UA_StatusCode decodeUAStatusCode(char *const buf, Int32 *pos);
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-UA_DateTime decodeUADateTime(const char *buf, Int32 *pos);
+UA_DateTime decodeUADateTime(char *const buf, Int32 *pos);
 /**
  *
  * @param buf

+ 1 - 1
OPCUAServer/tests/Makefile.am

@@ -3,4 +3,4 @@ check_PROGRAMS = check_stack
 check_stack_SOURCES = check_stack.c
 
 check_stack_CFLAGS = @CHECK_CFLAGS@
-check_stack_LDADD = $(top_builddir)/src/.libs/libopen62541.la @CHECK_LIBS@
+check_stack_LDADD = $(top_builddir)/src/libopen62541.la @CHECK_LIBS@

+ 412 - 19
OPCUAServer/tests/check_stack.c

@@ -14,8 +14,11 @@
 #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)
 {
 
@@ -29,6 +32,26 @@ START_TEST(test_getPacketType_validParameter)
 }
 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)
 {
@@ -54,23 +77,49 @@ START_TEST(decodeRequestHeader_test_validParameter)
 END_TEST
 */
 
-START_TEST(encodeByte_test)
+START_TEST(decodeInt16_test)
 {
+
 	AD_RawMessage rawMessage;
 	Int32 position = 0;
-	//EncodeByte
-		char *mem = malloc(sizeof(Byte));
-		rawMessage.message = mem;
-		Byte testByte = 0x08;
-		rawMessage.length = 1;
-		position = 0;
+	//EncodeUInt16
+	char mem[2] = {0x01,0x00};
 
-		encodeByte(testByte, &position, rawMessage.message);
+	rawMessage.message = mem;
+
+	rawMessage.length = 2;
+
+	//encodeUInt16(testUInt16, &position, &rawMessage);
+
+	Int32 p = 0;
+	Int16 val = decodeInt16(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(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 = decodeInt16(rawMessage.message,&p);
+	ck_assert_int_eq(val,testUInt16);
+	//ck_assert_int_eq(rawMessage.message[0], 0xAB);
 
-		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
 
@@ -96,7 +145,6 @@ START_TEST(decodeUInt16_test)
 
 }
 END_TEST
-
 START_TEST(encodeUInt16_test)
 {
 
@@ -114,13 +162,179 @@ START_TEST(encodeUInt16_test)
 
 	ck_assert_int_eq(position, 2);
 	Int32 p = 0;
-	Int16 val = decodeUInt16(rawMessage.message,&p);
+	UInt16 val = decodeUInt16(rawMessage.message,&p);
 	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 = decodeUInt32(rawMessage.message,&p);
+	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 = decodeInt32(rawMessage.message,&p);
+	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 = decodeUInt64(rawMessage.message,&p);
+	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 = decodeInt64(rawMessage.message,&p);
+	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 = decodeFloat(buf,&pos);
+	//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;
@@ -129,16 +343,29 @@ START_TEST(encodeFloat_test)
 
 	encodeFloat(value,&pos,buf);
 
-	ck_assert_int_eq(buf[2],0xD0);
-	ck_assert_int_eq(buf[3],0xC0);
+	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
 
@@ -162,7 +389,6 @@ START_TEST(encodeUAString_test)
 
 }
 END_TEST
-
 START_TEST(decodeUAString_test)
 {
 
@@ -203,7 +429,6 @@ START_TEST(diagnosticInfo_calcSize_test)
 
 }
 END_TEST
-
 START_TEST(extensionObject_calcSize_test)
 {
 
@@ -257,6 +482,7 @@ START_TEST(responseHeader_calcSize_test)
 
 	valcalc = responseHeader_calcSize(&responseHeader);
 	valreal = 49;
+
 	ck_assert_int_eq(valcalc,valreal);
 
 }
@@ -278,6 +504,26 @@ Suite *testSuite_encodeByte(void)
 	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");
@@ -295,6 +541,77 @@ Suite*testSuite_encodeUInt16(void)
 	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");
@@ -303,6 +620,15 @@ Suite *testSuite_encodeFloat(void)
 	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");
@@ -311,7 +637,14 @@ Suite *testSuite_encodeDouble(void)
 	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");
@@ -374,6 +707,18 @@ int main (void)
 	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);
@@ -386,6 +731,54 @@ int main (void)
 	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);