Leon Urbas 11 years ago
parent
commit
af72881508

+ 13 - 8
include/opcua_basictypes.h

@@ -52,13 +52,14 @@ UA_Int32 UA_alloc(void ** dst, int size);
 
 /* Array operations */
 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);
+UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_Byte * dst);
+UA_Int32 UA_Array_decode(UA_Byte const * src,UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void const **dst);
+UA_Int32 UA_Array_delete(void **p,UA_Int32 noElements);
 
 #define UA_TYPE_METHOD_PROTOTYPES(TYPE) \
 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##_encode(TYPE const * src, UA_Int32* pos, UA_Byte * dst);\
+UA_Int32 TYPE##_decode(UA_Byte const * src, UA_Int32* pos, TYPE * dst);\
 UA_Int32 TYPE##_delete(TYPE * p);\
 UA_Int32 TYPE##_deleteMembers(TYPE * p); \
 UA_Int32 TYPE##_init(TYPE * p); \
@@ -92,12 +93,12 @@ UA_Int32 TYPE##_deleteMembers(TYPE * p) { return UA_SUCCESS; }
 UA_Int32 TYPE##_deleteMembers(TYPE * p) { return TYPE_AS##_deleteMembers((TYPE_AS*) p);}
 
 #define UA_TYPE_METHOD_DECODE_AS(TYPE,TYPE_AS) \
-UA_Int32 TYPE##_decode(char const * src, UA_Int32* pos, TYPE *dst) { \
+UA_Int32 TYPE##_decode(UA_Byte 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) \
-UA_Int32 TYPE##_encode(TYPE const * src, UA_Int32* pos, char *dst) { \
+UA_Int32 TYPE##_encode(TYPE const * src, UA_Int32* pos, UA_Byte *dst) { \
 	return TYPE_AS##_encode((TYPE_AS*) src,pos,dst); \
 }
 
@@ -156,8 +157,8 @@ UA_TYPE_METHOD_PROTOTYPES (UA_IntegerId)
 typedef struct T_UA_VTable {
 	UA_UInt32 Id;
 	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_Int32 (*decode)(UA_Byte const * src, UA_Int32* pos, void* dst);
+	UA_Int32 (*encode)(void const * src, UA_Int32* pos, UA_Byte* dst);
 } UA_VTable;
 
 /* VariantBinaryEncoding - Part: 6, Chapter: 5.2.2.16, Page: 22 */
@@ -177,6 +178,7 @@ typedef struct T_UA_String
 }
 UA_String;
 UA_TYPE_METHOD_PROTOTYPES (UA_String)
+UA_Int32 UA_String_copy(UA_String const * src, UA_String* dst);
 UA_Int32 UA_String_compare(UA_String *string1, UA_String *string2);
 void UA_String_printf(char* label, UA_String* string);
 void UA_String_printx(char* label, UA_String* string);
@@ -191,6 +193,7 @@ typedef struct T_UA_ByteString
 UA_ByteString;
 UA_TYPE_METHOD_PROTOTYPES (UA_ByteString)
 UA_Int32 UA_ByteString_compare(UA_ByteString *string1, UA_ByteString *string2);
+extern UA_String UA_String_securityPoliceNone;
 
 /** LocalizedTextBinaryEncoding - Part: 6, Chapter: 5.2.2.14, Page: 21 */
 typedef struct T_UA_LocalizedText
@@ -219,6 +222,7 @@ UA_Int32 UA_Guid_compare(UA_Guid *g1, UA_Guid *g2);
 /* DateTime - Part: 6, Chapter: 5.2.2.5, Page: 16 */
 typedef UA_Int64 UA_DateTime; //100 nanosecond resolution
 UA_TYPE_METHOD_PROTOTYPES (UA_DateTime)
+UA_DateTime UA_DateTime_now();
 
 typedef struct T_UA_NodeId
 {
@@ -236,6 +240,7 @@ typedef struct T_UA_NodeId
 } UA_NodeId;
 UA_TYPE_METHOD_PROTOTYPES (UA_NodeId)
 UA_Int32 UA_NodeId_compare(UA_NodeId *n1, UA_NodeId *n2);
+void UA_NodeId_printf(char* label, UA_NodeId* node);
 
 /** XmlElement - Part: 6, Chapter: 5.2.2.8, Page: 17 */
 typedef struct T_UA_XmlElement

+ 21 - 21
src/UA_stackInternalTypes.c

@@ -13,7 +13,7 @@ UA_Int32 UA_MessageType_calcSize(UA_MessageType const * ptr){
 	 + 3 * sizeof(UA_Byte);
 }
 
-UA_Int32 UA_MessageType_encode(UA_MessageType const * src, UA_Int32* pos, char* dst){
+UA_Int32 UA_MessageType_encode(UA_MessageType const * src, UA_Int32* pos, UA_Byte* dst){
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Byte tmpBuf[3];
 	tmpBuf[0] = (UA_Byte)((((UA_Int32)*src) >> 16) );
@@ -26,7 +26,7 @@ UA_Int32 UA_MessageType_encode(UA_MessageType const * src, UA_Int32* pos, char*
 	return retval;
 }
 
-UA_Int32 UA_MessageType_decode(char const * src, UA_Int32* pos, UA_MessageType* dst){
+UA_Int32 UA_MessageType_decode(UA_Byte const * src, UA_Int32* pos, UA_MessageType* dst){
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Byte tmpBuf[3];
 	retval |= UA_Byte_decode(src,pos,&(tmpBuf[0]));//messageType to Byte representation
@@ -47,7 +47,7 @@ UA_Int32 UA_OPCUATcpMessageHeader_calcSize(UA_OPCUATcpMessageHeader const * ptr)
 	;
 }
 
-UA_Int32 UA_OPCUATcpMessageHeader_encode(UA_OPCUATcpMessageHeader const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_OPCUATcpMessageHeader_encode(UA_OPCUATcpMessageHeader const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_MessageType_encode(&(src->messageType),pos,dst);
 	retval |= UA_Byte_encode(&(src->isFinal),pos,dst);
@@ -55,7 +55,7 @@ UA_Int32 UA_OPCUATcpMessageHeader_encode(UA_OPCUATcpMessageHeader const * src, U
 	return retval;
 }
 
-UA_Int32 UA_OPCUATcpMessageHeader_decode(char const * src, UA_Int32* pos, UA_OPCUATcpMessageHeader* dst) {
+UA_Int32 UA_OPCUATcpMessageHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpMessageHeader* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_MessageType_decode(src,pos,&(dst->messageType));
 	retval |= UA_Byte_decode(src,pos,&(dst->isFinal));
@@ -86,7 +86,7 @@ UA_Int32 UA_OPCUATcpHelloMessage_calcSize(UA_OPCUATcpHelloMessage const * ptr) {
 	;
 }
 
-UA_Int32 UA_OPCUATcpHelloMessage_encode(UA_OPCUATcpHelloMessage const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_OPCUATcpHelloMessage_encode(UA_OPCUATcpHelloMessage const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->protocolVersion),pos,dst);
 	retval |= UA_UInt32_encode(&(src->receiveBufferSize),pos,dst);
@@ -97,7 +97,7 @@ UA_Int32 UA_OPCUATcpHelloMessage_encode(UA_OPCUATcpHelloMessage const * src, UA_
 	return retval;
 }
 
-UA_Int32 UA_OPCUATcpHelloMessage_decode(char const * src, UA_Int32* pos, UA_OPCUATcpHelloMessage* dst) {
+UA_Int32 UA_OPCUATcpHelloMessage_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpHelloMessage* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->protocolVersion));
 	retval |= UA_UInt32_decode(src,pos,&(dst->receiveBufferSize));
@@ -131,7 +131,7 @@ UA_Int32 UA_OPCUATcpAcknowledgeMessage_calcSize(UA_OPCUATcpAcknowledgeMessage co
 	;
 }
 
-UA_Int32 UA_OPCUATcpAcknowledgeMessage_encode(UA_OPCUATcpAcknowledgeMessage const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_OPCUATcpAcknowledgeMessage_encode(UA_OPCUATcpAcknowledgeMessage const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->protocolVersion),pos,dst);
 	retval |= UA_UInt32_encode(&(src->receiveBufferSize),pos,dst);
@@ -141,7 +141,7 @@ UA_Int32 UA_OPCUATcpAcknowledgeMessage_encode(UA_OPCUATcpAcknowledgeMessage cons
 	return retval;
 }
 
-UA_Int32 UA_OPCUATcpAcknowledgeMessage_decode(char const * src, UA_Int32* pos, UA_OPCUATcpAcknowledgeMessage* dst) {
+UA_Int32 UA_OPCUATcpAcknowledgeMessage_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpAcknowledgeMessage* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->protocolVersion));
 	retval |= UA_UInt32_decode(src,pos,&(dst->receiveBufferSize));
@@ -170,14 +170,14 @@ UA_Int32 UA_SecureConversationMessageHeader_calcSize(UA_SecureConversationMessag
 	;
 }
 
-UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_OPCUATcpMessageHeader_encode(src->tcpMessageHeader,pos,dst);
 	retval |= UA_UInt32_encode(&(src->secureChannelId),pos,dst);
 	return retval;
 }
 
-UA_Int32 UA_SecureConversationMessageHeader_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst) {
+UA_Int32 UA_SecureConversationMessageHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_alloc((void**)&(dst->tcpMessageHeader),UA_OPCUATcpMessageHeader_calcSize(UA_NULL));
 	retval |= UA_OPCUATcpMessageHeader_decode(src,pos,dst->tcpMessageHeader);
@@ -208,7 +208,7 @@ UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_calcSize(UA_AsymmetricAlgorithmSec
 	;
 }
 
-UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encode(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encode(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_ByteString_encode(&(src->securityPolicyUri),pos,dst);
 	retval |= UA_ByteString_encode(&(src->senderCertificate),pos,dst);
@@ -217,7 +217,7 @@ UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encode(UA_AsymmetricAlgorithmSecur
 	return retval;
 }
 
-UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decode(char const * src, UA_Int32* pos, UA_AsymmetricAlgorithmSecurityHeader* dst) {
+UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_AsymmetricAlgorithmSecurityHeader* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_ByteString_decode(src,pos,&(dst->securityPolicyUri));
 	retval |= UA_ByteString_decode(src,pos,&(dst->senderCertificate));
@@ -247,13 +247,13 @@ UA_Int32 UA_SymmetricAlgorithmSecurityHeader_calcSize(UA_SymmetricAlgorithmSecur
 	;
 }
 
-UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encode(UA_SymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encode(UA_SymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->tokenId),pos,dst);
 	return retval;
 }
 
-UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decode(char const * src, UA_Int32* pos, UA_SymmetricAlgorithmSecurityHeader* dst) {
+UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SymmetricAlgorithmSecurityHeader* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->tokenId));
 	return retval;
@@ -278,14 +278,14 @@ UA_Int32 UA_SequenceHeader_calcSize(UA_SequenceHeader const * ptr) {
 	;
 }
 
-UA_Int32 UA_SequenceHeader_encode(UA_SequenceHeader const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_SequenceHeader_encode(UA_SequenceHeader const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->sequenceNumber),pos,dst);
 	retval |= UA_UInt32_encode(&(src->requestId),pos,dst);
 	return retval;
 }
 
-UA_Int32 UA_SequenceHeader_decode(char const * src, UA_Int32* pos, UA_SequenceHeader* dst) {
+UA_Int32 UA_SequenceHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SequenceHeader* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->sequenceNumber));
 	retval |= UA_UInt32_decode(src,pos,&(dst->requestId));
@@ -312,7 +312,7 @@ UA_Int32 UA_SecureConversationMessageFooter_calcSize(UA_SecureConversationMessag
 	;
 }
 
-UA_Int32 UA_SecureConversationMessageFooter_encode(UA_SecureConversationMessageFooter const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_SecureConversationMessageFooter_encode(UA_SecureConversationMessageFooter const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Int32_encode(&(src->paddingSize),pos,dst); // encode size
 	retval |= UA_Array_encode((void const**) (src->padding),src->paddingSize, UA_BYTE,pos,dst);
@@ -320,7 +320,7 @@ UA_Int32 UA_SecureConversationMessageFooter_encode(UA_SecureConversationMessageF
 	return retval;
 }
 
-UA_Int32 UA_SecureConversationMessageFooter_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageFooter* dst) {
+UA_Int32 UA_SecureConversationMessageFooter_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageFooter* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Int32_decode(src,pos,&(dst->paddingSize)); // decode size
 	retval |= UA_alloc((void**)&(dst->padding),dst->paddingSize*sizeof(void*));
@@ -337,7 +337,7 @@ UA_Int32 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageF
     }
 UA_Int32 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter* p) {
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_Array_delete(p->padding,p->paddingSize);
+	retval |= UA_Array_delete((void**)p->padding,p->paddingSize);
 	return retval;
 }
 
@@ -349,14 +349,14 @@ UA_Int32 UA_SecureConversationMessageAbortBody_calcSize(UA_SecureConversationMes
 	;
 }
 
-UA_Int32 UA_SecureConversationMessageAbortBody_encode(UA_SecureConversationMessageAbortBody const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_SecureConversationMessageAbortBody_encode(UA_SecureConversationMessageAbortBody const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->error),pos,dst);
 	retval |= UA_String_encode(&(src->reason),pos,dst);
 	return retval;
 }
 
-UA_Int32 UA_SecureConversationMessageAbortBody_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageAbortBody* dst) {
+UA_Int32 UA_SecureConversationMessageAbortBody_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageAbortBody* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->error));
 	retval |= UA_String_decode(src,pos,&(dst->reason));

+ 20 - 20
src/UA_stackInternalTypes.h

@@ -41,8 +41,8 @@ UA_TYPE_METHOD_PROTOTYPES(UA_SL_Response)
 /* MessageType */
 typedef UA_Int32 UA_MessageType;
 UA_Int32 UA_MessageType_calcSize(UA_MessageType const * ptr);
-UA_Int32 UA_MessageType_encode(UA_MessageType const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_MessageType_decode(char const * src, UA_Int32* pos, UA_MessageType* dst);
+UA_Int32 UA_MessageType_encode(UA_MessageType const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_MessageType_decode(UA_Byte const * src, UA_Int32* pos, UA_MessageType* dst);
 UA_Int32 UA_MessageType_delete(UA_MessageType* p);
 UA_Int32 UA_MessageType_deleteMembers(UA_MessageType* p);
 
@@ -55,8 +55,8 @@ typedef struct T_UA_OPCUATcpMessageHeader {
 	UA_UInt32 messageSize;
 } UA_OPCUATcpMessageHeader;
 UA_Int32 UA_OPCUATcpMessageHeader_calcSize(UA_OPCUATcpMessageHeader const * ptr);
-UA_Int32 UA_OPCUATcpMessageHeader_encode(UA_OPCUATcpMessageHeader const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_OPCUATcpMessageHeader_decode(char const * src, UA_Int32* pos, UA_OPCUATcpMessageHeader* dst);
+UA_Int32 UA_OPCUATcpMessageHeader_encode(UA_OPCUATcpMessageHeader const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_OPCUATcpMessageHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpMessageHeader* dst);
 UA_Int32 UA_OPCUATcpMessageHeader_delete(UA_OPCUATcpMessageHeader* p);
 UA_Int32 UA_OPCUATcpMessageHeader_deleteMembers(UA_OPCUATcpMessageHeader* p);
 
@@ -71,8 +71,8 @@ typedef struct T_UA_OPCUATcpHelloMessage {
 	UA_String endpointUrl;
 } UA_OPCUATcpHelloMessage;
 UA_Int32 UA_OPCUATcpHelloMessage_calcSize(UA_OPCUATcpHelloMessage const * ptr);
-UA_Int32 UA_OPCUATcpHelloMessage_encode(UA_OPCUATcpHelloMessage const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_OPCUATcpHelloMessage_decode(char const * src, UA_Int32* pos, UA_OPCUATcpHelloMessage* dst);
+UA_Int32 UA_OPCUATcpHelloMessage_encode(UA_OPCUATcpHelloMessage const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_OPCUATcpHelloMessage_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpHelloMessage* dst);
 UA_Int32 UA_OPCUATcpHelloMessage_delete(UA_OPCUATcpHelloMessage* p);
 UA_Int32 UA_OPCUATcpHelloMessage_deleteMembers(UA_OPCUATcpHelloMessage* p);
 
@@ -86,8 +86,8 @@ typedef struct T_UA_OPCUATcpAcknowledgeMessage {
 	UA_UInt32 maxChunkCount;
 } UA_OPCUATcpAcknowledgeMessage;
 UA_Int32 UA_OPCUATcpAcknowledgeMessage_calcSize(UA_OPCUATcpAcknowledgeMessage const * ptr);
-UA_Int32 UA_OPCUATcpAcknowledgeMessage_encode(UA_OPCUATcpAcknowledgeMessage const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_OPCUATcpAcknowledgeMessage_decode(char const * src, UA_Int32* pos, UA_OPCUATcpAcknowledgeMessage* dst);
+UA_Int32 UA_OPCUATcpAcknowledgeMessage_encode(UA_OPCUATcpAcknowledgeMessage const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_OPCUATcpAcknowledgeMessage_decode(UA_Byte const * src, UA_Int32* pos, UA_OPCUATcpAcknowledgeMessage* dst);
 UA_Int32 UA_OPCUATcpAcknowledgeMessage_delete(UA_OPCUATcpAcknowledgeMessage* p);
 UA_Int32 UA_OPCUATcpAcknowledgeMessage_deleteMembers(UA_OPCUATcpAcknowledgeMessage* p);
 
@@ -98,8 +98,8 @@ typedef struct T_UA_SecureConversationMessageHeader {
 	UA_UInt32 secureChannelId;
 } UA_SecureConversationMessageHeader;
 UA_Int32 UA_SecureConversationMessageHeader_calcSize(UA_SecureConversationMessageHeader const * ptr);
-UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_SecureConversationMessageHeader_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst);
+UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_SecureConversationMessageHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst);
 UA_Int32 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader* p);
 UA_Int32 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader* p);
 
@@ -112,8 +112,8 @@ typedef struct T_UA_AsymmetricAlgorithmSecurityHeader {
 	// UA_UInt32 requestId;
 } UA_AsymmetricAlgorithmSecurityHeader;
 UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_calcSize(UA_AsymmetricAlgorithmSecurityHeader const * ptr);
-UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encode(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decode(char const * src, UA_Int32* pos, UA_AsymmetricAlgorithmSecurityHeader* dst);
+UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encode(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_AsymmetricAlgorithmSecurityHeader* dst);
 UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader* p);
 UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader* p);
 
@@ -123,8 +123,8 @@ typedef struct T_UA_SymmetricAlgorithmSecurityHeader {
 	UA_UInt32 tokenId;
 } UA_SymmetricAlgorithmSecurityHeader;
 UA_Int32 UA_SymmetricAlgorithmSecurityHeader_calcSize(UA_SymmetricAlgorithmSecurityHeader const * ptr);
-UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encode(UA_SymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decode(char const * src, UA_Int32* pos, UA_SymmetricAlgorithmSecurityHeader* dst);
+UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encode(UA_SymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SymmetricAlgorithmSecurityHeader* dst);
 UA_Int32 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader* p);
 UA_Int32 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader* p);
 
@@ -135,8 +135,8 @@ typedef struct T_UA_SequenceHeader {
 	UA_UInt32 requestId;
 } UA_SequenceHeader;
 UA_Int32 UA_SequenceHeader_calcSize(UA_SequenceHeader const * ptr);
-UA_Int32 UA_SequenceHeader_encode(UA_SequenceHeader const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_SequenceHeader_decode(char const * src, UA_Int32* pos, UA_SequenceHeader* dst);
+UA_Int32 UA_SequenceHeader_encode(UA_SequenceHeader const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_SequenceHeader_decode(UA_Byte const * src, UA_Int32* pos, UA_SequenceHeader* dst);
 UA_Int32 UA_SequenceHeader_delete(UA_SequenceHeader* p);
 UA_Int32 UA_SequenceHeader_deleteMembers(UA_SequenceHeader* p);
 
@@ -148,8 +148,8 @@ typedef struct T_UA_SecureConversationMessageFooter {
 	UA_Byte signature;
 } UA_SecureConversationMessageFooter;
 UA_Int32 UA_SecureConversationMessageFooter_calcSize(UA_SecureConversationMessageFooter const * ptr);
-UA_Int32 UA_SecureConversationMessageFooter_encode(UA_SecureConversationMessageFooter const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_SecureConversationMessageFooter_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageFooter* dst);
+UA_Int32 UA_SecureConversationMessageFooter_encode(UA_SecureConversationMessageFooter const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_SecureConversationMessageFooter_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageFooter* dst);
 UA_Int32 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter* p);
 UA_Int32 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter* p);
 
@@ -160,8 +160,8 @@ typedef struct T_UA_SecureConversationMessageAbortBody {
 	UA_String reason;
 } UA_SecureConversationMessageAbortBody;
 UA_Int32 UA_SecureConversationMessageAbortBody_calcSize(UA_SecureConversationMessageAbortBody const * ptr);
-UA_Int32 UA_SecureConversationMessageAbortBody_encode(UA_SecureConversationMessageAbortBody const * src, UA_Int32* pos, char* dst);
-UA_Int32 UA_SecureConversationMessageAbortBody_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageAbortBody* dst);
+UA_Int32 UA_SecureConversationMessageAbortBody_encode(UA_SecureConversationMessageAbortBody const * src, UA_Int32* pos, UA_Byte* dst);
+UA_Int32 UA_SecureConversationMessageAbortBody_decode(UA_Byte const * src, UA_Int32* pos, UA_SecureConversationMessageAbortBody* dst);
 UA_Int32 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody* p);
 UA_Int32 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody* p);
 

+ 46 - 46
src/opcua_basictypes.c

@@ -11,11 +11,11 @@
 #include "opcua_basictypes.h"
 
 
-UA_Int32 UA_encode(void* const data, UA_Int32 *pos, UA_Int32 type, char* dst) {
+UA_Int32 UA_encode(void* const data, UA_Int32 *pos, UA_Int32 type, UA_Byte* dst) {
 	return UA_[type].encode(data,pos,dst);
 }
 
-UA_Int32 UA_decode(char* const data, UA_Int32* pos, UA_Int32 type, void* dst){
+UA_Int32 UA_decode(UA_Byte* const data, UA_Int32* pos, UA_Int32 type, void* dst){
 	return UA_[type].decode(data,pos,dst);
 }
 
@@ -37,7 +37,7 @@ UA_Int32 UA_Array_calcSize(UA_Int32 nElements, UA_Int32 type, void const ** data
 	}
 	return length;
 }
-UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, char * dst) {
+UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_Byte * dst) {
 	UA_Int32 retVal = UA_SUCCESS;
 	UA_Int32 i = 0;
 
@@ -49,7 +49,7 @@ UA_Int32 UA_Array_encode(void const **src, UA_Int32 noElements, UA_Int32 type, U
 	return retVal;
 }
 
-UA_Int32 UA_Array_decode(char const * src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void const **dst) {
+UA_Int32 UA_Array_decode(UA_Byte const * src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void const **dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 i = 0;
 
@@ -99,12 +99,12 @@ UA_Int32 UA_memcpy(void * dst, void const * src, int size){
 
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Boolean)
-UA_Int32 UA_Boolean_encode(UA_Boolean const * src, UA_Int32* pos, char * dst) {
+UA_Int32 UA_Boolean_encode(UA_Boolean const * src, UA_Int32* pos, UA_Byte * dst) {
 	UA_Boolean tmpBool = ((*src > 0) ? UA_TRUE : UA_FALSE);
 	memcpy(&(dst[(*pos)++]), &tmpBool, sizeof(UA_Boolean));
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Boolean_decode(char const * src, UA_Int32* pos, UA_Boolean * dst) {
+UA_Int32 UA_Boolean_decode(UA_Byte const * src, UA_Int32* pos, UA_Boolean * dst) {
 	*dst = ((UA_Boolean) (src[(*pos)++]) > 0) ? UA_TRUE : UA_FALSE;
 	return UA_SUCCESS;
 }
@@ -119,11 +119,11 @@ UA_TYPE_METHOD_NEW_DEFAULT(UA_Boolean)
 
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Byte)
-UA_Int32 UA_Byte_encode(UA_Byte const * src, UA_Int32* pos, char * dst) {
+UA_Int32 UA_Byte_encode(UA_Byte const * src, UA_Int32* pos, UA_Byte * dst) {
 	dst[(*pos)++] = *src;
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Byte_decode(char const * src, UA_Int32* pos, UA_Byte * dst) {
+UA_Int32 UA_Byte_decode(UA_Byte const * src, UA_Int32* pos, UA_Byte * dst) {
 	*dst = src[(*pos)++];
 	return UA_SUCCESS;
 }
@@ -133,11 +133,11 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_Byte)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_Byte)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_SByte)
-UA_Int32 UA_SByte_encode(UA_SByte const * src, UA_Int32* pos, char * dst) {
+UA_Int32 UA_SByte_encode(UA_SByte const * src, UA_Int32* pos, UA_Byte * dst) {
 	dst[(*pos)++] = *src;
 	return UA_SUCCESS;
 }
-UA_Int32 UA_SByte_decode(char const * src, UA_Int32* pos, UA_SByte * dst) {
+UA_Int32 UA_SByte_decode(UA_Byte const * src, UA_Int32* pos, UA_SByte * dst) {
 	*dst = src[(*pos)++];
 	return 1;
 }
@@ -147,12 +147,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_SByte)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_SByte)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt16)
-UA_Int32 UA_UInt16_encode(UA_UInt16 const *src, UA_Int32* pos, char * dst) {
+UA_Int32 UA_UInt16_encode(UA_UInt16 const *src, UA_Int32* pos, UA_Byte * dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt16));
 	*pos += sizeof(UA_UInt16);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_UInt16_decode(char const * src, UA_Int32* pos, UA_UInt16* dst) {
+UA_Int32 UA_UInt16_decode(UA_Byte const * src, UA_Int32* pos, UA_UInt16* dst) {
 	UA_Byte t1 = src[(*pos)++];
 	UA_UInt16 t2 = (UA_UInt16) (src[(*pos)++] << 8);
 	*dst = t1 + t2;
@@ -164,12 +164,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_UInt16)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_UInt16)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int16)
-UA_Int32 UA_Int16_encode(UA_Int16 const * src, UA_Int32* pos, char* dst) {
+UA_Int32 UA_Int16_encode(UA_Int16 const * src, UA_Int32* pos, UA_Byte* dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int16));
 	*pos += sizeof(UA_Int16);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Int16_decode(char const * src, UA_Int32* pos, UA_Int16 *dst) {
+UA_Int32 UA_Int16_decode(UA_Byte const * src, UA_Int32* pos, UA_Int16 *dst) {
 	UA_Int16 t1 = (UA_Int16) (((UA_SByte) (src[(*pos)++]) & 0xFF));
 	UA_Int16 t2 = (UA_Int16) (((UA_SByte) (src[(*pos)++]) & 0xFF) << 8);
 	*dst = t1 + t2;
@@ -181,12 +181,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_Int16)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_Int16)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int32)
-UA_Int32 UA_Int32_encode(UA_Int32 const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_Int32_encode(UA_Int32 const * src, UA_Int32* pos, UA_Byte* dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int32));
 	*pos += sizeof(UA_Int32);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Int32_decode(char const * src, UA_Int32* pos, UA_Int32* dst) {
+UA_Int32 UA_Int32_decode(UA_Byte const * src, UA_Int32* pos, UA_Int32* dst) {
 	UA_Int32 t1 = (UA_Int32) (((UA_SByte) (src[(*pos)++]) & 0xFF));
 	UA_Int32 t2 = (UA_Int32) (((UA_SByte) (src[(*pos)++]) & 0xFF) << 8);
 	UA_Int32 t3 = (UA_Int32) (((UA_SByte) (src[(*pos)++]) & 0xFF) << 16);
@@ -200,12 +200,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_Int32)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_Int32)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt32)
-UA_Int32 UA_UInt32_encode(UA_UInt32 const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_UInt32_encode(UA_UInt32 const * src, UA_Int32* pos, UA_Byte* dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt32));
 	*pos += sizeof(UA_UInt32);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_UInt32_decode(char const * src, UA_Int32* pos, UA_UInt32 *dst) {
+UA_Int32 UA_UInt32_decode(UA_Byte const * src, UA_Int32* pos, UA_UInt32 *dst) {
 	UA_UInt32 t1 = (UA_UInt32)((UA_Byte)(src[(*pos)++] & 0xFF));
 	UA_UInt32 t2 = (UA_UInt32)((UA_Byte)(src[(*pos)++]& 0xFF) << 8);
 	UA_UInt32 t3 = (UA_UInt32)((UA_Byte)(src[(*pos)++]& 0xFF) << 16);
@@ -219,12 +219,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_UInt32)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_UInt32)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Int64)
-UA_Int32 UA_Int64_encode(UA_Int64 const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_Int64_encode(UA_Int64 const * src, UA_Int32* pos, UA_Byte *dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_Int64));
 	*pos += sizeof(UA_Int64);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Int64_decode(char const * src, UA_Int32* pos, UA_Int64* dst) {
+UA_Int32 UA_Int64_decode(UA_Byte const * src, UA_Int32* pos, UA_Int64* dst) {
 	UA_Int64 t1 = (UA_Int64) src[(*pos)++];
 	UA_Int64 t2 = (UA_Int64) src[(*pos)++] << 8;
 	UA_Int64 t3 = (UA_Int64) src[(*pos)++] << 16;
@@ -242,12 +242,12 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_Int64)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_Int64)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_UInt64)
-UA_Int32 UA_UInt64_encode(UA_UInt64 const * src , UA_Int32* pos, char * dst) {
+UA_Int32 UA_UInt64_encode(UA_UInt64 const * src , UA_Int32* pos, UA_Byte * dst) {
 	memcpy(&(dst[*pos]), src, sizeof(UA_UInt64));
 	*pos += sizeof(UA_UInt64);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_UInt64_decode(char const * src, UA_Int32* pos, UA_UInt64* dst) {
+UA_Int32 UA_UInt64_decode(UA_Byte const * src, UA_Int32* pos, UA_UInt64* dst) {
 	UA_UInt64 t1 = (UA_UInt64) src[(*pos)++];
 	UA_UInt64 t2 = (UA_UInt64) src[(*pos)++] << 8;
 	UA_UInt64 t3 = (UA_UInt64) src[(*pos)++] << 16;
@@ -265,13 +265,13 @@ UA_TYPE_METHOD_INIT_DEFAULT(UA_UInt64)
 UA_TYPE_METHOD_NEW_DEFAULT(UA_UInt64)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Float)
-UA_Int32 UA_Float_decode(char const * src, UA_Int32* pos, UA_Float* dst) {
+UA_Int32 UA_Float_decode(UA_Byte 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;
 }
-UA_Int32 UA_Float_encode(UA_Float const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_Float_encode(UA_Float const * src, UA_Int32* pos, UA_Byte* dst) {
 	// TODO: not yet implemented
 	memcpy(&(dst[*pos]), src, sizeof(UA_Float));
 	*pos += sizeof(UA_Float);
@@ -287,7 +287,7 @@ UA_Int32 UA_Float_init(UA_Float * p){
 UA_TYPE_METHOD_NEW_DEFAULT(UA_Float)
 
 UA_TYPE_METHOD_CALCSIZE_SIZEOF(UA_Double)
-UA_Int32 UA_Double_decode(char const * src, UA_Int32* pos, UA_Double * dst) {
+UA_Int32 UA_Double_decode(UA_Byte const * src, UA_Int32* pos, UA_Double * dst) {
 	// TODO: not yet implemented
 	UA_Double tmpDouble;
 	tmpDouble = (UA_Double) (src[*pos]);
@@ -295,7 +295,7 @@ UA_Int32 UA_Double_decode(char const * src, UA_Int32* pos, UA_Double * dst) {
 	*dst = tmpDouble;
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Double_encode(UA_Double const * src, UA_Int32 *pos, char * dst) {
+UA_Int32 UA_Double_encode(UA_Double const * src, UA_Int32 *pos, UA_Byte* dst) {
 	// TODO: not yet implemented
 	memcpy(&(dst[*pos]), src, sizeof(UA_Double));
 	*pos *= sizeof(UA_Double);
@@ -319,7 +319,7 @@ UA_Int32 UA_String_calcSize(UA_String const * string) {
 		}
 	}
 }
-UA_Int32 UA_String_encode(UA_String const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_String_encode(UA_String const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32_encode(&(src->length),pos,dst);
 
 	if (src->length > 0) {
@@ -328,7 +328,7 @@ UA_Int32 UA_String_encode(UA_String const * src, UA_Int32* pos, char *dst) {
 	}
 	return UA_SUCCESS;
 }
-UA_Int32 UA_String_decode(char const * src, UA_Int32* pos, UA_String * dst) {
+UA_Int32 UA_String_decode(UA_Byte 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) {
@@ -448,7 +448,7 @@ UA_Int32 UA_Guid_calcSize(UA_Guid const * p) {
 		;
 	}
 }
-UA_Int32 UA_Guid_encode(UA_Guid const *src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_Guid_encode(UA_Guid const *src, UA_Int32* pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_encode(&(src->data1), pos, dst);
 	retval |= UA_UInt16_encode(&(src->data2), pos, dst);
@@ -456,7 +456,7 @@ UA_Int32 UA_Guid_encode(UA_Guid const *src, UA_Int32* pos, char *dst) {
 	retval |= UA_ByteString_encode(&(src->data4), pos, dst);
 	return UA_SUCCESS;
 }
-UA_Int32 UA_Guid_decode(char const * src, UA_Int32* pos, UA_Guid *dst) {
+UA_Int32 UA_Guid_decode(UA_Byte const * src, UA_Int32* pos, UA_Guid *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt32_decode(src,pos,&(dst->data1));
 	retval |= UA_UInt16_decode(src,pos,&(dst->data2));
@@ -497,7 +497,7 @@ UA_Int32 UA_LocalizedText_calcSize(UA_LocalizedText const * p) {
 	return length;
 }
 UA_Int32 UA_LocalizedText_encode(UA_LocalizedText const * src, UA_Int32 *pos,
-		char * dst) {
+		UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_encode(&(src->encodingMask),pos,dst);
 	if (src->encodingMask & 0x01) {
@@ -508,7 +508,7 @@ UA_Int32 UA_LocalizedText_encode(UA_LocalizedText const * src, UA_Int32 *pos,
 	}
 	return retval;
 }
-UA_Int32 UA_LocalizedText_decode(char const * src, UA_Int32 *pos,
+UA_Int32 UA_LocalizedText_decode(UA_Byte const * src, UA_Int32 *pos,
 		UA_LocalizedText *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_String_copy(&UA_String_null,&(dst->locale));
@@ -570,7 +570,7 @@ UA_Int32 UA_NodeId_calcSize(UA_NodeId const *p) {
 	}
 	return length;
 }
-UA_Int32 UA_NodeId_encode(UA_NodeId const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_NodeId_encode(UA_NodeId const * src, UA_Int32* pos, UA_Byte* dst) {
 	// temporary variables for endian-save code
 	UA_Byte srcByte;
 	UA_UInt16 srcUInt16;
@@ -607,7 +607,7 @@ UA_Int32 UA_NodeId_encode(UA_NodeId const * src, UA_Int32* pos, char *dst) {
 	}
 	return retval;
 }
-UA_Int32 UA_NodeId_decode(char const * src, UA_Int32* pos, UA_NodeId *dst) {
+UA_Int32 UA_NodeId_decode(UA_Byte const * src, UA_Int32* pos, UA_NodeId *dst) {
 	int retval = UA_SUCCESS;
 	// temporary variables to overcome decoder's non-endian-saveness for datatypes
 	UA_Byte   dstByte;
@@ -755,7 +755,7 @@ UA_Int32 UA_ExpandedNodeId_calcSize(UA_ExpandedNodeId const * p) {
 	}
 	return length;
 }
-UA_Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, UA_Int32* pos, UA_Byte* dst) {
 	UA_UInt32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_encode(&(src->nodeId),pos,dst);
 	if (src->nodeId.encodingByte & NIEVT_NAMESPACE_URI_FLAG) {
@@ -766,7 +766,7 @@ UA_Int32 UA_ExpandedNodeId_encode(UA_ExpandedNodeId const * src, UA_Int32* pos,
 	}
 	return retval;
 }
-UA_Int32 UA_ExpandedNodeId_decode(char const * src, UA_Int32* pos,
+UA_Int32 UA_ExpandedNodeId_decode(UA_Byte const * src, UA_Int32* pos,
 		UA_ExpandedNodeId *dst) {
 	UA_UInt32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_decode(src,pos,&(dst->nodeId));
@@ -815,7 +815,7 @@ UA_Int32 UA_ExtensionObject_calcSize(UA_ExtensionObject const * p) {
 	}
 	return length;
 }
-UA_Int32 UA_ExtensionObject_encode(UA_ExtensionObject const *src, UA_Int32* pos, char * dst) {
+UA_Int32 UA_ExtensionObject_encode(UA_ExtensionObject const *src, UA_Int32* pos, UA_Byte * dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_NodeId_encode(&(src->typeId),pos,dst);
 	retval |= UA_Byte_encode(&(src->encoding),pos,dst);
@@ -829,7 +829,7 @@ UA_Int32 UA_ExtensionObject_encode(UA_ExtensionObject const *src, UA_Int32* pos,
 	}
 	return retval;
 }
-UA_Int32 UA_ExtensionObject_decode(char const * src, UA_Int32 *pos,
+UA_Int32 UA_ExtensionObject_decode(UA_Byte const * src, UA_Int32 *pos,
 		UA_ExtensionObject *dst) {
 	UA_Int32 retval = UA_SUCCESS;
  	retval |= UA_NodeId_decode(src,pos,&(dst->typeId));
@@ -864,7 +864,7 @@ UA_TYPE_METHOD_NEW_DEFAULT(UA_ExtensionObject)
 
 
 /** DiagnosticInfo - Part: 4, Chapter: 7.9, Page: 116 */
-UA_Int32 UA_DiagnosticInfo_decode(char const * src, UA_Int32 *pos, UA_DiagnosticInfo *dst) {
+UA_Int32 UA_DiagnosticInfo_decode(UA_Byte const * src, UA_Int32 *pos, UA_DiagnosticInfo *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	int i;
 
@@ -900,7 +900,7 @@ UA_Int32 UA_DiagnosticInfo_decode(char const * src, UA_Int32 *pos, UA_Diagnostic
 	}
 	return retval;
 }
-UA_Int32 UA_DiagnosticInfo_encode(UA_DiagnosticInfo const *src, UA_Int32 *pos, char *dst) {
+UA_Int32 UA_DiagnosticInfo_encode(UA_DiagnosticInfo const *src, UA_Int32 *pos, UA_Byte* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	int i;
 
@@ -1052,7 +1052,7 @@ UA_Int32 UA_QualifiedName_calcSize(UA_QualifiedName const * p) {
 	length += UA_String_calcSize(&(p->name)); //qualifiedName->name
 	return length;
 }
-UA_Int32 UA_QualifiedName_decode(char const * src, UA_Int32 *pos,
+UA_Int32 UA_QualifiedName_decode(UA_Byte const * src, UA_Int32 *pos,
 		UA_QualifiedName *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt16_decode(src,pos,&(dst->namespaceIndex));
@@ -1061,7 +1061,7 @@ UA_Int32 UA_QualifiedName_decode(char const * src, UA_Int32 *pos,
 	return retval;
 }
 UA_Int32 UA_QualifiedName_encode(UA_QualifiedName const *src, UA_Int32* pos,
-		char *dst) {
+		UA_Byte *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_UInt16_encode(&(src->namespaceIndex),pos,dst);
 	retval |= UA_UInt16_encode(&(src->reserved),pos,dst);
@@ -1115,7 +1115,7 @@ UA_Int32 UA_Variant_calcSize(UA_Variant const * p) {
 	}
 	return length;
 }
-UA_Int32 UA_Variant_encode(UA_Variant const *src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_Variant_encode(UA_Variant const *src, UA_Int32* pos, UA_Byte *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	int i = 0;
 
@@ -1141,7 +1141,7 @@ UA_Int32 UA_Variant_encode(UA_Variant const *src, UA_Int32* pos, char *dst) {
 	return retval;
 }
 
-UA_Int32 UA_Variant_decode(char const * src, UA_Int32 *pos, UA_Variant *dst) {
+UA_Int32 UA_Variant_decode(UA_Byte const * src, UA_Int32 *pos, UA_Variant *dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 ns0Id;
 	int i;
@@ -1202,7 +1202,7 @@ UA_TYPE_METHOD_NEW_DEFAULT(UA_Variant)
 
 //TODO: place this define at the server configuration
 #define MAX_PICO_SECONDS 1000
-UA_Int32 UA_DataValue_decode(char const * src, UA_Int32* pos, UA_DataValue* dst) {
+UA_Int32 UA_DataValue_decode(UA_Byte const * src, UA_Int32* pos, UA_DataValue* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_decode(src,pos,&(dst->encodingMask));
 	if (dst->encodingMask & UA_DATAVALUE_VARIANT) {
@@ -1231,7 +1231,7 @@ UA_Int32 UA_DataValue_decode(char const * src, UA_Int32* pos, UA_DataValue* dst)
 	}
 	return retval;
 }
-UA_Int32 UA_DataValue_encode(UA_DataValue const * src, UA_Int32* pos, char *dst) {
+UA_Int32 UA_DataValue_encode(UA_DataValue const * src, UA_Int32* pos, UA_Byte*dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	retval |= UA_Byte_encode(&(src->encodingMask),pos,dst);
 	if (src->encodingMask & UA_DATAVALUE_VARIANT) {

+ 8 - 17
src/opcua_secureLayer.c

@@ -20,17 +20,10 @@ UA_Int32 SL_initConnectionObject(UA_connection *connection)
 {
 
 	//TODO: fill with valid information
-	connection->secureLayer.localAsymAlgSettings.ReceiverCertificateThumbprint.data = NULL;
-	connection->secureLayer.localAsymAlgSettings.ReceiverCertificateThumbprint.length = 0;
-
-	connection->secureLayer.localAsymAlgSettings.SecurityPolicyUri.data = "http://opcfoundation.org/UA/SecurityPolicy#None";
-	connection->secureLayer.localAsymAlgSettings.SecurityPolicyUri.length = 47;
-
-	connection->secureLayer.localAsymAlgSettings.SenderCertificate.data = NULL;
-	connection->secureLayer.localAsymAlgSettings.SenderCertificate.length = 0;
-
-	connection->secureLayer.remoteNonce.data = NULL;
-	connection->secureLayer.remoteNonce.length = 0;
+	UA_ByteString_init(&(connection->secureLayer.localAsymAlgSettings.ReceiverCertificateThumbprint));
+	UA_ByteString_copy(&(connection->secureLayer.localAsymAlgSettings.SecurityPolicyUri), UA_String_securityPoliceNone);
+	UA_ByteString_init(&(connection->secureLayer.localAsymAlgSettings.SenderCertificate));
+	UA_ByteString_init(&(connection->secureLayer.remoteNonce));
 
 	UA_alloc((void**)&(connection->secureLayer.localNonce.data),sizeof(UA_Byte));
 	connection->secureLayer.localNonce.length = 1;
@@ -38,11 +31,9 @@ UA_Int32 SL_initConnectionObject(UA_connection *connection)
 	connection->secureLayer.connectionState = connectionState_CLOSED;
 
 	connection->secureLayer.requestId = 0;
-
 	connection->secureLayer.requestType = 0;
 
-	connection->secureLayer.secureChannelId.data = NULL;
-	connection->secureLayer.secureChannelId.length = 0;
+	UA_String_init(&(connection->secureLayer.secureChannelId));
 
 	connection->secureLayer.securityMode = UA_SECURITYMODE_INVALID;
 	//TODO set a valid start secureChannelId number
@@ -106,7 +97,7 @@ UA_Int32 SL_send(UA_connection *connection, UA_ByteString responseMessage, UA_In
 		responsePacket.data[3] = 'F';
 		pos += 1;
 		UA_Int32_encode(&packetSize,&pos,responsePacket.data);
-		UA_Int32_encode(&(connection->secureLayer.securityToken.secureChannelId),&pos,responsePacket.data);
+		UA_UInt32_encode(&(connection->secureLayer.securityToken.secureChannelId),&pos,responsePacket.data);
 
 		/*---encode Asymmetric Algorithm Header ---*/
 		UA_ByteString_encode(&(connection->secureLayer.localAsymAlgSettings.SecurityPolicyUri),
@@ -281,7 +272,7 @@ UA_Int32 SL_openSecureChannel(UA_connection *connection,
 	printf("SL_openSecureChannel - secureChannelId = %d \n",securityToken.secureChannelId);
 	UA_UInt32_encode(&(securityToken.secureChannelId), &pos,response.data);
 	printf("SL_openSecureChannel - tokenId = %d \n",securityToken.tokenId);
-	UA_Int32_encode(&(securityToken.tokenId), &pos,response.data);
+	UA_UInt32_encode(&(securityToken.tokenId), &pos,response.data);
 
 	UA_DateTime_encode(&(securityToken.createdAt), &pos,response.data);
 	printf("SL_openSecureChannel - revisedLifetime = %d \n",securityToken.revisedLifetime);
@@ -417,7 +408,7 @@ UA_Int32 SL_processMessage(UA_connection *connection, UA_ByteString message) {
 		}
 
 		// 	Req-4) MessageSecurityMode SecurityMode
-		UA_UInt32_decode(message.data, &pos, &securityMode);
+		UA_Int32_decode(message.data, &pos, &securityMode);
 		printf("SL_processMessage - securityMode=%d\n", securityMode);
 		switch (securityMode) {
 		case UA_SECURITYMODE_INVALID:

+ 3 - 3
src/opcua_transportLayer.c

@@ -25,17 +25,17 @@ UA_Int32 TL_initConnectionObject(UA_connection *connection)
 UA_Int32 TL_check(UA_connection *connection)
 {
 	UA_Int32 position = 4;
-	UA_UInt32 messageLength = 0;
+	UA_Int32 messageLength = 0;
 
 
 	printf("TL_check - entered \n");
 
 	UA_ByteString_printf("received data:",&(connection->readData));
-	UA_UInt32_decode(connection->readData.data,&position,&messageLength);
+	UA_Int32_decode(connection->readData.data,&position,&messageLength);
 
 	printf("TL_check - messageLength = %d \n",messageLength);
 
-	if (messageLength == connection->readData.length &&
+	if (messageLength != -1 && messageLength == connection->readData.length &&
 			messageLength < (connection->transportLayer.localConf.maxMessageSize))
 	{
 		printf("TL_check - no error \n");

+ 5 - 5
tool/generate_builtin.py

@@ -141,8 +141,8 @@ def createStructured(element):
     print("} " + name + ";", 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_Int32* pos, " + name + "* dst);", end='\n', file=fh)
+    print("UA_Int32 " + name + "_encode(" + name + " const * src, UA_Int32* pos, UA_Byte* dst);", end='\n', file=fh)
+    print("UA_Int32 " + name + "_decode(UA_Byte const * src, UA_Int32* pos, " + name + "* dst);", end='\n', file=fh)
     print("UA_Int32 " + name + "_delete("+ name + "* p);", end='\n', file=fh)
     print("UA_Int32 " + name + "_deleteMembers(" + name + "* p);", end='\n', file=fh)
     print("UA_Int32 " + name + "_init("+ name + " * p);", end='\n', file=fh)
@@ -169,7 +169,7 @@ def createStructured(element):
 
     print("\n\t;\n}\n", 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)
+    print("UA_Int32 "+name+"_encode("+name+" const * src, UA_Int32* pos, UA_Byte* dst) {\n\tUA_Int32 retval = UA_SUCCESS;", end='\n', file=fc)
     # code _encode
     for n,t in valuemap.iteritems():
         if t in elementary_size:
@@ -187,7 +187,7 @@ def createStructured(element):
     print("\treturn retval;\n}\n", end='\n', file=fc)
 
     # code _decode
-    print("UA_Int32 "+name+"_decode(char const * src, UA_Int32* pos, " + name + "* dst) {\n\tUA_Int32 retval = UA_SUCCESS;", end='\n', file=fc)
+    print("UA_Int32 "+name+"_decode(UA_Byte const * src, UA_Int32* pos, " + name + "* dst) {\n\tUA_Int32 retval = UA_SUCCESS;", end='\n', file=fc)
     for n,t in valuemap.iteritems():
         if t in elementary_size:
             print('\tretval |= UA_'+t+'_decode(src,pos,&(dst->'+n+'));', end='\n', file=fc)
@@ -219,7 +219,7 @@ def createStructured(element):
     for n,t in valuemap.iteritems():
         if t not in elementary_size:
             if t.find("**") != -1:
-		print("\tretval |= UA_Array_delete(p->"+n+",p->"+n+"Size);", end='\n', file=fc) #not tested
+		print("\tretval |= UA_Array_delete((void**)p->"+n+",p->"+n+"Size);", end='\n', file=fc) #not tested
             elif t.find("*") != -1:
 		print('\tretval |= UA_' + t[0:t.find("*")] + "_delete(p->"+n+");", end='\n', file=fc)
             else:

+ 1 - 1
tool/generate_namespace.py

@@ -97,7 +97,7 @@ for row in rows2:
     name = "UA_" + row[0]
     print('#define '+name.upper()+'_NS0 (UA_['+name.upper()+'].Id)', file=fh)
 
-    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{" + row[1] + ", (UA_Int32(*)(void const*)) " + name + "_calcSize, (UA_Int32(*)(UA_Byte const*,UA_Int32*,void*)) " + name + "_decode, (UA_Int32(*)(void const*,UA_Int32*,UA_Byte*))" + 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)