pull/462/merge
Alex Overchenko 1 year ago committed by GitHub
commit 9524dcdb36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,11 +5,14 @@
#ifndef LIBIEC61850_PLATFORM_INCLUDES_H_ #ifndef LIBIEC61850_PLATFORM_INCLUDES_H_
#define LIBIEC61850_PLATFORM_INCLUDES_H_ #define LIBIEC61850_PLATFORM_INCLUDES_H_
#define __STDC_FORMAT_MACROS 1
#include "stack_config.h" #include "stack_config.h"
#include "libiec61850_common_api.h" #include "libiec61850_common_api.h"
#include "string_utilities.h" #include "string_utilities.h"
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>

@ -736,7 +736,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength)
timeAllowedToLive = BerDecoder_decodeUint32(buffer, elementLength, bufPos); timeAllowedToLive = BerDecoder_decodeUint32(buffer, elementLength, bufPos);
if (DEBUG_GOOSE_SUBSCRIBER) if (DEBUG_GOOSE_SUBSCRIBER)
printf("GOOSE_SUBSCRIBER: Found timeAllowedToLive %u\n", timeAllowedToLive); printf("GOOSE_SUBSCRIBER: Found timeAllowedToLive %"PRIu32"\n", timeAllowedToLive);
break; break;
@ -783,13 +783,13 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength)
case 0x85: case 0x85:
stNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos); stNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos);
if (DEBUG_GOOSE_SUBSCRIBER) if (DEBUG_GOOSE_SUBSCRIBER)
printf("GOOSE_SUBSCRIBER: Found stNum: %u\n", stNum); printf("GOOSE_SUBSCRIBER: Found stNum: %"PRIu32"\n", stNum);
break; break;
case 0x86: case 0x86:
sqNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos); sqNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos);
if (DEBUG_GOOSE_SUBSCRIBER) if (DEBUG_GOOSE_SUBSCRIBER)
printf("GOOSE_SUBSCRIBER: Found sqNum: %u\n", sqNum); printf("GOOSE_SUBSCRIBER: Found sqNum: %"PRIu32"\n", sqNum);
break; break;
case 0x87: case 0x87:
@ -801,7 +801,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength)
case 0x88: case 0x88:
confRev = BerDecoder_decodeUint32(buffer, elementLength, bufPos); confRev = BerDecoder_decodeUint32(buffer, elementLength, bufPos);
if (DEBUG_GOOSE_SUBSCRIBER) if (DEBUG_GOOSE_SUBSCRIBER)
printf("GOOSE_SUBSCRIBER: Found confRev: %u\n", confRev); printf("GOOSE_SUBSCRIBER: Found confRev: %"PRIu32"\n", confRev);
break; break;
case 0x89: case 0x89:
@ -813,7 +813,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength)
case 0x8a: case 0x8a:
numberOfDatSetEntries = BerDecoder_decodeUint32(buffer, elementLength, bufPos); numberOfDatSetEntries = BerDecoder_decodeUint32(buffer, elementLength, bufPos);
if (DEBUG_GOOSE_SUBSCRIBER) if (DEBUG_GOOSE_SUBSCRIBER)
printf("GOOSE_SUBSCRIBER: Found number of entries: %u\n", numberOfDatSetEntries); printf("GOOSE_SUBSCRIBER: Found number of entries: %"PRIu32"\n", numberOfDatSetEntries);
break; break;
case 0xab: case 0xab:

@ -565,7 +565,7 @@ internalOperateHandler(uint32_t invokeId, void* parameter, MmsError err, MmsData
} }
else { else {
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: internal error - no matching outstanding call (ID: %u)!\n", invokeId); printf("IED_CLIENT: internal error - no matching outstanding call (ID: %"PRIu32")!\n", invokeId);
} }
} }

@ -756,7 +756,7 @@ writeMultipleVariablesHandler(uint32_t invokeId, void* parameter, MmsError mmsEr
} }
else { else {
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: internal error - no matching outstanding call with invoke ID: %u!\n", invokeId); printf("IED_CLIENT: internal error - no matching outstanding call with invoke ID: %"PRIu32"!\n", invokeId);
} }
} }

@ -465,13 +465,13 @@ handleLastApplErrorMessage(IedConnection self, MmsValue* lastApplError)
printf("IED_CLIENT: CntrlObj: %s\n", MmsValue_toString(cntrlObj)); printf("IED_CLIENT: CntrlObj: %s\n", MmsValue_toString(cntrlObj));
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: ctlNum: %u\n", MmsValue_toUint32(ctlNum)); printf("IED_CLIENT: ctlNum: %"PRIu32"\n", MmsValue_toUint32(ctlNum));
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: addCause: %i\n", MmsValue_toInt32(addCause)); printf("IED_CLIENT: addCause: %"PRIi32"\n", MmsValue_toInt32(addCause));
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: error: %i\n", MmsValue_toInt32(error)); printf("IED_CLIENT: error: %"PRIi32"\n", MmsValue_toInt32(error));
self->lastApplError.ctlNum = MmsValue_toUint32(ctlNum); self->lastApplError.ctlNum = MmsValue_toUint32(ctlNum);
self->lastApplError.addCause = (ControlAddCause) MmsValue_toInt32(addCause); self->lastApplError.addCause = (ControlAddCause) MmsValue_toInt32(addCause);
@ -4255,4 +4255,3 @@ FileDirectoryEntry_getLastModified(FileDirectoryEntry self)
{ {
return self->lastModified; return self->lastModified;
} }

@ -820,7 +820,7 @@ MmsMapping_varAccessSpecToObjectReference(MmsVariableAccessSpecification* varAcc
/* Add array index part */ /* Add array index part */
if (varAccessSpec->arrayIndex > -1) { if (varAccessSpec->arrayIndex > -1) {
sprintf(targetPos, "(%i)", varAccessSpec->arrayIndex); sprintf(targetPos, "(%"PRIi32")", varAccessSpec->arrayIndex);
targetPos += arrayIndexLen; targetPos += arrayIndexLen;
} }

@ -483,7 +483,7 @@ updateSboTimeoutValue(ControlObject* self)
uint32_t sboTimeoutVal = MmsValue_toInt32(self->sboTimeout); uint32_t sboTimeoutVal = MmsValue_toInt32(self->sboTimeout);
if (DEBUG_IED_SERVER) if (DEBUG_IED_SERVER)
printf("IED_SERVER: set timeout for %s/%s.%s to %u\n", MmsDomain_getName(self->mmsDomain), self->lnName, self->name, sboTimeoutVal); printf("IED_SERVER: set timeout for %s/%s.%s to %"PRIu32"\n", MmsDomain_getName(self->mmsDomain), self->lnName, self->name, sboTimeoutVal);
self->selectTimeout = sboTimeoutVal; self->selectTimeout = sboTimeoutVal;
} }
@ -546,7 +546,7 @@ checkSelectTimeout(ControlObject* self, uint64_t currentTime, MmsMapping* mmsMap
if (self->selectTimeout > 0) { if (self->selectTimeout > 0) {
if (currentTime > (self->selectTime + self->selectTimeout)) { if (currentTime > (self->selectTime + self->selectTimeout)) {
if (DEBUG_IED_SERVER) if (DEBUG_IED_SERVER)
printf("IED_SERVER: select-timeout (timeout-val = %u) for control %s/%s.%s\n", printf("IED_SERVER: select-timeout (timeout-val = %"PRIu32") for control %s/%s.%s\n",
self->selectTimeout, MmsDomain_getName(self->mmsDomain), self->lnName, self->name); self->selectTimeout, MmsDomain_getName(self->mmsDomain), self->lnName, self->name);
unselectObject(self, SELECT_STATE_REASON_TIMEOUT, mmsMapping); unselectObject(self, SELECT_STATE_REASON_TIMEOUT, mmsMapping);
@ -1681,7 +1681,7 @@ ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connect
if (DEBUG_IED_SERVER) { if (DEBUG_IED_SERVER) {
printf("IED_SERVER: sendLastApplError:\n"); printf("IED_SERVER: sendLastApplError:\n");
printf("IED_SERVER: control object: %s\n", ctlObj); printf("IED_SERVER: control object: %s\n", ctlObj);
printf("IED_SERVER: ctlNum: %u\n", MmsValue_toUint32(ctlNum)); printf("IED_SERVER: ctlNum: %"PRIu32"\n", MmsValue_toUint32(ctlNum));
} }
MmsValue ctlObjValueMemory; MmsValue ctlObjValueMemory;
@ -2550,4 +2550,3 @@ ControlAction_getControlTime(ControlAction self)
} }
#endif /* (CONFIG_IEC61850_CONTROL_SERVICE == 1) */ #endif /* (CONFIG_IEC61850_CONTROL_SERVICE == 1) */

@ -225,7 +225,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
uint32_t bufTm; uint32_t bufTm;
uint32_t intgPd; uint32_t intgPd;
int matchedItems = sscanf((char*) lineBuffer, "RC(%129s %129s %i %129s %u %i %i %u %u)", int matchedItems = sscanf((char*) lineBuffer, "RC(%129s %129s %i %129s %"SCNu32" %i %i %"SCNu32" %"SCNu32")",
nameString, nameString2, &isBuffered, nameString3, &confRef, nameString, nameString2, &isBuffered, nameString3, &confRef,
&trgOps, &options, &bufTm, &intgPd); &trgOps, &options, &bufTm, &intgPd);
@ -250,7 +250,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
int logEna; int logEna;
int withReasonCode; int withReasonCode;
int matchedItems = sscanf((char*) lineBuffer, "LC(%129s %129s %129s %u %u %i %i)", int matchedItems = sscanf((char*) lineBuffer, "LC(%129s %129s %129s %"SCNu32" %"SCNu32" %i %i)",
nameString, nameString2, nameString3, &trgOps, &intgPd, &logEna, &withReasonCode); nameString, nameString2, nameString3, &trgOps, &intgPd, &logEna, &withReasonCode);
if (matchedItems < 7) goto exit_error; if (matchedItems < 7) goto exit_error;
@ -281,7 +281,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
int minTime = -1; int minTime = -1;
int maxTime = -1; int maxTime = -1;
int matchedItems = sscanf((char*) lineBuffer, "GC(%129s %129s %129s %u %i %i %i)", int matchedItems = sscanf((char*) lineBuffer, "GC(%129s %129s %129s %"SCNu32" %i %i %i)",
nameString, nameString2, nameString3, &confRef, &fixedOffs, &minTime, &maxTime); nameString, nameString2, nameString3, &confRef, &fixedOffs, &minTime, &maxTime);
if (matchedItems < 5) goto exit_error; if (matchedItems < 5) goto exit_error;
@ -299,7 +299,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
int optFlds; int optFlds;
int isUnicast; int isUnicast;
int matchedItems = sscanf((char*) lineBuffer, "SMVC(%129s %129s %129s %u %i %i %i %i)", int matchedItems = sscanf((char*) lineBuffer, "SMVC(%129s %129s %129s %"SCNu32" %i %i %i %i)",
nameString, nameString2, nameString3, &confRev, &smpMod, &smpRate, &optFlds, &isUnicast); nameString, nameString2, nameString3, &confRev, &smpMod, &smpRate, &optFlds, &isUnicast);
if (matchedItems < 5) goto exit_error; if (matchedItems < 5) goto exit_error;
@ -360,7 +360,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
int triggerOptions = 0; int triggerOptions = 0;
uint32_t sAddr = 0; uint32_t sAddr = 0;
sscanf((char*) lineBuffer, "DA(%129s %i %i %i %i %u)", nameString, &arrayElements, &attributeType, &functionalConstraint, &triggerOptions, &sAddr); sscanf((char*) lineBuffer, "DA(%129s %i %i %i %i %"SCNu32")", nameString, &arrayElements, &attributeType, &functionalConstraint, &triggerOptions, &sAddr);
DataAttribute* dataAttribute = DataAttribute_create(nameString, currentModelNode, DataAttribute* dataAttribute = DataAttribute_create(nameString, currentModelNode,
(DataAttributeType) attributeType, (FunctionalConstraint) functionalConstraint, triggerOptions, arrayElements, sAddr); (DataAttributeType) attributeType, (FunctionalConstraint) functionalConstraint, triggerOptions, arrayElements, sAddr);
@ -398,7 +398,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
case IEC61850_ENUMERATED: case IEC61850_ENUMERATED:
{ {
int32_t intValue; int32_t intValue;
if (sscanf(valueIndicator + 1, "%i", &intValue) != 1) goto exit_error; if (sscanf(valueIndicator + 1, "%"SCNi32, &intValue) != 1) goto exit_error;
dataAttribute->mmsValue = MmsValue_newIntegerFromInt32(intValue); dataAttribute->mmsValue = MmsValue_newIntegerFromInt32(intValue);
} }
break; break;
@ -409,7 +409,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
case IEC61850_INT32U: case IEC61850_INT32U:
{ {
uint32_t uintValue; uint32_t uintValue;
if (sscanf(valueIndicator + 1, "%u", &uintValue) != 1) goto exit_error; if (sscanf(valueIndicator + 1, "%"SCNu32, &uintValue) != 1) goto exit_error;
dataAttribute->mmsValue = MmsValue_newUnsignedFromUint32(uintValue); dataAttribute->mmsValue = MmsValue_newUnsignedFromUint32(uintValue);
} }
break; break;
@ -517,7 +517,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle)
uint32_t vlanId; uint32_t vlanId;
uint32_t appId; uint32_t appId;
int matchedItems = sscanf((char*) lineBuffer, "PA(%u %u %u %129s)", &vlanPrio, &vlanId, &appId, nameString); int matchedItems = sscanf((char*) lineBuffer, "PA(%"SCNu32" %"SCNu32" %"SCNu32" %129s)", &vlanPrio, &vlanId, &appId, nameString);
if ((matchedItems != 4) || ((currentGoCB == NULL) && (currentSMVCB == NULL))) goto exit_error; if ((matchedItems != 4) || ((currentGoCB == NULL) && (currentSMVCB == NULL))) goto exit_error;

@ -228,7 +228,7 @@ handleUnconfirmedMmsPdu(MmsConnection self, ByteBuffer* message)
} }
else { else {
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
printf("handleUnconfirmedMmsPdu: error parsing PDU at %u\n", (uint32_t) rval.consumed); printf("handleUnconfirmedMmsPdu: error parsing PDU at %"PRIu32"\n", (uint32_t) rval.consumed);
} }
asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0); asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0);
@ -1230,7 +1230,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (mmsMsg_parseRejectPDU(payload->buffer, 0, payload->size, &invokeId, &hasInvokeId, &rejectType, &rejectReason) >= 0) { if (mmsMsg_parseRejectPDU(payload->buffer, 0, payload->size, &invokeId, &hasInvokeId, &rejectType, &rejectReason) >= 0) {
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: reject PDU invokeID: %u type: %i reason: %i\n", invokeId, rejectType, rejectReason); printf("MMS_CLIENT: reject PDU invokeID: %"PRIu32" type: %i reason: %i\n", invokeId, rejectType, rejectReason);
if (hasInvokeId) { if (hasInvokeId) {
MmsOutstandingCall call = checkForOutstandingCall(self, invokeId); MmsOutstandingCall call = checkForOutstandingCall(self, invokeId);
@ -1280,7 +1280,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
BerDecoder_decodeUint32(buf, invokeIdLength, bufPos); BerDecoder_decodeUint32(buf, invokeIdLength, bufPos);
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: mms_client_connection: rcvd confirmed resp - invokeId: %u length: %i bufLen: %i\n", printf("MMS_CLIENT: mms_client_connection: rcvd confirmed resp - invokeId: %"PRIu32" length: %i bufLen: %i\n",
invokeId, length, payload->size); invokeId, length, payload->size);
bufPos += invokeIdLength; bufPos += invokeIdLength;
@ -1407,7 +1407,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
case 0x02: /* invoke Id */ case 0x02: /* invoke Id */
invokeId = BerDecoder_decodeUint32(buf, length, bufPos); invokeId = BerDecoder_decodeUint32(buf, length, bufPos);
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: received request with invokeId: %u\n", invokeId); printf("MMS_CLIENT: received request with invokeId: %"PRIu32"\n", invokeId);
hasInvokeId = true; hasInvokeId = true;

@ -191,7 +191,7 @@ mmsClient_handleFileReadRequest(
int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos); int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos);
if (DEBUG_MMS_CLIENT) if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: mmsClient_handleFileReadRequest read request for frsmId: %i\n", frsmId); printf("MMS_CLIENT: mmsClient_handleFileReadRequest read request for frsmId: %"PRIi32"\n", frsmId);
MmsFileReadStateMachine* frsm = getFrsm(connection, frsmId); MmsFileReadStateMachine* frsm = getFrsm(connection, frsmId);

@ -2301,7 +2301,7 @@ MmsValue_printToBuffer(const MmsValue* self, char* buffer, int bufferSize)
break; break;
case MMS_UNSIGNED: case MMS_UNSIGNED:
snprintf(buffer, bufferSize, "%u", MmsValue_toUint32(self)); snprintf(buffer, bufferSize, "%"PRIu32, MmsValue_toUint32(self));
break; break;
case MMS_UTC_TIME: case MMS_UTC_TIME:

@ -286,13 +286,13 @@ parseInitRequestDetail(MmsServerConnection self, uint8_t* buffer, int bufPos, in
if (protocolVersion < 1) { if (protocolVersion < 1) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: invalid protocol version %u\n", protocolVersion); printf("MMS_SERVER: invalid protocol version %"PRIu32"\n", protocolVersion);
return false; return false;
} }
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: proposed version number %u\n", protocolVersion); printf("MMS_SERVER: proposed version number %"PRIu32"\n", protocolVersion);
} }
break; break;

@ -891,7 +891,7 @@ mmsServer_handleFileReadRequest(
int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos); int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos);
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: mmsServer_handleFileReadRequest read request for frsmId: %i\n", frsmId); printf("MMS_SERVER: mmsServer_handleFileReadRequest read request for frsmId: %"PRIi32"\n", frsmId);
MmsFileReadStateMachine* frsm = getFrsm(connection, frsmId); MmsFileReadStateMachine* frsm = getFrsm(connection, frsmId);
@ -927,7 +927,7 @@ mmsServer_handleFileCloseRequest(
} }
else { else {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: Unused file ID %i\n", frsmId); printf("MMS_SERVER: Unused file ID %"PRIi32"\n", frsmId);
mmsMsg_createServiceErrorPdu(invokeId, response, MMS_ERROR_FILE_OTHER); mmsMsg_createServiceErrorPdu(invokeId, response, MMS_ERROR_FILE_OTHER);
} }
@ -1282,4 +1282,3 @@ mmsServer_handleFileDirectoryRequest(
} }
#endif /* MMS_FILE_SERVICE == 1 */ #endif /* MMS_FILE_SERVICE == 1 */

@ -52,7 +52,7 @@ MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConn
if (completeMessageSize > self->maxPduSize) { if (completeMessageSize > self->maxPduSize) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: report message too large %u (max = %u) -> skip message!\n", completeMessageSize, self->maxPduSize); printf("MMS_SERVER: report message too large %"PRIu32" (max = %"PRIu32") -> skip message!\n", completeMessageSize, self->maxPduSize);
goto exit_function; goto exit_function;
} }
@ -157,7 +157,7 @@ MmsServerConnection_sendInformationReportListOfVariables(
if (completeMessageSize > self->maxPduSize) { if (completeMessageSize > self->maxPduSize) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: report message too large %u (max = %u) -> skip message!\n", completeMessageSize, self->maxPduSize); printf("MMS_SERVER: report message too large %"PRIu32" (max = %"PRIu32") -> skip message!\n", completeMessageSize, self->maxPduSize);
goto exit_function; goto exit_function;
} }
@ -281,7 +281,7 @@ MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, c
if (completeMessageSize > self->maxPduSize) { if (completeMessageSize > self->maxPduSize) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: report message too large %u (max = %u) -> skip message!\n", completeMessageSize, self->maxPduSize); printf("MMS_SERVER: report message too large %"PRIu32" (max = %"PRIu32") -> skip message!\n", completeMessageSize, self->maxPduSize);
goto exit_function; goto exit_function;
} }
@ -331,6 +331,3 @@ MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, c
exit_function: exit_function:
return; return;
} }

@ -569,7 +569,7 @@ encodeReadResponse(MmsServerConnection connection,
response->size = bufPos; response->size = bufPos;
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS read: sent message for request with id %u (size = %i)\n", invokeId, bufPos); printf("MMS read: sent message for request with id %"PRIu32" (size = %i)\n", invokeId, bufPos);
exit_function: exit_function:
return; return;
@ -976,4 +976,3 @@ MmsServerConnection_sendReadResponse(MmsServerConnection self, uint32_t invokeId
if (handlerMode == false) if (handlerMode == false)
IsoConnection_unlock(self->isoConnection); IsoConnection_unlock(self->isoConnection);
} }

@ -306,7 +306,7 @@ handleConfirmedRequestPdu(
case 0x02: /* invoke Id */ case 0x02: /* invoke Id */
invokeId = BerDecoder_decodeUint32(buffer, length, bufPos); invokeId = BerDecoder_decodeUint32(buffer, length, bufPos);
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: received request with invokeId: %u\n", invokeId); printf("MMS_SERVER: received request with invokeId: %"PRIu32"\n", invokeId);
self->lastInvokeId = invokeId; self->lastInvokeId = invokeId;
break; break;
@ -427,7 +427,7 @@ handleConfirmedErrorPdu(
if (mmsMsg_parseConfirmedErrorPDU(buffer, bufPos, maxBufPos, &invokeId, &hasInvokeId, &serviceError)) { if (mmsMsg_parseConfirmedErrorPDU(buffer, bufPos, maxBufPos, &invokeId, &hasInvokeId, &serviceError)) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: Handle confirmed error PDU: invokeID: %u\n", invokeId); printf("MMS_SERVER: Handle confirmed error PDU: invokeID: %"PRIu32"\n", invokeId);
if (hasInvokeId) { if (hasInvokeId) {
/* check if message is related to an existing file upload task */ /* check if message is related to an existing file upload task */
@ -488,19 +488,19 @@ mmsFileReadHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int32_
if (mmsError == MMS_ERROR_NONE) { if (mmsError == MMS_ERROR_NONE) {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: file %i received %u bytes\n", task->frmsId, bytesReceived); printf("MMS_SERVER: file %"PRIi32" received %"PRIu32" bytes\n", task->frmsId, bytesReceived);
if(task->fileHandle){ if(task->fileHandle){
FileSystem_writeFile(task->fileHandle, buffer, bytesReceived); FileSystem_writeFile(task->fileHandle, buffer, bytesReceived);
} }
else{ else{
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: problem reading file %i file already closed\n", task->frmsId); printf("MMS_SERVER: problem reading file %"PRIi32" file already closed\n", task->frmsId);
} }
} }
else { else {
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: problem reading file %i (error code: %i)\n", task->frmsId, mmsError); printf("MMS_SERVER: problem reading file %"PRIi32" (error code: %i)\n", task->frmsId, mmsError);
} }
} }
@ -646,7 +646,7 @@ handleConfirmedResponsePdu(
case 0x02: /* invoke Id */ case 0x02: /* invoke Id */
invokeId = BerDecoder_decodeUint32(buffer, length, bufPos); invokeId = BerDecoder_decodeUint32(buffer, length, bufPos);
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
printf("MMS_SERVER: received request with invokeId: %u\n", invokeId); printf("MMS_SERVER: received request with invokeId: %"PRIu32"\n", invokeId);
self->lastInvokeId = invokeId; self->lastInvokeId = invokeId;
break; break;
@ -891,6 +891,3 @@ MmsServerConnection_getFilesystemBasepath(MmsServerConnection self)
return CONFIG_VIRTUAL_FILESTORE_BASEPATH; return CONFIG_VIRTUAL_FILESTORE_BASEPATH;
#endif #endif
} }

@ -802,7 +802,7 @@ IsoPresentation_parseConnect(IsoPresentation* self, ByteBuffer* byteBuffer)
uint32_t modeSelector = BerDecoder_decodeUint32(buffer, len, bufPos); uint32_t modeSelector = BerDecoder_decodeUint32(buffer, len, bufPos);
if (DEBUG_PRES) if (DEBUG_PRES)
printf("PRES: modesel %ui\n", modeSelector); printf("PRES: modesel %"PRIu32"\n", modeSelector);
bufPos += len; bufPos += len;
} }

@ -21,10 +21,6 @@
* See COPYING file for the complete license text. * See COPYING file for the complete license text.
*/ */
#define __STDC_FORMAT_MACROS 1
#include "stack_config.h"
#include <inttypes.h>
#include "libiec61850_platform_includes.h" #include "libiec61850_platform_includes.h"
#include "hal_ethernet.h" #include "hal_ethernet.h"
@ -353,7 +349,7 @@ parseASDU(SVReceiver self, SVSubscriber subscriber, uint8_t* buffer, int length)
printf("SV_SUBSCRIBER: DataLength: %d\n", asdu.dataBufferLength); printf("SV_SUBSCRIBER: DataLength: %d\n", asdu.dataBufferLength);
printf("SV_SUBSCRIBER: SvId: %s\n", asdu.svId); printf("SV_SUBSCRIBER: SvId: %s\n", asdu.svId);
printf("SV_SUBSCRIBER: SmpCnt: %u\n", SVSubscriber_ASDU_getSmpCnt(&asdu)); printf("SV_SUBSCRIBER: SmpCnt: %u\n", SVSubscriber_ASDU_getSmpCnt(&asdu));
printf("SV_SUBSCRIBER: ConfRev: %u\n", SVSubscriber_ASDU_getConfRev(&asdu)); printf("SV_SUBSCRIBER: ConfRev: %"PRIu32"\n", SVSubscriber_ASDU_getConfRev(&asdu));
if (SVSubscriber_ASDU_hasDatSet(&asdu)) if (SVSubscriber_ASDU_hasDatSet(&asdu))
printf("SV_SUBSCRIBER: DatSet: %s\n", asdu.datSet); printf("SV_SUBSCRIBER: DatSet: %s\n", asdu.datSet);
@ -1010,4 +1006,3 @@ SVClientASDU_getDataSize(SVSubscriber_ASDU self)
{ {
return SVSubscriber_ASDU_getDataSize(self); return SVSubscriber_ASDU_getDataSize(self);
} }

Loading…
Cancel
Save