diff --git a/examples/server_example1/static_model.c b/examples/server_example1/static_model.c index 3abfe08..a5f5dcf 100644 --- a/examples/server_example1/static_model.c +++ b/examples/server_example1/static_model.c @@ -149,6 +149,7 @@ extern DataSetEntry ds_Device1_LLN0_dataset1_fcda2; DataSetEntry ds_Device1_LLN0_dataset1_fcda0 = { "Device1", + false, "LLN0$ST$Mod$q", -1, NULL, @@ -158,6 +159,7 @@ DataSetEntry ds_Device1_LLN0_dataset1_fcda0 = { DataSetEntry ds_Device1_LLN0_dataset1_fcda1 = { "Device1", + false, "MMXU1$ST$Mod$q", -1, NULL, @@ -167,6 +169,7 @@ DataSetEntry ds_Device1_LLN0_dataset1_fcda1 = { DataSetEntry ds_Device1_LLN0_dataset1_fcda2 = { "Device1", + false, "MMXU1$CF$Mod$ctlModel", -1, NULL, diff --git a/examples/server_example2/static_model.c b/examples/server_example2/static_model.c index fbc3cfa..a483753 100644 --- a/examples/server_example2/static_model.c +++ b/examples/server_example2/static_model.c @@ -315,6 +315,7 @@ extern DataSetEntry ds_Inverter_LLN0_dataset1_fcda4; DataSetEntry ds_Inverter_LLN0_dataset1_fcda0 = { "Inverter", + false, "LLN0$ST$Mod$q", -1, NULL, @@ -324,6 +325,7 @@ DataSetEntry ds_Inverter_LLN0_dataset1_fcda0 = { DataSetEntry ds_Inverter_LLN0_dataset1_fcda1 = { "Battery", + false, "LLN0$ST$Mod$q", -1, NULL, @@ -333,6 +335,7 @@ DataSetEntry ds_Inverter_LLN0_dataset1_fcda1 = { DataSetEntry ds_Inverter_LLN0_dataset1_fcda2 = { "Inverter", + false, "MMXU1$ST$Mod$q", -1, NULL, @@ -342,6 +345,7 @@ DataSetEntry ds_Inverter_LLN0_dataset1_fcda2 = { DataSetEntry ds_Inverter_LLN0_dataset1_fcda3 = { "Inverter", + false, "MMXU1$CF$Mod$ctlModel", -1, NULL, @@ -351,6 +355,7 @@ DataSetEntry ds_Inverter_LLN0_dataset1_fcda3 = { DataSetEntry ds_Inverter_LLN0_dataset1_fcda4 = { "Inverter", + false, "MMXU1$MX$TotW$mag", -1, NULL, diff --git a/examples/server_example3/static_model.c b/examples/server_example3/static_model.c index 90a4eb5..eb1941b 100644 --- a/examples/server_example3/static_model.c +++ b/examples/server_example3/static_model.c @@ -162,6 +162,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events_fcda3; DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1$stVal", -1, NULL, @@ -171,6 +172,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2$stVal", -1, NULL, @@ -180,6 +182,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3$stVal", -1, NULL, @@ -189,6 +192,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4$stVal", -1, NULL, @@ -211,6 +215,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events2_fcda3; DataSetEntry ds_GenericIO_LLN0_Events2_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1", -1, NULL, @@ -220,6 +225,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2", -1, NULL, @@ -229,6 +235,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3", -1, NULL, @@ -238,6 +245,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4", -1, NULL, @@ -264,6 +272,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Measurements_fcda7; DataSetEntry ds_GenericIO_LLN0_Measurements_fcda0 = { "GenericIO", + false, "GGIO1$MX$AnIn1$mag$f", -1, NULL, @@ -273,6 +282,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda1 = { "GenericIO", + false, "GGIO1$MX$AnIn1$q", -1, NULL, @@ -282,6 +292,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda2 = { "GenericIO", + false, "GGIO1$MX$AnIn2$mag$f", -1, NULL, @@ -291,6 +302,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda3 = { "GenericIO", + false, "GGIO1$MX$AnIn2$q", -1, NULL, @@ -300,6 +312,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda3 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda4 = { "GenericIO", + false, "GGIO1$MX$AnIn3$mag$f", -1, NULL, @@ -309,6 +322,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda4 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda5 = { "GenericIO", + false, "GGIO1$MX$AnIn3$q", -1, NULL, @@ -318,6 +332,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda5 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda6 = { "GenericIO", + false, "GGIO1$MX$AnIn4$mag$f", -1, NULL, @@ -327,6 +342,7 @@ DataSetEntry ds_GenericIO_LLN0_Measurements_fcda6 = { DataSetEntry ds_GenericIO_LLN0_Measurements_fcda7 = { "GenericIO", + false, "GGIO1$MX$AnIn4$q", -1, NULL, diff --git a/examples/server_example4/static_model.c b/examples/server_example4/static_model.c index 0897448..6bee7ce 100644 --- a/examples/server_example4/static_model.c +++ b/examples/server_example4/static_model.c @@ -159,6 +159,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events_fcda3; DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1$stVal", -1, NULL, @@ -168,6 +169,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2$stVal", -1, NULL, @@ -177,6 +179,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3$stVal", -1, NULL, @@ -186,6 +189,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4$stVal", -1, NULL, diff --git a/examples/server_example5/static_model.c b/examples/server_example5/static_model.c index 0897448..6bee7ce 100644 --- a/examples/server_example5/static_model.c +++ b/examples/server_example5/static_model.c @@ -159,6 +159,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events_fcda3; DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1$stVal", -1, NULL, @@ -168,6 +169,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2$stVal", -1, NULL, @@ -177,6 +179,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3$stVal", -1, NULL, @@ -186,6 +189,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4$stVal", -1, NULL, diff --git a/examples/server_example_goose/static_model.c b/examples/server_example_goose/static_model.c index 2beaeac..e1bcf92 100644 --- a/examples/server_example_goose/static_model.c +++ b/examples/server_example_goose/static_model.c @@ -160,6 +160,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events_fcda3; DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1$stVal", -1, NULL, @@ -169,6 +170,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2$stVal", -1, NULL, @@ -178,6 +180,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3$stVal", -1, NULL, @@ -187,6 +190,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4$stVal", -1, NULL, @@ -209,6 +213,7 @@ extern DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda3; DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda0 = { "GenericIO", + false, "GGIO1$MX$AnIn1", -1, NULL, @@ -218,6 +223,7 @@ DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda0 = { DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda1 = { "GenericIO", + false, "GGIO1$MX$AnIn2", -1, NULL, @@ -227,6 +233,7 @@ DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda1 = { DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda2 = { "GenericIO", + false, "GGIO1$MX$AnIn3", -1, NULL, @@ -236,6 +243,7 @@ DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda2 = { DataSetEntry ds_GenericIO_LLN0_AnalogValues_fcda3 = { "GenericIO", + false, "GGIO1$MX$AnIn4", -1, NULL, diff --git a/examples/server_example_threadless/static_model.c b/examples/server_example_threadless/static_model.c index 9001748..f63c227 100644 --- a/examples/server_example_threadless/static_model.c +++ b/examples/server_example_threadless/static_model.c @@ -161,6 +161,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events_fcda3; DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1$stVal", -1, NULL, @@ -170,6 +171,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2$stVal", -1, NULL, @@ -179,6 +181,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3$stVal", -1, NULL, @@ -188,6 +191,7 @@ DataSetEntry ds_GenericIO_LLN0_Events_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4$stVal", -1, NULL, @@ -210,6 +214,7 @@ extern DataSetEntry ds_GenericIO_LLN0_Events2_fcda3; DataSetEntry ds_GenericIO_LLN0_Events2_fcda0 = { "GenericIO", + false, "GGIO1$ST$SPCSO1", -1, NULL, @@ -219,6 +224,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda0 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda1 = { "GenericIO", + false, "GGIO1$ST$SPCSO2", -1, NULL, @@ -228,6 +234,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda1 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda2 = { "GenericIO", + false, "GGIO1$ST$SPCSO3", -1, NULL, @@ -237,6 +244,7 @@ DataSetEntry ds_GenericIO_LLN0_Events2_fcda2 = { DataSetEntry ds_GenericIO_LLN0_Events2_fcda3 = { "GenericIO", + false, "GGIO1$ST$SPCSO4", -1, NULL, diff --git a/src/iec61850/client/client_control.c b/src/iec61850/client/client_control.c index dc662a8..ff8c346 100644 --- a/src/iec61850/client/client_control.c +++ b/src/iec61850/client/client_control.c @@ -65,7 +65,7 @@ struct sControlObjectClient }; static void -convertToMmsAndInsertFC(char* newItemId, char* originalObjectName, char* fc) +convertToMmsAndInsertFC(char* newItemId, const char* originalObjectName, const char* fc) { int originalLength = strlen(originalObjectName); @@ -106,7 +106,7 @@ resetLastApplError(ControlObjectClient self) } ControlObjectClient -ControlObjectClient_create(char* objectReference, IedConnection connection) +ControlObjectClient_create(const char* objectReference, IedConnection connection) { ControlObjectClient self = NULL; diff --git a/src/iec61850/client/client_goose_control.c b/src/iec61850/client/client_goose_control.c index e61a2ec..67b1e9b 100644 --- a/src/iec61850/client/client_goose_control.c +++ b/src/iec61850/client/client_goose_control.c @@ -45,7 +45,7 @@ struct sClientGooseControlBlock { }; ClientGooseControlBlock -ClientGooseControlBlock_create(char* objectReference) +ClientGooseControlBlock_create(const char* objectReference) { ClientGooseControlBlock self = (ClientGooseControlBlock) GLOBAL_CALLOC(1, sizeof(struct sClientGooseControlBlock)); @@ -100,7 +100,7 @@ ClientGooseControlBlock_getGoID(ClientGooseControlBlock self) } void -ClientGooseControlBlock_setGoID(ClientGooseControlBlock self, char* goID) +ClientGooseControlBlock_setGoID(ClientGooseControlBlock self, const char* goID) { if (self->goID == NULL) self->goID = MmsValue_newVisibleString(goID); @@ -118,7 +118,7 @@ ClientGooseControlBlock_getDatSet(ClientGooseControlBlock self) } void -ClientGooseControlBlock_setDatSet(ClientGooseControlBlock self, char* datSet) +ClientGooseControlBlock_setDatSet(ClientGooseControlBlock self, const char* datSet) { if (self->datSet == NULL) self->datSet = MmsValue_newVisibleString(datSet); @@ -285,7 +285,7 @@ private_ClientGooseControlBlock_updateValues(ClientGooseControlBlock self, MmsVa } ClientGooseControlBlock -IedConnection_getGoCBValues(IedConnection self, IedClientError* error, char* goCBReference, ClientGooseControlBlock updateGoCB) +IedConnection_getGoCBValues(IedConnection self, IedClientError* error, const char* goCBReference, ClientGooseControlBlock updateGoCB) { MmsError mmsError = MMS_ERROR_NONE; *error = IED_ERROR_OK; @@ -297,7 +297,7 @@ IedConnection_getGoCBValues(IedConnection self, IedClientError* error, char* goC MmsMapping_getMmsDomainFromObjectReference(goCBReference, domainId); - char* itemIdStart = goCBReference + strlen(domainId) + 1; + const char* itemIdStart = goCBReference + strlen(domainId) + 1; char* separator = strchr(itemIdStart, '.'); diff --git a/src/iec61850/client/client_report.c b/src/iec61850/client/client_report.c index 45a31ca..181e09d 100644 --- a/src/iec61850/client/client_report.c +++ b/src/iec61850/client/client_report.c @@ -222,7 +222,7 @@ ClientReport_getDataSetValues(ClientReport self) } static ClientReport -lookupReportHandler(IedConnection self, char* rcbReference) +lookupReportHandler(IedConnection self, const char* rcbReference) { LinkedList element = LinkedList_getNext(self->enabledReports); @@ -239,7 +239,7 @@ lookupReportHandler(IedConnection self, char* rcbReference) } void -IedConnection_installReportHandler(IedConnection self, char* rcbReference, char* rptId, ReportCallbackFunction handler, +IedConnection_installReportHandler(IedConnection self, const char* rcbReference, const char* rptId, ReportCallbackFunction handler, void* handlerParameter) { ClientReport report = lookupReportHandler(self, rcbReference); @@ -268,7 +268,7 @@ IedConnection_installReportHandler(IedConnection self, char* rcbReference, char* } void -IedConnection_uninstallReportHandler(IedConnection self, char* rcbReference) +IedConnection_uninstallReportHandler(IedConnection self, const char* rcbReference) { ClientReport report = lookupReportHandler(self, rcbReference); @@ -279,7 +279,7 @@ IedConnection_uninstallReportHandler(IedConnection self, char* rcbReference) } void -IedConnection_triggerGIReport(IedConnection self, IedClientError* error, char* rcbReference) +IedConnection_triggerGIReport(IedConnection self, IedClientError* error, const char* rcbReference) { char domainId[65]; char itemId[129]; diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index 2e7407f..06537cf 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -32,7 +32,7 @@ #include "mms_mapping.h" static bool -isBufferedRcb(char* objectReference) +isBufferedRcb(const char* objectReference) { char* separator = strchr(objectReference, '.'); @@ -46,7 +46,7 @@ isBufferedRcb(char* objectReference) } ClientReportControlBlock -ClientReportControlBlock_create(char* objectReference) +ClientReportControlBlock_create(const char* objectReference) { ClientReportControlBlock self = (ClientReportControlBlock) GLOBAL_CALLOC(1, sizeof(struct sClientReportControlBlock)); @@ -103,7 +103,7 @@ ClientReportControlBlock_getRptId(ClientReportControlBlock self) } void -ClientReportControlBlock_setRptId(ClientReportControlBlock self, char* rptId) +ClientReportControlBlock_setRptId(ClientReportControlBlock self, const char* rptId) { if (self->rptId == NULL) self->rptId = MmsValue_newVisibleString(rptId); @@ -160,7 +160,7 @@ ClientReportControlBlock_getDataSetReference(ClientReportControlBlock self) } void -ClientReportControlBlock_setDataSetReference(ClientReportControlBlock self, char* dataSetReference) +ClientReportControlBlock_setDataSetReference(ClientReportControlBlock self, const char* dataSetReference) { if (self->datSet == NULL) self->datSet = MmsValue_newVisibleString(dataSetReference); @@ -423,7 +423,7 @@ private_ClientReportControlBlock_updateValues(ClientReportControlBlock self, Mms ClientReportControlBlock -IedConnection_getRCBValues(IedConnection self, IedClientError* error, char* rcbReference, +IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char* rcbReference, ClientReportControlBlock updateRcb) { MmsError mmsError = MMS_ERROR_NONE; diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index 8ef2843..26ab5e8 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -501,7 +501,7 @@ connectionLostHandler(MmsConnection connection, void* parameter) } void -IedConnection_connect(IedConnection self, IedClientError* error, char* hostname, int tcpPort) +IedConnection_connect(IedConnection self, IedClientError* error, const char* hostname, int tcpPort) { MmsError mmsError; diff --git a/src/iec61850/common/iec61850_common.c b/src/iec61850/common/iec61850_common.c index f21644f..df654c8 100644 --- a/src/iec61850/common/iec61850_common.c +++ b/src/iec61850/common/iec61850_common.c @@ -63,13 +63,13 @@ Quality_unsetFlag(Quality* self, int flag) Quality -Quality_fromMmsValue(MmsValue* mmsValue) +Quality_fromMmsValue(const MmsValue* mmsValue) { return (Quality) MmsValue_getBitStringAsInteger(mmsValue); } Dbpos -Dbpos_fromMmsValue(MmsValue* mmsValue) +Dbpos_fromMmsValue(const MmsValue* mmsValue) { return (Dbpos) MmsValue_getBitStringAsIntegerBigEndian(mmsValue); } @@ -131,7 +131,7 @@ FunctionalConstraint_toString(FunctionalConstraint fc) { } FunctionalConstraint -FunctionalConstraint_fromString(char* fcString) +FunctionalConstraint_fromString(const char* fcString) { if (fcString[0] == 'S') { if (fcString[1] == 'T') diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 748da87..b1b3401 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -186,7 +186,7 @@ IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs); * \param tcpPort the TCP port number of the server to connect to */ void -IedConnection_connect(IedConnection self, IedClientError* error, char* hostname, int tcpPort); +IedConnection_connect(IedConnection self, IedClientError* error, const char* hostname, int tcpPort); /** * \brief Abort the connection @@ -325,7 +325,7 @@ IedConnection_getMmsConnection(IedConnection self); **************************************************/ ClientGooseControlBlock -ClientGooseControlBlock_create(char* dataAttributeReference); +ClientGooseControlBlock_create(const char* dataAttributeReference); void ClientGooseControlBlock_destroy(ClientGooseControlBlock self); @@ -340,13 +340,13 @@ char* ClientGooseControlBlock_getGoID(ClientGooseControlBlock self); void -ClientGooseControlBlock_setGoID(ClientGooseControlBlock self, char* goID); +ClientGooseControlBlock_setGoID(ClientGooseControlBlock self, const char* goID); char* ClientGooseControlBlock_getDatSet(ClientGooseControlBlock self); void -ClientGooseControlBlock_setDatSet(ClientGooseControlBlock self, char* datSet); +ClientGooseControlBlock_setDatSet(ClientGooseControlBlock self, const char* datSet); uint32_t ClientGooseControlBlock_getConfRev(ClientGooseControlBlock self); @@ -420,7 +420,7 @@ ClientGooseControlBlock_setDstAddress_appid(ClientGooseControlBlock self, uint16 * the updateRcb parameter. */ ClientGooseControlBlock -IedConnection_getGoCBValues(IedConnection self, IedClientError* error, char* goCBReference, ClientGooseControlBlock updateGoCB); +IedConnection_getGoCBValues(IedConnection self, IedClientError* error, const char* goCBReference, ClientGooseControlBlock updateGoCB); /** * \brief Write access to attributes of a GOOSE control block (GoCB) at the connected server @@ -493,7 +493,7 @@ IedConnection_setGoCBValues(IedConnection self, IedClientError* error, ClientGoo * the updateRcb parameter. */ ClientReportControlBlock -IedConnection_getRCBValues(IedConnection self, IedClientError* error, char* rcbReference, +IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char* rcbReference, ClientReportControlBlock updateRcb); /** Describes the reason for the inclusion of the element in the report */ @@ -624,7 +624,7 @@ typedef void (*ReportCallbackFunction) (void* parameter, ClientReport report); * \param handlerParameter user provided parameter that will be passed to the callback function */ void -IedConnection_installReportHandler(IedConnection self, char* rcbReference, char* rptId, ReportCallbackFunction handler, +IedConnection_installReportHandler(IedConnection self, const char* rcbReference, const char* rptId, ReportCallbackFunction handler, void* handlerParameter); /** @@ -634,7 +634,7 @@ IedConnection_installReportHandler(IedConnection self, char* rcbReference, char* * \param rcbReference object reference of the report control block */ void -IedConnection_uninstallReportHandler(IedConnection self, char* rcbReference); +IedConnection_uninstallReportHandler(IedConnection self, const char* rcbReference); /** * \brief Trigger a general interrogation (GI) report for the specified report control block (RCB) @@ -646,7 +646,7 @@ IedConnection_uninstallReportHandler(IedConnection self, char* rcbReference); * \param rcbReference object reference of the report control block */ void -IedConnection_triggerGIReport(IedConnection self, IedClientError* error, char* rcbReference); +IedConnection_triggerGIReport(IedConnection self, IedClientError* error, const char* rcbReference); /**************************************** * Access to received reports @@ -788,7 +788,7 @@ ReasonForInclusion_getValueAsString(ReasonForInclusion reasonCode); **************************************************/ ClientReportControlBlock -ClientReportControlBlock_create(char* rcbReference); +ClientReportControlBlock_create(const char* rcbReference); void ClientReportControlBlock_destroy(ClientReportControlBlock self); @@ -803,7 +803,7 @@ char* ClientReportControlBlock_getRptId(ClientReportControlBlock self); void -ClientReportControlBlock_setRptId(ClientReportControlBlock self, char* rptId); +ClientReportControlBlock_setRptId(ClientReportControlBlock self, const char* rptId); bool ClientReportControlBlock_getRptEna(ClientReportControlBlock self); @@ -837,7 +837,7 @@ ClientReportControlBlock_getDataSetReference(ClientReportControlBlock self); * \param dataSetReference the reference of the data set */ void -ClientReportControlBlock_setDataSetReference(ClientReportControlBlock self, char* dataSetReference); +ClientReportControlBlock_setDataSetReference(ClientReportControlBlock self, const char* dataSetReference); uint32_t ClientReportControlBlock_getConfRev(ClientReportControlBlock self); @@ -1256,7 +1256,7 @@ typedef enum { * \return the newly created instance or NULL if the creation failed */ ControlObjectClient -ControlObjectClient_create(char* objectReference, IedConnection connection); +ControlObjectClient_create(const char* objectReference, IedConnection connection); void ControlObjectClient_destroy(ControlObjectClient self); diff --git a/src/iec61850/inc/iec61850_common.h b/src/iec61850/inc/iec61850_common.h index 795fce3..3341389 100644 --- a/src/iec61850/inc/iec61850_common.h +++ b/src/iec61850/inc/iec61850_common.h @@ -212,7 +212,7 @@ FunctionalConstraint_toString(FunctionalConstraint fc); * \brief parse a string treated as a functional constraint representation */ FunctionalConstraint -FunctionalConstraint_fromString(char* fcString); +FunctionalConstraint_fromString(const char* fcString); /** @} */ @@ -262,7 +262,7 @@ bool Quality_isFlagSet(Quality* self, int flag); Quality -Quality_fromMmsValue(MmsValue* mmsValue); +Quality_fromMmsValue(const MmsValue* mmsValue); /** @} */ @@ -288,7 +288,7 @@ typedef enum { * \return the corresponding Dbpos value */ Dbpos -Dbpos_fromMmsValue(MmsValue* mmsValue); +Dbpos_fromMmsValue(const MmsValue* mmsValue); /** * \brief conver Dbpos to MMS bit string diff --git a/src/mms/inc/mms_value.h b/src/mms/inc/mms_value.h index 42ac475..d700bbc 100644 --- a/src/mms/inc/mms_value.h +++ b/src/mms/inc/mms_value.h @@ -296,7 +296,7 @@ char* MmsValue_toString(MmsValue* self); void -MmsValue_setVisibleString(MmsValue* self, char* string); +MmsValue_setVisibleString(MmsValue* self, const char* string); /** @@ -319,7 +319,7 @@ MmsValue_setBitStringBit(MmsValue* self, int bitPos, bool value); * \return the value of the bit (true = 1 / false = 0) */ bool -MmsValue_getBitStringBit(MmsValue* self, int bitPos); +MmsValue_getBitStringBit(const MmsValue* self, int bitPos); /** * \brief Delete all bits (set to zero) of an MmsType object of type MMS_BITSTRING @@ -336,7 +336,7 @@ MmsValue_deleteAllBitStringBits(MmsValue* self); * \param self MmsValue instance to operate on. Has to be of a type MMS_BITSTRING. */ int -MmsValue_getBitStringSize(MmsValue* self); +MmsValue_getBitStringSize(const MmsValue* self); /** * \brief Get the number of bytes required by this bitString @@ -344,7 +344,7 @@ MmsValue_getBitStringSize(MmsValue* self); * \param self MmsValue instance to operate on. Has to be of a type MMS_BITSTRING. */ int -MmsValue_getBitStringByteSize(MmsValue* self); +MmsValue_getBitStringByteSize(const MmsValue* self); /** * \brief Count the number of set bits in a bit string. @@ -352,7 +352,7 @@ MmsValue_getBitStringByteSize(MmsValue* self); * \param self MmsValue instance to operate on. Has to be of a type MMS_BITSTRING. */ int -MmsValue_getNumberOfSetBits(MmsValue* self); +MmsValue_getNumberOfSetBits(const MmsValue* self); /** * Set all bits (set to one) of an MmsType object of type MMS_BITSTRING @@ -371,7 +371,7 @@ MmsValue_setAllBitStringBits(MmsValue* self); * \param self MmsValue instance to operate on. Has to be of a type MMS_BITSTRING. */ uint32_t -MmsValue_getBitStringAsInteger(MmsValue* self); +MmsValue_getBitStringAsInteger(const MmsValue* self); /** * \brief Convert an unsigned integer to a bit string @@ -394,7 +394,7 @@ MmsValue_setBitStringFromInteger(MmsValue* self, uint32_t intValue); * \param self MmsValue instance to operate on. Has to be of a type MMS_BITSTRING. */ uint32_t -MmsValue_getBitStringAsIntegerBigEndian(MmsValue* self); +MmsValue_getBitStringAsIntegerBigEndian(const MmsValue* self); /** * \brief Convert an unsigned integer to a bit string (big endian bit order) @@ -559,7 +559,7 @@ MmsValue_getOctetStringBuffer(MmsValue* self); * \return indicates if the update has been successful (false if not) */ bool -MmsValue_update(MmsValue* self, MmsValue* source); +MmsValue_update(MmsValue* self, const MmsValue* source); /** * \brief Check if two instances of MmsValue have the same value. @@ -573,7 +573,7 @@ MmsValue_update(MmsValue* self, MmsValue* source); * \return true if both instances are of the same type and have the same value */ bool -MmsValue_equals(MmsValue* self, MmsValue* otherValue); +MmsValue_equals(const MmsValue* self, const MmsValue* otherValue); /** * \brief Check if two (complex) instances of MmsValue have the same type. @@ -588,7 +588,7 @@ MmsValue_equals(MmsValue* self, MmsValue* otherValue); * \return true if both instances and all their children are of the same type. */ bool -MmsValue_equalTypes(MmsValue* self, MmsValue* otherValue); +MmsValue_equalTypes(const MmsValue* self, const MmsValue* otherValue); /************************************************************************************* * Constructors and destructors @@ -745,7 +745,7 @@ MmsValue_deleteIfNotNull(MmsValue* value); * \return new MmsValue instance of type MMS_VISIBLE_STRING */ MmsValue* -MmsValue_newVisibleString(char* string); +MmsValue_newVisibleString(const char* string); /** * \brief Create a new MmsValue instance of type MMS_VISIBLE_STRING. diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index 38400e6..1c9d16e 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -38,20 +38,20 @@ #include /* for ctime_r */ static inline int -bitStringByteSize(MmsValue* value) +bitStringByteSize(const MmsValue* value) { int bitSize = value->value.bitString.size; return (bitSize / 8) + ((bitSize % 8) > 0); } int -MmsValue_getBitStringByteSize(MmsValue* self) +MmsValue_getBitStringByteSize(const MmsValue* self) { return bitStringByteSize(self); } static void -updateStructuredComponent(MmsValue* self, MmsValue* update) +updateStructuredComponent(MmsValue* self, const MmsValue* update) { int componentCount; MmsValue** selfValues; @@ -96,7 +96,7 @@ MmsValue_newUnsignedFromBerInteger(Asn1PrimitiveValue* berInteger) } bool -MmsValue_equals(MmsValue* self, MmsValue* otherValue) +MmsValue_equals(const MmsValue* self, const MmsValue* otherValue) { if (self->type == otherValue->type) { switch (self->type) { @@ -189,7 +189,7 @@ MmsValue_equals(MmsValue* self, MmsValue* otherValue) } bool -MmsValue_equalTypes(MmsValue* self, MmsValue* otherValue) +MmsValue_equalTypes(const MmsValue* self, const MmsValue* otherValue) { if (self->type == otherValue->type) { switch (self->type) { @@ -220,7 +220,7 @@ MmsValue_equalTypes(MmsValue* self, MmsValue* otherValue) } bool -MmsValue_update(MmsValue* self, MmsValue* update) +MmsValue_update(MmsValue* self, const MmsValue* update) { if (self->type == update->type) { switch (self->type) { @@ -314,7 +314,7 @@ MmsValue_newBitString(int bitSize) } static int -getBitStringByteSize(MmsValue* self) +getBitStringByteSize(const MmsValue* self) { int byteSize; @@ -361,13 +361,13 @@ MmsValue_setAllBitStringBits(MmsValue* self) } int -MmsValue_getBitStringSize(MmsValue* self) +MmsValue_getBitStringSize(const MmsValue* self) { return self->value.bitString.size; } int -MmsValue_getNumberOfSetBits(MmsValue* self) +MmsValue_getNumberOfSetBits(const MmsValue* self) { int setBitsCount = 0; @@ -404,7 +404,7 @@ MmsValue_setBitStringBit(MmsValue* self, int bitPos, bool value) } bool -MmsValue_getBitStringBit(MmsValue* self, int bitPos) +MmsValue_getBitStringBit(const MmsValue* self, int bitPos) { if (bitPos < self->value.bitString.size) { int bytePos = bitPos / 8; @@ -423,7 +423,7 @@ MmsValue_getBitStringBit(MmsValue* self, int bitPos) } uint32_t -MmsValue_getBitStringAsInteger(MmsValue* self) +MmsValue_getBitStringAsInteger(const MmsValue* self) { uint32_t value = 0; @@ -454,7 +454,7 @@ MmsValue_setBitStringFromInteger(MmsValue* self, uint32_t intValue) } uint32_t -MmsValue_getBitStringAsIntegerBigEndian(MmsValue* self) +MmsValue_getBitStringAsIntegerBigEndian(const MmsValue* self) { uint32_t value = 0; @@ -1435,7 +1435,7 @@ exit_function: } static inline void -setVisibleStringValue(MmsValue* self, char* string) +setVisibleStringValue(MmsValue* self, const char* string) { if (self->value.visibleString.buf != NULL) { if (string != NULL) { @@ -1464,7 +1464,7 @@ exit_function: } static MmsValue* -MmsValue_newString(char* string, MmsType type) +MmsValue_newString(const char* string, MmsType type) { MmsValue* self = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue)); @@ -1497,7 +1497,7 @@ exit_function: } MmsValue* -MmsValue_newVisibleString(char* string) +MmsValue_newVisibleString(const char* string) { return MmsValue_newString(string, MMS_VISIBLE_STRING); } @@ -1687,7 +1687,7 @@ MmsValue_newMmsStringFromByteArray(uint8_t* byteArray, int size) } void -MmsValue_setVisibleString(MmsValue* self, char* string) +MmsValue_setVisibleString(MmsValue* self, const char* string) { if (self->type == MMS_VISIBLE_STRING) { assert(self->value.visibleString.buf != NULL);