From 44b94f0df09aabecad0308f7e8d1f25d644126c5 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Thu, 11 Feb 2016 17:19:29 +0100 Subject: [PATCH] - fixed signed integer encoding problem for frsmId in fileClose client service --- CHANGELOG | 2 ++ src/mms/iso_mms/client/mms_client_files.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1591bb81..ab86d705 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ Changes to version 0.9.0.2 -------------------------- +- fixed encoding problem with negative frsmId in client file read service +- allow 1 to 16 octet size ISO session selector (small API change in IsoConnectionParameters methods) - added C++ compatible headers to GOOSE/SV publisher headers - server: fixed problem in GetFileDirectory-service with a single file as parameter - added goose_publisher_example to cmake diff --git a/src/mms/iso_mms/client/mms_client_files.c b/src/mms/iso_mms/client/mms_client_files.c index ad0b5533..81b18bb2 100644 --- a/src/mms/iso_mms/client/mms_client_files.c +++ b/src/mms/iso_mms/client/mms_client_files.c @@ -577,9 +577,15 @@ mmsClient_createFileCloseRequest(uint32_t invokeId, ByteBuffer* request, int32_t { uint32_t invokeIdSize = BerEncoder_UInt32determineEncodedSize(invokeId); - uint32_t frsmIdSize = BerEncoder_UInt32determineEncodedSize(frsmId); + uint8_t frsmIdBuf[5]; + Asn1PrimitiveValue frsmIdBer; + frsmIdBer.octets = frsmIdBuf; + frsmIdBer.maxSize = 5; + frsmIdBer.size = 0; - uint32_t confirmedRequestPduSize = 1 + 2 + 2 + invokeIdSize + frsmIdSize; + BerInteger_setInt32(&frsmIdBer, frsmId); + + uint32_t confirmedRequestPduSize = 1 + 2 + 2 + invokeIdSize + frsmIdBer.size; int bufPos = 0; uint8_t* buffer = request->buffer; @@ -590,9 +596,7 @@ mmsClient_createFileCloseRequest(uint32_t invokeId, ByteBuffer* request, int32_t /* Encode FileClose tag (context | primitive) [74 = 4ah] */ buffer[bufPos++] = 0x9f; - buffer[bufPos++] = 0x4a; - bufPos = BerEncoder_encodeLength(frsmIdSize, buffer, bufPos); - bufPos = BerEncoder_encodeUInt32(frsmId, buffer, bufPos); + bufPos = BerEncoder_encodeOctetString(0x4a, frsmIdBer.octets, frsmIdBer.size, buffer, bufPos); request->size = bufPos; }