diff --git a/src/common/inc/libiec61850_platform_includes.h b/src/common/inc/libiec61850_platform_includes.h index a33abeb1..65f0c71e 100644 --- a/src/common/inc/libiec61850_platform_includes.h +++ b/src/common/inc/libiec61850_platform_includes.h @@ -5,11 +5,14 @@ #ifndef LIBIEC61850_PLATFORM_INCLUDES_H_ #define LIBIEC61850_PLATFORM_INCLUDES_H_ +#define __STDC_FORMAT_MACROS 1 + #include "stack_config.h" #include "libiec61850_common_api.h" #include "string_utilities.h" +#include #include #include #include diff --git a/src/goose/goose_receiver.c b/src/goose/goose_receiver.c index 164ddca8..d64015e9 100644 --- a/src/goose/goose_receiver.c +++ b/src/goose/goose_receiver.c @@ -736,7 +736,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength) timeAllowedToLive = BerDecoder_decodeUint32(buffer, elementLength, bufPos); if (DEBUG_GOOSE_SUBSCRIBER) - printf("GOOSE_SUBSCRIBER: Found timeAllowedToLive %u\n", timeAllowedToLive); + printf("GOOSE_SUBSCRIBER: Found timeAllowedToLive %"PRIu32"\n", timeAllowedToLive); break; @@ -783,13 +783,13 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength) case 0x85: stNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos); if (DEBUG_GOOSE_SUBSCRIBER) - printf("GOOSE_SUBSCRIBER: Found stNum: %u\n", stNum); + printf("GOOSE_SUBSCRIBER: Found stNum: %"PRIu32"\n", stNum); break; case 0x86: sqNum = BerDecoder_decodeUint32(buffer, elementLength, bufPos); if (DEBUG_GOOSE_SUBSCRIBER) - printf("GOOSE_SUBSCRIBER: Found sqNum: %u\n", sqNum); + printf("GOOSE_SUBSCRIBER: Found sqNum: %"PRIu32"\n", sqNum); break; case 0x87: @@ -801,7 +801,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength) case 0x88: confRev = BerDecoder_decodeUint32(buffer, elementLength, bufPos); if (DEBUG_GOOSE_SUBSCRIBER) - printf("GOOSE_SUBSCRIBER: Found confRev: %u\n", confRev); + printf("GOOSE_SUBSCRIBER: Found confRev: %"PRIu32"\n", confRev); break; case 0x89: @@ -813,7 +813,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength) case 0x8a: numberOfDatSetEntries = BerDecoder_decodeUint32(buffer, elementLength, bufPos); 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; case 0xab: @@ -856,7 +856,7 @@ parseGoosePayload(GooseReceiver self, uint8_t* buffer, int apduLength) MmsValue_setUtcTime(matchingSubscriber->timestamp, 0); } - + if (matchingSubscriber->isObserver && matchingSubscriber->dataSetValues != NULL) { MmsValue_delete(matchingSubscriber->dataSetValues); matchingSubscriber->dataSetValues = NULL; @@ -934,7 +934,7 @@ parseGooseMessage(GooseReceiver self, uint8_t* buffer, int numbytes) return; if (buffer[bufPos++] != 0xb8) return; - + uint8_t srcMac[6]; memcpy(srcMac,&buffer[6],6); @@ -976,7 +976,7 @@ parseGooseMessage(GooseReceiver self, uint8_t* buffer, int numbytes) while (element != NULL) { GooseSubscriber subscriber = (GooseSubscriber) LinkedList_getData(element); - + if (subscriber->isObserver) { subscriber->appId = appId; diff --git a/src/iec61850/client/client_control.c b/src/iec61850/client/client_control.c index caa07148..35fc4038 100644 --- a/src/iec61850/client/client_control.c +++ b/src/iec61850/client/client_control.c @@ -565,7 +565,7 @@ internalOperateHandler(uint32_t invokeId, void* parameter, MmsError err, MmsData } else { 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); } } diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index 6affd50e..15cde958 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -756,7 +756,7 @@ writeMultipleVariablesHandler(uint32_t invokeId, void* parameter, MmsError mmsEr } else { 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); } } diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index 71058942..865c84d9 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -465,13 +465,13 @@ handleLastApplErrorMessage(IedConnection self, MmsValue* lastApplError) printf("IED_CLIENT: CntrlObj: %s\n", MmsValue_toString(cntrlObj)); 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) - printf("IED_CLIENT: addCause: %i\n", MmsValue_toInt32(addCause)); + printf("IED_CLIENT: addCause: %"PRIi32"\n", MmsValue_toInt32(addCause)); 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.addCause = (ControlAddCause) MmsValue_toInt32(addCause); @@ -652,11 +652,11 @@ IedConnection_tick(IedConnection self) } void -IedConnection_setLocalAddress(IedConnection self, const char* localIpAddress, int localPort) +IedConnection_setLocalAddress(IedConnection self, const char* localIpAddress, int localPort) { MmsConnection connection = self->connection; IsoConnectionParameters isoP = MmsConnection_getIsoConnectionParameters(connection); - + IsoConnectionParameters_setLocalTcpParameters(isoP, localIpAddress, localPort); } @@ -4255,4 +4255,3 @@ FileDirectoryEntry_getLastModified(FileDirectoryEntry self) { return self->lastModified; } - diff --git a/src/iec61850/common/iec61850_common.c b/src/iec61850/common/iec61850_common.c index 60c1b789..ec20bb5b 100644 --- a/src/iec61850/common/iec61850_common.c +++ b/src/iec61850/common/iec61850_common.c @@ -820,7 +820,7 @@ MmsMapping_varAccessSpecToObjectReference(MmsVariableAccessSpecification* varAcc /* Add array index part */ if (varAccessSpec->arrayIndex > -1) { - sprintf(targetPos, "(%i)", varAccessSpec->arrayIndex); + sprintf(targetPos, "(%"PRIi32")", varAccessSpec->arrayIndex); targetPos += arrayIndexLen; } diff --git a/src/iec61850/server/mms_mapping/control.c b/src/iec61850/server/mms_mapping/control.c index bcbb7d22..caffa8f4 100644 --- a/src/iec61850/server/mms_mapping/control.c +++ b/src/iec61850/server/mms_mapping/control.c @@ -483,7 +483,7 @@ updateSboTimeoutValue(ControlObject* self) uint32_t sboTimeoutVal = MmsValue_toInt32(self->sboTimeout); 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; } @@ -546,7 +546,7 @@ checkSelectTimeout(ControlObject* self, uint64_t currentTime, MmsMapping* mmsMap if (self->selectTimeout > 0) { if (currentTime > (self->selectTime + self->selectTimeout)) { 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); unselectObject(self, SELECT_STATE_REASON_TIMEOUT, mmsMapping); @@ -1681,7 +1681,7 @@ ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connect if (DEBUG_IED_SERVER) { printf("IED_SERVER: sendLastApplError:\n"); 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; @@ -2550,4 +2550,3 @@ ControlAction_getControlTime(ControlAction self) } #endif /* (CONFIG_IEC61850_CONTROL_SERVICE == 1) */ - diff --git a/src/iec61850/server/model/config_file_parser.c b/src/iec61850/server/model/config_file_parser.c index 65d5847c..52ba85e2 100644 --- a/src/iec61850/server/model/config_file_parser.c +++ b/src/iec61850/server/model/config_file_parser.c @@ -225,7 +225,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) uint32_t bufTm; 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, &trgOps, &options, &bufTm, &intgPd); @@ -250,7 +250,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) int logEna; 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); if (matchedItems < 7) goto exit_error; @@ -281,7 +281,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) int minTime = -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); if (matchedItems < 5) goto exit_error; @@ -299,7 +299,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) int optFlds; 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); if (matchedItems < 5) goto exit_error; @@ -360,7 +360,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) int triggerOptions = 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, (DataAttributeType) attributeType, (FunctionalConstraint) functionalConstraint, triggerOptions, arrayElements, sAddr); @@ -398,7 +398,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) case IEC61850_ENUMERATED: { 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); } break; @@ -409,7 +409,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) case IEC61850_INT32U: { 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); } break; @@ -517,7 +517,7 @@ ConfigFileParser_createModelFromConfigFile(FileHandle fileHandle) uint32_t vlanId; 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; diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index cc63582b..c3a89acc 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -228,7 +228,7 @@ handleUnconfirmedMmsPdu(MmsConnection self, ByteBuffer* message) } else { 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); @@ -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 (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) { MmsOutstandingCall call = checkForOutstandingCall(self, invokeId); @@ -1280,7 +1280,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload) BerDecoder_decodeUint32(buf, invokeIdLength, bufPos); 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); bufPos += invokeIdLength; @@ -1407,7 +1407,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload) case 0x02: /* invoke Id */ invokeId = BerDecoder_decodeUint32(buf, length, bufPos); 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; @@ -1867,7 +1867,7 @@ MmsConnection_abort(MmsConnection self, MmsError* mmsError) } } - + if (success == false) { IsoClientConnection_close(self->isoClient); *mmsError = MMS_ERROR_SERVICE_TIMEOUT; diff --git a/src/mms/iso_mms/client/mms_client_files.c b/src/mms/iso_mms/client/mms_client_files.c index 4fca418e..e432de90 100644 --- a/src/mms/iso_mms/client/mms_client_files.c +++ b/src/mms/iso_mms/client/mms_client_files.c @@ -191,7 +191,7 @@ mmsClient_handleFileReadRequest( int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos); 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); diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index 549619a8..6899b5a2 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -2301,7 +2301,7 @@ MmsValue_printToBuffer(const MmsValue* self, char* buffer, int bufferSize) break; case MMS_UNSIGNED: - snprintf(buffer, bufferSize, "%u", MmsValue_toUint32(self)); + snprintf(buffer, bufferSize, "%"PRIu32, MmsValue_toUint32(self)); break; case MMS_UTC_TIME: diff --git a/src/mms/iso_mms/server/mms_association_service.c b/src/mms/iso_mms/server/mms_association_service.c index 83a32f3e..5ad45d5f 100644 --- a/src/mms/iso_mms/server/mms_association_service.c +++ b/src/mms/iso_mms/server/mms_association_service.c @@ -286,13 +286,13 @@ parseInitRequestDetail(MmsServerConnection self, uint8_t* buffer, int bufPos, in if (protocolVersion < 1) { if (DEBUG_MMS_SERVER) - printf("MMS_SERVER: invalid protocol version %u\n", protocolVersion); + printf("MMS_SERVER: invalid protocol version %"PRIu32"\n", protocolVersion); return false; } if (DEBUG_MMS_SERVER) - printf("MMS_SERVER: proposed version number %u\n", protocolVersion); + printf("MMS_SERVER: proposed version number %"PRIu32"\n", protocolVersion); } break; diff --git a/src/mms/iso_mms/server/mms_file_service.c b/src/mms/iso_mms/server/mms_file_service.c index e4ae154b..2ba5e2f5 100644 --- a/src/mms/iso_mms/server/mms_file_service.c +++ b/src/mms/iso_mms/server/mms_file_service.c @@ -436,11 +436,11 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task, int taskState) ByteBuffer* message = NULL; - if (taskState == MMS_FILE_UPLOAD_STATE_SEND_FILE_READ || + if (taskState == MMS_FILE_UPLOAD_STATE_SEND_FILE_READ || taskState == MMS_FILE_UPLOAD_STATE_SEND_FILE_CLOSE || taskState == MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_ERROR_SOURCE || taskState == MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_ERROR_DESTINATION || - taskState == MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_RESPONSE) + taskState == MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_RESPONSE) { IsoConnection_lock(task->connection->isoConnection); @@ -551,7 +551,7 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task, int taskState) FileSystem_closeFile(task->fileHandle); task->fileHandle = NULL; } - + deleteFile(MmsServer_getFilesystemBasepath(self), task->destinationFilename); if (DEBUG_MMS_SERVER) @@ -891,7 +891,7 @@ mmsServer_handleFileReadRequest( int32_t frsmId = BerDecoder_decodeInt32(buffer, maxBufPos - bufPos, bufPos); 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); @@ -927,7 +927,7 @@ mmsServer_handleFileCloseRequest( } else { 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); } @@ -1051,7 +1051,7 @@ createFileDirectoryResponse(const char* basepath, uint32_t invokeId, ByteBuffer* continueAfterFileName = NULL; } - if ((directoryName && mmsMsg_isFilenameSave(directoryName) == false) || + if ((directoryName && mmsMsg_isFilenameSave(directoryName) == false) || (continueAfterFileName && mmsMsg_isFilenameSave(continueAfterFileName) == false)) { if (DEBUG_MMS_SERVER) @@ -1282,4 +1282,3 @@ mmsServer_handleFileDirectoryRequest( } #endif /* MMS_FILE_SERVICE == 1 */ - diff --git a/src/mms/iso_mms/server/mms_information_report.c b/src/mms/iso_mms/server/mms_information_report.c index 95ae5e24..7d370301 100644 --- a/src/mms/iso_mms/server/mms_information_report.c +++ b/src/mms/iso_mms/server/mms_information_report.c @@ -52,7 +52,7 @@ MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConn if (completeMessageSize > self->maxPduSize) { 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; } @@ -157,7 +157,7 @@ MmsServerConnection_sendInformationReportListOfVariables( if (completeMessageSize > self->maxPduSize) { 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; } @@ -281,7 +281,7 @@ MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, c if (completeMessageSize > self->maxPduSize) { 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; } @@ -331,6 +331,3 @@ MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, c exit_function: return; } - - - diff --git a/src/mms/iso_mms/server/mms_read_service.c b/src/mms/iso_mms/server/mms_read_service.c index c1bae0bf..52fe7e1d 100644 --- a/src/mms/iso_mms/server/mms_read_service.c +++ b/src/mms/iso_mms/server/mms_read_service.c @@ -569,7 +569,7 @@ encodeReadResponse(MmsServerConnection connection, response->size = bufPos; 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: return; @@ -922,8 +922,8 @@ mmsServer_handleReadRequest( goto exit_function; } - if ((mmsPdu->present == MmsPdu_PR_confirmedRequestPdu) && - (mmsPdu->choice.confirmedRequestPdu.confirmedServiceRequest.present + if ((mmsPdu->present == MmsPdu_PR_confirmedRequestPdu) && + (mmsPdu->choice.confirmedRequestPdu.confirmedServiceRequest.present == ConfirmedServiceRequest_PR_read)) { request = &(mmsPdu->choice.confirmedRequestPdu.confirmedServiceRequest.choice.read); @@ -950,10 +950,10 @@ mmsServer_handleReadRequest( } #endif else { - mmsMsg_createServiceErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED); + mmsMsg_createServiceErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED); } -exit_function: +exit_function: asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0); } @@ -976,4 +976,3 @@ MmsServerConnection_sendReadResponse(MmsServerConnection self, uint32_t invokeId if (handlerMode == false) IsoConnection_unlock(self->isoConnection); } - diff --git a/src/mms/iso_mms/server/mms_server_connection.c b/src/mms/iso_mms/server/mms_server_connection.c index b14ecc3a..7ac4ce73 100644 --- a/src/mms/iso_mms/server/mms_server_connection.c +++ b/src/mms/iso_mms/server/mms_server_connection.c @@ -306,7 +306,7 @@ handleConfirmedRequestPdu( case 0x02: /* invoke Id */ invokeId = BerDecoder_decodeUint32(buffer, length, bufPos); 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; break; @@ -427,7 +427,7 @@ handleConfirmedErrorPdu( if (mmsMsg_parseConfirmedErrorPDU(buffer, bufPos, maxBufPos, &invokeId, &hasInvokeId, &serviceError)) { 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) { /* 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 (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){ FileSystem_writeFile(task->fileHandle, buffer, bytesReceived); } else{ 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 { 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 */ invokeId = BerDecoder_decodeUint32(buffer, length, bufPos); 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; break; @@ -891,6 +891,3 @@ MmsServerConnection_getFilesystemBasepath(MmsServerConnection self) return CONFIG_VIRTUAL_FILESTORE_BASEPATH; #endif } - - - diff --git a/src/mms/iso_presentation/iso_presentation.c b/src/mms/iso_presentation/iso_presentation.c index c4f2f64e..a73bd721 100644 --- a/src/mms/iso_presentation/iso_presentation.c +++ b/src/mms/iso_presentation/iso_presentation.c @@ -802,7 +802,7 @@ IsoPresentation_parseConnect(IsoPresentation* self, ByteBuffer* byteBuffer) uint32_t modeSelector = BerDecoder_decodeUint32(buffer, len, bufPos); if (DEBUG_PRES) - printf("PRES: modesel %ui\n", modeSelector); + printf("PRES: modesel %"PRIu32"\n", modeSelector); bufPos += len; } diff --git a/src/sampled_values/sv_subscriber.c b/src/sampled_values/sv_subscriber.c index 99f5d34f..a343ce5b 100644 --- a/src/sampled_values/sv_subscriber.c +++ b/src/sampled_values/sv_subscriber.c @@ -21,10 +21,6 @@ * See COPYING file for the complete license text. */ -#define __STDC_FORMAT_MACROS 1 -#include "stack_config.h" -#include - #include "libiec61850_platform_includes.h" #include "hal_ethernet.h" @@ -258,7 +254,7 @@ SVReceiver_startThreadless(SVReceiver self) self->running = true; } - + return self->ethSocket; } @@ -347,14 +343,14 @@ parseASDU(SVReceiver self, SVSubscriber subscriber, uint8_t* buffer, int length) asdu.svId[svIdLength] = 0; if (asdu.datSet != NULL) asdu.datSet[datSetLength] = 0; - + if (DEBUG_SV_SUBSCRIBER) { printf("SV_SUBSCRIBER: SV ASDU: ----------------\n"); printf("SV_SUBSCRIBER: DataLength: %d\n", asdu.dataBufferLength); printf("SV_SUBSCRIBER: SvId: %s\n", asdu.svId); 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)) printf("SV_SUBSCRIBER: DatSet: %s\n", asdu.datSet); @@ -1010,4 +1006,3 @@ SVClientASDU_getDataSize(SVSubscriber_ASDU self) { return SVSubscriber_ASDU_getDataSize(self); } -