diff --git a/CHANGELOG b/CHANGELOG index 07f257d8..91efaac4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ Changes to version 2.3.2 - updated HAL layer - Added new IEC 62351-3 related TLS features (session resumption, alarms, ...) - CS101 balanced link layer: Send request-status-of-link before calling reset-of-remote-link +- CS101 unbalanced master: Send request-status-of-link before calling reset-of-remote-link, added delay before repeating request-status-of-link - added function CS101_ASDU_clone - fixed - TLS: configured CRL are ignored (#117) - integrated code to serve files diff --git a/lib60870-C/Makefile b/lib60870-C/Makefile index 5babadce..932392e0 100644 --- a/lib60870-C/Makefile +++ b/lib60870-C/Makefile @@ -112,7 +112,7 @@ static_checks: lib splint -preproc +posixlib +skip-sys-headers +gnuextensions $(LIB_INCLUDES) $(LIB_SOURCES) cppcheck: lib - cppcheck --force --std=c99 --enable=all $(LIB_INCLUDES) $(LIB_SOURCES) 2> cppcheck-output.xml + cppcheck --xml --force --std=c99 --enable=all $(LIB_INCLUDES) $(LIB_SOURCES) 2> cppcheck-output.xml lib: $(LIB_NAME) diff --git a/lib60870-C/src/common/inc/linked_list.h b/lib60870-C/src/common/inc/linked_list.h index 9f1fd3cc..35da2c2a 100644 --- a/lib60870-C/src/common/inc/linked_list.h +++ b/lib60870-C/src/common/inc/linked_list.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 MZ Automation GmbH + * Copyright 2013-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -116,7 +116,7 @@ LinkedList_add(LinkedList self, void* data); * \param data data to remove from the LinkedList instance */ bool -LinkedList_remove(LinkedList self, void* data); +LinkedList_remove(LinkedList self, const void* data); /** * \brief Get the list element specified by index (starting with 0). diff --git a/lib60870-C/src/common/linked_list.c b/lib60870-C/src/common/linked_list.c index aa352559..049e6cb8 100644 --- a/lib60870-C/src/common/linked_list.c +++ b/lib60870-C/src/common/linked_list.c @@ -1,5 +1,5 @@ /* - * Copyright 2017 MZ Automation GmbH + * Copyright 2013-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -116,7 +116,7 @@ LinkedList_add(LinkedList list, void* data) } bool -LinkedList_remove(LinkedList list, void* data) +LinkedList_remove(LinkedList list, const void* data) { LinkedList lastElement = list; diff --git a/lib60870-C/src/iec60870/apl/cpXXtime2a.c b/lib60870-C/src/iec60870/apl/cpXXtime2a.c index fbc291c6..1d2011bf 100644 --- a/lib60870-C/src/iec60870/apl/cpXXtime2a.c +++ b/lib60870-C/src/iec60870/apl/cpXXtime2a.c @@ -3,7 +3,7 @@ * * Implementation of the types CP16Time2a, CP24Time2a and CP56Time2a * - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -39,7 +39,7 @@ **********************************/ bool -CP16Time2a_getFromBuffer (CP16Time2a self, uint8_t* msg, int msgSize, int startIndex) +CP16Time2a_getFromBuffer (CP16Time2a self, const uint8_t* msg, int msgSize, int startIndex) { if (msgSize < startIndex + 2) return false; @@ -53,7 +53,7 @@ CP16Time2a_getFromBuffer (CP16Time2a self, uint8_t* msg, int msgSize, int startI } int -CP16Time2a_getEplapsedTimeInMs(CP16Time2a self) +CP16Time2a_getEplapsedTimeInMs(const CP16Time2a self) { return (self->encodedValue[0] + (self->encodedValue[1] * 0x100)); } @@ -76,7 +76,7 @@ CP16Time2a_getEncodedValue(CP16Time2a self) ************************************/ static int -getMillisecond(uint8_t* encodedValue) +getMillisecond(const uint8_t* encodedValue) { return (encodedValue[0] + (encodedValue[1] * 0x100)) % 1000; } @@ -96,7 +96,7 @@ setMillisecond(uint8_t* encodedValue, int value) } static int -getSecond(uint8_t* encodedValue) +getSecond(const uint8_t* encodedValue) { return (encodedValue[0] + (encodedValue[1] * 0x100)) / 1000; } @@ -115,7 +115,7 @@ setSecond(uint8_t* encodedValue, int value) } static int -getMinute(uint8_t* encodedValue) +getMinute(const uint8_t* encodedValue) { return (encodedValue[2] & 0x3f); } @@ -127,7 +127,7 @@ setMinute(uint8_t* encodedValue, int value) } static bool -isInvalid(uint8_t* encodedValue) +isInvalid(const uint8_t* encodedValue) { return ((encodedValue[2] & 0x80) != 0); } @@ -142,7 +142,7 @@ setInvalid(uint8_t* encodedValue, bool value) } static bool -isSubstituted(uint8_t* encodedValue) +isSubstituted(const uint8_t* encodedValue) { return ((encodedValue[2] & 0x40) == 0x40); } @@ -161,7 +161,7 @@ setSubstituted(uint8_t* encodedValue, bool value) **********************************/ bool -CP24Time2a_getFromBuffer (CP24Time2a self, uint8_t* msg, int msgSize, int startIndex) +CP24Time2a_getFromBuffer (CP24Time2a self, const uint8_t* msg, int msgSize, int startIndex) { if (msgSize < startIndex + 3) return false; @@ -175,7 +175,7 @@ CP24Time2a_getFromBuffer (CP24Time2a self, uint8_t* msg, int msgSize, int startI } int -CP24Time2a_getMillisecond(CP24Time2a self) +CP24Time2a_getMillisecond(const CP24Time2a self) { return getMillisecond(self->encodedValue); } @@ -187,7 +187,7 @@ CP24Time2a_setMillisecond(CP24Time2a self, int value) } int -CP24Time2a_getSecond(CP24Time2a self) +CP24Time2a_getSecond(const CP24Time2a self) { return getSecond(self->encodedValue); } @@ -199,7 +199,7 @@ CP24Time2a_setSecond(CP24Time2a self, int value) } int -CP24Time2a_getMinute(CP24Time2a self) +CP24Time2a_getMinute(const CP24Time2a self) { return getMinute(self->encodedValue); } @@ -212,7 +212,7 @@ CP24Time2a_setMinute(CP24Time2a self, int value) } bool -CP24Time2a_isInvalid(CP24Time2a self) +CP24Time2a_isInvalid(const CP24Time2a self) { return isInvalid(self->encodedValue); } @@ -224,7 +224,7 @@ CP24Time2a_setInvalid(CP24Time2a self, bool value) } bool -CP24Time2a_isSubstituted(CP24Time2a self) +CP24Time2a_isSubstituted(const CP24Time2a self) { return isSubstituted(self->encodedValue); } @@ -322,7 +322,7 @@ CP32Time2a_create(CP32Time2a self) } bool -CP32Time2a_getFromBuffer (CP32Time2a self, uint8_t* msg, int msgSize, int startIndex) +CP32Time2a_getFromBuffer (CP32Time2a self, const uint8_t* msg, int msgSize, int startIndex) { if (msgSize < startIndex + 4) return false; @@ -336,7 +336,7 @@ CP32Time2a_getFromBuffer (CP32Time2a self, uint8_t* msg, int msgSize, int startI } int -CP32Time2a_getMillisecond(CP32Time2a self) +CP32Time2a_getMillisecond(const CP32Time2a self) { return (self->encodedValue[0] + (self->encodedValue[1] * 0x100)) % 1000; } @@ -352,7 +352,7 @@ CP32Time2a_setMillisecond(CP32Time2a self, int value) int -CP32Time2a_getSecond(CP32Time2a self) +CP32Time2a_getSecond(const CP32Time2a self) { return getSecond(self->encodedValue); } @@ -364,7 +364,7 @@ CP32Time2a_setSecond(CP32Time2a self, int value) } int -CP32Time2a_getMinute(CP32Time2a self) +CP32Time2a_getMinute(const CP32Time2a self) { return getMinute(self->encodedValue); } @@ -377,7 +377,7 @@ CP32Time2a_setMinute(CP32Time2a self, int value) } bool -CP32Time2a_isInvalid(CP32Time2a self) +CP32Time2a_isInvalid(const CP32Time2a self) { return isInvalid(self->encodedValue); } @@ -389,7 +389,7 @@ CP32Time2a_setInvalid(CP32Time2a self, bool value) } bool -CP32Time2a_isSubstituted(CP32Time2a self) +CP32Time2a_isSubstituted(const CP32Time2a self) { return isSubstituted(self->encodedValue); } @@ -401,7 +401,7 @@ CP32Time2a_setSubstituted(CP32Time2a self, bool value) } int -CP32Time2a_getHour(CP32Time2a self) +CP32Time2a_getHour(const CP32Time2a self) { return (self->encodedValue[3] & 0x1f); } @@ -413,7 +413,7 @@ CP32Time2a_setHour(CP32Time2a self, int value) } bool -CP32Time2a_isSummerTime(CP32Time2a self) +CP32Time2a_isSummerTime(const CP32Time2a self) { return ((self->encodedValue[3] & 0x80) != 0); } @@ -515,7 +515,7 @@ CP56Time2a_setFromMsTimestamp(CP56Time2a self, uint64_t timestamp) uint64_t -CP56Time2a_toMsTimestamp(CP56Time2a self) +CP56Time2a_toMsTimestamp(const CP56Time2a self) { struct tm tmTime; @@ -534,7 +534,7 @@ CP56Time2a_toMsTimestamp(CP56Time2a self) } /* private */ bool -CP56Time2a_getFromBuffer(CP56Time2a self, uint8_t* msg, int msgSize, int startIndex) +CP56Time2a_getFromBuffer(CP56Time2a self, const uint8_t* msg, int msgSize, int startIndex) { if (msgSize < startIndex + 7) return false; @@ -548,7 +548,7 @@ CP56Time2a_getFromBuffer(CP56Time2a self, uint8_t* msg, int msgSize, int startIn } int -CP56Time2a_getMillisecond(CP56Time2a self) +CP56Time2a_getMillisecond(const CP56Time2a self) { return getMillisecond(self->encodedValue); } @@ -560,7 +560,7 @@ CP56Time2a_setMillisecond(CP56Time2a self, int value) } int -CP56Time2a_getSecond(CP56Time2a self) +CP56Time2a_getSecond(const CP56Time2a self) { return getSecond(self->encodedValue); } @@ -572,7 +572,7 @@ CP56Time2a_setSecond(CP56Time2a self, int value) } int -CP56Time2a_getMinute(CP56Time2a self) +CP56Time2a_getMinute(const CP56Time2a self) { return getMinute(self->encodedValue); } @@ -584,7 +584,7 @@ CP56Time2a_setMinute(CP56Time2a self, int value) } int -CP56Time2a_getHour(CP56Time2a self) +CP56Time2a_getHour(const CP56Time2a self) { return (self->encodedValue[3] & 0x1f); } @@ -596,7 +596,7 @@ CP56Time2a_setHour(CP56Time2a self, int value) } int -CP56Time2a_getDayOfWeek(CP56Time2a self) +CP56Time2a_getDayOfWeek(const CP56Time2a self) { return ((self->encodedValue[4] & 0xe0) >> 5); } @@ -608,7 +608,7 @@ CP56Time2a_setDayOfWeek(CP56Time2a self, int value) } int -CP56Time2a_getDayOfMonth(CP56Time2a self) +CP56Time2a_getDayOfMonth(const CP56Time2a self) { return (self->encodedValue[4] & 0x1f); } @@ -620,7 +620,7 @@ CP56Time2a_setDayOfMonth(CP56Time2a self, int value) } int -CP56Time2a_getMonth(CP56Time2a self) +CP56Time2a_getMonth(const CP56Time2a self) { return (self->encodedValue[5] & 0x0f); } @@ -632,7 +632,7 @@ CP56Time2a_setMonth(CP56Time2a self, int value) } int -CP56Time2a_getYear(CP56Time2a self) +CP56Time2a_getYear(const CP56Time2a self) { return (self->encodedValue[6] & 0x7f); } @@ -646,7 +646,7 @@ CP56Time2a_setYear(CP56Time2a self, int value) } bool -CP56Time2a_isSummerTime(CP56Time2a self) +CP56Time2a_isSummerTime(const CP56Time2a self) { return ((self->encodedValue[3] & 0x80) != 0); } @@ -661,7 +661,7 @@ CP56Time2a_setSummerTime(CP56Time2a self, bool value) } bool -CP56Time2a_isInvalid(CP56Time2a self) +CP56Time2a_isInvalid(const CP56Time2a self) { return isInvalid(self->encodedValue); } @@ -673,7 +673,7 @@ CP56Time2a_setInvalid(CP56Time2a self, bool value) } bool -CP56Time2a_isSubstituted(CP56Time2a self) +CP56Time2a_isSubstituted(const CP56Time2a self) { return isSubstituted(self->encodedValue); } diff --git a/lib60870-C/src/iec60870/cs101/cs101_asdu.c b/lib60870-C/src/iec60870/cs101/cs101_asdu.c index bd4b394b..3e23a9c0 100644 --- a/lib60870-C/src/iec60870/cs101/cs101_asdu.c +++ b/lib60870-C/src/iec60870/cs101/cs101_asdu.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -52,7 +52,7 @@ asduFrame_setNextByte(Frame self, uint8_t byte) } static void -asduFrame_appendBytes(Frame self, uint8_t* bytes, int numberOfBytes) +asduFrame_appendBytes(Frame self, const uint8_t* bytes, int numberOfBytes) { ASDUFrame frame = (ASDUFrame) self; @@ -1086,8 +1086,6 @@ CS101_ASDU_getElementEx(CS101_ASDU self, InformationObject io, int index) case M_EI_NA_1: /* 70 - End of Initialization */ - elementSize = self->parameters->sizeOfIOA + 1; - retVal = (InformationObject) EndOfInitialization_getFromBuffer((EndOfInitialization) io, self->parameters, self->payload, self->payloadSize, 0); break; diff --git a/lib60870-C/src/iec60870/cs101/cs101_information_objects.c b/lib60870-C/src/iec60870/cs101/cs101_information_objects.c index ce704531..5ef2270c 100644 --- a/lib60870-C/src/iec60870/cs101/cs101_information_objects.c +++ b/lib60870-C/src/iec60870/cs101/cs101_information_objects.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -61,7 +61,7 @@ SingleEvent_setEventState(SingleEvent self, EventState eventState) } EventState -SingleEvent_getEventState(SingleEvent self) +SingleEvent_getEventState(const SingleEvent self) { return (EventState) (*self & 0x3); } @@ -79,19 +79,19 @@ SingleEvent_setQDP(SingleEvent self, QualityDescriptorP qdp) } QualityDescriptorP -SingleEvent_getQDP(SingleEvent self) +SingleEvent_getQDP(const SingleEvent self) { return (QualityDescriptor) (*self & 0xfc); } uint16_t -StatusAndStatusChangeDetection_getSTn(StatusAndStatusChangeDetection self) +StatusAndStatusChangeDetection_getSTn(const StatusAndStatusChangeDetection self) { return (uint16_t) (self->encodedValue[0] + 256 * self->encodedValue[1]); } uint16_t -StatusAndStatusChangeDetection_getCDn(StatusAndStatusChangeDetection self) +StatusAndStatusChangeDetection_getCDn(const StatusAndStatusChangeDetection self) { return (uint16_t) (self->encodedValue[2] + 256 * self->encodedValue[3]); } @@ -104,7 +104,7 @@ StatusAndStatusChangeDetection_setSTn(StatusAndStatusChangeDetection self, uint1 } bool -StatusAndStatusChangeDetection_getST(StatusAndStatusChangeDetection self, int index) +StatusAndStatusChangeDetection_getST(const StatusAndStatusChangeDetection self, int index) { if ((index >= 0) && (index < 16)) return ((int) (StatusAndStatusChangeDetection_getSTn(self) & (1 << index)) != 0); @@ -113,7 +113,7 @@ StatusAndStatusChangeDetection_getST(StatusAndStatusChangeDetection self, int in } bool -StatusAndStatusChangeDetection_getCD(StatusAndStatusChangeDetection self, int index) +StatusAndStatusChangeDetection_getCD(const StatusAndStatusChangeDetection self, int index) { if ((index >= 0) && (index < 16)) return ((int) (StatusAndStatusChangeDetection_getCDn(self) & (1 << index)) != 0); @@ -184,7 +184,7 @@ InformationObject_encodeBase(InformationObject self, Frame frame, CS101_AppLayer } int -InformationObject_ParseObjectAddress(CS101_AppLayerParameters parameters, uint8_t* msg, int startIndex) +InformationObject_ParseObjectAddress(CS101_AppLayerParameters parameters, const uint8_t* msg, int startIndex) { /* parse information object address */ int ioa = msg [startIndex]; @@ -504,12 +504,12 @@ StepPositionWithCP56Time2a_destroy(StepPositionWithCP56Time2a self) StepPositionWithCP56Time2a StepPositionWithCP56Time2a_create(StepPositionWithCP56Time2a self, int ioa, int value, bool isTransient, - QualityDescriptor quality, CP56Time2a timestamp) + QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (StepPositionWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sStepPositionWithCP56Time2a)); - if (self != NULL) { + if (self) { StepPositionWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -559,7 +559,7 @@ StepPositionWithCP56Time2a_getFromBuffer(StepPositionWithCP56Time2a self, CS101_ if (self == NULL) self = (StepPositionWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sStepPositionWithCP56Time2a)); - if (self != NULL) { + if (self) { StepPositionWithCP56Time2a_initialize(self); if (!isSequence) { @@ -624,12 +624,12 @@ StepPositionWithCP24Time2a_destroy(StepPositionWithCP24Time2a self) StepPositionWithCP24Time2a StepPositionWithCP24Time2a_create(StepPositionWithCP24Time2a self, int ioa, int value, bool isTransient, - QualityDescriptor quality, CP24Time2a timestamp) + QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (StepPositionWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sStepPositionWithCP24Time2a)); - if (self != NULL) { + if (self) { StepPositionWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -680,7 +680,7 @@ StepPositionWithCP24Time2a_getFromBuffer(StepPositionWithCP24Time2a self, CS101_ if (self == NULL) self = (StepPositionWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sStepPositionWithCP24Time2a)); - if (self != NULL) { + if (self) { StepPositionWithCP24Time2a_initialize(self); if (!isSequence) { @@ -749,12 +749,13 @@ DoublePointInformation_create(DoublePointInformation self, int ioa, DoublePointV if (self == NULL) self = (DoublePointInformation) GLOBAL_CALLOC(1, sizeof(struct sDoublePointInformation)); - if (self != NULL) + if (self) { DoublePointInformation_initialize(self); - self->objectAddress = ioa; - self->value = value; - self->quality = quality & 0xf0; + self->objectAddress = ioa; + self->value = value; + self->quality = quality & 0xf0; + } return self; } @@ -789,7 +790,7 @@ DoublePointInformation_getFromBuffer(DoublePointInformation self, CS101_AppLayer if (self == NULL) self = (DoublePointInformation) GLOBAL_MALLOC(sizeof(struct sDoublePointInformation)); - if (self != NULL) { + if (self) { DoublePointInformation_initialize(self); if (!isSequence) { @@ -857,12 +858,12 @@ DoublePointWithCP24Time2a_initialize(DoublePointWithCP24Time2a self) DoublePointWithCP24Time2a DoublePointWithCP24Time2a_create(DoublePointWithCP24Time2a self, int ioa, DoublePointValue value, - QualityDescriptor quality, CP24Time2a timestamp) + QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (DoublePointWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sDoublePointWithCP24Time2a)); - if (self != NULL) { + if (self) { DoublePointWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -898,7 +899,7 @@ DoublePointWithCP24Time2a_getFromBuffer(DoublePointWithCP24Time2a self, CS101_Ap if (self == NULL) self = (DoublePointWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sDoublePointWithCP24Time2a)); - if (self != NULL) { + if (self) { DoublePointWithCP24Time2a_initialize(self); if (!isSequence) { @@ -921,7 +922,6 @@ DoublePointWithCP24Time2a_getFromBuffer(DoublePointWithCP24Time2a self, CS101_Ap return self; } - /******************************************* * DoublePointWithCP56Time2a *******************************************/ @@ -948,8 +948,6 @@ DoublePointWithCP56Time2a_encode(DoublePointWithCP56Time2a self, Frame frame, CS return true; } - - struct sInformationObjectVFT doublePointWithCP56Time2aVFT = { (EncodeFunction) DoublePointWithCP56Time2a_encode, (DestroyFunction) DoublePointWithCP56Time2a_destroy @@ -970,12 +968,12 @@ DoublePointWithCP56Time2a_initialize(DoublePointWithCP56Time2a self) DoublePointWithCP56Time2a DoublePointWithCP56Time2a_create(DoublePointWithCP56Time2a self, int ioa, DoublePointValue value, - QualityDescriptor quality, CP56Time2a timestamp) + QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (DoublePointWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sDoublePointWithCP56Time2a)); - if (self != NULL) { + if (self) { DoublePointWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -987,7 +985,6 @@ DoublePointWithCP56Time2a_create(DoublePointWithCP56Time2a self, int ioa, Double return self; } - CP56Time2a DoublePointWithCP56Time2a_getTimestamp(DoublePointWithCP56Time2a self) { @@ -1012,7 +1009,7 @@ DoublePointWithCP56Time2a_getFromBuffer(DoublePointWithCP56Time2a self, CS101_Ap if (self == NULL) self = (DoublePointWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sDoublePointWithCP56Time2a)); - if (self != NULL) { + if (self) { DoublePointWithCP56Time2a_initialize(self); if (!isSequence) { @@ -1035,7 +1032,6 @@ DoublePointWithCP56Time2a_getFromBuffer(DoublePointWithCP56Time2a self, CS101_Ap return self; } - /******************************************* * SinglePointWithCP24Time2a *******************************************/ @@ -1083,12 +1079,12 @@ SinglePointWithCP24Time2a_initialize(SinglePointWithCP24Time2a self) SinglePointWithCP24Time2a SinglePointWithCP24Time2a_create(SinglePointWithCP24Time2a self, int ioa, bool value, - QualityDescriptor quality, CP24Time2a timestamp) + QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (SinglePointWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sSinglePointWithCP24Time2a)); - if (self != NULL) { + if (self) { SinglePointWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -1124,7 +1120,7 @@ SinglePointWithCP24Time2a_getFromBuffer(SinglePointWithCP24Time2a self, CS101_Ap if (self == NULL) self = (SinglePointWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sSinglePointWithCP24Time2a)); - if (self != NULL) { + if (self) { SinglePointWithCP24Time2a_initialize(self); if (!isSequence) { @@ -1147,8 +1143,6 @@ SinglePointWithCP24Time2a_getFromBuffer(SinglePointWithCP24Time2a self, CS101_Ap return self; } - - /******************************************* * SinglePointWithCP56Time2a *******************************************/ @@ -1176,7 +1170,6 @@ SinglePointWithCP56Time2a_encode(SinglePointWithCP56Time2a self, Frame frame, CS return true; } - struct sInformationObjectVFT singlePointWithCP56Time2aVFT = { (EncodeFunction) SinglePointWithCP56Time2a_encode, (DestroyFunction) SinglePointWithCP56Time2a_destroy @@ -1191,12 +1184,12 @@ SinglePointWithCP56Time2a_initialize(SinglePointWithCP56Time2a self) SinglePointWithCP56Time2a SinglePointWithCP56Time2a_create(SinglePointWithCP56Time2a self, int ioa, bool value, - QualityDescriptor quality, CP56Time2a timestamp) + QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (SinglePointWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sSinglePointWithCP56Time2a)); - if (self != NULL) { + if (self) { SinglePointWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -1220,7 +1213,6 @@ SinglePointWithCP56Time2a_getTimestamp(SinglePointWithCP56Time2a self) return &(self->timestamp); } - SinglePointWithCP56Time2a SinglePointWithCP56Time2a_getFromBuffer(SinglePointWithCP56Time2a self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex, bool isSequence) @@ -1239,7 +1231,7 @@ SinglePointWithCP56Time2a_getFromBuffer(SinglePointWithCP56Time2a self, CS101_Ap if (self == NULL) self = (SinglePointWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSinglePointWithCP56Time2a)); - if (self != NULL) { + if (self) { SinglePointWithCP56Time2a_initialize(self); if (!isSequence) { @@ -1262,8 +1254,6 @@ SinglePointWithCP56Time2a_getFromBuffer(SinglePointWithCP56Time2a self, CS101_Ap return self; } - - /********************************************** * BitString32 **********************************************/ @@ -1320,7 +1310,7 @@ BitString32_createEx(BitString32 self, int ioa, uint32_t value, QualityDescripto if (self == NULL) self = (BitString32) GLOBAL_CALLOC(1, sizeof(struct sBitString32)); - if (self != NULL) { + if (self) { BitString32_initialize(self); self->objectAddress = ioa; @@ -1361,7 +1351,7 @@ BitString32_getFromBuffer(BitString32 self, CS101_AppLayerParameters parameters, if (self == NULL) self = (BitString32) GLOBAL_MALLOC(sizeof(struct sBitString32)); - if (self != NULL) { + if (self) { BitString32_initialize(self); if (!isSequence) { @@ -1433,18 +1423,18 @@ Bitstring32WithCP24Time2a_destroy(Bitstring32WithCP24Time2a self) } Bitstring32WithCP24Time2a -Bitstring32WithCP24Time2a_create(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, CP24Time2a timestamp) +Bitstring32WithCP24Time2a_create(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, const CP24Time2a timestamp) { return Bitstring32WithCP24Time2a_createEx(self, ioa, value, IEC60870_QUALITY_GOOD, timestamp); } Bitstring32WithCP24Time2a -Bitstring32WithCP24Time2a_createEx(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, QualityDescriptor quality, CP24Time2a timestamp) +Bitstring32WithCP24Time2a_createEx(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (Bitstring32WithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sBitstring32WithCP24Time2a)); - if (self != NULL) { + if (self) { Bitstring32WithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -1480,7 +1470,7 @@ Bitstring32WithCP24Time2a_getFromBuffer(Bitstring32WithCP24Time2a self, CS101_Ap if (self == NULL) self = (Bitstring32WithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sBitstring32WithCP24Time2a)); - if (self != NULL) { + if (self) { Bitstring32WithCP24Time2a_initialize(self); if (!isSequence) { @@ -1555,18 +1545,18 @@ Bitstring32WithCP56Time2a_destroy(Bitstring32WithCP56Time2a self) } Bitstring32WithCP56Time2a -Bitstring32WithCP56Time2a_create(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, CP56Time2a timestamp) +Bitstring32WithCP56Time2a_create(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, const CP56Time2a timestamp) { return Bitstring32WithCP56Time2a_createEx(self, ioa, value, IEC60870_QUALITY_GOOD, timestamp); } Bitstring32WithCP56Time2a -Bitstring32WithCP56Time2a_createEx(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, QualityDescriptor quality, CP56Time2a timestamp) +Bitstring32WithCP56Time2a_createEx(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (Bitstring32WithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sBitstring32WithCP56Time2a)); - if (self != NULL) { + if (self) { Bitstring32WithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -1578,7 +1568,6 @@ Bitstring32WithCP56Time2a_createEx(Bitstring32WithCP56Time2a self, int ioa, uint return self; } - CP56Time2a Bitstring32WithCP56Time2a_getTimestamp(Bitstring32WithCP56Time2a self) { @@ -1603,7 +1592,7 @@ Bitstring32WithCP56Time2a_getFromBuffer(Bitstring32WithCP56Time2a self, CS101_Ap if (self == NULL) self = (Bitstring32WithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sBitstring32WithCP56Time2a)); - if (self != NULL) { + if (self) { Bitstring32WithCP56Time2a_initialize(self); if (!isSequence) { @@ -1630,13 +1619,12 @@ Bitstring32WithCP56Time2a_getFromBuffer(Bitstring32WithCP56Time2a self, CS101_Ap return self; } - /********************************************** * MeasuredValueNormalized **********************************************/ static int -getScaledValue(uint8_t* encodedValue) +getScaledValue(const uint8_t* encodedValue) { int value; @@ -1705,7 +1693,7 @@ MeasuredValueNormalized_create(MeasuredValueNormalized self, int ioa, float valu if (self == NULL) self = (MeasuredValueNormalized) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueNormalized)); - if (self != NULL) { + if (self) { MeasuredValueNormalized_initialize(self); self->objectAddress = ioa; @@ -1763,7 +1751,7 @@ MeasuredValueNormalized_getFromBuffer(MeasuredValueNormalized self, CS101_AppLay if (self == NULL) self = (MeasuredValueNormalized) GLOBAL_MALLOC(sizeof(struct sMeasuredValueNormalized)); - if (self != NULL) { + if (self) { MeasuredValueNormalized_initialize(self); if (!isSequence) { @@ -1798,7 +1786,9 @@ ParameterNormalizedValue_create(ParameterNormalizedValue self, int ioa, float va ParameterNormalizedValue pvn = MeasuredValueNormalized_create(self, ioa, value, (QualityDescriptor) quality); - pvn->type = P_ME_NA_1; + if (pvn) { + pvn->type = P_ME_NA_1; + } return pvn; } @@ -1828,8 +1818,9 @@ ParameterNormalizedValue_getFromBuffer(ParameterNormalizedValue self, CS101_AppL MeasuredValueNormalized pvn = MeasuredValueNormalized_getFromBuffer(self, parameters, msg, msgSize, startIndex, false); - if (pvn) + if (pvn) { pvn->type = P_ME_NA_1; + } return (ParameterNormalizedValue) pvn; } @@ -1879,7 +1870,7 @@ MeasuredValueNormalizedWithoutQuality_create(MeasuredValueNormalizedWithoutQuali if (self == NULL) self = (MeasuredValueNormalizedWithoutQuality) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueNormalizedWithoutQuality)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithoutQuality_initialize(self); self->objectAddress = ioa; @@ -1929,7 +1920,7 @@ MeasuredValueNormalizedWithoutQuality_getFromBuffer(MeasuredValueNormalizedWitho if (self == NULL) self = (MeasuredValueNormalizedWithoutQuality) GLOBAL_MALLOC(sizeof(struct sMeasuredValueNormalizedWithoutQuality)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithoutQuality_initialize(self); if (!isSequence) { @@ -1985,12 +1976,12 @@ MeasuredValueNormalizedWithCP24Time2a_destroy(MeasuredValueNormalizedWithCP24Tim MeasuredValueNormalizedWithCP24Time2a MeasuredValueNormalizedWithCP24Time2a_create(MeasuredValueNormalizedWithCP24Time2a self, int ioa, - float value, QualityDescriptor quality, CP24Time2a timestamp) + float value, QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (MeasuredValueNormalizedWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueNormalizedWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -2004,7 +1995,6 @@ MeasuredValueNormalizedWithCP24Time2a_create(MeasuredValueNormalizedWithCP24Time return self; } - CP24Time2a MeasuredValueNormalizedWithCP24Time2a_getTimestamp(MeasuredValueNormalizedWithCP24Time2a self) { @@ -2039,7 +2029,7 @@ MeasuredValueNormalizedWithCP24Time2a_getFromBuffer(MeasuredValueNormalizedWithC if (self == NULL) self = (MeasuredValueNormalizedWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueNormalizedWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithCP24Time2a_initialize(self); if (!isSequence) { @@ -2101,12 +2091,12 @@ MeasuredValueNormalizedWithCP56Time2a_destroy(MeasuredValueNormalizedWithCP56Tim MeasuredValueNormalizedWithCP56Time2a MeasuredValueNormalizedWithCP56Time2a_create(MeasuredValueNormalizedWithCP56Time2a self, int ioa, - float value, QualityDescriptor quality, CP56Time2a timestamp) + float value, QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (MeasuredValueNormalizedWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueNormalizedWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -2120,7 +2110,6 @@ MeasuredValueNormalizedWithCP56Time2a_create(MeasuredValueNormalizedWithCP56Time return self; } - CP56Time2a MeasuredValueNormalizedWithCP56Time2a_getTimestamp(MeasuredValueNormalizedWithCP56Time2a self) { @@ -2155,7 +2144,7 @@ MeasuredValueNormalizedWithCP56Time2a_getFromBuffer(MeasuredValueNormalizedWithC if (self == NULL) self = (MeasuredValueNormalizedWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueNormalizedWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueNormalizedWithCP56Time2a_initialize(self); if (!isSequence) { @@ -2177,8 +2166,6 @@ MeasuredValueNormalizedWithCP56Time2a_getFromBuffer(MeasuredValueNormalizedWithC return self; } - - /******************************************* * MeasuredValueScaled *******************************************/ @@ -2207,7 +2194,7 @@ MeasuredValueScaled_create(MeasuredValueScaled self, int ioa, int value, Quality if (self == NULL) self = (MeasuredValueScaled) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueScaled)); - if (self != NULL) { + if (self) { MeasuredValueScaled_initialize(self); self->objectAddress = ioa; @@ -2268,7 +2255,7 @@ MeasuredValueScaled_getFromBuffer(MeasuredValueScaled self, CS101_AppLayerParame if (self == NULL) self = (MeasuredValueScaled) GLOBAL_MALLOC(sizeof(struct sMeasuredValueScaled)); - if (self != NULL) { + if (self) { MeasuredValueScaled_initialize(self); if (!isSequence) { @@ -2303,7 +2290,9 @@ ParameterScaledValue_create(ParameterScaledValue self, int ioa, int value, Quali ParameterScaledValue pvn = MeasuredValueScaled_create(self, ioa, value, qpm); - pvn->type = P_ME_NB_1; + if (pvn) { + pvn->type = P_ME_NB_1; + } return pvn; } @@ -2333,13 +2322,13 @@ ParameterScaledValue_getFromBuffer(ParameterScaledValue self, CS101_AppLayerPara MeasuredValueScaled psv = MeasuredValueScaled_getFromBuffer(self, parameters, msg, msgSize, startIndex, false); - if (psv) + if (psv) { psv->type = P_ME_NB_1; + } return (ParameterScaledValue) psv; } - /******************************************* * MeasuredValueScaledWithCP24Time2a *******************************************/ @@ -2379,12 +2368,12 @@ MeasuredValueScaledWithCP24Time2a_destroy(MeasuredValueScaledWithCP24Time2a self MeasuredValueScaledWithCP24Time2a MeasuredValueScaledWithCP24Time2a_create(MeasuredValueScaledWithCP24Time2a self, int ioa, - int value, QualityDescriptor quality, CP24Time2a timestamp) + int value, QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (MeasuredValueScaledWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueScaledWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueScaledWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -2430,7 +2419,7 @@ MeasuredValueScaledWithCP24Time2a_getFromBuffer(MeasuredValueScaledWithCP24Time2 if (self == NULL) self = (MeasuredValueScaledWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueScaledWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueScaledWithCP24Time2a_initialize(self); if (!isSequence) { @@ -2492,12 +2481,12 @@ MeasuredValueScaledWithCP56Time2a_destroy(MeasuredValueScaledWithCP56Time2a self MeasuredValueScaledWithCP56Time2a MeasuredValueScaledWithCP56Time2a_create(MeasuredValueScaledWithCP56Time2a self, int ioa, - int value, QualityDescriptor quality, CP56Time2a timestamp) + int value, QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (MeasuredValueScaledWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueScaledWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueScaledWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -2525,7 +2514,6 @@ MeasuredValueScaledWithCP56Time2a_setTimestamp(MeasuredValueScaledWithCP56Time2a } } - MeasuredValueScaledWithCP56Time2a MeasuredValueScaledWithCP56Time2a_getFromBuffer(MeasuredValueScaledWithCP56Time2a self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex, bool isSequence) @@ -2544,7 +2532,7 @@ MeasuredValueScaledWithCP56Time2a_getFromBuffer(MeasuredValueScaledWithCP56Time2 if (self == NULL) self = (MeasuredValueScaledWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueScaledWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueScaledWithCP56Time2a_initialize(self); if (!isSequence) { @@ -2621,7 +2609,7 @@ MeasuredValueShort_create(MeasuredValueShort self, int ioa, float value, Quality if (self == NULL) self = (MeasuredValueShort) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueShort)); - if (self != NULL) { + if (self) { MeasuredValueShort_initialize(self); self->objectAddress = ioa; @@ -2668,7 +2656,7 @@ MeasuredValueShort_getFromBuffer(MeasuredValueShort self, CS101_AppLayerParamete if (self == NULL) self = (MeasuredValueShort) GLOBAL_MALLOC(sizeof(struct sMeasuredValueShort)); - if (self != NULL) { + if (self) { MeasuredValueShort_initialize(self); if (!isSequence) { @@ -2714,7 +2702,9 @@ ParameterFloatValue_create(ParameterFloatValue self, int ioa, float value, Quali ParameterFloatValue pvf = MeasuredValueShort_create(self, ioa, value, (QualityDescriptor) qpm); - pvf->type = P_ME_NC_1; + if (pvf) { + pvf->type = P_ME_NC_1; + } return pvf; } @@ -2744,8 +2734,9 @@ ParameterFloatValue_getFromBuffer(ParameterFloatValue self, CS101_AppLayerParame ParameterFloatValue psv = MeasuredValueShort_getFromBuffer(self, parameters, msg, msgSize, startIndex, false); - if (psv) + if (psv) { psv->type = P_ME_NC_1; + } return (ParameterFloatValue) psv; } @@ -2789,12 +2780,12 @@ MeasuredValueShortWithCP24Time2a_destroy(MeasuredValueShortWithCP24Time2a self) MeasuredValueShortWithCP24Time2a MeasuredValueShortWithCP24Time2a_create(MeasuredValueShortWithCP24Time2a self, int ioa, - float value, QualityDescriptor quality, CP24Time2a timestamp) + float value, QualityDescriptor quality, const CP24Time2a timestamp) { if (self == NULL) self = (MeasuredValueShortWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueShortWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueShortWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -2840,7 +2831,7 @@ MeasuredValueShortWithCP24Time2a_getFromBuffer(MeasuredValueShortWithCP24Time2a if (self == NULL) self = (MeasuredValueShortWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueShortWithCP24Time2a)); - if (self != NULL) { + if (self) { MeasuredValueShortWithCP24Time2a_initialize(self); if (!isSequence) { @@ -2912,12 +2903,12 @@ MeasuredValueShortWithCP56Time2a_destroy(MeasuredValueShortWithCP56Time2a self) MeasuredValueShortWithCP56Time2a MeasuredValueShortWithCP56Time2a_create(MeasuredValueShortWithCP56Time2a self, int ioa, - float value, QualityDescriptor quality, CP56Time2a timestamp) + float value, QualityDescriptor quality, const CP56Time2a timestamp) { if (self == NULL) self = (MeasuredValueShortWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sMeasuredValueShortWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueShortWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -2963,7 +2954,7 @@ MeasuredValueShortWithCP56Time2a_getFromBuffer(MeasuredValueShortWithCP56Time2a if (self == NULL) self = (MeasuredValueShortWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sMeasuredValueShortWithCP56Time2a)); - if (self != NULL) { + if (self) { MeasuredValueShortWithCP56Time2a_initialize(self); if (!isSequence) { @@ -2996,7 +2987,6 @@ MeasuredValueShortWithCP56Time2a_getFromBuffer(MeasuredValueShortWithCP56Time2a return self; } - /******************************************* * IntegratedTotals *******************************************/ @@ -3035,12 +3025,12 @@ IntegratedTotals_destroy(IntegratedTotals self) } IntegratedTotals -IntegratedTotals_create(IntegratedTotals self, int ioa, BinaryCounterReading value) +IntegratedTotals_create(IntegratedTotals self, int ioa, const BinaryCounterReading value) { if (self == NULL) self = (IntegratedTotals) GLOBAL_CALLOC(1, sizeof(struct sIntegratedTotals)); - if (self != NULL) { + if (self) { IntegratedTotals_initialize(self); self->objectAddress = ioa; @@ -3083,7 +3073,7 @@ IntegratedTotals_getFromBuffer(IntegratedTotals self, CS101_AppLayerParameters p if (self == NULL) self = (IntegratedTotals) GLOBAL_MALLOC(sizeof(struct sIntegratedTotals)); - if (self != NULL) { + if (self) { IntegratedTotals_initialize(self); if (!isSequence) { @@ -3141,12 +3131,12 @@ IntegratedTotalsWithCP24Time2a_destroy(IntegratedTotalsWithCP24Time2a self) IntegratedTotalsWithCP24Time2a IntegratedTotalsWithCP24Time2a_create(IntegratedTotalsWithCP24Time2a self, int ioa, - BinaryCounterReading value, CP24Time2a timestamp) + const BinaryCounterReading value, const CP24Time2a timestamp) { if (self == NULL) self = (IntegratedTotalsWithCP24Time2a) GLOBAL_CALLOC(1, sizeof(struct sIntegratedTotalsWithCP24Time2a)); - if (self != NULL) { + if (self) { IntegratedTotalsWithCP24Time2a_initialize(self); self->objectAddress = ioa; @@ -3157,7 +3147,6 @@ IntegratedTotalsWithCP24Time2a_create(IntegratedTotalsWithCP24Time2a self, int i return self; } - CP24Time2a IntegratedTotalsWithCP24Time2a_getTimestamp(IntegratedTotalsWithCP24Time2a self) { @@ -3174,7 +3163,6 @@ IntegratedTotalsWithCP24Time2a_setTimestamp(IntegratedTotalsWithCP24Time2a self, } } - IntegratedTotalsWithCP24Time2a IntegratedTotalsWithCP24Time2a_getFromBuffer(IntegratedTotalsWithCP24Time2a self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex, bool isSequence) @@ -3193,7 +3181,7 @@ IntegratedTotalsWithCP24Time2a_getFromBuffer(IntegratedTotalsWithCP24Time2a self if (self == NULL) self = (IntegratedTotalsWithCP24Time2a) GLOBAL_MALLOC(sizeof(struct sIntegratedTotalsWithCP24Time2a)); - if (self != NULL) { + if (self) { IntegratedTotalsWithCP24Time2a_initialize(self); if (!isSequence) { @@ -3255,12 +3243,12 @@ IntegratedTotalsWithCP56Time2a_destroy(IntegratedTotalsWithCP56Time2a self) IntegratedTotalsWithCP56Time2a IntegratedTotalsWithCP56Time2a_create(IntegratedTotalsWithCP56Time2a self, int ioa, - BinaryCounterReading value, CP56Time2a timestamp) + const BinaryCounterReading value, const CP56Time2a timestamp) { if (self == NULL) self = (IntegratedTotalsWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sIntegratedTotalsWithCP56Time2a)); - if (self != NULL) { + if (self) { IntegratedTotalsWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -3287,7 +3275,6 @@ IntegratedTotalsWithCP56Time2a_setTimestamp(IntegratedTotalsWithCP56Time2a self, } } - IntegratedTotalsWithCP56Time2a IntegratedTotalsWithCP56Time2a_getFromBuffer(IntegratedTotalsWithCP56Time2a self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex, bool isSequence) @@ -3306,7 +3293,7 @@ IntegratedTotalsWithCP56Time2a_getFromBuffer(IntegratedTotalsWithCP56Time2a self if (self == NULL) self = (IntegratedTotalsWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sIntegratedTotalsWithCP56Time2a)); - if (self != NULL) { + if (self) { IntegratedTotalsWithCP56Time2a_initialize(self); if (!isSequence) { @@ -3328,7 +3315,6 @@ IntegratedTotalsWithCP56Time2a_getFromBuffer(IntegratedTotalsWithCP56Time2a self return self; } - /*********************************************************************** * EventOfProtectionEquipment : InformationObject ***********************************************************************/ @@ -3372,12 +3358,12 @@ EventOfProtectionEquipment_destroy(EventOfProtectionEquipment self) EventOfProtectionEquipment EventOfProtectionEquipment_create(EventOfProtectionEquipment self, int ioa, - SingleEvent event, CP16Time2a elapsedTime, CP24Time2a timestamp) + const SingleEvent event, const CP16Time2a elapsedTime, const CP24Time2a timestamp) { if (self == NULL) self = (EventOfProtectionEquipment) GLOBAL_CALLOC(1, sizeof(struct sEventOfProtectionEquipment)); - if (self != NULL) { + if (self) { EventOfProtectionEquipment_initialize(self); self->objectAddress = ioa; @@ -3407,7 +3393,7 @@ EventOfProtectionEquipment_getFromBuffer(EventOfProtectionEquipment self, CS101_ if (self == NULL) self = (EventOfProtectionEquipment) GLOBAL_MALLOC(sizeof(struct sEventOfProtectionEquipment)); - if (self != NULL) { + if (self) { EventOfProtectionEquipment_initialize(self); if (!isSequence) { @@ -3430,7 +3416,6 @@ EventOfProtectionEquipment_getFromBuffer(EventOfProtectionEquipment self, CS101_ return self; } - SingleEvent EventOfProtectionEquipment_getEvent(EventOfProtectionEquipment self) { @@ -3492,12 +3477,12 @@ EventOfProtectionEquipmentWithCP56Time2a_destroy(EventOfProtectionEquipmentWithC EventOfProtectionEquipmentWithCP56Time2a EventOfProtectionEquipmentWithCP56Time2a_create(EventOfProtectionEquipmentWithCP56Time2a self, int ioa, - SingleEvent event, CP16Time2a elapsedTime, CP56Time2a timestamp) + const SingleEvent event, const CP16Time2a elapsedTime, const CP56Time2a timestamp) { if (self == NULL) self = (EventOfProtectionEquipmentWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sEventOfProtectionEquipmentWithCP56Time2a)); - if (self != NULL) { + if (self) { EventOfProtectionEquipmentWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -3545,7 +3530,7 @@ EventOfProtectionEquipmentWithCP56Time2a_getFromBuffer(EventOfProtectionEquipmen if (self == NULL) self = (EventOfProtectionEquipmentWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sEventOfProtectionEquipmentWithCP56Time2a)); - if (self != NULL) { + if (self) { EventOfProtectionEquipmentWithCP56Time2a_initialize(self); if (!isSequence) { @@ -3613,12 +3598,12 @@ PackedStartEventsOfProtectionEquipment_destroy(PackedStartEventsOfProtectionEqui PackedStartEventsOfProtectionEquipment PackedStartEventsOfProtectionEquipment_create(PackedStartEventsOfProtectionEquipment self, int ioa, - StartEvent event, QualityDescriptorP qdp, CP16Time2a elapsedTime, CP24Time2a timestamp) + StartEvent event, QualityDescriptorP qdp, CP16Time2a const elapsedTime, const CP24Time2a timestamp) { if (self == NULL) self = (PackedStartEventsOfProtectionEquipment) GLOBAL_CALLOC(1, sizeof(struct sPackedStartEventsOfProtectionEquipment)); - if (self != NULL) { + if (self) { PackedStartEventsOfProtectionEquipment_initialize(self); self->objectAddress = ioa; @@ -3673,7 +3658,7 @@ PackedStartEventsOfProtectionEquipment_getFromBuffer(PackedStartEventsOfProtecti if (self == NULL) self = (PackedStartEventsOfProtectionEquipment) GLOBAL_MALLOC(sizeof(struct sPackedStartEventsOfProtectionEquipment)); - if (self != NULL) { + if (self) { PackedStartEventsOfProtectionEquipment_initialize(self); if (!isSequence) { @@ -3744,12 +3729,12 @@ PackedStartEventsOfProtectionEquipmentWithCP56Time2a_destroy(PackedStartEventsOf PackedStartEventsOfProtectionEquipmentWithCP56Time2a PackedStartEventsOfProtectionEquipmentWithCP56Time2a_create(PackedStartEventsOfProtectionEquipmentWithCP56Time2a self, int ioa, - StartEvent event, QualityDescriptorP qdp, CP16Time2a elapsedTime, CP56Time2a timestamp) + StartEvent event, QualityDescriptorP qdp, const CP16Time2a elapsedTime, const CP56Time2a timestamp) { if (self == NULL) self = (PackedStartEventsOfProtectionEquipmentWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sPackedStartEventsOfProtectionEquipmentWithCP56Time2a)); - if (self != NULL) { + if (self) { PackedStartEventsOfProtectionEquipmentWithCP56Time2a_initialize(self); self->objectAddress = ioa; @@ -3830,7 +3815,6 @@ PackedStartEventsOfProtectionEquipmentWithCP56Time2a_getFromBuffer(PackedStartEv return self; } - /*********************************************************************** * PacketOutputCircuitInfo : InformationObject ***********************************************************************/ @@ -3876,7 +3860,7 @@ PackedOutputCircuitInfo_destroy(PackedOutputCircuitInfo self) PackedOutputCircuitInfo PackedOutputCircuitInfo_create(PackedOutputCircuitInfo self, int ioa, - OutputCircuitInfo oci, QualityDescriptorP qdp, CP16Time2a operatingTime, CP24Time2a timestamp) + OutputCircuitInfo oci, QualityDescriptorP qdp, const CP16Time2a operatingTime, const CP24Time2a timestamp) { if (self == NULL) self = (PackedOutputCircuitInfo) GLOBAL_CALLOC(1, sizeof(struct sPackedOutputCircuitInfo)); @@ -3936,7 +3920,7 @@ PackedOutputCircuitInfo_getFromBuffer(PackedOutputCircuitInfo self, CS101_AppLay if (self == NULL) self = (PackedOutputCircuitInfo) GLOBAL_MALLOC(sizeof(struct sPackedOutputCircuitInfo)); - if (self != NULL) { + if (self) { PacketOutputCircuitInfo_initialize(self); if (!isSequence) { @@ -4007,7 +3991,7 @@ PackedOutputCircuitInfoWithCP56Time2a_destroy(PackedOutputCircuitInfoWithCP56Tim PackedOutputCircuitInfoWithCP56Time2a PackedOutputCircuitInfoWithCP56Time2a_create(PackedOutputCircuitInfoWithCP56Time2a self, int ioa, - OutputCircuitInfo oci, QualityDescriptorP qdp, CP16Time2a operatingTime, CP56Time2a timestamp) + OutputCircuitInfo oci, QualityDescriptorP qdp, const CP16Time2a operatingTime, const CP56Time2a timestamp) { if (self == NULL) self = (PackedOutputCircuitInfoWithCP56Time2a) GLOBAL_CALLOC(1, sizeof(struct sPackedOutputCircuitInfoWithCP56Time2a)); @@ -4067,7 +4051,7 @@ PackedOutputCircuitInfoWithCP56Time2a_getFromBuffer(PackedOutputCircuitInfoWithC if (self == NULL) self = (PackedOutputCircuitInfoWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sPackedOutputCircuitInfoWithCP56Time2a)); - if (self != NULL) { + if (self) { PackedOutputCircuitInfoWithCP56Time2a_initialize(self); if (!isSequence) { @@ -4135,7 +4119,7 @@ PackedSinglePointWithSCD_destroy(PackedSinglePointWithSCD self) PackedSinglePointWithSCD PackedSinglePointWithSCD_create(PackedSinglePointWithSCD self, int ioa, - StatusAndStatusChangeDetection scd, QualityDescriptor qds) + const StatusAndStatusChangeDetection scd, QualityDescriptor qds) { if (self == NULL) self = (PackedSinglePointWithSCD) GLOBAL_CALLOC(1, sizeof(struct sPackedSinglePointWithSCD)); @@ -4203,7 +4187,6 @@ PackedSinglePointWithSCD_getFromBuffer(PackedSinglePointWithSCD self, CS101_AppL return self; } - /******************************************* * SingleCommand *******************************************/ @@ -4297,7 +4280,7 @@ SingleCommand_getFromBuffer(SingleCommand self, CS101_AppLayerParameters paramet if (self == NULL) self = (SingleCommand) GLOBAL_MALLOC(sizeof(struct sSingleCommand)); - if (self != NULL) { + if (self) { SingleCommand_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -4350,7 +4333,7 @@ SingleCommandWithCP56Time2a_destroy(SingleCommandWithCP56Time2a self) } SingleCommandWithCP56Time2a -SingleCommandWithCP56Time2a_create(SingleCommandWithCP56Time2a self, int ioa, bool command, bool selectCommand, int qu, CP56Time2a timestamp) +SingleCommandWithCP56Time2a_create(SingleCommandWithCP56Time2a self, int ioa, bool command, bool selectCommand, int qu, const CP56Time2a timestamp) { if (self == NULL) self = (SingleCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSingleCommandWithCP56Time2a)); @@ -4412,7 +4395,6 @@ SingleCommandWithCP56Time2a_getFromBuffer(SingleCommandWithCP56Time2a self, CS10 return self; } - /******************************************* * DoubleCommand : InformationObject *******************************************/ @@ -4524,7 +4506,6 @@ DoubleCommand_getFromBuffer(DoubleCommand self, CS101_AppLayerParameters paramet * DoubleCommandWithCP56Time2a : DoubleCommand **********************************************/ - static bool DoubleCommandWithCP56Time2a_encode(DoubleCommandWithCP56Time2a self, Frame frame, CS101_AppLayerParameters parameters, bool isSequence) { @@ -4559,7 +4540,7 @@ DoubleCommandWithCP56Time2a_destroy(DoubleCommandWithCP56Time2a self) } DoubleCommandWithCP56Time2a -DoubleCommandWithCP56Time2a_create(DoubleCommandWithCP56Time2a self, int ioa, int command, bool selectCommand, int qu, CP56Time2a timestamp) +DoubleCommandWithCP56Time2a_create(DoubleCommandWithCP56Time2a self, int ioa, int command, bool selectCommand, int qu, const CP56Time2a timestamp) { if (self == NULL) self = (DoubleCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sDoubleCommandWithCP56Time2a)); @@ -4616,7 +4597,7 @@ DoubleCommandWithCP56Time2a_getFromBuffer(DoubleCommandWithCP56Time2a self, CS10 if (self == NULL) self = (DoubleCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sDoubleCommandWithCP56Time2a)); - if (self != NULL) { + if (self) { DoubleCommandWithCP56Time2a_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -4748,7 +4729,6 @@ StepCommand_getFromBuffer(StepCommand self, CS101_AppLayerParameters parameters, return self; } - /************************************************* * StepCommandWithCP56Time2a : InformationObject *************************************************/ @@ -4787,7 +4767,7 @@ StepCommandWithCP56Time2a_destroy(StepCommandWithCP56Time2a self) } StepCommandWithCP56Time2a -StepCommandWithCP56Time2a_create(StepCommandWithCP56Time2a self, int ioa, StepCommandValue command, bool selectCommand, int qu, CP56Time2a timestamp) +StepCommandWithCP56Time2a_create(StepCommandWithCP56Time2a self, int ioa, StepCommandValue command, bool selectCommand, int qu, const CP56Time2a timestamp) { if (self == NULL) self = (StepCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sStepCommandWithCP56Time2a)); @@ -4844,7 +4824,7 @@ StepCommandWithCP56Time2a_getFromBuffer(StepCommandWithCP56Time2a self, CS101_Ap if (self == NULL) self = (StepCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sStepCommandWithCP56Time2a)); - if (self != NULL) { + if (self) { StepCommandWithCP56Time2a_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -4867,7 +4847,6 @@ StepCommandWithCP56Time2a_getTimestamp(StepCommandWithCP56Time2a self) return &(self->timestamp); } - /************************************************* * SetpointCommandNormalized : InformationObject ************************************************/ @@ -4966,7 +4945,7 @@ SetpointCommandNormalized_getFromBuffer(SetpointCommandNormalized self, CS101_Ap if (self == NULL) self = (SetpointCommandNormalized) GLOBAL_MALLOC(sizeof(struct sSetpointCommandNormalized)); - if (self != NULL) { + if (self) { SetpointCommandNormalized_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -5021,7 +5000,7 @@ SetpointCommandNormalizedWithCP56Time2a_destroy(SetpointCommandNormalizedWithCP5 } SetpointCommandNormalizedWithCP56Time2a -SetpointCommandNormalizedWithCP56Time2a_create(SetpointCommandNormalizedWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, CP56Time2a timestamp) +SetpointCommandNormalizedWithCP56Time2a_create(SetpointCommandNormalizedWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, const CP56Time2a timestamp) { if (self == NULL) self = (SetpointCommandNormalizedWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSetpointCommandNormalizedWithCP56Time2a)); @@ -5080,7 +5059,7 @@ SetpointCommandNormalizedWithCP56Time2a_getFromBuffer(SetpointCommandNormalizedW if (self == NULL) self = (SetpointCommandNormalizedWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSetpointCommandNormalizedWithCP56Time2a)); - if (self != NULL) { + if (self) { SetpointCommandNormalizedWithCP56Time2a_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -5106,7 +5085,6 @@ SetpointCommandNormalizedWithCP56Time2a_getTimestamp(SetpointCommandNormalizedWi return &(self->timestamp); } - /************************************************* * SetpointCommandScaled: InformationObject ************************************************/ @@ -5256,7 +5234,7 @@ SetpointCommandScaledWithCP56Time2a_destroy(SetpointCommandScaledWithCP56Time2a } SetpointCommandScaledWithCP56Time2a -SetpointCommandScaledWithCP56Time2a_create(SetpointCommandScaledWithCP56Time2a self, int ioa, int value, bool selectCommand, int ql, CP56Time2a timestamp) +SetpointCommandScaledWithCP56Time2a_create(SetpointCommandScaledWithCP56Time2a self, int ioa, int value, bool selectCommand, int ql, const CP56Time2a timestamp) { if (self == NULL) self = (SetpointCommandScaledWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSetpointCommandScaledWithCP56Time2a)); @@ -5313,7 +5291,7 @@ SetpointCommandScaledWithCP56Time2a_getFromBuffer(SetpointCommandScaledWithCP56T if (self == NULL) self = (SetpointCommandScaledWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSetpointCommandScaledWithCP56Time2a)); - if (self != NULL) { + if (self) { SetpointCommandScaledWithCP56Time2a_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -5471,7 +5449,6 @@ SetpointCommandShort_getFromBuffer(SetpointCommandShort self, CS101_AppLayerPara return self; } - /********************************************************************** * SetpointCommandShortWithCP56Time2a : SetpointCommandShort **********************************************************************/ @@ -5510,7 +5487,7 @@ SetpointCommandShortWithCP56Time2a_destroy(SetpointCommandShortWithCP56Time2a se } SetpointCommandShortWithCP56Time2a -SetpointCommandShortWithCP56Time2a_create(SetpointCommandShortWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, CP56Time2a timestamp) +SetpointCommandShortWithCP56Time2a_create(SetpointCommandShortWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, const CP56Time2a timestamp) { if (self == NULL) self = (SetpointCommandShortWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sSetpointCommandShortWithCP56Time2a)); @@ -5713,7 +5690,6 @@ Bitstring32Command_getFromBuffer(Bitstring32Command self, CS101_AppLayerParamete return self; } - /******************************************************* * Bitstring32CommandWithCP56Time2a: Bitstring32Command *******************************************************/ @@ -5746,7 +5722,7 @@ Bitstring32CommandWithCP56Time2a_initialize(Bitstring32CommandWithCP56Time2a sel } Bitstring32CommandWithCP56Time2a -Bitstring32CommandWithCP56Time2a_create(Bitstring32CommandWithCP56Time2a self, int ioa, uint32_t value, CP56Time2a timestamp) +Bitstring32CommandWithCP56Time2a_create(Bitstring32CommandWithCP56Time2a self, int ioa, uint32_t value, const CP56Time2a timestamp) { if (self == NULL) self = (Bitstring32CommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sBitstring32CommandWithCP56Time2a)); @@ -5797,7 +5773,7 @@ Bitstring32CommandWithCP56Time2a_getFromBuffer(Bitstring32CommandWithCP56Time2a if (self == NULL) self = (Bitstring32CommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sBitstring32CommandWithCP56Time2a)); - if (self != NULL) { + if (self) { Bitstring32CommandWithCP56Time2a_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -5825,7 +5801,6 @@ Bitstring32CommandWithCP56Time2a_getFromBuffer(Bitstring32CommandWithCP56Time2a return self; } - /************************************************* * ReadCommand : InformationObject ************************************************/ @@ -5933,7 +5908,7 @@ ClockSynchronizationCommand_initialize(ClockSynchronizationCommand self) } ClockSynchronizationCommand -ClockSynchronizationCommand_create(ClockSynchronizationCommand self, int ioa, CP56Time2a timestamp) +ClockSynchronizationCommand_create(ClockSynchronizationCommand self, int ioa, const CP56Time2a timestamp) { if (self == NULL) self = (ClockSynchronizationCommand) GLOBAL_MALLOC(sizeof(struct sClockSynchronizationCommand)); @@ -5975,7 +5950,7 @@ ClockSynchronizationCommand_getFromBuffer(ClockSynchronizationCommand self, CS10 if (self == NULL) self = (ClockSynchronizationCommand) GLOBAL_MALLOC(sizeof(struct sClockSynchronizationCommand)); - if (self != NULL) { + if (self) { ClockSynchronizationCommand_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -6064,7 +6039,7 @@ InterrogationCommand_getFromBuffer(InterrogationCommand self, CS101_AppLayerPara if (self == NULL) self = (InterrogationCommand) GLOBAL_MALLOC(sizeof(struct sInterrogationCommand)); - if (self != NULL) { + if (self) { InterrogationCommand_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -6153,7 +6128,7 @@ CounterInterrogationCommand_getFromBuffer(CounterInterrogationCommand self, CS10 if (self == NULL) self = (CounterInterrogationCommand) GLOBAL_MALLOC(sizeof(struct sCounterInterrogationCommand)); - if (self != NULL) { + if (self) { CounterInterrogationCommand_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -6297,7 +6272,7 @@ TestCommandWithCP56Time2a_initialize(TestCommandWithCP56Time2a self) } TestCommandWithCP56Time2a -TestCommandWithCP56Time2a_create(TestCommandWithCP56Time2a self, uint16_t tsc, CP56Time2a timestamp) +TestCommandWithCP56Time2a_create(TestCommandWithCP56Time2a self, uint16_t tsc, const CP56Time2a timestamp) { if (self == NULL) self = (TestCommandWithCP56Time2a) GLOBAL_MALLOC(sizeof(struct sTestCommandWithCP56Time2a)); @@ -6365,7 +6340,6 @@ TestCommandWithCP56Time2a_getFromBuffer(TestCommandWithCP56Time2a self, CS101_Ap return self; } - /************************************************* * ResetProcessCommand : InformationObject ************************************************/ @@ -6487,7 +6461,7 @@ DelayAcquisitionCommand_initialize(DelayAcquisitionCommand self) } DelayAcquisitionCommand -DelayAcquisitionCommand_create(DelayAcquisitionCommand self, int ioa, CP16Time2a delay) +DelayAcquisitionCommand_create(DelayAcquisitionCommand self, int ioa, const CP16Time2a delay) { if (self == NULL) self = (DelayAcquisitionCommand) GLOBAL_MALLOC(sizeof(struct sDelayAcquisitionCommand)); @@ -6544,7 +6518,6 @@ DelayAcquisitionCommand_getFromBuffer(DelayAcquisitionCommand self, CS101_AppLay return self; } - /******************************************* * ParameterActivation : InformationObject *******************************************/ @@ -6582,7 +6555,6 @@ ParameterActivation_destroy(ParameterActivation self) GLOBAL_FREEMEM(self); } - ParameterActivation ParameterActivation_create(ParameterActivation self, int ioa, QualifierOfParameterActivation qpa) { @@ -6599,7 +6571,6 @@ ParameterActivation_create(ParameterActivation self, int ioa, QualifierOfParamet return self; } - QualifierOfParameterActivation ParameterActivation_getQuality(ParameterActivation self) { @@ -6835,7 +6806,7 @@ FileReady_getFromBuffer(FileReady self, CS101_AppLayerParameters parameters, if (self == NULL) self = (FileReady) GLOBAL_MALLOC(sizeof(struct sFileReady)); - if (self != NULL) { + if (self) { FileReady_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -6919,7 +6890,6 @@ SectionReady_create(SectionReady self, int ioa, uint16_t nof, uint8_t nos, uint3 return self; } - bool SectionReady_isNotReady(SectionReady self) { @@ -6962,7 +6932,6 @@ SectionReady_destroy(SectionReady self) GLOBAL_FREEMEM(self); } - SectionReady SectionReady_getFromBuffer(SectionReady self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex) @@ -7000,7 +6969,6 @@ SectionReady_getFromBuffer(SectionReady self, CS101_AppLayerParameters parameter return self; }; - /******************************************* * FileCallOrSelect : InformationObject *******************************************/ @@ -7080,7 +7048,6 @@ FileCallOrSelect_destroy(FileCallOrSelect self) GLOBAL_FREEMEM(self); } - FileCallOrSelect FileCallOrSelect_getFromBuffer(FileCallOrSelect self, CS101_AppLayerParameters parameters, uint8_t* msg, int msgSize, int startIndex) @@ -7211,7 +7178,7 @@ FileLastSegmentOrSection_getFromBuffer(FileLastSegmentOrSection self, CS101_AppL if (self == NULL) self = (FileLastSegmentOrSection) GLOBAL_MALLOC(sizeof(struct sFileLastSegmentOrSection)); - if (self != NULL) { + if (self) { FileLastSegmentOrSection_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -7269,7 +7236,7 @@ FileACK_create(FileACK self, int ioa, uint16_t nof, uint8_t nos, uint8_t afq) if (self == NULL) self = (FileACK) GLOBAL_MALLOC(sizeof(struct sFileACK)); - if (self != NULL) { + if (self) { FileACK_initialize(self); self->objectAddress = ioa; @@ -7320,7 +7287,7 @@ FileACK_getFromBuffer(FileACK self, CS101_AppLayerParameters parameters, if (self == NULL) self = (FileACK) GLOBAL_MALLOC(sizeof(struct sFileACK)); - if (self != NULL) { + if (self) { FileACK_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -7338,7 +7305,6 @@ FileACK_getFromBuffer(FileACK self, CS101_AppLayerParameters parameters, return self; }; - /************************************************* * FileSegment : InformationObject *************************************************/ @@ -7381,7 +7347,7 @@ FileSegment_create(FileSegment self, int ioa, uint16_t nof, uint8_t nos, uint8_t if (self == NULL) self = (FileSegment) GLOBAL_MALLOC(sizeof(struct sFileSegment)); - if (self != NULL) { + if (self) { FileSegment_initialize(self); self->objectAddress = ioa; @@ -7455,7 +7421,7 @@ FileSegment_getFromBuffer(FileSegment self, CS101_AppLayerParameters parameters, if (self == NULL) self = (FileSegment) GLOBAL_MALLOC(sizeof(struct sFileSegment)); - if (self != NULL) { + if (self) { FileSegment_initialize(self); InformationObject_getFromBuffer((InformationObject) self, parameters, msg, startIndex); @@ -7516,12 +7482,12 @@ FileDirectory_initialize(FileDirectory self) } FileDirectory -FileDirectory_create(FileDirectory self, int ioa, uint16_t nof, int lengthOfFile, uint8_t sof, CP56Time2a creationTime) +FileDirectory_create(FileDirectory self, int ioa, uint16_t nof, int lengthOfFile, uint8_t sof, const CP56Time2a creationTime) { if (self == NULL) self = (FileDirectory) GLOBAL_MALLOC(sizeof(struct sFileDirectory)); - if (self != NULL) { + if (self) { FileDirectory_initialize(self); self->objectAddress = ioa; @@ -7604,7 +7570,7 @@ FileDirectory_getFromBuffer(FileDirectory self, CS101_AppLayerParameters paramet if (self == NULL) self = (FileDirectory) GLOBAL_MALLOC(sizeof(struct sFileDirectory)); - if (self != NULL) { + if (self) { FileDirectory_initialize(self); @@ -7666,12 +7632,12 @@ QueryLog_initialize(QueryLog self) } QueryLog -QueryLog_create(QueryLog self, int ioa, uint16_t nof, CP56Time2a rangeStartTime, CP56Time2a rangeStopTime) +QueryLog_create(QueryLog self, int ioa, uint16_t nof, const CP56Time2a rangeStartTime, const CP56Time2a rangeStopTime) { if (self == NULL) self = (QueryLog) GLOBAL_MALLOC(sizeof(struct sQueryLog)); - if (self != NULL) { + if (self) { QueryLog_initialize(self); self->objectAddress = ioa; @@ -7722,7 +7688,7 @@ QueryLog_getFromBuffer(QueryLog self, CS101_AppLayerParameters parameters, if (self == NULL) self = (QueryLog) GLOBAL_MALLOC(sizeof(struct sQueryLog)); - if (self != NULL) { + if (self) { QueryLog_initialize(self); @@ -7741,4 +7707,3 @@ QueryLog_getFromBuffer(QueryLog self, CS101_AppLayerParameters parameters, return self; } - diff --git a/lib60870-C/src/iec60870/cs101/cs101_master.c b/lib60870-C/src/iec60870/cs101/cs101_master.c index 8e60941f..06b8c860 100644 --- a/lib60870-C/src/iec60870/cs101/cs101_master.c +++ b/lib60870-C/src/iec60870/cs101/cs101_master.c @@ -166,7 +166,7 @@ static struct sIPrimaryApplicationLayer cs101UnbalancedAppLayerInterface = { ********************************************/ CS101_Master -CS101_Master_createEx(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, +CS101_Master_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int queueSize) { CS101_Master self = (CS101_Master) GLOBAL_MALLOC(sizeof(struct sCS101_Master)); @@ -224,7 +224,7 @@ CS101_Master_createEx(SerialPort serialPort, LinkLayerParameters llParameters, C } CS101_Master -CS101_Master_create(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode) +CS101_Master_create(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode) { return CS101_Master_createEx(serialPort, llParameters, alParameters, linkLayerMode, CS101_MAX_QUEUE_SIZE); } diff --git a/lib60870-C/src/iec60870/cs101/cs101_slave.c b/lib60870-C/src/iec60870/cs101/cs101_slave.c index 5c369b5b..6e190d89 100644 --- a/lib60870-C/src/iec60870/cs101/cs101_slave.c +++ b/lib60870-C/src/iec60870/cs101/cs101_slave.c @@ -1,7 +1,7 @@ /* * cs101_slave.c * - * Copyright 2017 MZ Automation GmbH + * Copyright 2017-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -96,14 +96,12 @@ struct sCS101_Slave static void handleASDU(CS101_Slave self, CS101_ASDU asdu); - - /******************************************** * ISecondaryApplicationLayer ********************************************/ static bool -IsClass1DataAvailable (void* parameter) +IsClass1DataAvailable(void* parameter) { CS101_Slave self = (CS101_Slave) parameter; @@ -111,7 +109,7 @@ IsClass1DataAvailable (void* parameter) } static Frame -GetClass1Data (void* parameter, Frame frame) +GetClass1Data(void* parameter, Frame frame) { CS101_Slave self = (CS101_Slave) parameter; @@ -125,7 +123,7 @@ GetClass1Data (void* parameter, Frame frame) } static Frame -GetClass2Data (void* parameter, Frame frame) +GetClass2Data(void* parameter, Frame frame) { CS101_Slave self = (CS101_Slave) parameter; @@ -139,7 +137,7 @@ GetClass2Data (void* parameter, Frame frame) } static bool -HandleReceivedData (void* parameter, uint8_t* msg, bool isBroadcast, int userDataStart, int userDataLength) +HandleReceivedData(void* parameter, uint8_t* msg, bool isBroadcast, int userDataStart, int userDataLength) { UNUSED_PARAMETER(isBroadcast); @@ -160,7 +158,7 @@ HandleReceivedData (void* parameter, uint8_t* msg, bool isBroadcast, int userDat } static void -ResetCUReceived (void* parameter, bool onlyFCB) +ResetCUReceived(void* parameter, bool onlyFCB) { CS101_Slave self = (CS101_Slave) parameter; @@ -193,7 +191,7 @@ static struct sISecondaryApplicationLayer cs101UnbalancedAppLayerInterface = { * IBalancedApplicationLayer ********************************************/ static bool -IsClass2DataAvailable (void* parameter) +IsClass2DataAvailable(void* parameter) { CS101_Slave self = (CS101_Slave) parameter; @@ -201,7 +199,7 @@ IsClass2DataAvailable (void* parameter) } static Frame -IBalancedApplicationLayer_GetUserData (void* parameter, Frame frame) +IBalancedApplicationLayer_GetUserData(void* parameter, Frame frame) { if (IsClass1DataAvailable(parameter)) return GetClass1Data(parameter, frame); @@ -212,7 +210,7 @@ IBalancedApplicationLayer_GetUserData (void* parameter, Frame frame) } static bool -IBalancedApplicationLayer_HandleReceivedData (void* parameter, uint8_t* msg, bool isBroadcast, int userDataStart, int userDataLength) +IBalancedApplicationLayer_HandleReceivedData(void* parameter, uint8_t* msg, bool isBroadcast, int userDataStart, int userDataLength) { return HandleReceivedData(parameter, msg, isBroadcast, userDataStart, userDataLength); } @@ -292,7 +290,7 @@ static struct sCS101_AppLayerParameters defaultAppLayerParameters = { }; CS101_Slave -CS101_Slave_createEx(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, +CS101_Slave_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int class1QueueSize, int class2QueueSize) { CS101_Slave self = (CS101_Slave) GLOBAL_MALLOC(sizeof(struct sCS101_Slave)); @@ -370,7 +368,7 @@ CS101_Slave_createEx(SerialPort serialPort, LinkLayerParameters llParameters, CS } CS101_Slave -CS101_Slave_create(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode) +CS101_Slave_create(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode) { return CS101_Slave_createEx(serialPort, llParameters, alParameters, linkLayerMode, CS101_MAX_QUEUE_SIZE, CS101_MAX_QUEUE_SIZE); } diff --git a/lib60870-C/src/iec60870/cs104/cs104_connection.c b/lib60870-C/src/iec60870/cs104/cs104_connection.c index 32617822..083bbc4d 100644 --- a/lib60870-C/src/iec60870/cs104/cs104_connection.c +++ b/lib60870-C/src/iec60870/cs104/cs104_connection.c @@ -527,7 +527,7 @@ CS104_Connection_setLocalAddress(CS104_Connection self, const char* localIpAddre } void -CS104_Connection_setAPCIParameters(CS104_Connection self, CS104_APCIParameters parameters) +CS104_Connection_setAPCIParameters(CS104_Connection self, const CS104_APCIParameters parameters) { self->parameters = *parameters; @@ -535,7 +535,7 @@ CS104_Connection_setAPCIParameters(CS104_Connection self, CS104_APCIParameters p } void -CS104_Connection_setAppLayerParameters(CS104_Connection self, CS101_AppLayerParameters parameters) +CS104_Connection_setAppLayerParameters(CS104_Connection self, const CS101_AppLayerParameters parameters) { self->alParameters = *parameters; } diff --git a/lib60870-C/src/iec60870/cs104/cs104_frame.c b/lib60870-C/src/iec60870/cs104/cs104_frame.c index b75bc731..96d7dbba 100644 --- a/lib60870-C/src/iec60870/cs104/cs104_frame.c +++ b/lib60870-C/src/iec60870/cs104/cs104_frame.c @@ -171,7 +171,7 @@ T104Frame_setNextByte(Frame super, uint8_t byte) } void -T104Frame_appendBytes(Frame super, uint8_t* bytes, int numberOfBytes) +T104Frame_appendBytes(Frame super, const uint8_t* bytes, int numberOfBytes) { T104Frame self = (T104Frame) super; diff --git a/lib60870-C/src/iec60870/cs104/cs104_slave.c b/lib60870-C/src/iec60870/cs104/cs104_slave.c index bfb5bdd7..2a9a2faa 100644 --- a/lib60870-C/src/iec60870/cs104/cs104_slave.c +++ b/lib60870-C/src/iec60870/cs104/cs104_slave.c @@ -214,11 +214,11 @@ MessageQueue_countEntriesUntilEndOfBuffer(MessageQueue self, uint8_t* firstEntry uint8_t* entryPtr = firstEntry; - struct sMessageQueueEntryInfo entryInfo; + while (entryPtr) { - memcpy(&entryInfo, entryPtr, sizeof(struct sMessageQueueEntryInfo)); + struct sMessageQueueEntryInfo entryInfo; - while (entryPtr) { + memcpy(&entryInfo, entryPtr, sizeof(struct sMessageQueueEntryInfo)); count++; @@ -227,8 +227,6 @@ MessageQueue_countEntriesUntilEndOfBuffer(MessageQueue self, uint8_t* firstEntry break; else entryPtr = entryPtr + sizeof(struct sMessageQueueEntryInfo) + entryInfo.size; - - memcpy(&entryInfo, entryPtr, sizeof(struct sMessageQueueEntryInfo)); } return count; @@ -928,7 +926,7 @@ CS104_RedundancyGroup_addAllowedClient(CS104_RedundancyGroup self, const char* i } void -CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, uint8_t* ipAddress, eCS104_IPAddressType addressType) +CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, const uint8_t* ipAddress, eCS104_IPAddressType addressType) { if (self->allowedClients == NULL) self->allowedClients = LinkedList_create(); @@ -2240,19 +2238,19 @@ checkSequenceNumber(MasterConnection self, int seqNo) static bool MasterConnection_isRunning(MasterConnection self) { - bool isRunning; + bool retVal; #if (CONFIG_USE_SEMAPHORES == 1) Semaphore_wait(self->stateLock); #endif - isRunning = self->isRunning; + retVal = self->isRunning; #if (CONFIG_USE_SEMAPHORES == 1) Semaphore_post(self->stateLock); #endif - return isRunning; + return retVal; } static bool @@ -2782,14 +2780,14 @@ handleTimeouts(MasterConnection self) /* check if counterpart confirmed I message */ if (self->oldestSentASDU != -1) { - if (currentTime > self->sentASDUs[self->oldestSentASDU].sentTime) { + /* check validity of sent time */ - /* check validity of sent time */ + if (self->sentASDUs[self->oldestSentASDU].sentTime > currentTime) { + /* sent time is in the future (maybe caused by system time change) */ + self->sentASDUs[self->oldestSentASDU].sentTime = currentTime; + } - if (self->sentASDUs[self->oldestSentASDU].sentTime > currentTime) { - /* sent time is in the future (maybe caused by system time change) */ - self->sentASDUs[self->oldestSentASDU].sentTime = currentTime; - } + if (currentTime > self->sentASDUs[self->oldestSentASDU].sentTime) { if ((currentTime - self->sentASDUs[self->oldestSentASDU].sentTime) >= (uint64_t) (self->slave->conParameters.t1 * 1000)) { timeoutsOk = false; diff --git a/lib60870-C/src/iec60870/link_layer/buffer_frame.c b/lib60870-C/src/iec60870/link_layer/buffer_frame.c index f46df1a8..58d30b05 100644 --- a/lib60870-C/src/iec60870/link_layer/buffer_frame.c +++ b/lib60870-C/src/iec60870/link_layer/buffer_frame.c @@ -1,5 +1,5 @@ /* - * Copyright 2017 MZ Automation GmbH + * Copyright 2017-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -73,7 +73,7 @@ BufferFrame_setNextByte(Frame super, uint8_t byte) } void -BufferFrame_appendBytes(Frame super, uint8_t* bytes, int numberOfBytes) +BufferFrame_appendBytes(Frame super, const uint8_t* bytes, int numberOfBytes) { BufferFrame self = (BufferFrame) super; diff --git a/lib60870-C/src/iec60870/link_layer/link_layer.c b/lib60870-C/src/iec60870/link_layer/link_layer.c index 252b31c5..31711c8a 100644 --- a/lib60870-C/src/iec60870/link_layer/link_layer.c +++ b/lib60870-C/src/iec60870/link_layer/link_layer.c @@ -603,8 +603,6 @@ HandleMessageBalancedAndPrimaryUnbalanced(void* parameter, uint8_t* msg, int msg int csStart = 0; int csIndex = 0; int address = 0; /* address can be ignored in balanced mode? */ - bool prm = true; - int fc = 0; bool isSingleCharAck = false; @@ -648,8 +646,6 @@ HandleMessageBalancedAndPrimaryUnbalanced(void* parameter, uint8_t* msg, int msg } else if (msg [0] == 0xe5) { isSingleCharAck = true; - fc = LL_FC_00_ACK; - prm = false; /* single char ACK is only sent by secondary station */ DEBUG_PRINT ("Received single char ACK\n"); } else { @@ -673,8 +669,8 @@ HandleMessageBalancedAndPrimaryUnbalanced(void* parameter, uint8_t* msg, int msg } /* parse C field bits */ - fc = c & 0x0f; - prm = ((c & 0x40) == 0x40); + uint8_t fc = c & 0x0f; + bool prm = ((c & 0x40) == 0x40); if (prm) { /* we are secondary link layer */ bool fcb = ((c & 0x20) == 0x20); diff --git a/lib60870-C/src/inc/api/cs101_information_objects.h b/lib60870-C/src/inc/api/cs101_information_objects.h index 0c5f4348..fc2f9863 100644 --- a/lib60870-C/src/inc/api/cs101_information_objects.h +++ b/lib60870-C/src/inc/api/cs101_information_objects.h @@ -250,13 +250,13 @@ void SingleEvent_setEventState(SingleEvent self, EventState eventState); EventState -SingleEvent_getEventState(SingleEvent self); +SingleEvent_getEventState(const SingleEvent self); void SingleEvent_setQDP(SingleEvent self, QualityDescriptorP qdp); QualityDescriptorP -SingleEvent_getQDP(SingleEvent self); +SingleEvent_getQDP(const SingleEvent self); typedef struct sStatusAndStatusChangeDetection tStatusAndStatusChangeDetection; @@ -268,19 +268,19 @@ struct sStatusAndStatusChangeDetection { }; uint16_t -StatusAndStatusChangeDetection_getSTn(StatusAndStatusChangeDetection self); +StatusAndStatusChangeDetection_getSTn(const StatusAndStatusChangeDetection self); uint16_t -StatusAndStatusChangeDetection_getCDn(StatusAndStatusChangeDetection self); +StatusAndStatusChangeDetection_getCDn(const StatusAndStatusChangeDetection self); void StatusAndStatusChangeDetection_setSTn(StatusAndStatusChangeDetection self, uint16_t value); bool -StatusAndStatusChangeDetection_getST(StatusAndStatusChangeDetection self, int index); +StatusAndStatusChangeDetection_getST(const StatusAndStatusChangeDetection self, int index); bool -StatusAndStatusChangeDetection_getCD(StatusAndStatusChangeDetection self, int index); +StatusAndStatusChangeDetection_getCD(const StatusAndStatusChangeDetection self, int index); /************************************************ @@ -338,7 +338,7 @@ typedef struct sSinglePointWithCP24Time2a* SinglePointWithCP24Time2a; SinglePointWithCP24Time2a SinglePointWithCP24Time2a_create(SinglePointWithCP24Time2a self, int ioa, bool value, - QualityDescriptor quality, CP24Time2a timestamp); + QualityDescriptor quality, const CP24Time2a timestamp); void SinglePointWithCP24Time2a_destroy(SinglePointWithCP24Time2a self); @@ -354,7 +354,7 @@ typedef struct sSinglePointWithCP56Time2a* SinglePointWithCP56Time2a; SinglePointWithCP56Time2a SinglePointWithCP56Time2a_create(SinglePointWithCP56Time2a self, int ioa, bool value, - QualityDescriptor quality, CP56Time2a timestamp); + QualityDescriptor quality, const CP56Time2a timestamp); void SinglePointWithCP56Time2a_destroy(SinglePointWithCP56Time2a self); @@ -393,7 +393,7 @@ DoublePointWithCP24Time2a_destroy(DoublePointWithCP24Time2a self); DoublePointWithCP24Time2a DoublePointWithCP24Time2a_create(DoublePointWithCP24Time2a self, int ioa, DoublePointValue value, - QualityDescriptor quality, CP24Time2a timestamp); + QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a DoublePointWithCP24Time2a_getTimestamp(DoublePointWithCP24Time2a self); @@ -406,7 +406,7 @@ typedef struct sDoublePointWithCP56Time2a* DoublePointWithCP56Time2a; DoublePointWithCP56Time2a DoublePointWithCP56Time2a_create(DoublePointWithCP56Time2a self, int ioa, DoublePointValue value, - QualityDescriptor quality, CP56Time2a timestamp); + QualityDescriptor quality, const CP56Time2a timestamp); void DoublePointWithCP56Time2a_destroy(DoublePointWithCP56Time2a self); @@ -464,7 +464,7 @@ StepPositionWithCP24Time2a_destroy(StepPositionWithCP24Time2a self); StepPositionWithCP24Time2a StepPositionWithCP24Time2a_create(StepPositionWithCP24Time2a self, int ioa, int value, bool isTransient, - QualityDescriptor quality, CP24Time2a timestamp); + QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a StepPositionWithCP24Time2a_getTimestamp(StepPositionWithCP24Time2a self); @@ -481,7 +481,7 @@ StepPositionWithCP56Time2a_destroy(StepPositionWithCP56Time2a self); StepPositionWithCP56Time2a StepPositionWithCP56Time2a_create(StepPositionWithCP56Time2a self, int ioa, int value, bool isTransient, - QualityDescriptor quality, CP56Time2a timestamp); + QualityDescriptor quality, const CP56Time2a timestamp); CP56Time2a StepPositionWithCP56Time2a_getTimestamp(StepPositionWithCP56Time2a self); @@ -517,10 +517,10 @@ void Bitstring32WithCP24Time2a_destroy(Bitstring32WithCP24Time2a self); Bitstring32WithCP24Time2a -Bitstring32WithCP24Time2a_create(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, CP24Time2a timestamp); +Bitstring32WithCP24Time2a_create(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, const CP24Time2a timestamp); Bitstring32WithCP24Time2a -Bitstring32WithCP24Time2a_createEx(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, QualityDescriptor quality, CP24Time2a timestamp); +Bitstring32WithCP24Time2a_createEx(Bitstring32WithCP24Time2a self, int ioa, uint32_t value, QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a Bitstring32WithCP24Time2a_getTimestamp(Bitstring32WithCP24Time2a self); @@ -535,10 +535,10 @@ void Bitstring32WithCP56Time2a_destroy(Bitstring32WithCP56Time2a self); Bitstring32WithCP56Time2a -Bitstring32WithCP56Time2a_create(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, CP56Time2a timestamp); +Bitstring32WithCP56Time2a_create(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, const CP56Time2a timestamp); Bitstring32WithCP56Time2a -Bitstring32WithCP56Time2a_createEx(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, QualityDescriptor quality, CP56Time2a timestamp); +Bitstring32WithCP56Time2a_createEx(Bitstring32WithCP56Time2a self, int ioa, uint32_t value, QualityDescriptor quality, const CP56Time2a timestamp); CP56Time2a Bitstring32WithCP56Time2a_getTimestamp(Bitstring32WithCP56Time2a self); @@ -593,7 +593,7 @@ MeasuredValueNormalizedWithCP24Time2a_destroy(MeasuredValueNormalizedWithCP24Tim MeasuredValueNormalizedWithCP24Time2a MeasuredValueNormalizedWithCP24Time2a_create(MeasuredValueNormalizedWithCP24Time2a self, int ioa, - float value, QualityDescriptor quality, CP24Time2a timestamp); + float value, QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a MeasuredValueNormalizedWithCP24Time2a_getTimestamp(MeasuredValueNormalizedWithCP24Time2a self); @@ -612,7 +612,7 @@ MeasuredValueNormalizedWithCP56Time2a_destroy(MeasuredValueNormalizedWithCP56Tim MeasuredValueNormalizedWithCP56Time2a MeasuredValueNormalizedWithCP56Time2a_create(MeasuredValueNormalizedWithCP56Time2a self, int ioa, - float value, QualityDescriptor quality, CP56Time2a timestamp); + float value, QualityDescriptor quality, const CP56Time2a timestamp); CP56Time2a MeasuredValueNormalizedWithCP56Time2a_getTimestamp(MeasuredValueNormalizedWithCP56Time2a self); @@ -666,7 +666,7 @@ MeasuredValueScaledWithCP24Time2a_destroy(MeasuredValueScaledWithCP24Time2a self MeasuredValueScaledWithCP24Time2a MeasuredValueScaledWithCP24Time2a_create(MeasuredValueScaledWithCP24Time2a self, int ioa, - int value, QualityDescriptor quality, CP24Time2a timestamp); + int value, QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a MeasuredValueScaledWithCP24Time2a_getTimestamp(MeasuredValueScaledWithCP24Time2a self); @@ -685,7 +685,7 @@ MeasuredValueScaledWithCP56Time2a_destroy(MeasuredValueScaledWithCP56Time2a self MeasuredValueScaledWithCP56Time2a MeasuredValueScaledWithCP56Time2a_create(MeasuredValueScaledWithCP56Time2a self, int ioa, - int value, QualityDescriptor quality, CP56Time2a timestamp); + int value, QualityDescriptor quality, const CP56Time2a timestamp); CP56Time2a MeasuredValueScaledWithCP56Time2a_getTimestamp(MeasuredValueScaledWithCP56Time2a self); @@ -725,7 +725,7 @@ MeasuredValueShortWithCP24Time2a_destroy(MeasuredValueShortWithCP24Time2a self); MeasuredValueShortWithCP24Time2a MeasuredValueShortWithCP24Time2a_create(MeasuredValueShortWithCP24Time2a self, int ioa, - float value, QualityDescriptor quality, CP24Time2a timestamp); + float value, QualityDescriptor quality, const CP24Time2a timestamp); CP24Time2a MeasuredValueShortWithCP24Time2a_getTimestamp(MeasuredValueShortWithCP24Time2a self); @@ -775,7 +775,7 @@ IntegratedTotals_destroy(IntegratedTotals self); * \return Reference to the new instance */ IntegratedTotals -IntegratedTotals_create(IntegratedTotals self, int ioa, BinaryCounterReading value); +IntegratedTotals_create(IntegratedTotals self, int ioa, const BinaryCounterReading value); BinaryCounterReading IntegratedTotals_getBCR(IntegratedTotals self); @@ -803,7 +803,7 @@ typedef struct sIntegratedTotalsWithCP24Time2a* IntegratedTotalsWithCP24Time2a; */ IntegratedTotalsWithCP24Time2a IntegratedTotalsWithCP24Time2a_create(IntegratedTotalsWithCP24Time2a self, int ioa, - BinaryCounterReading value, CP24Time2a timestamp); + const BinaryCounterReading value, const CP24Time2a timestamp); void IntegratedTotalsWithCP24Time2a_destroy(IntegratedTotalsWithCP24Time2a self); @@ -835,7 +835,7 @@ typedef struct sIntegratedTotalsWithCP56Time2a* IntegratedTotalsWithCP56Time2a; */ IntegratedTotalsWithCP56Time2a IntegratedTotalsWithCP56Time2a_create(IntegratedTotalsWithCP56Time2a self, int ioa, - BinaryCounterReading value, CP56Time2a timestamp); + const BinaryCounterReading value, const CP56Time2a timestamp); void IntegratedTotalsWithCP56Time2a_destroy(IntegratedTotalsWithCP56Time2a self); @@ -858,7 +858,7 @@ EventOfProtectionEquipment_destroy(EventOfProtectionEquipment self); EventOfProtectionEquipment EventOfProtectionEquipment_create(EventOfProtectionEquipment self, int ioa, - SingleEvent event, CP16Time2a elapsedTime, CP24Time2a timestamp); + const SingleEvent event, const CP16Time2a elapsedTime, const CP24Time2a timestamp); SingleEvent EventOfProtectionEquipment_getEvent(EventOfProtectionEquipment self); @@ -877,7 +877,7 @@ typedef struct sPackedStartEventsOfProtectionEquipment* PackedStartEventsOfProte PackedStartEventsOfProtectionEquipment PackedStartEventsOfProtectionEquipment_create(PackedStartEventsOfProtectionEquipment self, int ioa, - StartEvent event, QualityDescriptorP qdp, CP16Time2a elapsedTime, CP24Time2a timestamp); + StartEvent event, QualityDescriptorP qdp, const CP16Time2a elapsedTime, const CP24Time2a timestamp); void PackedStartEventsOfProtectionEquipment_destroy(PackedStartEventsOfProtectionEquipment self); @@ -905,7 +905,7 @@ PackedOutputCircuitInfo_destroy(PackedOutputCircuitInfo self); PackedOutputCircuitInfo PackedOutputCircuitInfo_create(PackedOutputCircuitInfo self, int ioa, - OutputCircuitInfo oci, QualityDescriptorP qdp, CP16Time2a operatingTime, CP24Time2a timestamp); + OutputCircuitInfo oci, QualityDescriptorP qdp, const CP16Time2a operatingTime, const CP24Time2a timestamp); OutputCircuitInfo PackedOutputCircuitInfo_getOCI(PackedOutputCircuitInfo self); @@ -930,7 +930,7 @@ PackedSinglePointWithSCD_destroy(PackedSinglePointWithSCD self); PackedSinglePointWithSCD PackedSinglePointWithSCD_create(PackedSinglePointWithSCD self, int ioa, - StatusAndStatusChangeDetection scd, QualityDescriptor qds); + const StatusAndStatusChangeDetection scd, QualityDescriptor qds); QualityDescriptor PackedSinglePointWithSCD_getQuality(PackedSinglePointWithSCD self); @@ -1006,7 +1006,7 @@ SingleCommandWithCP56Time2a_destroy(SingleCommandWithCP56Time2a self); * \return the initialized instance */ SingleCommandWithCP56Time2a -SingleCommandWithCP56Time2a_create(SingleCommandWithCP56Time2a self, int ioa, bool command, bool selectCommand, int qu, CP56Time2a timestamp); +SingleCommandWithCP56Time2a_create(SingleCommandWithCP56Time2a self, int ioa, bool command, bool selectCommand, int qu, const CP56Time2a timestamp); /** * \brief Get the time stamp of the command. @@ -1257,7 +1257,7 @@ ReadCommand_destroy(ReadCommand self); typedef struct sClockSynchronizationCommand* ClockSynchronizationCommand; ClockSynchronizationCommand -ClockSynchronizationCommand_create(ClockSynchronizationCommand self, int ioa, CP56Time2a timestamp); +ClockSynchronizationCommand_create(ClockSynchronizationCommand self, int ioa, const CP56Time2a timestamp); void ClockSynchronizationCommand_destroy(ClockSynchronizationCommand self); @@ -1449,7 +1449,7 @@ EventOfProtectionEquipmentWithCP56Time2a_destroy(EventOfProtectionEquipmentWithC EventOfProtectionEquipmentWithCP56Time2a EventOfProtectionEquipmentWithCP56Time2a_create(EventOfProtectionEquipmentWithCP56Time2a self, int ioa, - SingleEvent event, CP16Time2a elapsedTime, CP56Time2a timestamp); + const SingleEvent event, const CP16Time2a elapsedTime, const CP56Time2a timestamp); SingleEvent EventOfProtectionEquipmentWithCP56Time2a_getEvent(EventOfProtectionEquipmentWithCP56Time2a self); @@ -1471,7 +1471,7 @@ PackedStartEventsOfProtectionEquipmentWithCP56Time2a_destroy(PackedStartEventsOf PackedStartEventsOfProtectionEquipmentWithCP56Time2a PackedStartEventsOfProtectionEquipmentWithCP56Time2a_create(PackedStartEventsOfProtectionEquipmentWithCP56Time2a self, int ioa, - StartEvent event, QualityDescriptorP qdp, CP16Time2a elapsedTime, CP56Time2a timestamp); + StartEvent event, QualityDescriptorP qdp, const CP16Time2a elapsedTime, const CP56Time2a timestamp); StartEvent PackedStartEventsOfProtectionEquipmentWithCP56Time2a_getEvent(PackedStartEventsOfProtectionEquipmentWithCP56Time2a self); @@ -1496,7 +1496,7 @@ PackedOutputCircuitInfoWithCP56Time2a_destroy(PackedOutputCircuitInfoWithCP56Tim PackedOutputCircuitInfoWithCP56Time2a PackedOutputCircuitInfoWithCP56Time2a_create(PackedOutputCircuitInfoWithCP56Time2a self, int ioa, - OutputCircuitInfo oci, QualityDescriptorP qdp, CP16Time2a operatingTime, CP56Time2a timestamp); + OutputCircuitInfo oci, QualityDescriptorP qdp, const CP16Time2a operatingTime, const CP56Time2a timestamp); OutputCircuitInfo PackedOutputCircuitInfoWithCP56Time2a_getOCI(PackedOutputCircuitInfoWithCP56Time2a self); @@ -1520,7 +1520,7 @@ void DoubleCommandWithCP56Time2a_destroy(DoubleCommandWithCP56Time2a self); DoubleCommandWithCP56Time2a -DoubleCommandWithCP56Time2a_create(DoubleCommandWithCP56Time2a self, int ioa, int command, bool selectCommand, int qu, CP56Time2a timestamp); +DoubleCommandWithCP56Time2a_create(DoubleCommandWithCP56Time2a self, int ioa, int command, bool selectCommand, int qu, const CP56Time2a timestamp); int DoubleCommandWithCP56Time2a_getQU(DoubleCommandWithCP56Time2a self); @@ -1544,7 +1544,7 @@ void StepCommandWithCP56Time2a_destroy(StepCommandWithCP56Time2a self); StepCommandWithCP56Time2a -StepCommandWithCP56Time2a_create(StepCommandWithCP56Time2a self, int ioa, StepCommandValue command, bool selectCommand, int qu, CP56Time2a timestamp); +StepCommandWithCP56Time2a_create(StepCommandWithCP56Time2a self, int ioa, StepCommandValue command, bool selectCommand, int qu, const CP56Time2a timestamp); int StepCommandWithCP56Time2a_getQU(StepCommandWithCP56Time2a self); @@ -1568,7 +1568,7 @@ void SetpointCommandNormalizedWithCP56Time2a_destroy(SetpointCommandNormalizedWithCP56Time2a self); SetpointCommandNormalizedWithCP56Time2a -SetpointCommandNormalizedWithCP56Time2a_create(SetpointCommandNormalizedWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, CP56Time2a timestamp); +SetpointCommandNormalizedWithCP56Time2a_create(SetpointCommandNormalizedWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, const CP56Time2a timestamp); float SetpointCommandNormalizedWithCP56Time2a_getValue(SetpointCommandNormalizedWithCP56Time2a self); @@ -1592,7 +1592,7 @@ void SetpointCommandScaledWithCP56Time2a_destroy(SetpointCommandScaledWithCP56Time2a self); SetpointCommandScaledWithCP56Time2a -SetpointCommandScaledWithCP56Time2a_create(SetpointCommandScaledWithCP56Time2a self, int ioa, int value, bool selectCommand, int ql, CP56Time2a timestamp); +SetpointCommandScaledWithCP56Time2a_create(SetpointCommandScaledWithCP56Time2a self, int ioa, int value, bool selectCommand, int ql, const CP56Time2a timestamp); int SetpointCommandScaledWithCP56Time2a_getValue(SetpointCommandScaledWithCP56Time2a self); @@ -1616,7 +1616,7 @@ void SetpointCommandShortWithCP56Time2a_destroy(SetpointCommandShortWithCP56Time2a self); SetpointCommandShortWithCP56Time2a -SetpointCommandShortWithCP56Time2a_create(SetpointCommandShortWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, CP56Time2a timestamp); +SetpointCommandShortWithCP56Time2a_create(SetpointCommandShortWithCP56Time2a self, int ioa, float value, bool selectCommand, int ql, const CP56Time2a timestamp); float SetpointCommandShortWithCP56Time2a_getValue(SetpointCommandShortWithCP56Time2a self); @@ -1637,7 +1637,7 @@ SetpointCommandShortWithCP56Time2a_getTimestamp(SetpointCommandShortWithCP56Time typedef struct sBitstring32CommandWithCP56Time2a* Bitstring32CommandWithCP56Time2a; Bitstring32CommandWithCP56Time2a -Bitstring32CommandWithCP56Time2a_create(Bitstring32CommandWithCP56Time2a self, int ioa, uint32_t value, CP56Time2a timestamp); +Bitstring32CommandWithCP56Time2a_create(Bitstring32CommandWithCP56Time2a self, int ioa, uint32_t value, const CP56Time2a timestamp); void Bitstring32CommandWithCP56Time2a_destroy(Bitstring32CommandWithCP56Time2a self); @@ -1695,7 +1695,7 @@ typedef struct sTestCommandWithCP56Time2a* TestCommandWithCP56Time2a; * \return the new or initialized instance */ TestCommandWithCP56Time2a -TestCommandWithCP56Time2a_create(TestCommandWithCP56Time2a self, uint16_t tsc, CP56Time2a timestamp); +TestCommandWithCP56Time2a_create(TestCommandWithCP56Time2a self, uint16_t tsc, const CP56Time2a timestamp); void TestCommandWithCP56Time2a_destroy(TestCommandWithCP56Time2a self); @@ -1728,7 +1728,7 @@ ResetProcessCommand_getQRP(ResetProcessCommand self); typedef struct sDelayAcquisitionCommand* DelayAcquisitionCommand; DelayAcquisitionCommand -DelayAcquisitionCommand_create(DelayAcquisitionCommand self, int ioa, CP16Time2a delay); +DelayAcquisitionCommand_create(DelayAcquisitionCommand self, int ioa, const CP16Time2a delay); void DelayAcquisitionCommand_destroy(DelayAcquisitionCommand self); @@ -2047,7 +2047,7 @@ FileSegment_destroy(FileSegment self); typedef struct sFileDirectory* FileDirectory; FileDirectory -FileDirectory_create(FileDirectory self, int ioa, uint16_t nof, int lengthOfFile, uint8_t sof, CP56Time2a creationTime); +FileDirectory_create(FileDirectory self, int ioa, uint16_t nof, int lengthOfFile, uint8_t sof, const CP56Time2a creationTime); uint16_t FileDirectory_getNOF(FileDirectory self); @@ -2083,7 +2083,7 @@ FileDirectory_destroy(FileDirectory self); typedef struct sQueryLog* QueryLog; QueryLog -QueryLog_create(QueryLog self, int ioa, uint16_t nof, CP56Time2a rangeStartTime, CP56Time2a rangeStopTime); +QueryLog_create(QueryLog self, int ioa, uint16_t nof, const CP56Time2a rangeStartTime, const CP56Time2a rangeStopTime); uint16_t QueryLog_getNOF(QueryLog self); diff --git a/lib60870-C/src/inc/api/cs101_master.h b/lib60870-C/src/inc/api/cs101_master.h index bf0e08a5..97329288 100644 --- a/lib60870-C/src/inc/api/cs101_master.h +++ b/lib60870-C/src/inc/api/cs101_master.h @@ -65,7 +65,7 @@ typedef struct sCS101_Master* CS101_Master; * \return the new CS101_Master instance */ CS101_Master -CS101_Master_create(SerialPort port, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode mode); +CS101_Master_create(SerialPort port, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode mode); /** * \brief Create a new master instance and specify message queue size (for balanced mode) @@ -79,7 +79,7 @@ CS101_Master_create(SerialPort port, LinkLayerParameters llParameters, CS101_App * \return the new CS101_Master instance */ CS101_Master -CS101_Master_createEx(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, +CS101_Master_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int queueSize); /** diff --git a/lib60870-C/src/inc/api/cs101_slave.h b/lib60870-C/src/inc/api/cs101_slave.h index 268b2ab8..79511500 100644 --- a/lib60870-C/src/inc/api/cs101_slave.h +++ b/lib60870-C/src/inc/api/cs101_slave.h @@ -72,7 +72,7 @@ typedef struct sCS101_Slave* CS101_Slave; * \return the new slave instance */ CS101_Slave -CS101_Slave_create(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode); +CS101_Slave_create(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode); /** * \brief Create a new balanced or unbalanced CS101 slave @@ -89,7 +89,7 @@ CS101_Slave_create(SerialPort serialPort, LinkLayerParameters llParameters, CS10 * \return the new slave instance */ CS101_Slave -CS101_Slave_createEx(SerialPort serialPort, LinkLayerParameters llParameters, CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, +CS101_Slave_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int class1QueueSize, int class2QueueSize); /** diff --git a/lib60870-C/src/inc/api/cs104_connection.h b/lib60870-C/src/inc/api/cs104_connection.h index 6487b10d..7fa58c45 100644 --- a/lib60870-C/src/inc/api/cs104_connection.h +++ b/lib60870-C/src/inc/api/cs104_connection.h @@ -95,9 +95,10 @@ CS104_Connection_setLocalAddress(CS104_Connection self, const char* localIpAddre * the behavior is undefined. * * \param self CS104_Connection instance + * \param parameters the APCI layer parameters */ void -CS104_Connection_setAPCIParameters(CS104_Connection self, CS104_APCIParameters parameters); +CS104_Connection_setAPCIParameters(CS104_Connection self, const CS104_APCIParameters parameters); /** * \brief Get the currently used CS104 specific APCI parameters @@ -116,7 +117,7 @@ CS104_Connection_getAPCIParameters(CS104_Connection self); * \param parameters the application layer parameters */ void -CS104_Connection_setAppLayerParameters(CS104_Connection self, CS101_AppLayerParameters parameters); +CS104_Connection_setAppLayerParameters(CS104_Connection self, const CS101_AppLayerParameters parameters); /** * \brief Return the currently used application layer parameter diff --git a/lib60870-C/src/inc/api/cs104_slave.h b/lib60870-C/src/inc/api/cs104_slave.h index dc4d684a..770db5b4 100644 --- a/lib60870-C/src/inc/api/cs104_slave.h +++ b/lib60870-C/src/inc/api/cs104_slave.h @@ -1,7 +1,7 @@ /* * cs104_slave.h * - * Copyright 2017, 2018 MZ Automation GmbH + * Copyright 2017-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -368,7 +368,7 @@ CS104_RedundancyGroup_addAllowedClient(CS104_RedundancyGroup self, const char* i * \param addressType type of the IP address (either IP_ADDRESS_TYPE_IPV4 or IP_ADDRESS_TYPE_IPV6) */ void -CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, uint8_t* ipAddress, eCS104_IPAddressType addressType); +CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, const uint8_t* ipAddress, eCS104_IPAddressType addressType); /** * \brief Destroy the instance and release all resources. @@ -380,7 +380,6 @@ CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, uint8_t* ip void CS104_RedundancyGroup_destroy(CS104_RedundancyGroup self); - /** * @} */ @@ -393,5 +392,4 @@ CS104_RedundancyGroup_destroy(CS104_RedundancyGroup self); } #endif - #endif /* SRC_INC_API_CS104_SLAVE_H_ */ diff --git a/lib60870-C/src/inc/api/iec60870_common.h b/lib60870-C/src/inc/api/iec60870_common.h index 1f832d16..54fa4c46 100644 --- a/lib60870-C/src/inc/api/iec60870_common.h +++ b/lib60870-C/src/inc/api/iec60870_common.h @@ -589,7 +589,7 @@ CS101_ASDU_removeAllElements(CS101_ASDU self); * \brief Get the elapsed time in ms */ int -CP16Time2a_getEplapsedTimeInMs(CP16Time2a self); +CP16Time2a_getEplapsedTimeInMs(const CP16Time2a self); /** * \brief set the elapsed time in ms @@ -601,7 +601,7 @@ CP16Time2a_setEplapsedTimeInMs(CP16Time2a self, int value); * \brief Get the millisecond part of the time value */ int -CP24Time2a_getMillisecond(CP24Time2a self); +CP24Time2a_getMillisecond(const CP24Time2a self); /** * \brief Set the millisecond part of the time value @@ -613,7 +613,7 @@ CP24Time2a_setMillisecond(CP24Time2a self, int value); * \brief Get the second part of the time value */ int -CP24Time2a_getSecond(CP24Time2a self); +CP24Time2a_getSecond(const CP24Time2a self); /** * \brief Set the second part of the time value @@ -625,7 +625,7 @@ CP24Time2a_setSecond(CP24Time2a self, int value); * \brief Get the minute part of the time value */ int -CP24Time2a_getMinute(CP24Time2a self); +CP24Time2a_getMinute(const CP24Time2a self); /** * \brief Set the minute part of the time value @@ -637,7 +637,7 @@ CP24Time2a_setMinute(CP24Time2a self, int value); * \brief Check if the invalid flag of the time value is set */ bool -CP24Time2a_isInvalid(CP24Time2a self); +CP24Time2a_isInvalid(const CP24Time2a self); /** * \brief Set the invalid flag of the time value @@ -649,7 +649,7 @@ CP24Time2a_setInvalid(CP24Time2a self, bool value); * \brief Check if the substituted flag of the time value is set */ bool -CP24Time2a_isSubstituted(CP24Time2a self); +CP24Time2a_isSubstituted(const CP24Time2a self); /** * \brief Set the substituted flag of the time value @@ -671,44 +671,44 @@ void CP32Time2a_setFromMsTimestamp(CP32Time2a self, uint64_t timestamp); int -CP32Time2a_getMillisecond(CP32Time2a self); +CP32Time2a_getMillisecond(const CP32Time2a self); void CP32Time2a_setMillisecond(CP32Time2a self, int value); int -CP32Time2a_getSecond(CP32Time2a self); +CP32Time2a_getSecond(const CP32Time2a self); void CP32Time2a_setSecond(CP32Time2a self, int value); int -CP32Time2a_getMinute(CP32Time2a self); +CP32Time2a_getMinute(const CP32Time2a self); void CP32Time2a_setMinute(CP32Time2a self, int value); bool -CP32Time2a_isInvalid(CP32Time2a self); +CP32Time2a_isInvalid(const CP32Time2a self); void CP32Time2a_setInvalid(CP32Time2a self, bool value); bool -CP32Time2a_isSubstituted(CP32Time2a self); +CP32Time2a_isSubstituted(const CP32Time2a self); void CP32Time2a_setSubstituted(CP32Time2a self, bool value); int -CP32Time2a_getHour(CP32Time2a self); +CP32Time2a_getHour(const CP32Time2a self); void CP32Time2a_setHour(CP32Time2a self, int value); bool -CP32Time2a_isSummerTime(CP32Time2a self); +CP32Time2a_isSummerTime(const CP32Time2a self); void CP32Time2a_setSummerTime(CP32Time2a self, bool value); @@ -723,13 +723,13 @@ CP56Time2a_setFromMsTimestamp(CP56Time2a self, uint64_t timestamp); * \brief Convert a 7 byte time to a ms timestamp */ uint64_t -CP56Time2a_toMsTimestamp(CP56Time2a self); +CP56Time2a_toMsTimestamp(const CP56Time2a self); /** * \brief Get the ms part of a time value */ int -CP56Time2a_getMillisecond(CP56Time2a self); +CP56Time2a_getMillisecond(const CP56Time2a self); /** * \brief Set the ms part of a time value @@ -738,31 +738,31 @@ void CP56Time2a_setMillisecond(CP56Time2a self, int value); int -CP56Time2a_getSecond(CP56Time2a self); +CP56Time2a_getSecond(const CP56Time2a self); void CP56Time2a_setSecond(CP56Time2a self, int value); int -CP56Time2a_getMinute(CP56Time2a self); +CP56Time2a_getMinute(const CP56Time2a self); void CP56Time2a_setMinute(CP56Time2a self, int value); int -CP56Time2a_getHour(CP56Time2a self); +CP56Time2a_getHour(const CP56Time2a self); void CP56Time2a_setHour(CP56Time2a self, int value); int -CP56Time2a_getDayOfWeek(CP56Time2a self); +CP56Time2a_getDayOfWeek(const CP56Time2a self); void CP56Time2a_setDayOfWeek(CP56Time2a self, int value); int -CP56Time2a_getDayOfMonth(CP56Time2a self); +CP56Time2a_getDayOfMonth(const CP56Time2a self); void CP56Time2a_setDayOfMonth(CP56Time2a self, int value); @@ -773,7 +773,7 @@ CP56Time2a_setDayOfMonth(CP56Time2a self, int value); * \return value the month (1..12) */ int -CP56Time2a_getMonth(CP56Time2a self); +CP56Time2a_getMonth(const CP56Time2a self); /** * \brief Set the month field of the time @@ -789,7 +789,7 @@ CP56Time2a_setMonth(CP56Time2a self, int value); * \param value the year (0..99) */ int -CP56Time2a_getYear(CP56Time2a self); +CP56Time2a_getYear(const CP56Time2a self); /** * \brief Set the year @@ -800,19 +800,19 @@ void CP56Time2a_setYear(CP56Time2a self, int value); bool -CP56Time2a_isSummerTime(CP56Time2a self); +CP56Time2a_isSummerTime(const CP56Time2a self); void CP56Time2a_setSummerTime(CP56Time2a self, bool value); bool -CP56Time2a_isInvalid(CP56Time2a self); +CP56Time2a_isInvalid(const CP56Time2a self); void CP56Time2a_setInvalid(CP56Time2a self, bool value); bool -CP56Time2a_isSubstituted(CP56Time2a self); +CP56Time2a_isSubstituted(const CP56Time2a self); void CP56Time2a_setSubstituted(CP56Time2a self, bool value); diff --git a/lib60870-C/src/inc/internal/apl_types_internal.h b/lib60870-C/src/inc/internal/apl_types_internal.h index d0357154..e3438ae2 100644 --- a/lib60870-C/src/inc/internal/apl_types_internal.h +++ b/lib60870-C/src/inc/internal/apl_types_internal.h @@ -1,7 +1,7 @@ /* * apl_types_internal.h * - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -38,22 +38,22 @@ void CS101_ASDU_encode(CS101_ASDU self, Frame frame); bool -CP16Time2a_getFromBuffer (CP16Time2a self, uint8_t* msg, int msgSize, int startIndex); +CP16Time2a_getFromBuffer (CP16Time2a self, const uint8_t* msg, int msgSize, int startIndex); uint8_t* CP16Time2a_getEncodedValue(CP16Time2a self); bool -CP24Time2a_getFromBuffer (CP24Time2a self, uint8_t* msg, int msgSize, int startIndex); +CP24Time2a_getFromBuffer (CP24Time2a self, const uint8_t* msg, int msgSize, int startIndex); bool -CP32Time2a_getFromBuffer (CP32Time2a self, uint8_t* msg, int msgSize, int startIndex); +CP32Time2a_getFromBuffer (CP32Time2a self, const uint8_t* msg, int msgSize, int startIndex); uint8_t* CP32Time2a_getEncodedValue(CP32Time2a self); bool -CP56Time2a_getFromBuffer (CP56Time2a self, uint8_t* msg, int msgSize, int startIndex); +CP56Time2a_getFromBuffer (CP56Time2a self, const uint8_t* msg, int msgSize, int startIndex); uint8_t* CP56Time2a_getEncodedValue(CP56Time2a self); diff --git a/lib60870-C/src/inc/internal/buffer_frame.h b/lib60870-C/src/inc/internal/buffer_frame.h index c42b77ea..856c5070 100644 --- a/lib60870-C/src/inc/internal/buffer_frame.h +++ b/lib60870-C/src/inc/internal/buffer_frame.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 MZ Automation GmbH + * Copyright 2017-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -50,7 +50,7 @@ void BufferFrame_setNextByte(Frame super, uint8_t byte); void -BufferFrame_appendBytes(Frame super, uint8_t* bytes, int numberOfBytes); +BufferFrame_appendBytes(Frame super, const uint8_t* bytes, int numberOfBytes); int BufferFrame_getMsgSize(Frame super); diff --git a/lib60870-C/src/inc/internal/cs104_frame.h b/lib60870-C/src/inc/internal/cs104_frame.h index 868eaf6a..afb870e2 100644 --- a/lib60870-C/src/inc/internal/cs104_frame.h +++ b/lib60870-C/src/inc/internal/cs104_frame.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -44,7 +44,7 @@ void T104Frame_setNextByte(Frame self, uint8_t byte); void -T104Frame_appendBytes(Frame self, uint8_t* bytes, int numberOfBytes); +T104Frame_appendBytes(Frame self, const uint8_t* bytes, int numberOfBytes); int T104Frame_getMsgSize(Frame self); diff --git a/lib60870-C/src/inc/internal/frame.h b/lib60870-C/src/inc/internal/frame.h index 6aa844d1..2c2bfdd8 100644 --- a/lib60870-C/src/inc/internal/frame.h +++ b/lib60870-C/src/inc/internal/frame.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -32,7 +32,7 @@ struct sFrameVFT { void (*destroy)(Frame self); void (*resetFrame)(Frame self); void (*setNextByte)(Frame self, uint8_t byte); - void (*appendBytes)(Frame self, uint8_t* bytes, int numberOfBytes); + void (*appendBytes)(Frame self, const uint8_t* bytes, int numberOfBytes); int (*getMsgSize)(Frame self); uint8_t* (*getBuffer)(Frame self); int (*getSpaceLeft)(Frame self); diff --git a/lib60870-C/src/inc/internal/information_objects_internal.h b/lib60870-C/src/inc/internal/information_objects_internal.h index fbc6d726..ef1e38ae 100644 --- a/lib60870-C/src/inc/internal/information_objects_internal.h +++ b/lib60870-C/src/inc/internal/information_objects_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -34,7 +34,7 @@ void InformationObject_setObjectAddress(InformationObject self, int ioa); int -InformationObject_ParseObjectAddress(CS101_AppLayerParameters parameters, uint8_t* msg, int startIndex); +InformationObject_ParseObjectAddress(CS101_AppLayerParameters parameters, const uint8_t* msg, int startIndex); SinglePointInformation SinglePointInformation_getFromBuffer(SinglePointInformation self, CS101_AppLayerParameters parameters,