Browse Source

changing datatype names

FlorianPalm 11 years ago
parent
commit
74c242d00b

+ 5 - 2
include/UA_config.h

@@ -5,8 +5,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "opcua_builtInDatatypes.h"
+//#include "opcua_builtInDatatypes.h"
+#include "../tool/opcua_basictypes.h"
+#include "../tool/opcua.h"
+#include "../tool/opcua_namespace_0.h"
 #include "UA_abbr.h"
 
-
+// constants
 #endif /* UA_CONFIG_H_ */

+ 10 - 10
include/UA_indexedList.h

@@ -10,7 +10,7 @@
  */
 typedef struct T_UA_indexedList_Element {
 	struct T_UA_list_Element* father;
-	Int32 index;
+	UA_Int32 index;
 	void* payload;
 }UA_indexedList_Element;
 
@@ -19,22 +19,22 @@ typedef UA_list_PayloadVisitor UA_indexedList_PayloadVisitor;
 
 void UA_indexedList_defaultFreer(void* payload);
 
-Int32 UA_indexedList_init(UA_indexedList_List* const list);
+UA_Int32 UA_indexedList_init(UA_indexedList_List* const list);
 
-Int32 UA_indexedList_destroy(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor);
+UA_Int32 UA_indexedList_destroy(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor);
 
-Int32 UA_indexedList_initElement(UA_indexedList_Element* const elem);
+UA_Int32 UA_indexedList_initElement(UA_indexedList_Element* const elem);
 
-Int32 UA_indexedList_addValue(UA_indexedList_List* const list, Int32 index, void* payload);
+UA_Int32 UA_indexedList_addValue(UA_indexedList_List* const list, UA_Int32 index, void* payload);
 
-Int32 UA_indexedList_addValueToFront(UA_indexedList_List* const list, Int32 index, void* payload);
+UA_Int32 UA_indexedList_addValueToFront(UA_indexedList_List* const list, UA_Int32 index, void* payload);
 
-UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, Int32 index);
+UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, UA_Int32 index);
 
-void* UA_indexedList_findValue(UA_indexedList_List* const list, Int32 index);
+void* UA_indexedList_findValue(UA_indexedList_List* const list, UA_Int32 index);
 
-Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor);
+UA_Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor);
 
-Int32 UA_indexedList_removeElement(UA_indexedList_List* const list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor);
+UA_Int32 UA_indexedList_removeElement(UA_indexedList_List* const list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor);
 
 #endif /* UA_INDEXEDLIST_H_ */

+ 13 - 13
include/UA_list.h

@@ -19,7 +19,7 @@ typedef struct T_UA_list_Element {
 typedef struct T_UA_list_List {
    struct T_UA_list_Element* first;
    struct T_UA_list_Element* last;
-   Int32 size;
+   UA_Int32 size;
 }UA_list_List;
 
 typedef void (*UA_list_ElementVisitor)(UA_list_Element* payload);
@@ -28,29 +28,29 @@ typedef Boolean (*UA_list_PayloadMatcher)(void* payload);
 
 void UA_list_defaultFreer(void* payload);
 
-Int32 UA_list_initElement(UA_list_Element* const element);
+UA_Int32 UA_list_initElement(UA_list_Element* const element);
 
-Int32 UA_list_init(UA_list_List* const list);
+UA_Int32 UA_list_init(UA_list_List* const list);
 
-Int32 UA_list_addElementToFront(UA_list_List* const list, UA_list_Element* const element);
+UA_Int32 UA_list_addElementToFront(UA_list_List* const list, UA_list_Element* const element);
 
-Int32 UA_list_addPayloadToFront(UA_list_List* const list, void* const payload);
+UA_Int32 UA_list_addPayloadToFront(UA_list_List* const list, void* const payload);
 
-Int32 UA_list_addElementToBack(UA_list_List* const list, UA_list_Element* const element);
+UA_Int32 UA_list_addElementToBack(UA_list_List* const list, UA_list_Element* const element);
 
-Int32 UA_list_addPayloadToBack(UA_list_List* const list, void* const payload);
+UA_Int32 UA_list_addPayloadToBack(UA_list_List* const list, void* const payload);
 
-Int32 UA_list_removeFirst(UA_list_List* const list, UA_list_PayloadVisitor visitor);
+UA_Int32 UA_list_removeFirst(UA_list_List* const list, UA_list_PayloadVisitor visitor);
 
-Int32 UA_list_removeLast(UA_list_List* const list, UA_list_PayloadVisitor visitor);
+UA_Int32 UA_list_removeLast(UA_list_List* const list, UA_list_PayloadVisitor visitor);
 
-Int32 UA_list_removeElement(UA_list_Element* const elem, UA_list_PayloadVisitor visitor);
+UA_Int32 UA_list_removeElement(UA_list_Element* const elem, UA_list_PayloadVisitor visitor);
 
-Int32 UA_list_destroy(UA_list_List* const list, UA_list_PayloadVisitor visitor);
+UA_Int32 UA_list_destroy(UA_list_List* const list, UA_list_PayloadVisitor visitor);
 
-Int32 UA_list_iterateElement(UA_list_List* const list, UA_list_ElementVisitor visitor);
+UA_Int32 UA_list_iterateElement(UA_list_List* const list, UA_list_ElementVisitor visitor);
 
-Int32 UA_list_iteratePayload(UA_list_List* const list, UA_list_PayloadVisitor visitor);
+UA_Int32 UA_list_iteratePayload(UA_list_List* const list, UA_list_PayloadVisitor visitor);
 
 UA_list_Element* UA_list_find(UA_list_List* const list, UA_list_PayloadMatcher matcher);
 

+ 5 - 5
src/Makefile.am

@@ -18,16 +18,16 @@
 #					  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\
+libopen62541_la_SOURCES = opcua_transportLayer.c\
 						opcua_encodingLayer.c\
 						opcua_secureChannelLayer.c\
 						opcua_memory.c\
 						opcua_time.c\
 						tcp_layer.c\
-						opcua_builtInDatatypes.h\
-						opcua_binaryEncDec.h\
+						#opcua_binaryEncDec.c\
+						#opcua_builtInDatatypes.c\
+						#opcua_builtInDatatypes.h\
+						#opcua_binaryEncDec.h\
 						opcua_transportLayer.h\
 						opcua_advancedDatatypes.h\
 						opcua_types.h\

+ 6 - 6
src/opcua_advancedDatatypes.h

@@ -133,10 +133,10 @@ struct BED_DataValue
 struct BED_DiagnosticInfo
 {
 //ToDo	struct ???? identifier;				//ToDo: what kind of strcuture?
-	Int32 namespaceUri;
-	Int32 symbolicId;
-	Int32 locale;
-	Int32 localizesText;
+	UA_Int32 namespaceUri;
+	UA_Int32 symbolicId;
+	UA_Int32 locale;
+	UA_Int32 localizesText;
 	UA_String additionalInfo;
 	UA_StatusCode innerStatusCode;
 	struct BED_DiagnosticInfo *innerDiagnosticInfo;
@@ -410,7 +410,7 @@ struct BED_VariableAttributes
 //	struct UA_LocalizedText description;
 //ToDo	DefinedByTheDataTypeAttribte??? value				//ToDo
 //	struct UA_NodeId dataType;
-	Int32 valueRank;
+	UA_Int32 valueRank;
 //	UInt32 arrayDimensions[];
 	Byte accessLevel;
 	Byte userAccesLevel;
@@ -469,7 +469,7 @@ struct BED_VariableTypeAttributes
 //	struct UA_LocalizedText description;
 //ToDo	DefinedByTheDataTypeAttribte??? value			//ToDo
 //	struct UA_NodeId dataType;
-	Int32 valueRank;
+	UA_Int32 valueRank;
 //	UInt32 arrayDimesions[];
 	Boolean isAbstract;
 	UInt32 writeMask;

File diff suppressed because it is too large
+ 317 - 414
src/opcua_binaryEncDec.c


+ 48 - 48
src/opcua_binaryEncDec.h

@@ -8,10 +8,10 @@
 #ifndef OPCUA_BINARYENCDEC_NEU_H_
 #define OPCUA_BINARYENCDEC_NEU_H_
 
-#include "opcua_builtInDatatypes.h"
+//#include "opcua_builtInDatatypes.h"
 
-#include "opcua_advancedDatatypes.h"
-#include "opcua_types.h"
+//#include "opcua_advancedDatatypes.h"
+//#include "opcua_types.h"
 
 
 #define UA_TRUE 1
@@ -27,7 +27,7 @@
  * @param dstStructure
  * @return
  */
-Int32 decoder_decodeBuiltInDatatype(char const * srcBuf, Int32 type, Int32 *pos,
+UA_Int32 decoder_decodeBuiltInDatatype(char const * srcBuf, UA_Int32 type, UA_Int32 *pos,
 		void *dstStructure);
 /**
  *
@@ -37,7 +37,7 @@ Int32 decoder_decodeBuiltInDatatype(char const * srcBuf, Int32 type, Int32 *pos,
  * @param dstBuf
  * @return
  */
-Int32 encoder_encodeBuiltInDatatype(void *data, Int32 type, Int32 *pos, char *dstBuf);
+UA_Int32 encoder_encodeBuiltInDatatype(void *data, UA_Int32 type, UA_Int32 *pos, char *dstBuf);
 
 
 /**
@@ -49,8 +49,8 @@ Int32 encoder_encodeBuiltInDatatype(void *data, Int32 type, Int32 *pos, char *ds
  * @param dstBuf
  * @return
  */
-Int32 encoder_encodeBuiltInDatatypeArray(void **data, Int32 size,
-		Int32 arrayType, Int32 *pos,
+UA_Int32 encoder_encodeBuiltInDatatypeArray(void **data, UA_Int32 size,
+		UA_Int32 arrayType, UA_Int32 *pos,
 		char *dstBuf);
 /**
  *
@@ -59,14 +59,14 @@ Int32 encoder_encodeBuiltInDatatypeArray(void **data, Int32 size,
  * @param dst
  * @return
  */
-Int32 decodeBoolean(char const * buf, Int32 *pos, Boolean *dst);
+UA_Int32 decodeBoolean(char const * buf, UA_Int32 *pos, Boolean *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeBoolean(Boolean value, Int32 *pos, char *dstBuf);
+void encodeBoolean(Boolean value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -74,14 +74,14 @@ void encodeBoolean(Boolean value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeSByte(char const * buf, Int32 *pos, SByte *dst);
+UA_Int32 decodeSByte(char const * buf, UA_Int32 *pos, SByte *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeSByte(SByte value, Int32 *pos, char *dstBuf);
+void encodeSByte(SByte value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -89,28 +89,28 @@ void encodeSByte(SByte value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeByte(char const * buf, Int32 *pos,Byte *dst);
+UA_Int32 decodeByte(char const * buf, UA_Int32 *pos,Byte *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeByte(Byte value, Int32 *pos, char *dstBuf);
+void encodeByte(Byte value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-Int32 decodeUInt16(char const * buf, Int32 *pos, UInt16 *dst);
+UA_Int32 decodeUInt16(char const * buf, UA_Int32 *pos, UInt16 *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeUInt16(UInt16 value, Int32 *pos, char *dstBuf);
+void encodeUInt16(UInt16 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -118,14 +118,14 @@ void encodeUInt16(UInt16 value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeInt16(char const * buf, Int32 *pos, Int16 *dst);
+UA_Int32 decodeInt16(char const * buf, UA_Int32 *pos, Int16 *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeInt16(Int16 value, Int32 *pos, char *dstBuf);
+void encodeInt16(Int16 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -133,14 +133,14 @@ void encodeInt16(Int16 value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeInt32(char const * buf, Int32 *pos, Int32 *dst);
+UA_Int32 decodeInt32(char const * buf, UA_Int32 *pos, UA_Int32 *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeInt32(Int32 value, Int32 *pos, char *dstBuf);
+void encodeInt32(UA_Int32 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -148,14 +148,14 @@ void encodeInt32(Int32 value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeUInt32(char const * const buf, Int32 *pos, UInt32 *dst);
+UA_Int32 decodeUInt32(char const * const buf, UA_Int32 *pos, UInt32 *dst);
 /**
  *
  * @param value
  * @param dstBuf
  * @param pos
  */
-void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
+void encodeUInt32(UInt32 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -163,14 +163,14 @@ void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeInt64(char const * buf, Int32 *pos,Int64 *dst);
+UA_Int32 decodeInt64(char const * buf, UA_Int32 *pos,Int64 *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeInt64(Int64 value, Int32 *pos, char *dstBuf);
+void encodeInt64(Int64 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -178,14 +178,14 @@ void encodeInt64(Int64 value, Int32 *pos, char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeUInt64(char const * buf, Int32 *pos, UInt64 *dst);
+UA_Int32 decodeUInt64(char const * buf, UA_Int32 *pos, UInt64 *dst);
 /**
  *
  * @param value
  * @param pos
  * @param dstBuf
  */
-void encodeUInt64(UInt64 value, Int32 *pos, char *dstBuf);
+void encodeUInt64(UInt64 value, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf  			binary encoded message
@@ -193,7 +193,7 @@ void encodeUInt64(UInt64 value, Int32 *pos, char *dstBuf);
  * @param dstNodeId		receiver of the nodeid structure
  * @param return		success = 0
  */
-Int32 decodeUANodeId(char const * buf, Int32 *pos, UA_NodeId *dstNodeId);
+UA_Int32 decodeUANodeId(char const * buf, UA_Int32 *pos, UA_NodeId *dstNodeId);
 /**
  *
  * @param buf
@@ -201,7 +201,7 @@ Int32 decodeUANodeId(char const * buf, Int32 *pos, UA_NodeId *dstNodeId);
  * @param dst
  * @return
  */
-Int32 decodeFloat(char const * buf, Int32 *pos, Float *dst);
+UA_Int32 decodeFloat(char const * buf, UA_Int32 *pos, Float *dst);
 /**
  *
  * @param value
@@ -209,7 +209,7 @@ Int32 decodeFloat(char const * buf, Int32 *pos, Float *dst);
  * @param dstBuf
  * @return
  */
-Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf);
+UA_Int32 encodeFloat(Float value,UA_Int32 *pos,char *dstBuf);
 /**
  *
  * @param buf
@@ -217,7 +217,7 @@ Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf);
  * @param dst
  * @return
  */
-Int32 decodeDouble(char const * buf, Int32 *pos, Double *dst);
+UA_Int32 decodeDouble(char const * buf, UA_Int32 *pos, Double *dst);
 /**
  *
  * @param value
@@ -225,7 +225,7 @@ Int32 decodeDouble(char const * buf, Int32 *pos, Double *dst);
  * @param dstBuf
  * @return
  */
-Int32 encodeDouble(Double value, Int32 *pos,char *dstBuf);
+UA_Int32 encodeDouble(Double value, UA_Int32 *pos,char *dstBuf);
 /**
  *
  * @param srcNodeId
@@ -233,7 +233,7 @@ Int32 encodeDouble(Double value, Int32 *pos,char *dstBuf);
  * @param buf
  * @return
  */
-Int32 encodeUANodeId(UA_NodeId *srcNodeId, Int32 *pos, char *buf);
+UA_Int32 encodeUANodeId(UA_NodeId *srcNodeId, UA_Int32 *pos, char *buf);
 /**
  *
  * @param srcGuid
@@ -241,7 +241,7 @@ Int32 encodeUANodeId(UA_NodeId *srcNodeId, Int32 *pos, char *buf);
  * @param buf
  * @return
  */
-Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf);
+UA_Int32 encodeUAGuid(UA_Guid *srcGuid, UA_Int32 *pos, char *buf);
 /**
  *
  * @param buf
@@ -249,7 +249,7 @@ Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf);
  * @param dstGUID
  * @return
  */
-Int32 decodeUAGuid(char const * buf, Int32 *pos, UA_Guid *dstGUID);
+UA_Int32 decodeUAGuid(char const * buf, UA_Int32 *pos, UA_Guid *dstGUID);
 /**
  *
  * @param buf
@@ -257,14 +257,14 @@ Int32 decodeUAGuid(char const * buf, Int32 *pos, UA_Guid *dstGUID);
  * @param dst
  * @return
  */
-Int32 decodeUAStatusCode(char const * buf, Int32 *pos,UA_StatusCode* dst);
+UA_Int32 decodeUAStatusCode(char const * buf, UA_Int32 *pos,UA_StatusCode* dst);
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-Int32 decodeUADateTime(char const * buf, Int32 *pos,UA_DateTime *dst);
+UA_Int32 decodeUADateTime(char const * buf, UA_Int32 *pos,UA_DateTime *dst);
 /**
  *
  * @param time
@@ -272,7 +272,7 @@ Int32 decodeUADateTime(char const * buf, Int32 *pos,UA_DateTime *dst);
  * @param dstBuf
  * @return
  */
-void encodeUADateTime(UA_DateTime time, Int32 *pos, char *dstBuf);
+void encodeUADateTime(UA_DateTime time, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -280,13 +280,13 @@ void encodeUADateTime(UA_DateTime time, Int32 *pos, char *dstBuf);
  * @param dstUAString
  * @return
  */
-Int32 decodeUAString(char const * buf, Int32 *pos, UA_String *dstUAString);
+UA_Int32 decodeUAString(char const * buf, UA_Int32 *pos, UA_String *dstUAString);
 /**
  *
  * @param byteString
  * @return length of the binary encoded data
  */
-Int32 UAByteString_calcSize(UA_ByteString *byteString);
+UA_Int32 UAByteString_calcSize(UA_ByteString *byteString);
 /**
  *
  * @param xmlElement
@@ -294,7 +294,7 @@ Int32 UAByteString_calcSize(UA_ByteString *byteString);
  * @param dstBuf
  * @return
  */
-Int32 encodeXmlElement(UA_XmlElement *xmlElement, Int32 *pos, char *dstBuf);
+UA_Int32 encodeXmlElement(UA_XmlElement *xmlElement, UA_Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -302,14 +302,14 @@ Int32 encodeXmlElement(UA_XmlElement *xmlElement, Int32 *pos, char *dstBuf);
  * @param xmlElement
  * @return
  */
-Int32 decodeXmlElement(char const * buf, Int32* pos, UA_XmlElement *xmlElement);
+UA_Int32 decodeXmlElement(char const * buf, UA_Int32* pos, UA_XmlElement *xmlElement);
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-Int32 decodeIntegerId(char const * buf, Int32 *pos, Int32* dst);
+UA_Int32 decodeIntegerId(char const * buf, UA_Int32 *pos, UA_Int32* dst);
 /**
  *
  * @param integerId
@@ -317,7 +317,7 @@ Int32 decodeIntegerId(char const * buf, Int32 *pos, Int32* dst);
  * @param buf
 
  */
-void encodeIntegerId(UA_AD_IntegerId integerId, Int32 *pos, char *buf);
+void encodeIntegerId(UA_AD_IntegerId integerId, UA_Int32 *pos, char *buf);
 /**
  * \brief
  * \param srcRaw             pointer to raw data which holds the encoded data
@@ -325,7 +325,7 @@ void encodeIntegerId(UA_AD_IntegerId integerId, Int32 *pos, char *buf);
  * \param dstRequestHeader   pointer to a structure which hold the encoded header
  * \return                   0 = success
  */
-Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, UA_AD_RequestHeader *dstRequestHeader);
+UA_Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,UA_Int32 *pos, UA_AD_RequestHeader *dstRequestHeader);
 /**
  *
  * @param srcHeader
@@ -333,7 +333,7 @@ Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, UA_AD_RequestH
  * @param dstRaw
  * @return
  */
-Int32 encodeRequestHeader(const UA_AD_RequestHeader *srcHeader,Int32 *pos,UA_ByteString *dstRaw);
+UA_Int32 encodeRequestHeader(const UA_AD_RequestHeader *srcHeader,UA_Int32 *pos,UA_ByteString *dstRaw);
 /**
  *
  * @param srcRaw
@@ -341,7 +341,7 @@ Int32 encodeRequestHeader(const UA_AD_RequestHeader *srcHeader,Int32 *pos,UA_Byt
  * @param dstResponseHeader
  * @return
  */
-Int32 decodeResponseHeader(const UA_ByteString *srcRaw, Int32 *pos, UA_AD_ResponseHeader *dstResponseHeader);
+UA_Int32 decodeResponseHeader(const UA_ByteString *srcRaw, UA_Int32 *pos, UA_AD_ResponseHeader *dstResponseHeader);
 /**
  *  @brief function to encode a secureChannelRequestHeader
  *
@@ -349,19 +349,19 @@ Int32 decodeResponseHeader(const UA_ByteString *srcRaw, Int32 *pos, UA_AD_Respon
  * @param dstBuf   pointer to a structure which hold the encoded header
  * @return
  */
-Int32 encodeResponseHeader(const UA_AD_ResponseHeader *responseHeader, Int32 *pos, UA_ByteString *dstBuf);
+UA_Int32 encodeResponseHeader(const UA_AD_ResponseHeader *responseHeader, UA_Int32 *pos, UA_ByteString *dstBuf);
 /**
  *
  * @param diagnosticInfo
  * @return length of the binary encoded data
  */
-Int32 diagnosticInfo_calcSize(UA_DiagnosticInfo *diagnosticInfo);
+UA_Int32 diagnosticInfo_calcSize(UA_DiagnosticInfo *diagnosticInfo);
 /**
  *
  * @param extensionObject
  * @return length of the binary encoded data
  */
-Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject);
+UA_Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject);
 
 
 

+ 3 - 3
src/opcua_builtInDatatypes.c

@@ -10,8 +10,8 @@
 UA_ExtensionObject the_empty_UA_ExtensionObject = { { NIEVT_TWO_BYTE, 0 }, NO_BODY_IS_ENCODED};
 UA_DiagnosticInfo the_empty_UA_DiagnosticInfo = { 0x00 };
 
-Int32 UA_String_compare(UA_String *string1, UA_String *string2) {
-	Int32 i;
+UA_Int32 UA_String_compare(UA_String *string1, UA_String *string2) {
+	UA_Int32 i;
 	Boolean equal;
 
 	if (string1->Length == string2->Length&&
@@ -32,7 +32,7 @@ else
 	return UA_EQUAL;
 }
 
-Int32 UA_ByteString_compare(UA_ByteString *string1, UA_ByteString *string2) {
+UA_Int32 UA_ByteString_compare(UA_ByteString *string1, UA_ByteString *string2) {
 	return UA_String_compare((UA_String*) string1, (UA_String*) string2);
 }
 

+ 44 - 44
src/opcua_builtInDatatypes.h

@@ -135,7 +135,7 @@ typedef int16_t Int16;
 
 typedef uint16_t UInt16;
 
-typedef int32_t Int32;
+typedef int32_t UA_Int32;
 
 typedef uint32_t UInt32;
 
@@ -156,7 +156,7 @@ typedef double Double;
 */
 typedef struct UA_String
 {
-	Int32 Length;
+	UA_Int32 Length;
 	char *Data;
 }
 UA_String;
@@ -178,7 +178,7 @@ typedef Int64 UA_DateTime; //100 nanosecond resolution
 */
 typedef struct UA_ByteString
 {
-	Int32 Length;
+	UA_Int32 Length;
 	Byte *Data;
 }
 UA_ByteString;
@@ -290,7 +290,7 @@ UA_NodeId;
 typedef struct UA_ExpandedNodeId
 {
 	UA_NodeId NodeId;
-	Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
+	UA_Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
 	UA_String NamespaceUri;
 	UInt32 ServerIndex;
 }
@@ -321,10 +321,10 @@ typedef enum UA_StatusCodes
 typedef struct UA_DiagnosticInfo
 {
 	Byte EncodingMask; //Type of the Enum UA_DiagnosticInfoEncodingMaskType
-	Int32 SymbolicId;
-	Int32 NamespaceUri;
-	Int32 LocalizedText;
-	Int32 Locale;
+	UA_Int32 SymbolicId;
+	UA_Int32 NamespaceUri;
+	UA_Int32 LocalizedText;
+	UA_Int32 Locale;
 	UA_String AdditionalInfo;
 	UA_StatusCode InnerStatusCode;
 	struct UA_DiagnosticInfo* InnerDiagnosticInfo;
@@ -417,7 +417,7 @@ typedef UA_VariantUnion;
 typedef struct UA_Variant
 {
 	Byte EncodingMask; //Type of Enum UA_VariantTypeEncodingMaskType
-	Int32 ArrayLength;
+	UA_Int32 ArrayLength;
 	UA_VariantUnion *Value;
 }
 UA_Variant;
@@ -442,14 +442,14 @@ UA_DataValue;
 
 typedef struct IntegerString
 {
-	Int32 *data;
-	Int32 length;
+	UA_Int32 *data;
+	UA_Int32 length;
 }IntegerString;
 
 typedef struct Int32_Array
 {
-	Int32 *data;
-	Int32 arrayLength;
+	UA_Int32 *data;
+	UA_Int32 arrayLength;
 	IntegerString dimensions;
 }Int32_Array;
 
@@ -458,42 +458,42 @@ typedef struct Int32_Array
 typedef struct SBYte_Array
 {
 	SByte *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString dimensions;
 }SBYte_Array;
 
 typedef struct Boolean_Array
 {
 	Boolean *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Boolean_Array;
 
 typedef struct
 {
 	SByte *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }SByte_Array;
 
 typedef struct Byte_Array
 {
 	Byte *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Byte_Array;
 
 typedef struct Int16_Array
 {
 	Int16 *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Int16_Array;
 
 typedef struct UInt16_Array
 {
 	UInt16 *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }UInt16_Array;
 
@@ -501,84 +501,84 @@ typedef struct UInt16_Array
 typedef struct UInt32_Array
 {
 	UInt32 *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }UInt32_Array;
 
 typedef struct
 {
 	Int64 *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Int64_Array;
 
 typedef struct UInt64_Array
 {
 	UInt64 *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }UInt64_Array;
 
 typedef struct Float_Array
 {
 	Float *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Float_Array;
 
 typedef struct Double_Array
 {
 	Double *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Double_Array;
 
 typedef struct String_Array
 {
 	UA_String *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }String_Array;
 
 typedef struct DateTime_Array
 {
 	UA_DateTime *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }DateTime_Array;
 
 typedef struct Guid_Array
 {
 	UA_Guid *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Guid_Array;
 
 typedef struct ByteString_Array
 {
 	UA_ByteString *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }ByteString_Array;
 
 typedef struct XmlElement_Array
 {
 	UA_XmlElement *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }XmlElement_Array;
 
 typedef struct NodeId_Array
 {
 	UA_NodeId *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }NodeId_Array;
 
 typedef struct ExpandedNodeId_Array
 {
 	UA_ExpandedNodeId *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }ExpandedNodeId_Array;
 
@@ -586,49 +586,49 @@ typedef struct ExpandedNodeId_Array
 typedef struct StatusCode_Array
 {
 	UA_StatusCode *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }StatusCode_Array;
 
 typedef struct QualifiedName_Array
 {
 	UA_QualifiedName *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }QualifiedName_Array;
 
 typedef struct LocalizedText_Array
 {
 	UA_LocalizedText *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }LocalizedText_Array;
 
 typedef struct ExtensionObject_Array
 {
 	UA_ExtensionObject *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }ExtensionObject_Array;
 
 typedef struct
 {
 	struct UA_DataValue *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }DataValue_Array;
 
 typedef struct Variant_Array
 {
 	struct UA_Variant *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString  dimensions;
 }Variant_Array;
 
 typedef struct DiagnosticInfo_Array
 {
 	UA_DiagnosticInfo *data;
-	Int32 arrayLength;
+	UA_Int32 arrayLength;
 	IntegerString dimensions;
 }DiagnosticInfo_Array;
 
@@ -667,15 +667,15 @@ UA_VariantArrayUnion;
 typedef struct UA_VariantArrayValue
 {
 	//Byte TypeEncoding;
-    Int32  Length;
+    UA_Int32  Length;
     UA_VariantArrayUnion Value;
 }
 UA_VariantArrayValue;
 
 typedef struct
 {
-    Int32 NoOfDimensions;
-    Int32* Dimensions;
+    UA_Int32 NoOfDimensions;
+    UA_Int32* Dimensions;
     UA_VariantArrayUnion Value;
 }
 UA_VariantMatrixValue;
@@ -687,7 +687,7 @@ union UA_VariantUnion
     Byte Byte;
     Int16 Int16;
     UInt16 UInt16;
-    Int32 Int32;
+    UA_Int32 Int32;
     UInt32 UInt32;
     Int64 Int64;
     UInt64 UInt64;
@@ -766,13 +766,13 @@ typedef double UA_Duration;
  * @param string2
  * @return
  */
-Int32 UA_String_compare(UA_String *string1, UA_String *string2);
+UA_Int32 UA_String_compare(UA_String *string1, UA_String *string2);
 /**
  *
  * @param string1
  * @param string2
  * @return
  */
-Int32 UA_ByteString_compare(UA_ByteString *string1, UA_ByteString *string2);
+UA_Int32 UA_ByteString_compare(UA_ByteString *string1, UA_ByteString *string2);
 
 #endif /* OPCUA_BUILTINDATATYPES_H_ */

+ 3 - 3
src/opcua_connectionHelper.h

@@ -32,7 +32,7 @@ typedef struct
 	UInt32 secureChannelId;
 	UInt32 tokenId;
 	UA_DateTime createdAt;
-	Int32 revisedLifetime;
+	UA_Int32 revisedLifetime;
 }SL_ChannelSecurityToken;
 
 typedef struct
@@ -46,7 +46,7 @@ typedef struct
 
 struct TL_connection
 {
-	Int32 socket;
+	UA_Int32 socket;
 	UInt32 connectionState;
 	TL_buffer remoteConf;
 	TL_buffer localConf;
@@ -65,7 +65,7 @@ typedef struct
 struct SL_connection
 {
 	AsymmetricAlgSecuritySettings remoteAsymAlgSettings;
-	AsymmetricAlgSecuritySettings localtAsymAlgSettings;
+	AsymmetricAlgSecuritySettings localAsymAlgSettings;
 /*
 	UA_ByteString SecurityPolicyUri;
 	UA_ByteString SenderCertificate;

+ 116 - 116
src/opcua_secureChannelLayer.c

@@ -15,25 +15,25 @@
 /*
  * inits a connection object for secure channel layer
  */
-Int32 SL_initConnectionObject(UA_connection *connection)
+UA_Int32 SL_initConnectionObject(UA_connection *connection)
 {
 
 	//TODO: fill with valid information
-	connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.Data = NULL;
-	connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.Length = 0;
+	connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.data = NULL;
+	connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.length = 0;
 
-	connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.Data = "http://opcfoundation.org/UA/SecurityPolicy#None";
-	connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.Length = 47;
+	connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.data = "http://opcfoundation.org/UA/SecurityPolicy#None";
+	connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.length = 47;
 
-	connection->secureLayer.localtAsymAlgSettings.SenderCertificate.Data = NULL;
-	connection->secureLayer.localtAsymAlgSettings.SenderCertificate.Length = 0;
+	connection->secureLayer.localtAsymAlgSettings.SenderCertificate.data = NULL;
+	connection->secureLayer.localtAsymAlgSettings.SenderCertificate.length = 0;
 
-	connection->secureLayer.remoteNonce.Data = NULL;
-	connection->secureLayer.remoteNonce.Length = 0;
+	connection->secureLayer.remoteNonce.data = NULL;
+	connection->secureLayer.remoteNonce.length = 0;
 
-	connection->secureLayer.localNonce.Data = (Byte*)opcua_malloc(sizeof(Byte));
-	*connection->secureLayer.localNonce.Data = sizeof(Byte);
-	connection->secureLayer.localNonce.Length = 1;
+	connection->secureLayer.localNonce.data = (Byte*)opcua_malloc(sizeof(Byte));
+	*connection->secureLayer.localNonce.data = sizeof(Byte);
+	connection->secureLayer.localNonce.length = 1;
 
 	connection->secureLayer.connectionState = connectionState_CLOSED;
 
@@ -41,8 +41,8 @@ Int32 SL_initConnectionObject(UA_connection *connection)
 
 	connection->secureLayer.requestType = 0;
 
-	connection->secureLayer.secureChannelId.Data = NULL;
-	connection->secureLayer.secureChannelId.Length = 0;
+	connection->secureLayer.secureChannelId.data = NULL;
+	connection->secureLayer.secureChannelId.length = 0;
 
 	connection->secureLayer.securityMode = securityMode_INVALID;
 	//TODO set a valid start secureChannelId number
@@ -55,22 +55,22 @@ Int32 SL_initConnectionObject(UA_connection *connection)
 	return UA_NO_ERROR;
 }
 
-Int32 SL_send(UA_connection *connection, UA_ByteString responseMessage, Int32 type)
+UA_Int32 SL_send(UA_connection *connection, UA_ByteString responseMessage, UA_Int32 type)
 {
 	UInt32 sequenceNumber;
 	UInt32 requestId;
-	Int32 pos;
-	Int32 sizeAsymAlgHeader;
+	UA_Int32 pos;
+	UA_Int32 sizeAsymAlgHeader;
 	UA_ByteString responsePacket;
-	Int32 packetSize;
-	Int32 sizePadding;
-	Int32 sizeSignature;
+	UA_Int32 packetSize;
+	UA_Int32 sizePadding;
+	UA_Int32 sizeSignature;
 
 
 	sizeAsymAlgHeader = 3 * sizeof(UInt32) +
-			connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.Length +
-			connection->secureLayer.localtAsymAlgSettings.SenderCertificate.Length +
-			connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.Length;
+			connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri.length +
+			connection->secureLayer.localtAsymAlgSettings.SenderCertificate.length +
+			connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint.length;
 	pos = 0;
 	//sequence header
 	sequenceNumber = connection->secureLayer.sequenceNumber;
@@ -87,46 +87,46 @@ Int32 SL_send(UA_connection *connection, UA_ByteString responseMessage, Int32 ty
 		packetSize = SIZE_SECURECHANNEL_HEADER +
 				SIZE_SEQHEADER_HEADER +
 				sizeAsymAlgHeader +
-				responseMessage.Length +
+				responseMessage.length +
 				sizePadding +
 				sizeSignature;
 
 		//get memory for response
-		responsePacket.Data = (char*)opcua_malloc(packetSize);
+		responsePacket.data = (char*)opcua_malloc(packetSize);
 
-		responsePacket.Length = packetSize;
+		responsePacket.length = packetSize;
 
 		/*---encode Secure Conversation Message Header ---*/
 		//encode MessageType - OPN message
-		responsePacket.Data[0] = 'O';
-		responsePacket.Data[1] = 'P';
-		responsePacket.Data[2] = 'N';
+		responsePacket.data[0] = 'O';
+		responsePacket.data[1] = 'P';
+		responsePacket.data[2] = 'N';
 		pos += 3;
 		//encode Chunk Type - set to final
-		responsePacket.Data[3] = 'F';
+		responsePacket.data[3] = 'F';
 		pos += 1;
-		encoder_encodeBuiltInDatatype(&packetSize,INT32,&pos,responsePacket.Data);
+		encoder_encodeBuiltInDatatype(&packetSize,INT32,&pos,responsePacket.data);
 		encoder_encodeBuiltInDatatype(&(connection->secureLayer.securityToken.secureChannelId),
-				INT32,&pos,responsePacket.Data);
+				INT32,&pos,responsePacket.data);
 
 		/*---encode Asymmetric Algorithm Header ---*/
 		encoder_encodeBuiltInDatatype(&(connection->secureLayer.localtAsymAlgSettings.SecurityPolicyUri),
-						BYTE_STRING,&pos,responsePacket.Data);
+						BYTE_STRING,&pos,responsePacket.data);
 		encoder_encodeBuiltInDatatype(&(connection->secureLayer.localtAsymAlgSettings.SenderCertificate),
-						BYTE_STRING,&pos,responsePacket.Data );
+						BYTE_STRING,&pos,responsePacket.data );
 		encoder_encodeBuiltInDatatype(&(connection->secureLayer.localtAsymAlgSettings.ReceiverCertificateThumbprint),
-						BYTE_STRING,&pos,responsePacket.Data );
+						BYTE_STRING,&pos,responsePacket.data );
 	}
 
 
 
 
 	/*---encode Sequence Header ---*/
-	encoder_encodeBuiltInDatatype(&sequenceNumber,UINT32,&pos,responsePacket.Data);
-	encoder_encodeBuiltInDatatype(&requestId,UINT32,&pos,responsePacket.Data);
+	encoder_encodeBuiltInDatatype(&sequenceNumber,UINT32,&pos,responsePacket.data);
+	encoder_encodeBuiltInDatatype(&requestId,UINT32,&pos,responsePacket.data);
 
 	/*---add encoded Message ---*/
-	memcpy(&(responsePacket.Data[pos]), responseMessage.Data, responseMessage.Length);
+	memcpy(&(responsePacket.data[pos]), responseMessage.data, responseMessage.length);
 
 	/* sign Data*/
 
@@ -142,7 +142,7 @@ Int32 SL_send(UA_connection *connection, UA_ByteString responseMessage, Int32 ty
 /*
  * opens a secure channel
  */
-Int32 SL_openSecureChannel(UA_connection *connection,
+UA_Int32 SL_openSecureChannel(UA_connection *connection,
 		UA_AD_RequestHeader *requestHeader,
 		UA_StatusCode serviceResult)
 {
@@ -155,14 +155,14 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 	UA_ByteString serverNonce;
 	UA_NodeId responseType;
 	//sizes for memory allocation
-	Int32 sizeResponse;
-	Int32 sizeRespHeader;
-	Int32 sizeResponseType;
-	Int32 sizeRespMessage;
-	Int32 sizeSecurityToken;
+	UA_Int32 sizeResponse;
+	UA_Int32 sizeRespHeader;
+	UA_Int32 sizeResponseType;
+	UA_Int32 sizeRespMessage;
+	UA_Int32 sizeSecurityToken;
 	UA_ByteString response;
 	UInt32 serverProtocolVersion;
-	Int32 pos;
+	UA_Int32 pos;
 	UA_DiagnosticInfo serviceDiagnostics;
 
 	if(requestHeader->returnDiagnostics != 0)
@@ -170,19 +170,19 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 		printf("SL_openSecureChannel - diagnostics demanded by the client\n");
 		printf("SL_openSecureChannel - retrieving diagnostics not implemented!\n");
 		//TODO fill with demanded information part 4, 7.8 - Table 123
-		serviceDiagnostics.EncodingMask = 0;
+		serviceDiagnostics.encodingMask = 0;
 	}
 	else
 	{
-		serviceDiagnostics.EncodingMask = 0;
+		serviceDiagnostics.encodingMask = 0;
 	}
 	/*--------------type ----------------------*/
 
 	//Four Bytes Encoding
-	responseType.EncodingByte = NIEVT_FOUR_BYTE;
+	responseType.encodingByte = NIEVT_FOUR_BYTE;
 	//openSecureChannelResponse = 449
-	responseType.Identifier.Numeric = 449;
-	responseType.Namespace = 0;
+	responseType.identifier.numeric = 449;
+	responseType.namespace = 0;
 
 	/*--------------responseHeader-------------*/
 
@@ -210,14 +210,14 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 
 
 	// no additional header
-	additionalHeader.Encoding = 0;
+	additionalHeader.encoding = 0;
 
-	additionalHeader.Body.Data = NULL;
-	additionalHeader.Body.Length = 0;
+	additionalHeader.body.data = NULL;
+	additionalHeader.body.length = 0;
 
-	additionalHeader.TypeId.EncodingByte = 0;
-	additionalHeader.TypeId.Namespace = 0;
-	additionalHeader.TypeId.Identifier.Numeric = 0;
+	additionalHeader.typeId.encodingByte = 0;
+	additionalHeader.typeId.namespace = 0;
+	additionalHeader.typeId.identifier.numeric = 0;
 
 	responseHeader.additionalHeader = &additionalHeader;
 	printf("SL_openSecureChannel - built response header\n");
@@ -232,14 +232,14 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 	*/
 
 	//                  secureChannelId + TokenId + CreatedAt + RevisedLifetime
-	sizeSecurityToken = sizeof(UInt32) + sizeof(UInt32) + sizeof(UA_DateTime) + sizeof(Int32);
+	sizeSecurityToken = sizeof(UInt32) + sizeof(UInt32) + sizeof(UA_DateTime) + sizeof(UA_Int32);
 
 	//ignore server nonce
-	serverNonce.Length = -1;
-	serverNonce.Data = NULL;
+	serverNonce.length = -1;
+	serverNonce.data = NULL;
 
-	serverNonce.Length = connection->secureLayer.localNonce.Length;
-	serverNonce.Data = connection->secureLayer.localNonce.Data;
+	serverNonce.length = connection->secureLayer.localNonce.length;
+	serverNonce.data = connection->secureLayer.localNonce.data;
 
 	//fill token structure with default server information
 	securityToken.secureChannelId = connection->secureLayer.securityToken.secureChannelId;
@@ -250,21 +250,21 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 	serverProtocolVersion = connection->transportLayer.localConf.protocolVersion;
 
 	//                ProtocolVersion + SecurityToken + Nonce
-	sizeRespMessage = sizeof(UInt32) + serverNonce.Length + sizeof(Int32) + sizeSecurityToken;
+	sizeRespMessage = sizeof(UInt32) + serverNonce.length + sizeof(UA_Int32) + sizeSecurityToken;
 	printf("SL_openSecureChannel - size of response message=%d\n",sizeRespMessage);
 
 
 	//get memory for response
 	sizeResponseType = nodeId_calcSize(&responseType);
 
-	response.Length = sizeResponseType + sizeRespHeader + sizeRespMessage;
+	response.length = sizeResponseType + sizeRespHeader + sizeRespMessage;
 
 	//get memory for response
-	response.Data = (char*)opcua_malloc(nodeId_calcSize(&responseType) + sizeRespHeader + sizeRespMessage);
+	response.data = (char*)opcua_malloc(nodeId_calcSize(&responseType) + sizeRespHeader + sizeRespMessage);
 	pos = 0;
 	//encode responseType (NodeId)
 	UA_NodeId_printf("SL_openSecureChannel - TypeId =",&responseType);
-	encoder_encodeBuiltInDatatype(&responseType, NODE_ID, &pos, response.Data);
+	encoder_encodeBuiltInDatatype(&responseType, NODE_ID, &pos, response.data);
 
 	//encode header
 	printf("SL_openSecureChannel - encoding response header \n");
@@ -274,19 +274,19 @@ Int32 SL_openSecureChannel(UA_connection *connection,
 
 	//encode message
 	printf("SL_openSecureChannel - serverProtocolVersion = %d \n",serverProtocolVersion);
-	encoder_encodeBuiltInDatatype(&serverProtocolVersion, UINT32, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&serverProtocolVersion, UINT32, &pos,response.data);
 	printf("SL_openSecureChannel - secureChannelId = %d \n",securityToken.secureChannelId);
-	encoder_encodeBuiltInDatatype(&(securityToken.secureChannelId), UINT32, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&(securityToken.secureChannelId), UINT32, &pos,response.data);
 	printf("SL_openSecureChannel - tokenId = %d \n",securityToken.tokenId);
-	encoder_encodeBuiltInDatatype(&(securityToken.tokenId), INT32, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&(securityToken.tokenId), INT32, &pos,response.data);
 
-	encoder_encodeBuiltInDatatype(&(securityToken.createdAt), DATE_TIME, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&(securityToken.createdAt), DATE_TIME, &pos,response.data);
 	printf("SL_openSecureChannel - revisedLifetime = %d \n",securityToken.revisedLifetime);
-	encoder_encodeBuiltInDatatype(&(securityToken.revisedLifetime), INT32, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&(securityToken.revisedLifetime), INT32, &pos,response.data);
 
-	encoder_encodeBuiltInDatatype(&serverNonce, BYTE_STRING, &pos,response.Data);
+	encoder_encodeBuiltInDatatype(&serverNonce, BYTE_STRING, &pos,response.data);
 
-	printf("SL_openSecureChannel - response.Length = %d \n",response.Length);
+	printf("SL_openSecureChannel - response.length = %d \n",response.length);
 	//449 = openSecureChannelResponse
 	SL_send(connection, response, 449);
 
@@ -308,34 +308,34 @@ Int32 SL_openSecureChannel_responseMessage_calcSize(SL_Response *response,
 void SL_secureChannel_close(UA_connection *connection) {
 
 }
-Int32 SL_check(UA_connection *connection, UA_ByteString secureChannelPacket) {
+UA_Int32 SL_check(UA_connection *connection, UA_ByteString secureChannelPacket) {
 	return UA_NO_ERROR;
 }
-Int32 SL_createSecurityToken(UA_connection *connection, Int32 lifeTime) {
+UA_Int32 SL_createSecurityToken(UA_connection *connection, UA_Int32 lifeTime) {
 	return UA_NO_ERROR;
 }
 
-Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
+UA_Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 	UA_DiagnosticInfo serviceDiagnostics;
 
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	UA_AD_RequestHeader requestHeader;
 	UInt32 clientProtocolVersion;
 	UA_NodeId serviceRequestType;
-	Int32 requestType;
-	Int32 securityMode;
-	Int32 requestedLifetime;
+	UA_Int32 requestType;
+	UA_Int32 securityMode;
+	UA_Int32 requestedLifetime;
 	UA_ByteString clientNonce;
 	UA_StatusCode serviceResult;
 
 	// Every Message starts with a NodeID which names the serviceRequestType
-	decoder_decodeBuiltInDatatype(message.Data, NODE_ID, &pos,
+	decoder_decodeBuiltInDatatype(message.data, NODE_ID, &pos,
 			&serviceRequestType);
 	UA_NodeId_printf("SL_processMessage - serviceRequestType=",
 			&serviceRequestType);
 
-	if (serviceRequestType.EncodingByte == NIEVT_FOUR_BYTE
-			&& serviceRequestType.Identifier.Numeric == 446) {
+	if (serviceRequestType.encodingByte == NIEVT_FOUR_BYTE
+			&& serviceRequestType.identifier.numeric == 446) {
 		/* OpenSecureChannelService, defined in 62541-6 §6.4.4, Table 34.
 		 * Note that part 6 adds ClientProtocolVersion and ServerProtocolVersion
 		 * to the definition in part 4 */
@@ -344,18 +344,18 @@ Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 		// 	Req-2) UInt32 ClientProtocolVersion
 		UInt32 clientProtocolVersion;
 		// 	Req-3) Enum SecurityTokenRequestType requestType
-		Int32 requestType;
+		UA_Int32 requestType;
 		// 	Req-4) Enum MessageSecurityMode SecurityMode
-		Int32 securityMode;
+		UA_Int32 securityMode;
 		//  Req-5) ByteString ClientNonce
 		UA_ByteString clientNonce;
 		//  Req-6) Int32 RequestLifetime
-		Int32 requestedLifetime;
+		UA_Int32 requestedLifetime;
 
 		UA_ByteString_printx("SL_processMessage - message=", &message);
 
 		// Req-1) RequestHeader requestHeader
-		decoder_decodeRequestHeader(message.Data, &pos, &requestHeader);
+		decoder_decodeRequestHeader(message.data, &pos, &requestHeader);
 		UA_String_printf("SL_processMessage - requestHeader.auditEntryId=",
 				&requestHeader.auditEntryId);
 		UA_NodeId_printf(
@@ -363,7 +363,7 @@ Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 				&requestHeader.authenticationToken);
 
 		// 	Req-2) UInt32 ClientProtocolVersion
-		decoder_decodeBuiltInDatatype(message.Data, UINT32, &pos,
+		decoder_decodeBuiltInDatatype(message.data, UINT32, &pos,
 				&clientProtocolVersion);
 		printf("SL_processMessage - clientProtocolVersion=%d\n",
 				clientProtocolVersion);
@@ -377,7 +377,7 @@ Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 		}
 
 		// 	Req-3) SecurityTokenRequestType requestType
-		decoder_decodeBuiltInDatatype(message.Data, INT32, &pos, &requestType);
+		decoder_decodeBuiltInDatatype(message.data, INT32, &pos, &requestType);
 		printf("SL_processMessage - requestType=%d\n", requestType);
 		switch (requestType) {
 		case securityToken_ISSUE:
@@ -404,33 +404,33 @@ Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 		}
 
 		// 	Req-4) MessageSecurityMode SecurityMode
-		decoder_decodeBuiltInDatatype(message.Data, INT32, &pos, &securityMode);
+		decoder_decodeBuiltInDatatype(message.data, INT32, &pos, &securityMode);
 		printf("SL_processMessage - securityMode=%d\n", securityMode);
 		switch (securityMode) {
-		case securityMode_INVALID:
-			connection->secureLayer.remoteNonce.Data = NULL;
-			connection->secureLayer.remoteNonce.Length = 0;
+		case UA_securityMode_INVALID:
+			connection->secureLayer.remoteNonce.data = NULL;
+			connection->secureLayer.remoteNonce.length = 0;
 			printf("SL_processMessage - client demands no security \n");
 			break;
 
-		case securityMode_SIGN:
+		case UA_securityMode_SIGN:
 			printf("SL_processMessage - client demands signed \n");
 			//TODO check if senderCertificate and ReceiverCertificateThumbprint are present
 			break;
 
-		case securityMode_SIGNANDENCRYPT:
+		case UA_securityMode_SIGNANDENCRYPT:
 			printf("SL_processMessage - client demands signed & encrypted \n");
 			//TODO check if senderCertificate and ReceiverCertificateThumbprint are present
 			break;
 		}
 
 		//  Req-5) ByteString ClientNonce
-		decoder_decodeBuiltInDatatype(message.Data, BYTE_STRING, &pos,
+		decoder_decodeBuiltInDatatype(message.data, BYTE_STRING, &pos,
 				&clientNonce);
 		UA_String_printf("SL_processMessage - clientNonce=", &clientNonce);
 
 		//  Req-6) Int32 RequestLifetime
-		decoder_decodeBuiltInDatatype(message.Data, INT32, &pos,
+		decoder_decodeBuiltInDatatype(message.data, INT32, &pos,
 				&requestedLifetime);
 		printf("SL_processMessage - requestedLifeTime=%d\n", requestedLifetime);
 		//TODO process requestedLifetime
@@ -454,16 +454,16 @@ void SL_receive(UA_connection *connection, UA_ByteString *serviceMessage) {
 	SL_SecureConversationMessageHeader SCM_Header;
 	SL_AsymmetricAlgorithmSecurityHeader AAS_Header;
 	SL_SequenceHeader SequenceHeader;
-	Int32 packetType = 0;
-	Int32 pos = 0;
-	Int32 iTmp;
+	UA_Int32 packetType = 0;
+	UA_Int32 pos = 0;
+	UA_Int32 iTmp;
 	//TODO Error Handling, length checking
 	//get data from transport layer
 	printf("SL_receive - entered \n");
 
 	TL_receive(connection, &secureChannelPacket);
 
-	if (secureChannelPacket.Length > 0 && secureChannelPacket.Data != NULL) {
+	if (secureChannelPacket.length > 0 && secureChannelPacket.data != NULL) {
 
 		printf("SL_receive - data received \n");
 		packetType = TL_getPacketType(&secureChannelPacket, &pos);
@@ -508,8 +508,8 @@ void SL_receive(UA_connection *connection, UA_ByteString *serviceMessage) {
 					SequenceHeader.SequenceNumber;
 
 			//SL_decrypt(&secureChannelPacket);
-			message.Data = &secureChannelPacket.Data[pos];
-			message.Length = secureChannelPacket.Length - pos;
+			message.data = &secureChannelPacket.data[pos];
+			message.length = secureChannelPacket.length - pos;
 
 			SL_processMessage(connection, message);
 
@@ -600,17 +600,17 @@ void SL_receive(UA_connection *connection, UA_ByteString *serviceMessage) {
 /*
  * get the secure channel message header
  */
-Int32 decodeSCMHeader(UA_ByteString *rawMessage, Int32 *pos,
+UA_Int32 decodeSCMHeader(UA_ByteString *rawMessage, UA_Int32 *pos,
 		SL_SecureConversationMessageHeader* SC_Header) {
 	UInt32 err;
 	printf("decodeSCMHeader - entered \n");
 	// LU: wild guess - reset pos, we want to reread the message type again
 	*pos = 0;
 	SC_Header->MessageType = TL_getPacketType(rawMessage, pos);
-	SC_Header->IsFinal = rawMessage->Data[*pos];
+	SC_Header->IsFinal = rawMessage->data[*pos];
 	*pos += 1;
-	decodeUInt32(rawMessage->Data, pos, &(SC_Header->MessageSize));
-	decodeUInt32(rawMessage->Data, pos, &(SC_Header->SecureChannelId));
+	decodeUInt32(rawMessage->data, pos, &(SC_Header->MessageSize));
+	decodeUInt32(rawMessage->data, pos, &(SC_Header->SecureChannelId));
 	return UA_NO_ERROR;
 
 }
@@ -647,30 +647,30 @@ Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header, Int32 *pos,
 }
 */
 
-Int32 decodeSequenceHeader(UA_ByteString *rawMessage, Int32 *pos,
+UA_Int32 decodeSequenceHeader(UA_ByteString *rawMessage, UA_Int32 *pos,
 		SL_SequenceHeader *SequenceHeader) {
-	decodeUInt32(rawMessage->Data, pos, &(SequenceHeader->SequenceNumber));
-	decodeUInt32(rawMessage->Data, pos, &(SequenceHeader->RequestId));
+	decodeUInt32(rawMessage->data, pos, &(SequenceHeader->SequenceNumber));
+	decodeUInt32(rawMessage->data, pos, &(SequenceHeader->RequestId));
 	return UA_NO_ERROR;
 }
 
 /*
  * get the asymmetric algorithm security header
  */
-Int32 decodeAASHeader(UA_ByteString *rawMessage, Int32 *pos,
+UA_Int32 decodeAASHeader(UA_ByteString *rawMessage, UA_Int32 *pos,
 		SL_AsymmetricAlgorithmSecurityHeader* AAS_Header) {
-	Int32 err = 0;
-	err += decodeUAByteString(rawMessage->Data, pos,
+	UA_Int32 err = 0;
+	err += decodeUAByteString(rawMessage->data, pos,
 			&(AAS_Header->SecurityPolicyUri));
-	err += decodeUAByteString(rawMessage->Data, pos,
+	err += decodeUAByteString(rawMessage->data, pos,
 			&(AAS_Header->SenderCertificate));
-	err += decodeUAByteString(rawMessage->Data, pos,
+	err += decodeUAByteString(rawMessage->data, pos,
 			&(AAS_Header->ReceiverThumbprint));
 	return err;
 }
 
-Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
-		Int32 *pos, AD_RawMessage* dstRawMessage) {
+UA_Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
+		UA_Int32 *pos, AD_RawMessage* dstRawMessage) {
 	encodeUAString(AAS_Header->SecurityPolicyUri, pos,
 			&dstRawMessage->message[*pos]);
 	encodeUAString(AAS_Header->SenderCertificate, pos,

+ 18 - 18
src/opcua_secureChannelLayer.h

@@ -8,11 +8,11 @@
 #ifndef OPCUA_SECURECHANNELLAYER_H_
 #define OPCUA_SECURECHANNELLAYER_H_
 
-#include "opcua_advancedDatatypes.h"
-#include "opcua_encodingLayer.h"
+//#include "opcua_advancedDatatypes.h"
+//#include "opcua_encodingLayer.h"
 #include "opcua_connectionHelper.h"
-
-static const Int32 SL_HEADER_LENGTH = 0;
+#include "../include/UA_config.h"
+static const UA_Int32 SL_HEADER_LENGTH = 0;
 #define TOKEN_LIFETIME 30000
 typedef enum
 {
@@ -22,9 +22,9 @@ typedef enum
 
 typedef enum
 {
-	securityMode_INVALID = 0,
-	securityMode_SIGN = 1,
-	securityMode_SIGNANDENCRYPT = 2
+	UA_securityMode_INVALID = 0,
+	UA_securityMode_SIGN = 1,
+	UA_securityMode_SIGNANDENCRYPT = 2
 
 }securityMode;
 typedef struct
@@ -87,7 +87,7 @@ typedef struct _SL_ResponseHeader
  * @param connection
  * @return
  */
-Int32 SL_initConnectionObject(UA_connection *connection);
+UA_Int32 SL_initConnectionObject(UA_connection *connection);
 
 /**
  *
@@ -96,8 +96,8 @@ Int32 SL_initConnectionObject(UA_connection *connection);
  * @param sizeInOut
  * @return
  */
-Int32 SL_openSecureChannel_responseMessage_get(UA_connection *connection,
-		SL_Response *response, Int32* sizeInOut);
+UA_Int32 SL_openSecureChannel_responseMessage_get(UA_connection *connection,
+		SL_Response *response, UA_Int32* sizeInOut);
 
 /**
  *
@@ -107,7 +107,7 @@ Int32 SL_openSecureChannel_responseMessage_get(UA_connection *connection,
  * @param SC_Header
  * @return
  */
-Int32 decodeSCMHeader(UA_ByteString *rawMessage,Int32 *pos,
+UA_Int32 decodeSCMHeader(UA_ByteString *rawMessage,UA_Int32 *pos,
 		SL_SecureConversationMessageHeader* SC_Header);
 
 /**
@@ -117,8 +117,8 @@ Int32 decodeSCMHeader(UA_ByteString *rawMessage,Int32 *pos,
  * @param rawMessage
  * @return
  */
-Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header,
-	 Int32 *pos,AD_RawMessage *rawMessage);
+UA_Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header,
+	 UA_Int32 *pos,AD_RawMessage *rawMessage);
 
 /**
  *
@@ -127,7 +127,7 @@ Int32 encodeSCMHeader(SL_SecureConversationMessageHeader *SC_Header,
  * @param SequenceHeader
  * @return
  */
-Int32 decodeSequenceHeader(UA_ByteString *rawMessage, Int32 *pos,
+UA_Int32 decodeSequenceHeader(UA_ByteString *rawMessage, UA_Int32 *pos,
 		SL_SequenceHeader *sequenceHeader);
 /**
  *
@@ -136,7 +136,7 @@ Int32 decodeSequenceHeader(UA_ByteString *rawMessage, Int32 *pos,
  * @param dstRawMessage
  * @return
  */
-Int32 encodeSequenceHeader(SL_SequenceHeader *sequenceHeader,Int32 *pos,
+UA_Int32 encodeSequenceHeader(SL_SequenceHeader *sequenceHeader,UA_Int32 *pos,
 		AD_RawMessage *dstRawMessage);
 /**
  *
@@ -145,7 +145,7 @@ Int32 encodeSequenceHeader(SL_SequenceHeader *sequenceHeader,Int32 *pos,
  * @param AAS_Header
  * @return
  */
-Int32 decodeAASHeader(UA_ByteString *rawMessage, Int32 *pos,
+UA_Int32 decodeAASHeader(UA_ByteString *rawMessage, UA_Int32 *pos,
 	SL_AsymmetricAlgorithmSecurityHeader* AAS_Header);
 
 /**
@@ -155,8 +155,8 @@ Int32 decodeAASHeader(UA_ByteString *rawMessage, Int32 *pos,
  * @param dstRawMessage
  * @return
  */
-Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
-		Int32 *pos, AD_RawMessage* dstRawMessage);
+UA_Int32 encodeAASHeader(SL_AsymmetricAlgorithmSecurityHeader *AAS_Header,
+		UA_Int32 *pos, AD_RawMessage* dstRawMessage);
 
 /**
  *

+ 1 - 1
src/opcua_serializationLayer.c

@@ -10,7 +10,7 @@ serviceManager_registerServiceImplementation()
 {
 
 }
-serviceManager(Int32 serviceRequest)
+serviceManager(UA_Int32 serviceRequest)
 {
 	if(serviceManager_serviceAvailable(serviceRequest))
 	{

+ 61 - 60
src/opcua_transportLayer.c

@@ -8,12 +8,12 @@
 #include "opcua_transportLayer.h"
 
 
-Int32 TL_initConnectionObject(UA_connection *connection)
+UA_Int32 TL_initConnectionObject(UA_connection *connection)
 {
 
 	connection->newDataToRead = 0;
-	connection->readData.Data = NULL;
-	connection->readData.Length = 0;
+	connection->readData->data = NULL;
+	connection->readData->length = 0;
 	connection->transportLayer.connectionState = connectionState_CLOSED;
 	connection->transportLayer.localConf.maxChunkCount = 1;
 	connection->transportLayer.localConf.maxMessageSize = 16384;
@@ -22,20 +22,20 @@ Int32 TL_initConnectionObject(UA_connection *connection)
 	return UA_NO_ERROR;
 }
 
-Int32 TL_check(UA_connection *connection)
+UA_Int32 TL_check(UA_connection *connection)
 {
-	Int32 position = 4;
+	UA_Int32 position = 4;
 	UInt32 messageLength = 0;
 
 
 	printf("TL_check - entered \n");
 
 
-	decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,&position,&messageLength);
+	decoder_decodeBuiltInDatatype(connection->readData->data,UINT32,&position,&messageLength);
 
 	printf("TL_check - messageLength = %d \n",messageLength);
 
-	if (messageLength == connection->readData.Length &&
+	if (messageLength == connection->readData->length &&
 			messageLength < (connection->transportLayer.localConf.maxMessageSize))
 	{
 		printf("TL_check - no error \n");
@@ -45,27 +45,28 @@ Int32 TL_check(UA_connection *connection)
 	printf("TL_check - length error \n");
 
 	return UA_ERROR;
+
 }
 
 
-Int32 TL_receive(UA_connection *connection, UA_ByteString *packet)
+UA_Int32 TL_receive(UA_connection *connection, UA_ByteString *packet)
 {
 	UInt32 length = 0;
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 
 	AD_RawMessage tmpRawMessage;
 	struct TL_header tmpHeader;
 	printf("TL_receive - entered \n");
 
-	packet->Data = NULL;
-	packet->Length = 0;
+	packet->data = NULL;
+	packet->length = 0;
 
 	if(TL_check(connection) == UA_NO_ERROR)
 	{
 
 		printf("TL_receive - no error \n");
-		printf("TL_receive - connection->readData.Length %d \n",connection->readData.Length);
-		Int32 packetType = TL_getPacketType(&(connection->readData),&pos);
+		printf("TL_receive - connection->readData.length %d \n",connection->readData.length);
+		UA_Int32 packetType = TL_getPacketType(&(connection->readData),&pos);
 
 		//is final chunk or not
 		//TODO process chunks
@@ -80,8 +81,8 @@ Int32 TL_receive(UA_connection *connection, UA_ByteString *packet)
 		case packetType_OPN:
 		case packetType_CLO:
 		{
-			packet->Data = connection->readData.Data;
-			packet->Length = connection->readData.Length;
+			packet->data = connection->readData.data;
+			packet->length = connection->readData.length;
 
 			printf("TL_receive - received MSG or OPN or CLO message\n");
 			break;
@@ -115,50 +116,50 @@ Int32 TL_receive(UA_connection *connection, UA_ByteString *packet)
 
 #define Cmp3Byte(data,pos,a,b,c) (*((Int32*) ((data)+(pos))) & 0xFFFFFF) == (Int32)(((Byte)(a))|((Byte)(b))<<8|((Byte)(c))<<16)
 
-Int32 TL_getPacketType(UA_ByteString *packet, Int32 *pos)
+UA_Int32 TL_getPacketType(UA_ByteString *packet, UA_Int32 *pos)
 {
-	Int32 retVal = -1;
+	UA_Int32 retVal = -1;
 	// printf("TL_getPacketType - entered \n");
 	// printf("TL_getPacketType - pos = %d \n",*pos);
 
-	if(packet->Data[*pos] == 'H' &&
-	   packet->Data[*pos+1] == 'E' &&
-	   packet->Data[*pos+2] == 'L')
+	if(packet->data[*pos] == 'H' &&
+	   packet->data[*pos+1] == 'E' &&
+	   packet->data[*pos+2] == 'L')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal = packetType_HEL;
 	}
-	else if(packet->Data[*pos] == 'A' &&
-	        packet->Data[*pos+1] == 'C' &&
-	        packet->Data[*pos+2] == 'K')
+	else if(packet->data[*pos] == 'A' &&
+	        packet->data[*pos+1] == 'C' &&
+	        packet->data[*pos+2] == 'K')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal = packetType_ACK;
 	}
-	else if(packet->Data[*pos] == 'E' &&
-			packet->Data[*pos+1] == 'R' &&
-			packet->Data[*pos+2] == 'R')
+	else if(packet->data[*pos] == 'E' &&
+			packet->data[*pos+1] == 'R' &&
+			packet->data[*pos+2] == 'R')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal =  packetType_ERR;
 	}
-	else if(packet->Data[*pos] == 'O' &&
-	        packet->Data[*pos+1] == 'P' &&
-	        packet->Data[*pos+2] == 'N')
+	else if(packet->data[*pos] == 'O' &&
+	        packet->data[*pos+1] == 'P' &&
+	        packet->data[*pos+2] == 'N')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal =  packetType_OPN;
 	}
-	else if(packet->Data[*pos] == 'C' &&
-	        packet->Data[*pos+1] == 'L' &&
-	        packet->Data[*pos+2] == 'O')
+	else if(packet->data[*pos] == 'C' &&
+	        packet->data[*pos+1] == 'L' &&
+	        packet->data[*pos+2] == 'O')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal =  packetType_CLO;
 	}
-	else if(packet->Data[*pos] == 'M' &&
-			packet->Data[*pos+1] == 'S' &&
-			packet->Data[*pos+2] == 'G')
+	else if(packet->data[*pos] == 'M' &&
+			packet->data[*pos+1] == 'S' &&
+			packet->data[*pos+2] == 'G')
 	{
 		*pos += 3 * sizeof(Byte);
 		retVal =  packetType_MSG;
@@ -168,9 +169,9 @@ Int32 TL_getPacketType(UA_ByteString *packet, Int32 *pos)
 }
 
 
-Int32 TL_process(UA_connection *connection,Int32 packetType, Int32 *pos)
+UA_Int32 TL_process(UA_connection *connection,UA_Int32 packetType, UA_Int32 *pos)
 {
-	Int32 tmpPos = 0;
+	UA_Int32 tmpPos = 0;
 	UA_ByteString tmpMessage;
 	Byte reserved;
 	UInt32 messageSize;
@@ -185,77 +186,77 @@ Int32 TL_process(UA_connection *connection,Int32 packetType, Int32 *pos)
 			printf("TL_process - pos = %d \n",*pos);
 
 			/* extract information from received header */
-			decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,UINT32,pos,
 					(void*)(&(connection->transportLayer.remoteConf.protocolVersion)));
 
 			printf("TL_process - protocolVersion = %d \n",connection->transportLayer.remoteConf.protocolVersion);
 
-			decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,UINT32,pos,
 					(void*)(&(connection->transportLayer.remoteConf.recvBufferSize)));
 
 			printf("TL_process - recvBufferSize = %d \n",connection->transportLayer.remoteConf.recvBufferSize);
 
-			decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,UINT32,pos,
 					(void*)(&(connection->transportLayer.remoteConf.sendBufferSize)));
 
 			printf("TL_process - sendBufferSize = %d \n",connection->transportLayer.remoteConf.sendBufferSize);
 
-			decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,UINT32,pos,
 					(void*)(&(connection->transportLayer.remoteConf.maxMessageSize)));
 
 			printf("TL_process - maxMessageSize = %d \n",connection->transportLayer.remoteConf.maxMessageSize);
 
-			decoder_decodeBuiltInDatatype(connection->readData.Data,UINT32,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,UINT32,pos,
 					(void*)(&(connection->transportLayer.remoteConf.maxChunkCount)));
 
 			printf("TL_process - maxChunkCount = %d \n",connection->transportLayer.remoteConf.maxChunkCount);
 
-			decoder_decodeBuiltInDatatype(connection->readData.Data,STRING,pos,
+			decoder_decodeBuiltInDatatype(connection->readData.data,STRING,pos,
 					(void*)(&(connection->transportLayer.endpointURL)));
 
 			/* send back acknowledge */
-			tmpMessage.Data = (Byte*)opcua_malloc(SIZE_OF_ACKNOWLEDGE_MESSAGE);
-			if(tmpMessage.Data == NULL)
+			tmpMessage.data = (Byte*)opcua_malloc(SIZE_OF_ACKNOWLEDGE_MESSAGE);
+			if(tmpMessage.data == NULL)
 			{
 				printf("TL_process - memory allocation failed \n");
 			}
-			tmpMessage.Length = SIZE_OF_ACKNOWLEDGE_MESSAGE;
+			tmpMessage.length = SIZE_OF_ACKNOWLEDGE_MESSAGE;
 			printf("TL_process - allocated memory \n");
 			/* ------------------------ Header ------------------------ */
 			// MessageType
-			tmpMessage.Data[0] = 'A';
-			tmpMessage.Data[1] = 'C';
-			tmpMessage.Data[2] = 'K';
+			tmpMessage.data[0] = 'A';
+			tmpMessage.data[1] = 'C';
+			tmpMessage.data[2] = 'K';
 			tmpPos += 3;
 			// Chunk
 			reserved = 'F';
-			encoder_encodeBuiltInDatatype(&reserved, BYTE, &tmpPos, tmpMessage.Data);
+			encoder_encodeBuiltInDatatype(&reserved, BYTE, &tmpPos, tmpMessage.data);
 			// MessageSize
 			messageSize = SIZE_OF_ACKNOWLEDGE_MESSAGE;
-			encoder_encodeBuiltInDatatype(&messageSize,UINT32, &tmpPos, tmpMessage.Data);
+			encoder_encodeBuiltInDatatype(&messageSize,UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - Size messageToSend = %d \n",messageSize);
 
 			/* ------------------------ Body ------------------------ */
 			// protocol version
 			encoder_encodeBuiltInDatatype(&(connection->transportLayer.localConf.protocolVersion),
-					UINT32, &tmpPos, tmpMessage.Data);
+					UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - localConf.protocolVersion = %d \n",connection->transportLayer.localConf.protocolVersion);
 
 			//receive buffer size
 			encoder_encodeBuiltInDatatype(&(connection->transportLayer.localConf.recvBufferSize),
-					UINT32, &tmpPos, tmpMessage.Data);
+					UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - localConf.recvBufferSize = %d \n", connection->transportLayer.localConf.recvBufferSize);
 			//send buffer size
 			encoder_encodeBuiltInDatatype(&(connection->transportLayer.localConf.sendBufferSize),
-					UINT32, &tmpPos, tmpMessage.Data);
+					UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - localConf.sendBufferSize = %d \n", connection->transportLayer.localConf.sendBufferSize);
 			//maximum message size
 			encoder_encodeBuiltInDatatype(&(connection->transportLayer.localConf.maxMessageSize),
-					UINT32, &tmpPos, tmpMessage.Data);
+					UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - localConf.maxMessageSize = %d \n", connection->transportLayer.localConf.maxMessageSize);
 			//maximum chunk count
 			encoder_encodeBuiltInDatatype(&(connection->transportLayer.localConf.maxChunkCount),
-					UINT32, &tmpPos, tmpMessage.Data);
+					UINT32, &tmpPos, tmpMessage.data);
 			printf("TL_process - localConf.maxChunkCount = %d \n", connection->transportLayer.localConf.maxChunkCount);
 
 			TL_send(connection, &tmpMessage);
@@ -280,11 +281,11 @@ TL_send(UA_connection *connection, UA_ByteString *packet)
 {
 	printf("TL_send - entered \n");
 	connection->newDataToWrite = 1;
-	if(packet->Length < connection->transportLayer.remoteConf.maxMessageSize)
+	if(packet->length < connection->transportLayer.remoteConf.maxMessageSize)
 	{
-		connection->writeData.Data = packet->Data;
-		connection->writeData.Length = packet->Length;
-		printf("TL_send - packet length = %d \n", packet->Length);
+		connection->writeData.data = packet->data;
+		connection->writeData.length = packet->length;
+		printf("TL_send - packet length = %d \n", packet->length);
 	}
 	else
 	{

+ 13 - 4
src/opcua_transportLayer.h

@@ -56,6 +56,15 @@ struct TL_message
 	struct TL_header Header;
 	char *message;
 };
+typedef struct UA_T_SecureConversationMessageHeader
+{
+	UA_ByteString messageType;
+	UA_Byte isFinal;
+	UA_UInt32 messageSize;
+	UA_UInt32 secureChannelId;
+}UA_SecureConversationMessageHeader;
+typedef _Bool UA_Boolean;
+UA_TYPE_METHOD_PROTOTYPES (UA_SecureConversationMessageHeader)
 
 struct TL_messageBodyHEL
 {
@@ -90,15 +99,15 @@ struct TL_messageBodyERR
  * @param TL_message
  * @return
  */
-Int32 TL_check(UA_connection *connection);
+UA_Int32 TL_check(UA_connection *connection);
 /**
  *
  * @param connection
  * @param TL_message
  */
-Int32 TL_receive(UA_connection *connection,UA_ByteString *packet);
-Int32 TL_send(UA_connection *connection, UA_ByteString *packet);
-Int32 TL_getPacketType(UA_ByteString *packet, Int32 *pos);
+UA_Int32 TL_receive(UA_connection *connection,UA_ByteString *packet);
+UA_Int32 TL_send(UA_connection *connection, UA_ByteString *packet);
+UA_Int32 TL_getPacketType(UA_ByteString *packet, UA_Int32 *pos);
 
 
 #endif /* OPCUA_TRANSPORTLAYER_H_ */

+ 6 - 6
src/opcua_types.h

@@ -166,10 +166,10 @@ typedef struct UA_AD_DataValue
 typedef struct
 {
 	//ToDo	struct ???? identifier;	identifier is only needed for encoding????
-	Int32 namespaceUri;
-	Int32 symbolicId;
-	Int32 locale;
-	Int32 localizesText;
+	UA_Int32 namespaceUri;
+	UA_Int32 symbolicId;
+	UA_Int32 locale;
+	UA_Int32 localizesText;
 	UA_String additionalInfo;
 	UA_StatusCode innerStatusCode;
 	struct _UA_DiagnosticInfo* innerDiagnosticInfo;
@@ -479,7 +479,7 @@ typedef struct
 	UA_LocalizedText description;
 //ToDo	DefinedByTheDataTypeAttribte??? value				//ToDo
 	UA_NodeId dataType;
-	Int32 valueRank;
+	UA_Int32 valueRank;
 	UInt16 noOfArrayDimensions;
 	UInt32* arrayDimensions;
 	Byte accessLevel;
@@ -542,7 +542,7 @@ typedef struct
 	UA_LocalizedText description;
 //ToDo	DefinedByTheDataTypeAttribte??? value			//ToDo
 	UA_NodeId dataType;
-	Int32 valueRank;
+	UA_Int32 valueRank;
 	UInt16 noOfArrayDimensions;
 	UInt32* arrayDimesions;
 	Boolean isAbstract;

+ 9 - 9
src/util/UA_indexedList.c

@@ -5,12 +5,12 @@ void UA_indexedList_defaultFreer(void* payload){
 	UA_list_defaultFreer(payload);
 }
 
-Int32 UA_indexedList_init(UA_indexedList_List* const list){
+UA_Int32 UA_indexedList_init(UA_indexedList_List* const list){
 	if(list==NULL)return UA_ERROR;
 	return UA_list_init((UA_list_List*)list);
 }
 
-Int32 UA_indexedList_destroy(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor){
+UA_Int32 UA_indexedList_destroy(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* current = NULL;
 	current=list->first;
@@ -30,7 +30,7 @@ Int32 UA_indexedList_destroy(UA_indexedList_List* const list, UA_indexedList_Pay
 	return UA_NO_ERROR;
 }
 
-Int32 UA_indexedList_initElement(UA_indexedList_Element* const elem){
+UA_Int32 UA_indexedList_initElement(UA_indexedList_Element* const elem){
 	if(elem==NULL)return UA_ERROR;
 	elem->father = NULL;
 	elem->index = -1;
@@ -38,7 +38,7 @@ Int32 UA_indexedList_initElement(UA_indexedList_Element* const elem){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_indexedList_addValue(UA_indexedList_List* const list, Int32 index, void* payload){
+UA_Int32 UA_indexedList_addValue(UA_indexedList_List* const list, UA_Int32 index, void* payload){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* dllElem = (UA_list_Element*)malloc(sizeof(*dllElem));
 	UA_list_initElement(dllElem);
@@ -51,7 +51,7 @@ Int32 UA_indexedList_addValue(UA_indexedList_List* const list, Int32 index, void
 	return UA_list_addElementToBack((UA_list_List*)list, dllElem);
 }
 
-Int32 UA_indexedList_addValueToFront(UA_indexedList_List* const list, Int32 index, void* payload){
+UA_Int32 UA_indexedList_addValueToFront(UA_indexedList_List* const list, UA_Int32 index, void* payload){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* dllElem = (UA_list_Element*)malloc(sizeof(*dllElem));
 	UA_list_initElement(dllElem);
@@ -64,7 +64,7 @@ Int32 UA_indexedList_addValueToFront(UA_indexedList_List* const list, Int32 inde
 	return UA_list_addElementToFront((UA_list_List*)list, dllElem);
 }
 
-UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, Int32 index){
+UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, UA_Int32 index){
 	if(list==NULL)return NULL;
 	UA_list_Element* current = list->first;
 	while(current){
@@ -79,7 +79,7 @@ UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, Int
 	return NULL;
 }
 
-void* UA_indexedList_findValue(UA_indexedList_List* const list, Int32 index){
+void* UA_indexedList_findValue(UA_indexedList_List* const list, UA_Int32 index){
 	if(list==NULL)return NULL;
 	UA_indexedList_Element* iilElem = UA_indexedList_find(list, index);
 	if(iilElem){
@@ -88,7 +88,7 @@ void* UA_indexedList_findValue(UA_indexedList_List* const list, Int32 index){
 	return NULL;
 }
 
-Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor){
+UA_Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* current = list->first;
 	while(current){
@@ -104,7 +104,7 @@ Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedLi
 	return UA_NO_ERROR;
 }
 
-Int32 UA_indexedList_removeElement(UA_indexedList_List* const list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor){
+UA_Int32 UA_indexedList_removeElement(UA_indexedList_List* const list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor){
 	if(list==NULL || elem==NULL)return UA_ERROR;
 	if(visitor){
 		(*visitor)(elem->payload);

+ 12 - 12
src/util/UA_list.c

@@ -7,7 +7,7 @@ void UA_list_defaultFreer(void* payload){
 	}
 }
 
-Int32 UA_list_initElement(UA_list_Element* const element){
+UA_Int32 UA_list_initElement(UA_list_Element* const element){
 	if(element==NULL)return UA_ERROR;
 	element->next=NULL;
 	element->prev=NULL;
@@ -16,7 +16,7 @@ Int32 UA_list_initElement(UA_list_Element* const element){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_init(UA_list_List* const list){
+UA_Int32 UA_list_init(UA_list_List* const list){
 	if(list==NULL)return UA_ERROR;
 	list->first = NULL;
 	list->last = NULL;
@@ -24,7 +24,7 @@ Int32 UA_list_init(UA_list_List* const list){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_addElementToFront(UA_list_List* const list, UA_list_Element* const element){
+UA_Int32 UA_list_addElementToFront(UA_list_List* const list, UA_list_Element* const element){
 	if(list==NULL || element==NULL)return UA_ERROR;
 	UA_list_Element* second = NULL;
 	second = list->first;
@@ -42,7 +42,7 @@ Int32 UA_list_addElementToFront(UA_list_List* const list, UA_list_Element* const
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_addPayloadToFront(UA_list_List* const list, void* const payload){
+UA_Int32 UA_list_addPayloadToFront(UA_list_List* const list, void* const payload){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* elem = (UA_list_Element*)opcua_malloc(sizeof(*elem));
 	UA_list_initElement(elem);
@@ -51,7 +51,7 @@ Int32 UA_list_addPayloadToFront(UA_list_List* const list, void* const payload){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_addElementToBack(UA_list_List* const list, UA_list_Element* const element){
+UA_Int32 UA_list_addElementToBack(UA_list_List* const list, UA_list_Element* const element){
 	if(list==NULL || element == NULL)return UA_ERROR;
 	UA_list_Element* secondLast = NULL;
 	secondLast = list->last;
@@ -69,7 +69,7 @@ Int32 UA_list_addElementToBack(UA_list_List* const list, UA_list_Element* const
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_addPayloadToBack(UA_list_List* const list, void* const payload){
+UA_Int32 UA_list_addPayloadToBack(UA_list_List* const list, void* const payload){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* elem = (UA_list_Element*)opcua_malloc(sizeof(*elem));
 	UA_list_initElement(elem);
@@ -78,7 +78,7 @@ Int32 UA_list_addPayloadToBack(UA_list_List* const list, void* const payload){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_removeFirst(UA_list_List* const list, UA_list_PayloadVisitor visitor){
+UA_Int32 UA_list_removeFirst(UA_list_List* const list, UA_list_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* temp = NULL;
 	if(list->first){
@@ -98,7 +98,7 @@ Int32 UA_list_removeFirst(UA_list_List* const list, UA_list_PayloadVisitor visit
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_removeLast(UA_list_List* const list, UA_list_PayloadVisitor visitor){
+UA_Int32 UA_list_removeLast(UA_list_List* const list, UA_list_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* temp = NULL;
 	if(list->last){
@@ -119,7 +119,7 @@ Int32 UA_list_removeLast(UA_list_List* const list, UA_list_PayloadVisitor visito
 }
 
 
-Int32 UA_list_removeElement(UA_list_Element* const elem, UA_list_PayloadVisitor visitor){
+UA_Int32 UA_list_removeElement(UA_list_Element* const elem, UA_list_PayloadVisitor visitor){
 	if(elem==NULL)return UA_ERROR;
 	if(elem==elem->father->first){
 		return UA_list_removeFirst(elem->father, visitor);
@@ -139,7 +139,7 @@ Int32 UA_list_removeElement(UA_list_Element* const elem, UA_list_PayloadVisitor
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_destroy(UA_list_List* const list, UA_list_PayloadVisitor visitor){
+UA_Int32 UA_list_destroy(UA_list_List* const list, UA_list_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* current = NULL;
 	current=list->first;
@@ -155,7 +155,7 @@ Int32 UA_list_destroy(UA_list_List* const list, UA_list_PayloadVisitor visitor){
 	return UA_NO_ERROR;
 }
 
-Int32 UA_list_iterateElement(UA_list_List* const list, UA_list_ElementVisitor visitor){
+UA_Int32 UA_list_iterateElement(UA_list_List* const list, UA_list_ElementVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* current = list->first;
 	while(current){
@@ -178,7 +178,7 @@ Int32 UA_list_iterateElement(UA_list_List* const list, UA_list_ElementVisitor vi
 	return UA_NO_ERROR;
 }*/
 /** ANSI C forbids function nesting - reworked ugly version **/
-Int32 UA_list_iteratePayload(UA_list_List* const list, UA_list_PayloadVisitor visitor){
+UA_Int32 UA_list_iteratePayload(UA_list_List* const list, UA_list_PayloadVisitor visitor){
 	if(list==NULL)return UA_ERROR;
 	UA_list_Element* current = list->first;
 	while(current){

+ 8 - 8
tests/check_indexedList.c

@@ -4,8 +4,8 @@
 #include "check.h"
 
 /* global test counters */
-Int32 visit_count = 0;
-Int32 free_count = 0;
+UA_Int32 visit_count = 0;
+UA_Int32 free_count = 0;
 
 void visitor(void* payload){
 	visit_count++;
@@ -22,7 +22,7 @@ Boolean matcher(void* payload){
 	if(payload == NULL){
 		return FALSE;
 	}
-	if(*((Int32*)payload) == 42){
+	if(*((UA_Int32*)payload) == 42){
 		return TRUE;
 	}
 	return FALSE;
@@ -36,13 +36,13 @@ START_TEST(linkedList_test_basic)
 
 	ck_assert_int_eq(list.size, 0);
 
-	Int32* payload = (Int32*)malloc(sizeof(*payload));
+	UA_Int32* payload = (UA_Int32*)malloc(sizeof(*payload));
 	*payload = 10;
 	UA_indexedList_addValue(&list, 1, payload);
-	payload = (Int32*)malloc(sizeof(*payload));
+	payload = (UA_Int32*)malloc(sizeof(*payload));
 	*payload = 20;
 	UA_indexedList_addValueToFront(&list, 2, payload);
-	payload = (Int32*)malloc(sizeof(*payload));
+	payload = (UA_Int32*)malloc(sizeof(*payload));
 	*payload = 30;
 	UA_indexedList_addValue(&list, 3, payload);
 
@@ -52,7 +52,7 @@ START_TEST(linkedList_test_basic)
 	ck_assert_int_eq(visit_count, 3);
 	visit_count = 0;
 
-	payload = (Int32*)UA_indexedList_findValue(&list, 2);
+	payload = (UA_Int32*)UA_indexedList_findValue(&list, 2);
 	if(payload){
 		ck_assert_int_eq(*payload, 20);
 	}else{
@@ -64,7 +64,7 @@ START_TEST(linkedList_test_basic)
 	free_count=0;
 	ck_assert_int_eq(list.size, 2);
 
-	payload = (Int32*)UA_indexedList_findValue(&list, 2);
+	payload = (UA_Int32*)UA_indexedList_findValue(&list, 2);
 	if(payload){
 		fail("Previously removed element 20 found");
 	}

+ 7 - 7
tests/check_list.c

@@ -4,8 +4,8 @@
 #include "check.h"
 
 /* global test counters */
-Int32 visit_count = 0;
-Int32 free_count = 0;
+UA_Int32 visit_count = 0;
+UA_Int32 free_count = 0;
 
 void visitor(void* payload){
 	visit_count++;
@@ -22,7 +22,7 @@ Boolean matcher(void* payload){
 	if(payload == NULL){
 		return FALSE;
 	}
-	if(*((Int32*)payload) == 42){
+	if(*((UA_Int32*)payload) == 42){
 		return TRUE;
 	}
 	return FALSE;
@@ -36,13 +36,13 @@ START_TEST(list_test_basic)
 
 	ck_assert_int_eq(list.size, 0);
 
-	Int32* payload = (Int32*)opcua_malloc(sizeof(*payload));
+	UA_Int32* payload = (UA_Int32*)opcua_malloc(sizeof(*payload));
 	*payload = 42;
 	UA_list_addPayloadToFront(&list, payload);
-	payload = (Int32*)opcua_malloc(sizeof(*payload));
+	payload = (UA_Int32*)opcua_malloc(sizeof(*payload));
 	*payload = 24;
 	UA_list_addPayloadToFront(&list, payload);
-	payload = (Int32*)opcua_malloc(sizeof(*payload));
+	payload = (UA_Int32*)opcua_malloc(sizeof(*payload));
 	*payload = 1;
 	UA_list_addPayloadToBack(&list, payload);
 
@@ -55,7 +55,7 @@ START_TEST(list_test_basic)
 	UA_list_Element* elem = NULL;
 	elem = UA_list_find(&list, matcher);
 	if(elem){
-		ck_assert_int_eq((*((Int32*)elem->payload)), 42);
+		ck_assert_int_eq((*((UA_Int32*)elem->payload)), 42);
 		UA_list_removeElement(elem, freer);
 		ck_assert_int_eq(free_count, 1);
 		free_count = 0; //reset free counter

+ 46 - 46
tests/check_stack.c

@@ -24,7 +24,7 @@ START_TEST(test_getPacketType_validParameter)
 {
 
 	char buf[] = {'C','L','O'};
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	UA_ByteString msg;
 	msg.Data = buf;
 	msg.Length = 3;
@@ -37,7 +37,7 @@ END_TEST
 START_TEST(decodeByte_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeByte
 		char *mem = malloc(sizeof(Byte));
 		UInt16 Ui16Val;
@@ -59,7 +59,7 @@ END_TEST
 START_TEST(encodeByte_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeByte
 		char *mem = malloc(sizeof(Byte));
 		rawMessage.message = mem;
@@ -103,7 +103,7 @@ END_TEST
 
 START_TEST(decodeInt16_test_positives)
 {
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	Int16 val;
 	AD_RawMessage rawMessage;
 	char mem[] = {
@@ -129,7 +129,7 @@ START_TEST(decodeInt16_test_positives)
 END_TEST
 START_TEST(decodeInt16_test_negatives)
 {
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	Int16 val;
 	AD_RawMessage rawMessage;
 	char mem[] = {
@@ -152,7 +152,7 @@ START_TEST(encodeInt16_test)
 {
 
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeUInt16
 	char *mem = malloc(sizeof(UInt16));
 	rawMessage.message = mem;
@@ -164,7 +164,7 @@ START_TEST(encodeInt16_test)
 	//encodeUInt16(testUInt16, &position, &rawMessage);
 
 	ck_assert_int_eq(position, 2);
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	Int16 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, INT16, &p, &val);
 	ck_assert_int_eq(val,testUInt16);
@@ -177,7 +177,7 @@ START_TEST(decodeUInt16_test)
 {
 
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeUInt16
 	char mem[2] = {0x01,0x00};
 
@@ -187,7 +187,7 @@ START_TEST(decodeUInt16_test)
 
 	//encodeUInt16(testUInt16, &position, &rawMessage);
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	UInt16 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message,UINT16,&p,&val);
 
@@ -201,7 +201,7 @@ START_TEST(encodeUInt16_test)
 {
 
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeUInt16
 	char *mem = malloc(sizeof(UInt16));
 	rawMessage.message = mem;
@@ -213,7 +213,7 @@ START_TEST(encodeUInt16_test)
 	//encodeUInt16(testUInt16, &position, &rawMessage);
 
 	ck_assert_int_eq(position, 2);
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	UInt16 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, UINT16, &p, &val);
 	ck_assert_int_eq(val,testUInt16);
@@ -226,14 +226,14 @@ END_TEST
 START_TEST(decodeUInt32_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeUInt16
 	char mem[4] = {0xFF,0x00,0x00,0x00};
 
 	rawMessage.message = mem;
 	rawMessage.length = 4;
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	UInt32 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, UINT32, &p, &val);
 	ck_assert_uint_eq(val,255);
@@ -243,7 +243,7 @@ END_TEST
 START_TEST(encodeUInt32_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	UInt32 value = 0x0101FF00;
 	//EncodeUInt16
 
@@ -251,7 +251,7 @@ START_TEST(encodeUInt32_test)
 
 	rawMessage.length = 8;
 
-	Int32 p = 4;
+	UA_Int32 p = 4;
 	//encodeUInt32(value, &p,rawMessage.message);
 	encoder_encodeBuiltInDatatype(&value,UINT32,&p,rawMessage.message);
 	ck_assert_uint_eq((Byte)rawMessage.message[4],0x00);
@@ -267,7 +267,7 @@ END_TEST
 START_TEST(decodeInt32_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	//EncodeUInt16
 	char mem[4] = {0x00,0xCA,0x9A,0x3B};
 
@@ -276,8 +276,8 @@ START_TEST(decodeInt32_test)
 	rawMessage.length = 4;
 
 
-	Int32 p = 0;
-	Int32 val;
+	UA_Int32 p = 0;
+	UA_Int32 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, INT32, &p, &val);
 	ck_assert_int_eq(val,1000000000);
 }
@@ -292,7 +292,7 @@ END_TEST
 START_TEST(decodeUInt64_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	UInt64 expectedVal = 0xFF;
 	expectedVal = expectedVal << 56;
 	char mem[8] = {00,00,00,00,0x00,0x00,0x00,0xFF};
@@ -301,7 +301,7 @@ START_TEST(decodeUInt64_test)
 
 	rawMessage.length = 8;
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	UInt64 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, UINT64, &p, &val);
 	ck_assert_uint_eq(val, expectedVal);
@@ -310,7 +310,7 @@ END_TEST
 START_TEST(encodeUInt64_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	UInt64 value = 0x0101FF00FF00FF00;
 	//EncodeUInt16
 
@@ -318,7 +318,7 @@ START_TEST(encodeUInt64_test)
 
 	rawMessage.length = 8;
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	encodeUInt64(value, &p,rawMessage.message);
 
 	ck_assert_uint_eq((Byte)rawMessage.message[0],0x00);
@@ -335,7 +335,7 @@ END_TEST
 START_TEST(decodeInt64_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	Int64 expectedVal = 0xFF;
 	expectedVal = expectedVal << 56;
 	char mem[8] = {00,00,00,00,0x00,0x00,0x00,0xFF};
@@ -344,7 +344,7 @@ START_TEST(decodeInt64_test)
 
 	rawMessage.length = 8;
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	Int64 val;
 	decoder_decodeBuiltInDatatype(rawMessage.message, INT64, &p, &val);
 	ck_assert_uint_eq(val, expectedVal);
@@ -353,7 +353,7 @@ END_TEST
 START_TEST(encodeInt64_test)
 {
 	AD_RawMessage rawMessage;
-	Int32 position = 0;
+	UA_Int32 position = 0;
 	UInt64 value = 0x0101FF00FF00FF00;
 	//EncodeUInt16
 
@@ -361,7 +361,7 @@ START_TEST(encodeInt64_test)
 
 	rawMessage.length = 8;
 
-	Int32 p = 0;
+	UA_Int32 p = 0;
 	encodeUInt64(value, &p,rawMessage.message);
 
 	ck_assert_uint_eq((Byte)rawMessage.message[0],0x00);
@@ -379,7 +379,7 @@ END_TEST
 START_TEST(decodeFloat_test)
 {
 	Float expectedValue = -6.5;
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	char buf[4] = {0x00,0x00,0xD0,0xC0};
 
 
@@ -388,7 +388,7 @@ START_TEST(decodeFloat_test)
 	decoder_decodeBuiltInDatatype(buf, FLOAT, &pos, &calcVal);
 	//val should be -6.5
 
-	Int32 val = (calcVal > -6.501 && calcVal < -6.499);
+	UA_Int32 val = (calcVal > -6.501 && calcVal < -6.499);
 
 
 	ck_assert_int_gt(val,0);
@@ -399,7 +399,7 @@ END_TEST
 START_TEST(encodeFloat_test)
 {
 	Float value = -6.5;
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	char *buf = (char*)opcua_malloc(sizeof(Float));
 
 	encodeFloat(value,&pos,buf);
@@ -419,7 +419,7 @@ END_TEST
 START_TEST(encodeDouble_test)
 {
 	Float value = -6.5;
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	char *buf = (char*)opcua_malloc(sizeof(Float));
 
 	encodeDouble(value,&pos,buf);
@@ -434,18 +434,18 @@ END_TEST
 START_TEST(encodeUAString_test)
 {
 
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	UA_String string;
-	Int32 l = 11;
+	UA_Int32 l = 11;
 	char mem[11] = "ACPLT OPCUA";
-	char *dstBuf = (char*) malloc(sizeof(Int32)+l);
+	char *dstBuf = (char*) malloc(sizeof(UA_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');
+	ck_assert_int_eq(dstBuf[0+sizeof(UA_Int32)],'A');
 
 
 }
@@ -453,12 +453,12 @@ END_TEST
 START_TEST(decodeUAString_test)
 {
 
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	UA_String string;
-	Int32 l = 11;
+	UA_Int32 l = 11;
 	char binString[15] = {11,0x00,0x00,0x00,'A','C','P','L','T',' ','U','A'};
 
-	char *dstBuf = (char*) malloc(l-sizeof(Int32));
+	char *dstBuf = (char*) malloc(l-sizeof(UA_Int32));
 	string.Data = dstBuf;
 	string.Length = 0;
 	decodeUAString(binString, &pos, &string);
@@ -474,8 +474,8 @@ END_TEST
 START_TEST(diagnosticInfo_calcSize_test)
 {
 
-	Int32 valreal = 0;
-	Int32 valcalc = 0;
+	UA_Int32 valreal = 0;
+	UA_Int32 valcalc = 0;
 	UA_DiagnosticInfo diagnosticInfo;
 	diagnosticInfo.EncodingMask = 0x01 | 0x02 | 0x04 | 0x08 | 0x10;
 	diagnosticInfo.SymbolicId = 30;
@@ -494,8 +494,8 @@ END_TEST
 START_TEST(extensionObject_calcSize_test)
 {
 
-	Int32 valreal = 0;
-	Int32 valcalc = 0;
+	UA_Int32 valreal = 0;
+	UA_Int32 valcalc = 0;
 	Byte data[3] = {1,2,3};
 	UA_ExtensionObject extensionObject;
 
@@ -550,8 +550,8 @@ END_TEST
 //ToDo: Function needs to be filled
 START_TEST(expandedNodeId_calcSize_test)
 {
-	Int32 valreal = 300;
-	Int32 valcalc = 0;
+	UA_Int32 valreal = 300;
+	UA_Int32 valcalc = 0;
 	ck_assert_int_eq(valcalc,valreal);
 }
 END_TEST
@@ -559,7 +559,7 @@ END_TEST
 START_TEST(encodeDataValue_test)
 {
 	UA_DataValue dataValue;
-	Int32 pos = 0;
+	UA_Int32 pos = 0;
 	char *buf = (char*)opcua_malloc(15);
 	UA_DateTime dateTime;
 	dateTime = 80;
@@ -628,11 +628,11 @@ END_TEST
 
 START_TEST(encode_builtInDatatypeArray_test_String)
 {
-	Int32 noElements = 2;
+	UA_Int32 noElements = 2;
 	UA_ByteString s1 = { 6, "OPC UA" };
 	UA_ByteString s2 = { -1, NULL };
 	UA_ByteString* array[] = { &s1, &s2	};
-	Int32 pos = 0, i;
+	UA_Int32 pos = 0, i;
 	char buf[256];
 	char result[] = {
 			0x02, 0x00, 0x00, 0x00,		// noElements

+ 11 - 11
tool/generate_builtin.py

@@ -125,27 +125,27 @@ def createStructured(element):
     if len(valuemap) > 0:
         for n,t in valuemap.iteritems():
             if t.find("**") != -1:
-	        print("\t" + "UInt32 " + n + "_size;", end='\n', file=fh)
+	        print("\t" + "UA_UInt32 " + n + "_size;", end='\n', file=fh)
             print("\t" + "UA_" + t + " " + n + ";", end='\n', file=fh)
     else:
         print("// null record", end='\n', file=fh)
     print("} " + name + ";", end='\n', file=fh)
 
-    print("Int32 " + name + "_calcSize(" + name + " const * ptr);", end='\n', file=fh)
-    print("Int32 " + name + "_encode(" + name + " const * src, Int32* pos, char* dst);", end='\n', file=fh)
-    print("Int32 " + name + "_decode(char const * src, UInt32* pos, " + name + "* dst);", end='\n', file=fh)
+    print("UA_Int32 " + name + "_calcSize(" + name + " const * ptr);", end='\n', file=fh)
+    print("UA_Int32 " + name + "_encode(" + name + " const * src, UA_Int32* pos, char* dst);", end='\n', file=fh)
+    print("UA_Int32 " + name + "_decode(char const * src, UA_UInt32* pos, " + name + "* dst);", end='\n', file=fh)
 
     if "Response" in name[len(name)-9:]:
 		#Sten: not sure how to get it, actually we need to solve it on a higher level
-        #print("Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn UA_ResponseHeader_getSize()", end='', file=fc)
-		print("Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc)  
+        #print("UA_Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn UA_ResponseHeader_getSize()", end='', file=fc)
+		print("UA_Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc)  
     elif "Request" in name[len(name)-9:]:
 		#Sten: dito
-        #print("Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn UA_RequestHeader_getSize()", end='', file=fc) 
-		print("Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc) 
+        #print("UA_Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn UA_RequestHeader_getSize()", end='', file=fc) 
+		print("UA_Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc) 
     else:
 	# code 
-        print("Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc)
+        print("UA_Int32 "  + name + "_calcSize(" + name + " const * ptr) {\n\treturn 0", end='', file=fc)
 
     # code _calcSize
     for n,t in valuemap.iteritems():
@@ -164,7 +164,7 @@ def createStructured(element):
 
     print("\n\t;\n};\n", end='\n', file=fc)
 
-    print("Int32 "+name+"_encode("+name+" const * src, Int32* pos, char* dst) {\n\tInt32 retval = UA_SUCCESS;", end='\n', file=fc)
+    print("UA_Int32 "+name+"_encode("+name+" const * src, UA_Int32* pos, char* dst) {\n\tUA_Int32 retval = UA_SUCCESS;", end='\n', file=fc)
     # code _encode
     for n,t in valuemap.iteritems():
         if t in elementary_size:
@@ -181,7 +181,7 @@ def createStructured(element):
                 print('\tretval |= UA_'+t+"_encode(&(src->"+n+"),pos,dst);", end='\n', file=fc)
     print("\treturn retval;\n};\n", end='\n', file=fc)
 
-    print("Int32 "+name+"_decode(char const * src, UInt32* pos, " + name + "* dst) {\n\tInt32 retval = UA_SUCCESS;", end='\n', file=fc)
+    print("UA_Int32 "+name+"_decode(char const * src, UA_UInt32* pos, " + name + "* dst) {\n\tUA_Int32 retval = UA_SUCCESS;", end='\n', file=fc)
     # code _decode
     for n,t in valuemap.iteritems():
         if t in elementary_size:

+ 4 - 4
tool/generate_namespace.py

@@ -58,15 +58,15 @@ print('''/**********************************************************
 
 #include "opcua.h"  // definition of UA_VTable and basic UA_Types
 
-Int32 UA_toIndex(Int32 id);
+UA_Int32 UA_toIndex(UA_Int32 id);
 extern UA_VTable UA_[]; 
 
 enum UA_VTableIndex_enum {''', end='\n', file=fh)
 
 print('''/* Mapping and vTable of Namespace Zero */
 #include "opcua.h"
-Int32 UA_toIndex(Int32 id) {
-    Int32 retval = -1;
+UA_Int32 UA_toIndex(UA_Int32 id) {
+    UA_Int32 retval = -1;
     switch (id) { ''', end='\n',file=fc)
 
 i = 0
@@ -97,7 +97,7 @@ for row in rows2:
     name = "UA_" + row[0]
     print('#define '+name.upper()+'_NS0 (UA_namespace_zero['+name.upper()+'].Id)', file=fh)
 
-    print("\t{" + row[1] + ", (Int32(*)(void const*)) " + name + "_calcSize, (Int32(*)(char const*,Int32*,void*)) " + name + "_decode, (Int32(*)(void const*,Int32*,char*))" + name + "_encode},",end='\n',file=fc) 
+    print("\t{" + row[1] + ", (UA_Int32(*)(void const*)) " + name + "_calcSize, (UA_Int32(*)(char const*,UA_Int32*,void*)) " + name + "_decode, (UA_Int32(*)(void const*,UA_Int32*,char*))" + name + "_encode},",end='\n',file=fc) 
 
 print("\t{0,UA_NULL,UA_NULL,UA_NULL}\n};",file=fc)
 print('#endif /* OPCUA_NAMESPACE_0_H_ */', end='\n', file=fh)

+ 167 - 247
tool/opcua_basictypes.c

@@ -9,56 +9,84 @@
 #include <string.h>
 
 
+UA_Int32 UA_encode(void* const data, UA_Int32 *pos, UA_Int32 type, char* dst) {
+	return UA_[type].encode(data,pos,dst);
+}
+
+UA_Int32 UA_decode(char* const data, UA_Int32* pos, UA_Int32 type, void* dst){
+	return UA_[type].decode(data,pos,dst);
+}
 
-Int32 UA_calcSize(void* const data, UInt32 type) {
+UA_Int32 UA_calcSize(void* const data, UInt32 type) {
 	return (UA_[type].calcSize)(data);
 }
 
-Int32 UA_Array_calcSize(Int32 nElements, Int32 type, void const ** data) {
+UA_Int32 UA_Array_calcSize(UA_Int32 nElements, UA_Int32 type, void const ** data) {
+
 	int length = sizeof(UA_Int32);
 	int i;
 
+	char** ptr = (char**)data;
+
 	if (nElements > 0) {
-		for(i=0; i<nElements;i++,data++) {
-			length += UA_calcSize(data,type);
+		for(i=0; i<nElements;i++) {
+			length += UA_calcSize((void*)ptr[i],type);
 		}
 	}
 	return length;
 }
-Int32 UA_Array_encode(void const **src, Int32 noElements, Int32 type, Int32* pos, char * dst) {
-	//TODO: Implement
-	return UA_ERR_NOT_IMPLEMENTED;
+UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, char * dst) {
+	UA_Int32 length = sizeof(UA_Int32);
+	UA_Int32 retVal = 0;
+	UA_Int32 i = 0;
+
+	char** ptr = (char**)src;
+
+	UA_Int32_encode(&noElements, pos, dst);
+	for(i=0; i<noElements; i++) {
+		retVal |= UA_[type].encode((void*)src[i], pos, dst);
+	}
+
+	return retVal;
 }
 
-Int32 UA_Array_decode(char const * src, Int32 noElements, Int32 type, Int32* pos, void const **dst) {
-	//TODO: Implement
-	return UA_ERR_NOT_IMPLEMENTED;
+UA_Int32 UA_Array_decode(char const * src,UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void const **dst) {
+	UA_Int32 length = sizeof(UA_Int32);
+	UA_Int32 retval = 0;
+	UA_Int32 i = 0;
+
+	char** ptr = (char**)src;
+
+	for(i=0; i<noElements; i++) {
+		retval |= UA_[type].decode(src, pos, (void*)dst[i]);
+	}
+	return retval;
 }
 
-Int32 UA_free(void * ptr){
+UA_Int32 UA_free(void * ptr){
 	free(ptr);
 	return UA_SUCCESS;
 }
 
-Int32 UA_alloc(void ** ptr, int size){
+UA_Int32 UA_alloc(void ** ptr, int size){
 	*ptr = malloc(size);
 	if(*ptr == UA_NULL) return UA_ERR_NO_MEMORY;
 	return UA_SUCCESS;
 }
 
-Int32 UA_memcpy(void * dst, void const * src, int size){
+UA_Int32 UA_memcpy(void * dst, void const * src, int size){
 	memcpy(dst, src, size);
 	return UA_SUCCESS;
 }
 
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Boolean)
-Int32 UA_Boolean_encode(UA_Boolean const * src, Int32* pos, char * dst) {
+UA_Int32 UA_Boolean_encode(UA_Boolean const * src, UA_Int32* pos, char * dst) {
 	UA_Boolean tmpBool = ((*src > 0) ? UA_TRUE : UA_FALSE);
 	memcpy(&(dst[(*pos)++]), &tmpBool, sizeof(UA_Boolean));
 	return UA_SUCCESS;
 }
-Int32 UA_Boolean_decode(char const * src, Int32* pos, UA_Boolean * dst) {
+UA_Int32 UA_Boolean_decode(char const * src, UA_Int32* pos, UA_Boolean * dst) {
 	*dst = ((UA_Boolean) (src[(*pos)++]) > 0) ? UA_TRUE : UA_FALSE;
 	return UA_SUCCESS;
 }
@@ -66,13 +94,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Boolean)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Boolean)
 
 
-
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Byte)
-Int32 UA_Byte_encode(UA_Byte const * src, Int32* pos, char * dst) {
+UA_Int32 UA_Byte_encode(UA_Byte const * src, UA_Int32* pos, char * dst) {
 	*dst = src[(*pos)++];
 	return UA_SUCCESS;
 }
-Int32 UA_Byte_decode(char const * src, Int32* pos, UA_Byte * dst) {
+UA_Int32 UA_Byte_decode(char const * src, UA_Int32* pos, UA_Byte * dst) {
 	memcpy(&(dst[(*pos)++]), src, sizeof(UA_Byte));
 	return UA_SUCCESS;
 }
@@ -80,11 +107,11 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Byte)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Byte)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_SByte)
-Int32 UA_SByte_encode(UA_SByte const * src, Int32* pos, char * dst) {
+UA_Int32 UA_SByte_encode(UA_SByte const * src, UA_Int32* pos, char * dst) {
 	dst[(*pos)++] = *src;
 	return UA_SUCCESS;
 }
-Int32 UA_SByte_decode(char const * src, Int32* pos, UA_SByte * dst) {
+UA_Int32 UA_SByte_decode(char const * src, UA_Int32* pos, UA_SByte * dst) {
 	*dst = src[(*pos)++];
 	return 1;
 }
@@ -92,12 +119,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_SByte)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_SByte)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt16)
-Int32 UA_UInt16_encode(UA_UInt16 const *src, Int32* pos, char * dst) {
+UA_Int32 UA_UInt16_encode(UA_UInt16 const *src, UA_Int32* pos, char * dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt16));
 	*pos += sizeof(UA_UInt16);
 	return UA_SUCCESS;
 }
-Int32 UA_UInt16_decode(char const * src, Int32* pos, UA_UInt16* dst) {
+UA_Int32 UA_UInt16_decode(char const * src, UA_Int32* pos, UA_UInt16* dst) {
 	Byte t1 = src[(*pos)++];
 	UInt16 t2 = (UInt16) (src[(*pos)++] << 8);
 	*dst = t1 + t2;
@@ -107,12 +134,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_UInt16)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_UInt16)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int16)
-Int32 UA_Int16_encode(UA_Int16 const * src, Int32* pos, char* dst) {
+UA_Int32 UA_Int16_encode(UA_Int16 const * src, UA_Int32* pos, char* dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int16));
 	*pos += sizeof(UA_Int16);
 	return UA_SUCCESS;
 }
-Int32 UA_Int16_decode(char const * src, Int32* pos, UA_Int16 *dst) {
+UA_Int32 UA_Int16_decode(char const * src, UA_Int32* pos, UA_Int16 *dst) {
 	Int16 t1 = (Int16) (((SByte) (src[(*pos)++]) & 0xFF));
 	Int16 t2 = (Int16) (((SByte) (src[(*pos)++]) & 0xFF) << 8);
 	*dst = t1 + t2;
@@ -122,16 +149,16 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Int16)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Int16)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int32)
-Int32 UA_Int32_encode(UA_Int32 const * src, Int32* pos, char *dst) {
+UA_Int32 UA_Int32_encode(UA_Int32 const * src, UA_Int32* pos, char *dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int32));
 	*pos += sizeof(UA_Int32);
 	return UA_SUCCESS;
 }
-Int32 UA_Int32_decode(char const * src, Int32* pos, UA_Int32* dst) {
-	Int32 t1 = (Int32) (((SByte) (src[(*pos)++]) & 0xFF));
-	Int32 t2 = (Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 8);
-	Int32 t3 = (Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 16);
-	Int32 t4 = (Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 24);
+UA_Int32 UA_Int32_decode(char const * src, UA_Int32* pos, UA_Int32* dst) {
+	UA_Int32 t1 = (UA_Int32) (((SByte) (src[(*pos)++]) & 0xFF));
+	UA_Int32 t2 = (UA_Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 8);
+	UA_Int32 t3 = (UA_Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 16);
+	UA_Int32 t4 = (UA_Int32) (((SByte) (src[(*pos)++]) & 0xFF) << 24);
 	*dst = t1 + t2 + t3 + t4;
 	return UA_SUCCESS;
 }
@@ -139,12 +166,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Int32)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Int32)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt32)
-Int32 UA_UInt32_encode(UA_UInt32 const * src, Int32* pos, char *dst) {
+UA_Int32 UA_UInt32_encode(UA_UInt32 const * src, UA_Int32* pos, char *dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt32));
 	*pos += sizeof(UA_UInt32);
 	return UA_SUCCESS;
 }
-Int32 UA_UInt32_decode(char const * src, Int32* pos, UA_UInt32 *dst) {
+UA_Int32 UA_UInt32_decode(char const * src, UA_Int32* pos, UA_UInt32 *dst) {
 	UInt32 t1 = (UInt32) src[(*pos)++];
 	UInt32 t2 = (UInt32) src[(*pos)++] << 8;
 	UInt32 t3 = (UInt32) src[(*pos)++] << 16;
@@ -156,12 +183,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_UInt32)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_UInt32)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int64)
-Int32 UA_Int64_encode(UA_Int64 const * src, Int32* pos, char *dst) {
+UA_Int32 UA_Int64_encode(UA_Int64 const * src, UA_Int32* pos, char *dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int64));
 	*pos += sizeof(UA_Int64);
 	return UA_SUCCESS;
 }
-Int32 UA_Int64_decode(char const * src, Int32* pos, UA_Int64* dst) {
+UA_Int32 UA_Int64_decode(char const * src, UA_Int32* pos, UA_Int64* dst) {
 	Int64 t1 = (Int64) src[(*pos)++];
 	Int64 t2 = (Int64) src[(*pos)++] << 8;
 	Int64 t3 = (Int64) src[(*pos)++] << 16;
@@ -177,12 +204,12 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Int64)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Int64)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt64)
-Int32 UA_UInt64_encode(UA_UInt64 const * src , Int32* pos, char * dst) {
+UA_Int32 UA_UInt64_encode(UA_UInt64 const * src , UA_Int32* pos, char * dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt64));
 	*pos += sizeof(UInt64);
 	return UA_SUCCESS;
 }
-Int32 UA_UInt64_decode(char const * src, Int32* pos, UA_UInt64* dst) {
+UA_Int32 UA_UInt64_decode(char const * src, UA_Int32* pos, UA_UInt64* dst) {
 	UInt64 t1 = (UInt64) src[(*pos)++];
 	UInt64 t2 = (UInt64) src[(*pos)++] << 8;
 	UInt64 t3 = (UInt64) src[(*pos)++] << 16;
@@ -198,13 +225,13 @@ UA_TYPE_METHOD_DELETE_FREE(UA_UInt64)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_UInt64)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Float)
-Int32 UA_Float_decode(char const * src, Int32* pos, UA_Float* dst) {
+UA_Int32 UA_Float_decode(char const * src, UA_Int32* pos, UA_Float* dst) {
 	// TODO: not yet implemented
 	memcpy(dst, &(src[*pos]), sizeof(UA_Float));
 	*pos += sizeof(UA_Float);
 	return UA_SUCCESS;
 }
-Int32 UA_Float_encode(UA_Float const * src, Int32* pos, char *dst) {
+UA_Int32 UA_Float_encode(UA_Float const * src, UA_Int32* pos, char *dst) {
 	// TODO: not yet implemented
 	memcpy(&(dst[*pos]), src, sizeof(UA_Float));
 	*pos += sizeof(UA_Float);
@@ -214,7 +241,7 @@ UA_TYPE_METHOD_DELETE_FREE(UA_Float)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Float)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Double)
-Int32 UA_Double_decode(char const * src, Int32* pos, UA_Double * dst) {
+UA_Int32 UA_Double_decode(char const * src, UA_Int32* pos, UA_Double * dst) {
 	// TODO: not yet implemented
 	Double tmpDouble;
 	tmpDouble = (Double) (src[*pos]);
@@ -222,7 +249,7 @@ Int32 UA_Double_decode(char const * src, Int32* pos, UA_Double * dst) {
 	*dst = tmpDouble;
 	return UA_SUCCESS;
 }
-Int32 UA_Double_encode(UA_Double const * src, Int32 *pos, char * dst) {
+UA_Int32 UA_Double_encode(UA_Double const * src, UA_Int32 *pos, char * dst) {
 	// TODO: not yet implemented
 	memcpy(&(dst[*pos]), src, sizeof(UA_Double));
 	*pos *= sizeof(UA_Double);
@@ -231,7 +258,7 @@ Int32 UA_Double_encode(UA_Double const * src, Int32 *pos, char * dst) {
 UA_TYPE_METHOD_DELETE_FREE(UA_Double)
 UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_Double)
 
-Int32 UA_String_calcSize(UA_String const * string) {
+UA_Int32 UA_String_calcSize(UA_String const * string) {
 	if (string == UA_NULL) {
 		// internal size for UA_memalloc
 		return sizeof(UA_String);
@@ -244,7 +271,7 @@ Int32 UA_String_calcSize(UA_String const * string) {
 		}
 	}
 }
-Int32 UA_String_encode(UA_String const * src, Int32* pos, char *dst) {
+UA_Int32 UA_String_encode(UA_String const * src, UA_Int32* pos, char *dst) {
 	UA_Int32_encode(&(src->length),pos,dst);
 
 	if (src->length > 0) {
@@ -253,11 +280,11 @@ Int32 UA_String_encode(UA_String const * src, Int32* pos, char *dst) {
 	}
 	return UA_SUCCESS;
 }
-Int32 UA_String_decode(char const * src, Int32* pos, UA_String * dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_String_decode(char const * src, UA_Int32* pos, UA_String * dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Int32_decode(src,pos,&(dst->length));
 	if (dst->length > 0) {
-		retval |= UA_alloc(&(dst->data),dst->length);
+		retval |= UA_alloc((void*)&(dst->data),dst->length);
 		retval |= UA_memcpy((void*)&(src[*pos]),dst->data,dst->length);
 		*pos += dst->length;
 	} else {
@@ -266,13 +293,14 @@ Int32 UA_String_decode(char const * src, Int32* pos, UA_String * dst) {
 	return retval;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_String)
-Int32 UA_String_deleteMembers(UA_String* p) { return UA_free(p->data); };
-Int32 UA_String_copy(UA_String const * src, UA_String* dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_String_deleteMembers(UA_String* p) { return UA_free(p->data); };
+UA_Int32 UA_String_copy(UA_String const * src, UA_String* dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	dst->length = src->length;
 	dst->data = UA_NULL;
 	if (src->length > 0) {
-		retval |= UA_alloc(&(dst->data), src->length);
+
+		retval |= UA_alloc((void*)&(dst->data), src->length);
 		if (retval == UA_SUCCESS) {
 			retval |= UA_memcpy((void*)dst->data, src->data, src->length);
 		}
@@ -290,7 +318,7 @@ UA_TYPE_METHOD_DECODE_AS(UA_ByteString, UA_String)
 UA_TYPE_METHOD_DELETE_AS(UA_ByteString, UA_String)
 UA_TYPE_METHOD_DELETEMEMBERS_AS(UA_ByteString, UA_String)
 
-Int32 UA_Guid_calcSize(UA_Guid const * p) {
+UA_Int32 UA_Guid_calcSize(UA_Guid const * p) {
 	if (p == UA_NULL) {
 		return sizeof(UA_Guid);
 	} else {
@@ -302,16 +330,16 @@ Int32 UA_Guid_calcSize(UA_Guid const * p) {
 		;
 	}
 }
-Int32 UA_Guid_encode(UA_Guid const *src, Int32* pos, char *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_Guid_encode(UA_Guid const *src, UA_Int32* pos, char *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->data1), pos, dst);
 	retval |= UA_UInt16_encode(&(src->data2), pos, dst);
 	retval |= UA_UInt16_encode(&(src->data3), pos, dst);
 	retval |= UA_ByteString_encode(&(src->data4), pos, dst);
 	return UA_SUCCESS;
 }
-Int32 UA_Guid_decode(char const * src, Int32* pos, UA_Guid *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_Guid_decode(char const * src, UA_Int32* pos, UA_Guid *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Int32_decode(src,pos,&(dst->data1));
 	retval |= UA_Int16_decode(src,pos,&(dst->data2));
 	retval |= UA_Int16_decode(src,pos,&(dst->data3));
@@ -319,10 +347,10 @@ Int32 UA_Guid_decode(char const * src, Int32* pos, UA_Guid *dst) {
 	return retval;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_Guid)
-Int32 UA_Guid_deleteMembers(UA_Guid* p) { return UA_ByteString_delete(&(p->data4)); };
+UA_Int32 UA_Guid_deleteMembers(UA_Guid* p) { return UA_ByteString_delete(&(p->data4)); };
 
-Int32 UA_LocalizedText_calcSize(UA_LocalizedText const * p) {
-	Int32 length = 0;
+UA_Int32 UA_LocalizedText_calcSize(UA_LocalizedText const * p) {
+	UA_Int32 length = 0;
 	if (p==UA_NULL) {
 		// size for UA_memalloc
 		length = sizeof(UA_LocalizedText);
@@ -338,9 +366,9 @@ Int32 UA_LocalizedText_calcSize(UA_LocalizedText const * p) {
 	}
 	return length;
 }
-Int32 UA_LocalizedText_encode(UA_LocalizedText const * src, Int32 *pos,
+UA_Int32 UA_LocalizedText_encode(UA_LocalizedText const * src, UA_Int32 *pos,
 		char * dst) {
-	Int32 retval = UA_SUCCESS;
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_encode(&(src->encodingMask),pos,dst);
 	if (src->encodingMask & 0x01) {
 		UA_String_encode(&(src->locale),pos,dst);
@@ -350,9 +378,9 @@ Int32 UA_LocalizedText_encode(UA_LocalizedText const * src, Int32 *pos,
 	}
 	return retval;
 }
-Int32 UA_LocalizedText_decode(char const * src, Int32 *pos,
+UA_Int32 UA_LocalizedText_decode(char const * src, UA_Int32 *pos,
 		UA_LocalizedText *dst) {
-	Int32 retval = UA_SUCCESS;
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_String_copy(&UA_String_null,&(dst->locale));
 	retval |= UA_String_copy(&UA_String_null,&(dst->text));
 
@@ -366,7 +394,7 @@ Int32 UA_LocalizedText_decode(char const * src, Int32 *pos,
 	return retval;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_LocalizedText)
-Int32 UA_LocalizedText_deleteMembers(UA_LocalizedText* p) {
+UA_Int32 UA_LocalizedText_deleteMembers(UA_LocalizedText* p) {
 	return UA_SUCCESS
 			|| UA_String_deleteMembers(&(p->locale))
 			|| UA_String_deleteMembers(&(p->text))
@@ -374,8 +402,8 @@ Int32 UA_LocalizedText_deleteMembers(UA_LocalizedText* p) {
 };
 
 /* Serialization of UA_NodeID is specified in 62541-6, §5.2.2.9 */
-Int32 UA_NodeId_calcSize(UA_NodeId const *p) {
-	Int32 length = 0;
+UA_Int32 UA_NodeId_calcSize(UA_NodeId const *p) {
+	UA_Int32 length = 0;
 	if (p == UA_NULL) {
 		length = sizeof(UA_NodeId);
 	} else {
@@ -404,7 +432,7 @@ Int32 UA_NodeId_calcSize(UA_NodeId const *p) {
 	}
 	return length;
 }
-Int32 UA_NodeId_encode(UA_NodeId const * src, Int32* pos, char *dst) {
+UA_Int32 UA_NodeId_encode(UA_NodeId const * src, UA_Int32* pos, char *dst) {
 	// temporary variables for endian-save code
 	UA_Byte srcByte;
 	UA_UInt16 srcUInt16;
@@ -441,7 +469,7 @@ Int32 UA_NodeId_encode(UA_NodeId const * src, Int32* pos, char *dst) {
 	}
 	return retval;
 }
-Int32 UA_NodeId_decode(char const * src, Int32* pos, UA_NodeId *dst) {
+UA_Int32 UA_NodeId_decode(char const * src, UA_Int32* pos, UA_NodeId *dst) {
 	int retval = UA_SUCCESS;
 	// temporary variables to overcome decoder's non-endian-saveness for datatypes
 	Byte   dstByte;
@@ -480,7 +508,7 @@ Int32 UA_NodeId_decode(char const * src, Int32* pos, UA_NodeId *dst) {
 	return retval;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_NodeId)
-Int32 UA_NodeId_deleteMembers(UA_NodeId* p) {
+UA_Int32 UA_NodeId_deleteMembers(UA_NodeId* p) {
 	int retval = UA_SUCCESS;
 	switch (p->encodingByte) {
 	case UA_NodeIdType_TwoByte:
@@ -503,8 +531,8 @@ Int32 UA_NodeId_deleteMembers(UA_NodeId* p) {
 //FIXME: Sten Where do these two flags come from?
 #define NIEVT_NAMESPACE_URI_FLAG 0x80 	//Is only for ExpandedNodeId required
 #define NIEVT_SERVERINDEX_FLAG 0x40 //Is only for ExpandedNodeId required
-Int32 UA_ExpandedNodeId_calcSize(UA_ExpandedNodeId const * p) {
-	Int32 length = 0;
+UA_Int32 UA_ExpandedNodeId_calcSize(UA_ExpandedNodeId const * p) {
+	UA_Int32 length = 0;
 	if (p == UA_NULL) {
 		length = sizeof(UA_ExpandedNodeId);
 	} else {
@@ -518,7 +546,7 @@ Int32 UA_ExpandedNodeId_calcSize(UA_ExpandedNodeId const * p) {
 	}
 	return length;
 }
-Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, Int32* pos, char *dst) {
+UA_Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, UA_Int32* pos, char *dst) {
 	UInt32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_encode(&(src->nodeId),pos,dst);
 	if (src->nodeId.encodingByte & NIEVT_NAMESPACE_URI_FLAG) {
@@ -529,7 +557,7 @@ Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, Int32* pos, char *
 	}
 	return retval;
 }
-Int32 UA_ExpandedNodeId_decode(char const * src, Int32* pos,
+UA_Int32 UA_ExpandedNodeId_decode(char const * src, UA_Int32* pos,
 		UA_ExpandedNodeId *dst) {
 	UInt32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_decode(src,pos,&(dst->nodeId));
@@ -546,15 +574,15 @@ Int32 UA_ExpandedNodeId_decode(char const * src, Int32* pos,
 	return retval;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_ExpandedNodeId)
-Int32 UA_ExpandedNodeId_deleteMembers(UA_ExpandedNodeId* p) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_ExpandedNodeId_deleteMembers(UA_ExpandedNodeId* p) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_deleteMembers(&(p->nodeId));
 	retval |= UA_String_deleteMembers(&(p->namespaceUri));
 	return retval;
 }
 
-Int32 UA_ExtensionObject_calcSize(UA_ExtensionObject const * p) {
-	Int32 length = 0;
+UA_Int32 UA_ExtensionObject_calcSize(UA_ExtensionObject const * p) {
+	UA_Int32 length = 0;
 	if (p == UA_NULL) {
 		length = sizeof(UA_ExtensionObject);
 	} else {
@@ -574,31 +602,31 @@ Int32 UA_ExtensionObject_calcSize(UA_ExtensionObject const * p) {
 	}
 	return length;
 }
-Int32 UA_ExtensionObject_encode(UA_ExtensionObject const *src, Int32* pos, char * dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_ExtensionObject_encode(UA_ExtensionObject const *src, UA_Int32* pos, char * dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_encode(&(src->typeId),pos,dst);
 	retval |= UA_Byte_encode(&(src->encoding),pos,dst);
 	switch (src->encoding) {
-	case NO_BODY_IS_ENCODED:
+	case UA_ExtensionObject_NoBodyIsEncoded:
 		break;
-	case BODY_IS_BYTE_STRING:
-	case BODY_IS_XML_ELEMENT:
+	case UA_ExtensionObject_BodyIsByteString:
+	case UA_ExtensionObject_BodyIsXml:
 		retval |= UA_ByteString_encode(&(src->body),pos,dst);
 		break;
 	}
 	return retval;
 }
-Int32 UA_ExtensionObject_decode(char const * src, Int32 *pos,
+UA_Int32 UA_ExtensionObject_decode(char const * src, UA_Int32 *pos,
 		UA_ExtensionObject *dst) {
-	Int32 retval = UA_SUCCESS;
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_decode(src,pos,&(dst->typeId));
 	retval |= UA_Byte_decode(src,pos,&(dst->encoding));
 	retval |= UA_String_copy(&UA_String_null, (UA_String*) &(dst->body));
 	switch (dst->encoding) {
-	case NO_BODY_IS_ENCODED:
+	case UA_ExtensionObject_NoBodyIsEncoded:
 		break;
-	case BODY_IS_BYTE_STRING:
-	case BODY_IS_XML_ELEMENT:
+	case UA_ExtensionObject_BodyIsByteString:
+	case UA_ExtensionObject_BodyIsXml:
 		retval |= UA_ByteString_decode(src,pos,&(dst->body));
 		break;
 	}
@@ -606,8 +634,8 @@ Int32 UA_ExtensionObject_decode(char const * src, Int32 *pos,
 }
 
 UA_TYPE_METHOD_DELETE_STRUCT(UA_ExtensionObject)
-Int32 UA_ExtensionObject_deleteMembers(UA_ExtensionObject *p) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_ExtensionObject_deleteMembers(UA_ExtensionObject *p) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_deleteMembers(&(p->typeId));
 	retval |= UA_ByteString_deleteMembers(&(p->body));
 	return retval;
@@ -619,33 +647,34 @@ Int32 UA_ExtensionObject_deleteMembers(UA_ExtensionObject *p) {
 // TODO: UA_DataValue_deleteMembers
 
 /** DiagnosticInfo - Part: 4, Chapter: 7.9, Page: 116 */
-Int32 UA_DiagnosticInfo_decode(char const * src, Int32 *pos, UA_DiagnosticInfo *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_DiagnosticInfo_decode(char const * src, UA_Int32 *pos, UA_DiagnosticInfo *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	int i;
 
 	retval |= UA_Byte_decode(src, pos, &(dst->encodingMask));
 
 	for (i = 0; i < 7; i++) {
 		switch ( (0x01 << i) & dst->encodingMask)  {
-		case DIEMT_SYMBOLIC_ID:
+
+		case UA_DiagnosticInfoEncodingMaskType_SymbolicId:
 			 retval |= UA_Int32_decode(src, pos, &(dst->symbolicId));
 			break;
-		case DIEMT_NAMESPACE:
+		case UA_DiagnosticInfoEncodingMaskType_Namespace:
 			retval |= UA_Int32_decode(src, pos, &(dst->namespaceUri));
 			break;
-		case DIEMT_LOCALIZED_TEXT:
+		case UA_DiagnosticInfoEncodingMaskType_LocalizedText:
 			retval |= UA_Int32_decode(src, pos, &(dst->localizedText));
 			break;
-		case DIEMT_LOCALE:
+		case UA_DiagnosticInfoEncodingMaskType_Locale:
 			retval |= UA_Int32_decode(src, pos, &(dst->locale));
 			break;
-		case DIEMT_ADDITIONAL_INFO:
+		case UA_DiagnosticInfoEncodingMaskType_AdditionalInfo:
 			retval |= UA_String_decode(src, pos, &(dst->additionalInfo));
 			break;
-		case DIEMT_INNER_STATUS_CODE:
+		case UA_DiagnosticInfoEncodingMaskType_InnerStatusCode:
 			retval |= UA_StatusCode_decode(src, pos, &(dst->innerStatusCode));
 			break;
-		case DIEMT_INNER_DIAGNOSTIC_INFO:
+		case UA_DiagnosticInfoEncodingMaskType_InnerDiagnosticInfo:
 			// innerDiagnosticInfo is a pointer to struct, therefore allocate
 			retval |= UA_alloc((void **) &(dst->innerDiagnosticInfo),UA_DiagnosticInfo_calcSize(UA_NULL));
 			retval |= UA_DiagnosticInfo_decode(src, pos, dst->innerDiagnosticInfo);
@@ -654,41 +683,41 @@ Int32 UA_DiagnosticInfo_decode(char const * src, Int32 *pos, UA_DiagnosticInfo *
 	}
 	return retval;
 }
-Int32 UA_DiagnosticInfo_encode(UA_DiagnosticInfo const *src, Int32 *pos, char *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_DiagnosticInfo_encode(UA_DiagnosticInfo const *src, UA_Int32 *pos, char *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	Byte mask;
 	int i;
 
 	UA_Byte_encode(&(src->encodingMask), pos, dst);
 	for (i = 0; i < 7; i++) {
 		switch ( (0x01 << i) & src->encodingMask)  {
-		case DIEMT_SYMBOLIC_ID:
+		case UA_DiagnosticInfoEncodingMaskType_SymbolicId:
 			retval |= UA_Int32_encode(&(src->symbolicId), pos, dst);
 			break;
-		case DIEMT_NAMESPACE:
+		case UA_DiagnosticInfoEncodingMaskType_Namespace:
 			retval |=  UA_Int32_encode( &(src->namespaceUri), pos, dst);
 			break;
-		case DIEMT_LOCALIZED_TEXT:
+		case UA_DiagnosticInfoEncodingMaskType_LocalizedText:
 			retval |= UA_Int32_encode(&(src->localizedText), pos, dst);
 			break;
-		case DIEMT_LOCALE:
+		case UA_DiagnosticInfoEncodingMaskType_Locale:
 			retval |= UA_Int32_encode(&(src->locale), pos, dst);
 			break;
-		case DIEMT_ADDITIONAL_INFO:
+		case UA_DiagnosticInfoEncodingMaskType_AdditionalInfo:
 			retval |= UA_String_encode(&(src->additionalInfo), pos, dst);
 			break;
-		case DIEMT_INNER_STATUS_CODE:
+		case UA_DiagnosticInfoEncodingMaskType_InnerStatusCode:
 			retval |= UA_StatusCode_encode(&(src->innerStatusCode), pos, dst);
 			break;
-		case DIEMT_INNER_DIAGNOSTIC_INFO:
+		case UA_DiagnosticInfoEncodingMaskType_InnerDiagnosticInfo:
 			retval |= UA_DiagnosticInfo_encode(src->innerDiagnosticInfo, pos, dst);
 			break;
 		}
 	}
 	return retval;
 }
-Int32 UA_DiagnosticInfo_calcSize(UA_DiagnosticInfo const * ptr) {
-	Int32 length = 0;
+UA_Int32 UA_DiagnosticInfo_calcSize(UA_DiagnosticInfo const * ptr) {
+	UA_Int32 length = 0;
 	if (ptr == UA_NULL) {
 		length = sizeof(UA_DiagnosticInfo);
 	} else {
@@ -698,26 +727,26 @@ Int32 UA_DiagnosticInfo_calcSize(UA_DiagnosticInfo const * ptr) {
 		for (mask = 0x01; mask <= 0x40; mask *= 2) {
 			switch (mask & (ptr->encodingMask)) {
 
-			case DIEMT_SYMBOLIC_ID:
+			case UA_DiagnosticInfoEncodingMaskType_SymbolicId:
 				//	puts("diagnosticInfo symbolic id");
 				length += sizeof(UA_Int32);
 				break;
-			case DIEMT_NAMESPACE:
+			case UA_DiagnosticInfoEncodingMaskType_Namespace:
 				length += sizeof(UA_Int32);
 				break;
-			case DIEMT_LOCALIZED_TEXT:
+			case UA_DiagnosticInfoEncodingMaskType_LocalizedText:
 				length += sizeof(UA_Int32);
 				break;
-			case DIEMT_LOCALE:
+			case UA_DiagnosticInfoEncodingMaskType_Locale:
 				length += sizeof(UA_Int32);
 				break;
-			case DIEMT_ADDITIONAL_INFO:
+			case UA_DiagnosticInfoEncodingMaskType_AdditionalInfo:
 				length += UA_String_calcSize(&(ptr->additionalInfo));
 				break;
-			case DIEMT_INNER_STATUS_CODE:
+			case UA_DiagnosticInfoEncodingMaskType_InnerStatusCode:
 				length += sizeof(UA_StatusCode);
 				break;
-			case DIEMT_INNER_DIAGNOSTIC_INFO:
+			case UA_DiagnosticInfoEncodingMaskType_InnerDiagnosticInfo:
 				length += UA_DiagnosticInfo_calcSize(ptr->innerDiagnosticInfo);
 				break;
 			}
@@ -726,9 +755,9 @@ Int32 UA_DiagnosticInfo_calcSize(UA_DiagnosticInfo const * ptr) {
 	return length;
 }
 UA_TYPE_METHOD_DELETE_STRUCT(UA_DiagnosticInfo)
-Int32 UA_DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p) {
-	Int32 retval = UA_SUCCESS;
-	if (p->encodingMask & DIEMT_INNER_DIAGNOSTIC_INFO) {
+UA_Int32 UA_DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p) {
+	UA_Int32 retval = UA_SUCCESS;
+	if (p->encodingMask & UA_DiagnosticInfoEncodingMaskType_InnerDiagnosticInfo) {
 		retval |= UA_DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo);
 		retval |= UA_free(p->innerDiagnosticInfo);
 	}
@@ -761,24 +790,24 @@ UA_TYPE_METHOD_DECODE_AS(UA_StatusCode, UA_UInt32)
 UA_TYPE_METHOD_DELETE_AS(UA_StatusCode, UA_UInt32)
 UA_TYPE_METHOD_DELETEMEMBERS_AS(UA_StatusCode, UA_UInt32)
 
-Int32 UA_QualifiedName_calcSize(UA_QualifiedName const * p) {
-	Int32 length = 0;
+UA_Int32 UA_QualifiedName_calcSize(UA_QualifiedName const * p) {
+	UA_Int32 length = 0;
 	length += sizeof(UInt16); //qualifiedName->namespaceIndex
 	length += sizeof(UInt16); //qualifiedName->reserved
 	length += UA_String_calcSize(&(p->name)); //qualifiedName->name
 	return length;
 }
-Int32 UA_QualifiedName_decode(char const * src, Int32 *pos,
+UA_Int32 UA_QualifiedName_decode(char const * src, UA_Int32 *pos,
 		UA_QualifiedName *dst) {
-	Int32 retval = UA_SUCCESS;
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt16_decode(src,pos,&(dst->namespaceIndex));
 	retval |= UA_UInt16_decode(src,pos,&(dst->reserved));
 	retval |= UA_String_decode(src,pos,&(dst->name));
 	return retval;
 }
-Int32 UA_QualifiedName_encode(UA_QualifiedName const *src, Int32* pos,
+UA_Int32 UA_QualifiedName_encode(UA_QualifiedName const *src, UA_Int32* pos,
 		char *dst) {
-	Int32 retval = UA_SUCCESS;
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt16_encode(&(src->namespaceIndex),pos,dst);
 	retval |= UA_UInt16_encode(&(src->reserved),pos,dst);
 	retval |= UA_String_encode(&(src->name),pos,dst);
@@ -786,9 +815,9 @@ Int32 UA_QualifiedName_encode(UA_QualifiedName const *src, Int32* pos,
 }
 
 
-Int32 UA_Variant_calcSize(UA_Variant const * p) {
-	Int32 length = 0;
-	Int32 ns0Id = p->encodingMask & 0x1F; // Bits 1-5
+UA_Int32 UA_Variant_calcSize(UA_Variant const * p) {
+	UA_Int32 length = 0;
+	UA_Int32 ns0Id = p->encodingMask & 0x1F; // Bits 1-5
 	Boolean isArray = p->encodingMask & (0x01 << 7); // Bit 7
 	Boolean hasDimensions = p->encodingMask & (0x01 << 6); // Bit 6
 	int i;
@@ -798,7 +827,7 @@ Int32 UA_Variant_calcSize(UA_Variant const * p) {
 	}
 	length += sizeof(Byte); //p->encodingMask
 	if (isArray) { // array length is encoded
-		length += sizeof(Int32); //p->arrayLength
+		length += sizeof(UA_Int32); //p->arrayLength
 		if (p->arrayLength > 0) {
 			// TODO: add suggestions of @jfpr to not iterate over arrays with fixed len elements
 			for (i=0;i<p->arrayLength;i++) {
@@ -813,8 +842,8 @@ Int32 UA_Variant_calcSize(UA_Variant const * p) {
 	}
 	return length;
 }
-Int32 UA_Variant_encode(UA_Variant const *src, Int32* pos, char *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_Variant_encode(UA_Variant const *src, UA_Int32* pos, char *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	int i;
 
 	if (src->vt == UA_NULL || src->encodingMask != src->vt->Id) {
@@ -839,9 +868,9 @@ Int32 UA_Variant_encode(UA_Variant const *src, Int32* pos, char *dst) {
 	return retval;
 }
 
-Int32 UA_Variant_decode(char const * src, Int32 *pos, UA_Variant *dst) {
-	Int32 retval = UA_SUCCESS;
-	Int32 ns0Id;
+UA_Int32 UA_Variant_decode(char const * src, UA_Int32 *pos, UA_Variant *dst) {
+	UA_Int32 retval = UA_SUCCESS;
+	UA_Int32 ns0Id;
 	int i;
 
 	retval |= UA_Byte_decode(src,pos,&(dst->encodingMask));
@@ -881,8 +910,8 @@ Int32 UA_Variant_decode(char const * src, Int32 *pos, UA_Variant *dst) {
 
 //TODO: place this define at the server configuration
 #define MAX_PICO_SECONDS 1000
-Int32 UA_DataValue_decode(char const * src, Int32* pos, UA_DataValue* dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_DataValue_decode(char const * src, UA_Int32* pos, UA_DataValue* dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_decode(src,pos,&(dst->encodingMask));
 	if (dst->encodingMask & 0x01) {
 		retval |= UA_Variant_decode(src,pos,&(dst->value));
@@ -910,8 +939,8 @@ Int32 UA_DataValue_decode(char const * src, Int32* pos, UA_DataValue* dst) {
 	}
 	return retval;
 }
-Int32 UA_DataValue_encode(UA_DataValue const * src, Int32* pos, char *dst) {
-	Int32 retval = UA_SUCCESS;
+UA_Int32 UA_DataValue_encode(UA_DataValue const * src, UA_Int32* pos, char *dst) {
+	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_encode(&(src->encodingMask),pos,dst);
 	if (src->encodingMask & 0x01) {
 		retval |= UA_Variant_encode(&(src->value),pos,dst);
@@ -934,8 +963,8 @@ Int32 UA_DataValue_encode(UA_DataValue const * src, Int32* pos, char *dst) {
 	return retval;
 }
 
-Int32 UA_DataValue_calcSize(UA_DataValue const * p) {
-	Int32 length = 0;
+UA_Int32 UA_DataValue_calcSize(UA_DataValue const * p) {
+	UA_Int32 length = 0;
 
 	if (p == UA_NULL) {	// get static storage size
 		length = sizeof(UA_DataValue);
@@ -963,112 +992,3 @@ Int32 UA_DataValue_calcSize(UA_DataValue const * p) {
 	return length;
 }
 
-/**
- * RequestHeader
- * Part: 4
- * Chapter: 7.26
- * Page: 132
- */
-/** \copydoc decodeRequestHeader */
-/*** Sten: removed to compile
-Int32 decodeRequestHeader(const AD_RawMessage *srcRaw, Int32 *pos,
-		UA_AD_RequestHeader *dstRequestHeader) {
-	return decoder_decodeRequestHeader(srcRaw->message, pos, dstRequestHeader);
-}
-***/
-
-/*** Sten: removed to compile
-Int32 decoder_decodeRequestHeader(char const * message, Int32 *pos,
-		UA_AD_RequestHeader *dstRequestHeader) {
-	// 62541-4 §5.5.2.2 OpenSecureChannelServiceParameters
-	// requestHeader - common request parameters. The authenticationToken is always omitted
-	decoder_decodeBuiltInDatatype(message, NODE_ID, pos,
-			&(dstRequestHeader->authenticationToken));
-	decoder_decodeBuiltInDatatype(message, DATE_TIME, pos,
-			&(dstRequestHeader->timestamp));
-	decoder_decodeBuiltInDatatype(message, UINT32, pos,
-			&(dstRequestHeader->requestHandle));
-	decoder_decodeBuiltInDatatype(message, UINT32, pos,
-			&(dstRequestHeader->returnDiagnostics));
-	decoder_decodeBuiltInDatatype(message, STRING, pos,
-			&(dstRequestHeader->auditEntryId));
-	decoder_decodeBuiltInDatatype(message, UINT32, pos,
-			&(dstRequestHeader->timeoutHint));
-	decoder_decodeBuiltInDatatype(message, EXTENSION_OBJECT, pos,
-			&(dstRequestHeader->additionalHeader));
-	// 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 */
-/*** Sten: removed to compile
-Int32 encodeResponseHeader(UA_AD_ResponseHeader const * responseHeader,
-		Int32 *pos, UA_ByteString *dstBuf) {
-	encodeUADateTime(responseHeader->timestamp, pos, dstBuf->data);
-	encodeIntegerId(responseHeader->requestHandle, pos, dstBuf->data);
-	encodeUInt32(responseHeader->serviceResult, pos, dstBuf->data);
-	encodeDiagnosticInfo(responseHeader->serviceDiagnostics, pos, dstBuf->data);
-
-	encoder_encodeBuiltInDatatypeArray(responseHeader->stringTable,
-			responseHeader->noOfStringTable, STRING_ARRAY, pos, dstBuf->data);
-
-	encodeExtensionObject(responseHeader->additionalHeader, pos, dstBuf->data);
-
-	//Kodieren von String Datentypen
-
-	return 0;
-}
-***/
-/*** Sten: removed to compile
-Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject) {
-	Int32 length = 0;
-
-	length += nodeId_calcSize(&(extensionObject->typeId));
-	length += sizeof(Byte); //The EncodingMask Byte
-
-	if (extensionObject->encoding == BODY_IS_BYTE_STRING
-			|| extensionObject->encoding == BODY_IS_XML_ELEMENT) {
-		length += UAByteString_calcSize(&(extensionObject->body));
-	}
-	return length;
-}
-***/
-
-/*** Sten: removed to compile
-Int32 responseHeader_calcSize(UA_AD_ResponseHeader *responseHeader) {
-	Int32 i;
-	Int32 length = 0;
-
-	// UtcTime timestamp	8
-	length += sizeof(UA_DateTime);
-
-	// IntegerId requestHandle	4
-	length += sizeof(UA_AD_IntegerId);
-
-	// StatusCode serviceResult	4
-	length += sizeof(UA_StatusCode);
-
-	// DiagnosticInfo serviceDiagnostics
-	length += diagnosticInfo_calcSize(responseHeader->serviceDiagnostics);
-
-	// String stringTable[], see 62541-6 § 5.2.4
-	length += sizeof(Int32); // Length of Stringtable always
-	if (responseHeader->noOfStringTable > 0) {
-		for (i = 0; i < responseHeader->noOfStringTable; i++) {
-			length += UAString_calcSize(responseHeader->stringTable[i]);
-		}
-	}
-
-	// ExtensibleObject additionalHeader
-	length += extensionObject_calcSize(responseHeader->additionalHeader);
-	return length;
-}
-***/

+ 36 - 38
tool/opcua_basictypes.h

@@ -15,7 +15,7 @@ typedef _Bool Boolean;
 typedef uint8_t Byte;
 typedef int8_t 	SByte;
 typedef int16_t Int16;
-typedef int32_t Int32;
+typedef int32_t UA_Int32;
 typedef int64_t Int64;
 typedef uint16_t UInt16;
 typedef uint32_t UInt32;
@@ -39,58 +39,57 @@ typedef double Double;
 #define FALSE UA_FALSE
 
 /* heap memory functions */
-Int32 UA_free(void * ptr);
-Int32 UA_memcpy(void *dst, void const *src, int size);
-Int32 UA_alloc(void ** dst, int size);
+UA_Int32 UA_free(void * ptr);
+UA_Int32 UA_memcpy(void *dst, void const *src, int size);
+UA_Int32 UA_alloc(void ** dst, int size);
 
 /* Array operations */
-Int32 UA_Array_calcSize(Int32 noElements, Int32 type, void const ** ptr);
-Int32 UA_Array_encode(void const **src, Int32 noElements, Int32 type, Int32* pos, char * dst);
-Int32 UA_Array_decode(char const * src, Int32 noElements, Int32 type, Int32* pos, void const **dst);
-
+UA_Int32 UA_Array_calcSize(UA_Int32 noElements, UA_Int32 type, void const ** ptr);
+UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, char * dst);
+UA_Int32 UA_Array_decode(char const * src,UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void const **dst);
 #define UA_NULL ((void*)0)
 // #define NULL UA_NULL
 
 #define UA_TYPE_METHOD_PROTOTYPES(TYPE) \
-Int32 TYPE##_calcSize(TYPE const * ptr);\
-Int32 TYPE##_encode(TYPE const * src, Int32* pos, char * dst);\
-Int32 TYPE##_decode(char const * src, Int32* pos, TYPE * dst);\
-Int32 TYPE##_delete(TYPE * p);\
-Int32 TYPE##_deleteMembers(TYPE * p); \
+UA_Int32 TYPE##_calcSize(TYPE const * ptr);\
+UA_Int32 TYPE##_encode(TYPE const * src, UA_Int32* pos, char * dst);\
+UA_Int32 TYPE##_decode(char const * src, UA_Int32* pos, TYPE * dst);\
+UA_Int32 TYPE##_delete(TYPE * p);\
+UA_Int32 TYPE##_deleteMembers(TYPE * p); \
 
 #define UA_TYPE_METHOD_CALCSIZE_SIZEOF(TYPE) \
-Int32 TYPE##_calcSize(TYPE const * p) { return sizeof(TYPE); }
+UA_Int32 TYPE##_calcSize(TYPE const * p) { return sizeof(TYPE); }
 
 #define UA_TYPE_METHOD_CALCSIZE_AS(TYPE, TYPE_AS) \
-Int32 TYPE##_calcSize(TYPE const * p) { return TYPE_AS##_calcSize((TYPE_AS*) p); }
+UA_Int32 TYPE##_calcSize(TYPE const * p) { return TYPE_AS##_calcSize((TYPE_AS*) p); }
 
 #define UA_TYPE_METHOD_DELETE_FREE(TYPE) \
-Int32 TYPE##_delete(TYPE * p) { return UA_free(p); };
+UA_Int32 TYPE##_delete(TYPE * p) { return UA_free(p); };
 
 #define UA_TYPE_METHOD_DELETE_AS(TYPE, TYPE_AS) \
-Int32 TYPE##_delete(TYPE * p) { return TYPE_AS##_delete((TYPE_AS*) p);};
+UA_Int32 TYPE##_delete(TYPE * p) { return TYPE_AS##_delete((TYPE_AS*) p);};
 
 #define UA_TYPE_METHOD_DELETE_STRUCT(TYPE) \
-Int32 TYPE##_delete(TYPE *p) { \
-	Int32 retval = UA_SUCCESS; \
+UA_Int32 TYPE##_delete(TYPE *p) { \
+	UA_Int32 retval = UA_SUCCESS; \
 	retval |= TYPE##_deleteMembers(p); \
 	retval |= UA_free(p); \
 	return retval; \
 }
 
 #define UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(TYPE) \
-Int32 TYPE##_deleteMembers(TYPE * p) { return UA_SUCCESS; };
+UA_Int32 TYPE##_deleteMembers(TYPE * p) { return UA_SUCCESS; };
 
 #define UA_TYPE_METHOD_DELETEMEMBERS_AS(TYPE, TYPE_AS) \
-Int32 TYPE##_deleteMembers(TYPE * p) { return TYPE_AS##_deleteMembers((TYPE_AS*) p);};
+		UA_Int32 TYPE##_deleteMembers(TYPE * p) { return TYPE_AS##_deleteMembers((TYPE_AS*) p);};
 
 #define UA_TYPE_METHOD_DECODE_AS(TYPE,TYPE_AS) \
-Int32 TYPE##_decode(char const * src, Int32* pos, TYPE *dst) { \
+		UA_Int32 TYPE##_decode(char const * src, UA_Int32* pos, TYPE *dst) { \
 	return TYPE_AS##_decode(src,pos,(TYPE_AS*) dst); \
 }
 
 #define UA_TYPE_METHOD_ENCODE_AS(TYPE,TYPE_AS) \
-Int32 TYPE##_encode(TYPE const * src, Int32* pos, char *dst) { \
+UA_Int32 TYPE##_encode(TYPE const * src, UA_Int32* pos, char *dst) { \
 	return TYPE_AS##_encode((TYPE_AS*) src,pos,dst); \
 }
 
@@ -149,9 +148,9 @@ UA_TYPE_METHOD_PROTOTYPES (UA_IntegerId)
 
 typedef struct T_UA_VTable {
 	UA_UInt32 Id;
-	Int32 (*calcSize)(void const * ptr);
-	Int32 (*decode)(char const * src, Int32* pos, void* dst);
-	Int32 (*encode)(void const * src, Int32* pos, char* dst);
+	UA_Int32 (*calcSize)(void const * ptr);
+	UA_Int32 (*decode)(char const * src, UA_Int32* pos, void* dst);
+	UA_Int32 (*encode)(void const * src, UA_Int32* pos, char* dst);
 } UA_VTable;
 
 /* VariantBinaryEncoding - Part: 6, Chapter: 5.2.2.16, Page: 22 */
@@ -250,11 +249,12 @@ typedef struct T_UA_ExtensionObject {
 	UA_ByteString body;
 } UA_ExtensionObject;
 UA_TYPE_METHOD_PROTOTYPES(UA_ExtensionObject)
+
 enum UA_ExtensionObject_EncodingMaskType_enum
 {
-	NO_BODY_IS_ENCODED = 	0x00,
-	BODY_IS_BYTE_STRING = 	0x01,
-	BODY_IS_XML_ELEMENT = 	0x02
+	UA_ExtensionObject_NoBodyIsEncoded = 	0x00,
+	UA_ExtensionObject_BodyIsByteString = 	0x01,
+	UA_ExtensionObject_BodyIsXml = 	0x02
 };
 
 /* QualifiedNameBinaryEncoding - Part: 6, Chapter: 5.2.2.13, Page: 20 */
@@ -292,15 +292,13 @@ UA_TYPE_METHOD_PROTOTYPES(UA_DiagnosticInfo)
 
 enum UA_DiagnosticInfoEncodingMaskType_enum
 {
-	// Some Values are called the same as previous 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_SymbolicId = 			0x01,
+	UA_DiagnosticInfoEncodingMaskType_Namespace = 			0x02,
+	UA_DiagnosticInfoEncodingMaskType_LocalizedText = 		0x04,
+	UA_DiagnosticInfoEncodingMaskType_Locale = 				0x08,
+	UA_DiagnosticInfoEncodingMaskType_AdditionalInfo = 		0x10,
+	UA_DiagnosticInfoEncodingMaskType_InnerStatusCode = 	0x20,
+	UA_DiagnosticInfoEncodingMaskType_InnerDiagnosticInfo = 0x40
 };
 
 #endif /* OPCUA_BASICTYPES_H_ */