Skip to content

Commit

Permalink
quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
uleon committed Mar 24, 2014
1 parent c7ac2d5 commit 8da17e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/opcua_secureChannelLayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,14 @@ void SL_receive(UA_connection *connection, UA_ByteString *serviceMessage) {
if (secureChannelPacket.length > 0 && secureChannelPacket.data != NULL) {

printf("SL_receive - data received \n");
packetType = TL_getPacketType(&secureChannelPacket, &pos);
secureConvHeader.messageType = TL_getPacketType(&secureChannelPacket, &pos);

UA_SecureConversationMessageHeader_decode(secureChannelPacket.data, &pos, &secureConvHeader);

switch (secureConvHeader.messageType) {

case packetType_OPN: /* openSecureChannel Message received */
UA_AsymmetricAlgorithmSecurityHeader_encode(secureChannelPacket.data, &pos, &asymAlgSecHeader);
UA_AsymmetricAlgorithmSecurityHeader_decode(secureChannelPacket.data, &pos, &asymAlgSecHeader);
UA_ByteString_printf("SL_receive - AAS_Header.ReceiverThumbprint=",
&(asymAlgSecHeader.receiverCertificateThumbprint));
UA_ByteString_printf("SL_receive - AAS_Header.SecurityPolicyUri=",
Expand Down Expand Up @@ -703,6 +703,7 @@ UA_Int32 UA_OPCUATcpAcknowledgeMessage_decode(char const * src, UA_Int32* pos, U
return retval;
}

// FIXME: decide if serialized messageType (3 Bytes) shall be part of header
UA_Int32 UA_SecureConversationMessageHeader_calcSize(UA_SecureConversationMessageHeader const * ptr) {
return 0
+ sizeof(UA_UInt32) // messageType
Expand All @@ -712,6 +713,7 @@ UA_Int32 UA_SecureConversationMessageHeader_calcSize(UA_SecureConversationMessag
;
}

// FIXME: decide if serialized messageType (3 Bytes) shall be part of header
UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, char* dst) {
UA_Int32 retval = UA_SUCCESS;
retval |= UA_UInt32_encode(&(src->messageType),pos,dst);
Expand All @@ -721,9 +723,11 @@ UA_Int32 UA_SecureConversationMessageHeader_encode(UA_SecureConversationMessageH
return retval;
}

// FIXME: decide if serialized messageType (3 Bytes) shall be part of header
UA_Int32 UA_SecureConversationMessageHeader_decode(char const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst) {
UA_Int32 retval = UA_SUCCESS;
retval |= UA_UInt32_decode(src,pos,&(dst->messageType));
// TODO: this is an inconsistent quickfix for current logic in SL_receive
// retval |= UA_UInt32_decode(src,pos,&(dst->messageType));
retval |= UA_Byte_decode(src,pos,&(dst->isFinal));
retval |= UA_UInt32_decode(src,pos,&(dst->messageSize));
retval |= UA_UInt32_decode(src,pos,&(dst->secureChannelId));
Expand Down

0 comments on commit 8da17e3

Please sign in to comment.