From 1d61afaa8bb8cca2538b92ea802560a20c6ec559 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 7 Dec 2018 11:29:00 +0100 Subject: [PATCH] - C library: removed C++ style line comments --- CHANGELOG | 6 +-- src/common/conversions.c | 2 +- src/goose/goose_publisher.c | 8 +-- src/goose/goose_receiver.c | 6 +-- src/goose/goose_subscriber.h | 5 +- src/iec61850/client/client_control.c | 2 +- .../inc_private/ied_connection_private.h | 2 - src/iec61850/server/mms_mapping/control.c | 1 - src/iec61850/server/mms_mapping/mms_goose.c | 2 +- src/iec61850/server/mms_mapping/mms_mapping.c | 6 +-- src/iec61850/server/mms_mapping/mms_sv.c | 2 +- src/iec61850/server/mms_mapping/reporting.c | 4 +- src/iec61850/server/model/cdc.c | 20 +++---- src/iec61850/server/model/dynamic_model.c | 2 +- src/iec61850/server/model/model.c | 4 +- src/mms/asn1/ber_encoder.c | 2 +- src/mms/inc/mms_client_connection.h | 3 -- src/mms/inc_private/cotp.h | 4 +- src/mms/inc_private/mms_server_internal.h | 2 +- src/mms/iso_acse/acse.c | 2 - src/mms/iso_client/iso_client_connection.c | 2 +- src/mms/iso_cotp/cotp.c | 6 ++- src/mms/iso_mms/asn1c/GeneralizedTime.c | 15 +++--- src/mms/iso_mms/asn1c/INTEGER.c | 8 +-- src/mms/iso_mms/asn1c/NativeEnumerated.c | 2 +- src/mms/iso_mms/asn1c/UTF8String.c | 54 ++++++++++--------- src/mms/iso_mms/asn1c/asn_internal.h | 1 - src/mms/iso_mms/asn1c/asn_system.h | 14 ++--- .../iso_mms/client/mms_client_connection.c | 6 +-- .../iso_mms/client/mms_client_get_namelist.c | 4 +- src/mms/iso_mms/client/mms_client_journals.c | 2 - .../client/mms_client_named_variable_list.c | 1 - src/mms/iso_mms/client/mms_client_write.c | 1 - src/mms/iso_mms/common/mms_common_msg.c | 1 - src/mms/iso_mms/common/mms_value.c | 2 +- src/mms/iso_mms/server/mms_access_result.c | 2 +- .../iso_mms/server/mms_association_service.c | 4 +- src/mms/iso_mms/server/mms_file_service.c | 2 +- src/mms/iso_mms/server/mms_journal_service.c | 12 ++--- .../server/mms_named_variable_list_service.c | 4 +- src/mms/iso_mms/server/mms_read_service.c | 4 +- .../iso_mms/server/mms_server_connection.c | 2 +- src/mms/iso_mms/server/mms_value_cache.c | 6 ++- src/mms/iso_mms/server/mms_write_service.c | 2 +- src/mms/iso_presentation/iso_presentation.c | 2 +- src/mms/iso_server/iso_server.c | 6 +-- src/vs/stdbool.h | 2 +- 47 files changed, 125 insertions(+), 127 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2379d3fb..f2a6337d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,17 +2,17 @@ Changes to version 1.4.0 ------------------------ - IEC 61850 client: added asynchronous client API (can handle multiple outstanding requests in a single thread) - IEC 61850 client: added support for non-thread mode (for use with asynchronous API) -- IEC 61850 client: added IedConnection_StateChangedHandler callback that is called for each connection state change (CLOSED, CONNECTING, CONNECTED, CLOSING) +- IEC 61850 client: added IedConnection_StateChangedHandler callback that is called for each connection state change - .NET API: Added support for IedConnection.GetState and StateChangedHandler - modelviewer: show full hierarchy including sub data objects - IEC 61850 server: added IedServer_updateCtlModel function to change control model at runtime -- IEC 61850 client: added implementations for functions IedConnection_getLogicalDeviceVariables, IedConnection_getLogicalDeviceDataSets, and IedConnection_getLogicalDeviceDataSetsAsync to address #89 +- IEC 61850 client: added functions IedConnection_getLogicalDeviceVariables, IedConnection_getLogicalDeviceDataSets, and IedConnection_getLogicalDeviceDataSetsAsync to address #89 - .NET API: DataSet implements IDisposable interface, Report/DataSet GetValues methods return now clones of the original native values to prevent GC issues - .NET API: MmsValue - added Clone method and implemented IDisposable interface - .NET API: extended MmsValue.ToString method to print arrays and data access errors - common: MmsVariableSpecification_getChildValue now also accepts "." as separator - .NET API: ReportControlBlock.GetOwner returns null when no owner available (#79) - +- IEC 61850 client: IedConnection - added CONNECTING AND CLOSING states - removed IDLE state (CLOSED, CONNECTING, CONNECTED, CLOSING) Changes to version 1.3.1 ------------------------ diff --git a/src/common/conversions.c b/src/common/conversions.c index 04156bc6..4c1f18c2 100644 --- a/src/common/conversions.c +++ b/src/common/conversions.c @@ -58,7 +58,7 @@ timegm(struct tm* tm_time) #if defined(__MINGW32__) -static inline // assuming gmtime is thread safe in windows! +static inline /* assuming gmtime is thread safe in windows! */ struct tm* gmtime_r(const time_t* timep, struct tm* result) { struct tm* t; diff --git a/src/goose/goose_publisher.c b/src/goose/goose_publisher.c index 4c57701b..7f418b02 100644 --- a/src/goose/goose_publisher.c +++ b/src/goose/goose_publisher.c @@ -40,7 +40,7 @@ prepareGooseBuffer(GoosePublisher self, CommParameters* parameters, const char* struct sGoosePublisher { uint8_t* buffer; - //uint16_t appId; + /* uint16_t appId; */ EthernetSocket ethernetSocket; int lengthField; int payloadStart; @@ -49,9 +49,9 @@ struct sGoosePublisher { char* goCBRef; char* dataSetRef; - //uint16_t minTime; - //uint16_t maxTime; - //bool fixedOffs; + /* uint16_t minTime; */ + /* uint16_t maxTime; */ + /* bool fixedOffs; */ uint32_t confRev; uint32_t stNum; diff --git a/src/goose/goose_receiver.c b/src/goose/goose_receiver.c index 2a728093..392319d3 100644 --- a/src/goose/goose_receiver.c +++ b/src/goose/goose_receiver.c @@ -744,7 +744,7 @@ parseGooseMessage(GooseReceiver self, int numbytes) printf("GOOSE_SUBSCRIBER: APDU length: %i\n", apduLength); } - // check if there is an interested subscriber + /* check if there is an interested subscriber */ LinkedList element = LinkedList_getNext(self->subscriberList); while (element != NULL) { @@ -792,7 +792,7 @@ gooseReceiverLoop(void* threadParameter) } #endif -// start GOOSE receiver in a separate thread +/* start GOOSE receiver in a separate thread */ void GooseReceiver_start(GooseReceiver self) { @@ -879,7 +879,7 @@ GooseReceiver_stopThreadless(GooseReceiver self) self->running = false; } -// call after reception of ethernet frame +/* call after reception of ethernet frame */ bool GooseReceiver_tick(GooseReceiver self) { diff --git a/src/goose/goose_subscriber.h b/src/goose/goose_subscriber.h index 9d908046..9dfb4c2a 100644 --- a/src/goose/goose_subscriber.h +++ b/src/goose/goose_subscriber.h @@ -70,8 +70,9 @@ typedef void (*GooseListener)(GooseSubscriber subscriber, void* parameter); LIB61850_API GooseSubscriber GooseSubscriber_create(char* goCbRef, MmsValue* dataSetValues); -//char* -//GooseSubscriber_getGoCbRef(GooseSubscriber self); +/* char* +GooseSubscriber_getGoCbRef(GooseSubscriber self); +*/ /** * \brief set the APPID used by the subscriber to filter relevant messages. diff --git a/src/iec61850/client/client_control.c b/src/iec61850/client/client_control.c index 0fa2c4d1..55d4a1e3 100644 --- a/src/iec61850/client/client_control.c +++ b/src/iec61850/client/client_control.c @@ -299,7 +299,7 @@ ControlObjectClient_setControlModel(ControlObjectClient self, ControlModel ctlMo void ControlObjectClient_changeServerControlModel(ControlObjectClient self, ControlModel ctlModel) { - //TODO write new ctlModel to server + /* TODO write new ctlModel to server */ self->ctlModel = ctlModel; } diff --git a/src/iec61850/inc_private/ied_connection_private.h b/src/iec61850/inc_private/ied_connection_private.h index 6f850c4e..e10bc3d8 100644 --- a/src/iec61850/inc_private/ied_connection_private.h +++ b/src/iec61850/inc_private/ied_connection_private.h @@ -49,8 +49,6 @@ struct sIedConnectionOutstandingCall { bool cont; } getFileDirectory; } specificParameter2; /* function/service specific parameter */ - - //void* specificParameter2; /* function/service specific parameter */ }; struct sIedConnection diff --git a/src/iec61850/server/mms_mapping/control.c b/src/iec61850/server/mms_mapping/control.c index a03128c5..ec2f3383 100644 --- a/src/iec61850/server/mms_mapping/control.c +++ b/src/iec61850/server/mms_mapping/control.c @@ -1061,7 +1061,6 @@ Control_readAccessControlObject(MmsMapping* self, MmsDomain* domain, char* varia return value; } -//INFO: function can be removed if no certification is required static bool checkValidityOfOriginParameter(MmsValue* origin) { diff --git a/src/iec61850/server/mms_mapping/mms_goose.c b/src/iec61850/server/mms_mapping/mms_goose.c index b15be830..b6c2f517 100644 --- a/src/iec61850/server/mms_mapping/mms_goose.c +++ b/src/iec61850/server/mms_mapping/mms_goose.c @@ -244,7 +244,7 @@ MmsGooseControlBlock_enable(MmsGooseControlBlock self) if (self->goId != NULL) GoosePublisher_setGoID(self->publisher, self->goId); - //prepare data set values + /* prepare data set values */ self->dataSetValues = LinkedList_create(); DataSetEntry* dataSetEntry = self->dataSet->fcdas; diff --git a/src/iec61850/server/mms_mapping/mms_mapping.c b/src/iec61850/server/mms_mapping/mms_mapping.c index b8d7ee8e..caae7b2a 100644 --- a/src/iec61850/server/mms_mapping/mms_mapping.c +++ b/src/iec61850/server/mms_mapping/mms_mapping.c @@ -256,7 +256,7 @@ createNamedVariableFromDataAttribute(DataAttribute* attribute) namedVariable->type = MMS_UTC_TIME; break; case IEC61850_QUALITY: - namedVariable->typeSpec.bitString = -13; // -13 = up to 13 bits + namedVariable->typeSpec.bitString = -13; /* -13 = up to 13 bits */ namedVariable->type = MMS_BIT_STRING; break; case IEC61850_ENTRY_TIME: @@ -1644,7 +1644,7 @@ writeAccessGooseControlBlock(MmsMapping* self, MmsDomain* domain, char* variable #if (CONFIG_GOOSE_DATSET_WRITABLE == 1) if (strcmp(varName, "DatSet") == 0) { - // allow to set non-existing data set? + /* allow to set non-existing data set? */ MmsValue_update(MmsValue_getElement(MmsGooseControlBlock_getMmsValues(mmsGCB), 2), value); allowAccess = true; @@ -2566,7 +2566,7 @@ variableListChangedHandler (void* parameter, bool create, MmsVariableListType li if (create) { if (listType == MMS_DOMAIN_SPECIFIC) { - // check if LN exists - otherwise reject request (to fulfill test case sDsN1c) + /* check if LN exists - otherwise reject request (to fulfill test case sDsN1c) */ allow = MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT; diff --git a/src/iec61850/server/mms_mapping/mms_sv.c b/src/iec61850/server/mms_mapping/mms_sv.c index 03087403..22c25598 100644 --- a/src/iec61850/server/mms_mapping/mms_sv.c +++ b/src/iec61850/server/mms_mapping/mms_sv.c @@ -195,7 +195,7 @@ LIBIEC61850_SV_writeAccessSVControlBlock(MmsMapping* self, MmsDomain* domain, ch else { bool allowAccess = false; - // In 61850-9-2 mapping only Resv and SvEna are writable! + /* In 61850-9-2 mapping only Resv and SvEna are writable! */ if (allowAccess) return DATA_ACCESS_ERROR_SUCCESS; diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index 1297c2aa..1ace677b 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -1260,7 +1260,7 @@ updateOwner(ReportControl* rc, MmsServerConnection connection) separator = strchr(separator, '.'); if (separator != NULL) - separator++; // skip '.' character + separator++; /* skip '.' character */ addrElementCount ++; } @@ -2427,7 +2427,7 @@ return_out_of_memory: if (DEBUG_IED_SERVER) printf("IED_SERVER: sendNextReportEntry failed - memory allocation problem!\n"); - //TODO set some flag to notify application here + /* TODO set some flag to notify application here */ cleanup_and_return: diff --git a/src/iec61850/server/model/cdc.c b/src/iec61850/server/model/cdc.c index 9a64cb0e..9b5038b2 100644 --- a/src/iec61850/server/model/cdc.c +++ b/src/iec61850/server/model/cdc.c @@ -417,8 +417,10 @@ CDC_MV_create(const char* dataObjectName, ModelNode* parent, uint32_t options, b CDC_addTimeQuality(newMV, IEC61850_FC_MX); -// if (options & CDC_OPTION_PICS_SUBST) -// CDC_addOptionPicsSubst(newMV, ) +/* + if (options & CDC_OPTION_PICS_SUBST) + CDC_addOptionPicsSubst(newMV, ) +*/ CDC_addStandardOptions(newMV, options); @@ -447,8 +449,8 @@ CDC_CMV_create(const char* dataObjectName, ModelNode* parent, uint32_t options) CDC_addTimeQuality(newMV, IEC61850_FC_MX); -// if (options & CDC_OPTION_PICS_SUBST) -// CDC_addOptionPicsSubst(newMV, ) +/* if (options & CDC_OPTION_PICS_SUBST) + CDC_addOptionPicsSubst(newMV, )*/ CDC_addStandardOptions(newMV, options); @@ -499,7 +501,7 @@ CDC_HST_create(const char* dataObjectName, ModelNode* parent, uint32_t options, DataAttribute_create("numPts", (ModelNode*) newHST, IEC61850_INT16U, IEC61850_FC_CF, 0, 0, 0); - //TODO add mandatory attribute "hstRangeC" + /* TODO add mandatory attribute "hstRangeC" */ CAC_Unit_create("units", (ModelNode*) newHST, options & CDC_OPTION_UNIT_MULTIPLIER); @@ -898,8 +900,8 @@ CDC_WYE_create(const char* dataObjectName, ModelNode* parent, uint32_t options) { DataObject* newWYE = DataObject_create(dataObjectName, parent, 0); - //TODO check if some options should be masked - //TODO take care for GC_1 + /* TODO check if some options should be masked */ + /* TODO take care for GC_1 */ CDC_CMV_create("phsA", (ModelNode*) newWYE, options); CDC_CMV_create("phsB", (ModelNode*) newWYE, options); CDC_CMV_create("phsC", (ModelNode*) newWYE, options); @@ -921,7 +923,7 @@ CDC_DEL_create(const char* dataObjectName, ModelNode* parent, uint32_t options) { DataObject* newDEL = DataObject_create(dataObjectName, parent, 0); - //TODO check if some options should be masked + /* TODO check if some options should be masked */ CDC_CMV_create("phsAB", (ModelNode*) newDEL, options); CDC_CMV_create("phsBC", (ModelNode*) newDEL, options); CDC_CMV_create("phsCA", (ModelNode*) newDEL, options); @@ -1038,7 +1040,7 @@ CDC_SPV_create(const char* dataObjectName, ModelNode* parent, uint32_t options, CDC_APC_create("actVal", (ModelNode*) newSPV, 0, controlOptions, false); - //TOOO add optional "oldVal" APC + /* TOOO add optional "oldVal" APC */ if (wpOptions & CDC_OPTION_61400_MIN_MX_VAL) CAC_AnalogueValue_create("minMxVal", (ModelNode*) newSPV, IEC61850_FC_MX, 0, false); diff --git a/src/iec61850/server/model/dynamic_model.c b/src/iec61850/server/model/dynamic_model.c index a1de52ed..88fd7a0c 100644 --- a/src/iec61850/server/model/dynamic_model.c +++ b/src/iec61850/server/model/dynamic_model.c @@ -718,7 +718,7 @@ ModelNode_destroy(ModelNode* modelNode) void IedModel_destroy(IedModel* model) { - // delete all model nodes and dynamically created strings + /* delete all model nodes and dynamically created strings */ /* delete all logical devices */ diff --git a/src/iec61850/server/model/model.c b/src/iec61850/server/model/model.c index 79a8db19..0c6e4d62 100644 --- a/src/iec61850/server/model/model.c +++ b/src/iec61850/server/model/model.c @@ -583,7 +583,7 @@ ModelNode_getChildCount(ModelNode* modelNode) { ModelNode* ModelNode_getChild(ModelNode* self, const char* name) { - // check for separator + /* check for separator */ const char* separator = strchr(name, '.'); int nameElementLength = 0; @@ -620,7 +620,7 @@ ModelNode_getChild(ModelNode* self, const char* name) ModelNode* ModelNode_getChildWithFc(ModelNode* self, const char* name, FunctionalConstraint fc) { - // check for separator + /* check for separator */ const char* separator = strchr(name, '.'); int nameElementLength = 0; diff --git a/src/mms/asn1/ber_encoder.c b/src/mms/asn1/ber_encoder.c index 2417c1fa..ea80128d 100644 --- a/src/mms/asn1/ber_encoder.c +++ b/src/mms/asn1/ber_encoder.c @@ -317,7 +317,7 @@ int BerEncoder_encodeFloat(uint8_t* floatValue, uint8_t formatWidth, uint8_t exponentWidth, uint8_t* buffer, int bufPos) { - //TODO operate on encoding buffer directly + /* TODO operate on encoding buffer directly */ uint8_t valueBuffer[9]; int byteSize = formatWidth / 8; diff --git a/src/mms/inc/mms_client_connection.h b/src/mms/inc/mms_client_connection.h index 23a0734e..80e15f04 100644 --- a/src/mms/inc/mms_client_connection.h +++ b/src/mms/inc/mms_client_connection.h @@ -264,9 +264,6 @@ MmsConnection_connect(MmsConnection self, MmsError* mmsError, const char* server LIB61850_API void MmsConnection_connectAsync(MmsConnection self, MmsError* mmsError, const char* serverName, int serverPort); - -// return value indicates that connection is currently waiting and calling thread can be suspended - /** * \brief Call MmsConnection state machine and connection handling code (for non-threaded mode only) * diff --git a/src/mms/inc_private/cotp.h b/src/mms/inc_private/cotp.h index 62ed9a30..75eba309 100644 --- a/src/mms/inc_private/cotp.h +++ b/src/mms/inc_private/cotp.h @@ -44,9 +44,9 @@ typedef struct { int protocolClass; Socket socket; -//#if (CONFIG_MMS_SUPPORT_TLS == 1) +#if (CONFIG_MMS_SUPPORT_TLS == 1) TLSSocket tlsSocket; -//#endif +#endif CotpOptions options; bool isLastDataUnit; diff --git a/src/mms/inc_private/mms_server_internal.h b/src/mms/inc_private/mms_server_internal.h index 45ed7882..0cab6c2a 100644 --- a/src/mms/inc_private/mms_server_internal.h +++ b/src/mms/inc_private/mms_server_internal.h @@ -116,7 +116,7 @@ struct sMmsServer { MmsConnectionHandler connectionHandler; void* connectionHandlerParameter; - MmsNamedVariableListChangedHandler variableListChangedHandler; //TODO this is only required if dynamic data sets are supported! + MmsNamedVariableListChangedHandler variableListChangedHandler; /* TODO this is only required if dynamic data sets are supported! */ void* variableListChangedHandlerParameter; Map openConnections; diff --git a/src/mms/iso_acse/acse.c b/src/mms/iso_acse/acse.c index 6235f216..8ff5b335 100644 --- a/src/mms/iso_acse/acse.c +++ b/src/mms/iso_acse/acse.c @@ -623,8 +623,6 @@ AcseConnection_createAssociateRequestMessage(AcseConnection* self, { contentLength += 2; - //if (authParameter->value.password.passwordLength == 0) - passwordLength = authParameter->value.password.passwordLength; authValueStringLength = BerEncoder_determineLengthSize( diff --git a/src/mms/iso_client/iso_client_connection.c b/src/mms/iso_client/iso_client_connection.c index 3acfdce7..74f0108a 100644 --- a/src/mms/iso_client/iso_client_connection.c +++ b/src/mms/iso_client/iso_client_connection.c @@ -828,7 +828,7 @@ IsoClientConnection_abortAsync(IsoClientConnection self) void IsoClientConnection_release(IsoClientConnection self) { - //TODO block other messages from being sent + /* TODO block other messages from being sent */ IsoClientConnection_allocateTransmitBuffer(self); struct sBufferChain sAcseBuffer; diff --git a/src/mms/iso_cotp/cotp.c b/src/mms/iso_cotp/cotp.c index 7ce8ecc4..2b39d4df 100644 --- a/src/mms/iso_cotp/cotp.c +++ b/src/mms/iso_cotp/cotp.c @@ -5,7 +5,7 @@ * * Partial implementation of the ISO 8073 COTP (ISO TP0) protocol for MMS. * - * Copyright 2013, 2014 Michael Zillgith + * Copyright 2013-2018 Michael Zillgith * * This file is part of libIEC61850. * @@ -63,7 +63,7 @@ getUint8(uint8_t* buffer) static void writeOptions(CotpConnection* self) { - // max size = 11 byte + /* max size = 11 byte */ uint8_t* buffer = self->writeBuffer->buffer; int bufPos = self->writeBuffer->size; @@ -449,7 +449,9 @@ CotpConnection_init(CotpConnection* self, Socket socket, { self->state = 0; self->socket = socket; +#if (CONFIG_MMS_SUPPORT_TLS == 1) self->tlsSocket = NULL; +#endif self->remoteRef = -1; self->localRef = 1; self->protocolClass = -1; diff --git a/src/mms/iso_mms/asn1c/GeneralizedTime.c b/src/mms/iso_mms/asn1c/GeneralizedTime.c index e04df240..45d6b842 100644 --- a/src/mms/iso_mms/asn1c/GeneralizedTime.c +++ b/src/mms/iso_mms/asn1c/GeneralizedTime.c @@ -161,10 +161,7 @@ static long GMTOFF(struct tm a){ #ifdef _EMULATE_TIMEGM static time_t timegm(struct tm *tm) { time_t tloc; - //ATZVARS; - //ATZSAVETZ; tloc = mktime(tm); -// ATZOLDTZ; return tloc; } #endif /* _EMULATE_TIMEGM */ @@ -245,7 +242,9 @@ GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, /* Failed to recognize time. Fail completely. */ _ASN_ENCODE_FAILED; - //st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */ +#if 0 + st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */ +#endif if(!st) _ASN_ENCODE_FAILED; /* Memory allocation failure. */ erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key); @@ -264,7 +263,7 @@ GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { - GeneralizedTime_t *gt = NULL; // modified MZ + GeneralizedTime_t *gt = NULL; /* modified MZ */ asn_enc_rval_t rv; int fv, fd; /* fractional parts */ struct tm tm; @@ -275,7 +274,9 @@ GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, && errno != EPERM) _ASN_ENCODE_FAILED; - //gt = asn_time2GT_frac(0, &tm, fv, fd, 1); +#if 0 + gt = asn_time2GT_frac(0, &tm, fv, fd, 1); +#endif if(!gt) _ASN_ENCODE_FAILED; rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, @@ -551,7 +552,7 @@ local_finish: /*** AT THIS POINT tm_s is either GMT or local (unknown) ****/ if(offset_specified) { - //tloc = timegm(&tm_s); + /* tloc = timegm(&tm_s); */ } else { /* * Without an offset (or "Z"), diff --git a/src/mms/iso_mms/asn1c/INTEGER.c b/src/mms/iso_mms/asn1c/INTEGER.c index c1d074f5..08d4b1df 100644 --- a/src/mms/iso_mms/asn1c/INTEGER.c +++ b/src/mms/iso_mms/asn1c/INTEGER.c @@ -6,7 +6,7 @@ #include #include #include /* Encoder and decoder of a primitive type */ -//#include +/* #include */ /* * INTEGER basic type description. @@ -742,7 +742,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { /* Sanity checking */ if(!iptr || !iptr->buf || !lptr) { - //errno = EINVAL; + /* errno = EINVAL; */ return -1; } @@ -771,7 +771,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { size = end - b; if(size > sizeof(long)) { /* Still cannot fit the long */ - //errno = ERANGE; + /* errno = ERANGE; */ return -1; } } @@ -804,7 +804,7 @@ asn_long2INTEGER(INTEGER_t *st, long value) { int add; if(!st) { - //errno = EINVAL; + /* errno = EINVAL; */ return -1; } diff --git a/src/mms/iso_mms/asn1c/NativeEnumerated.c b/src/mms/iso_mms/asn1c/NativeEnumerated.c index 76aab81b..3afa5eeb 100644 --- a/src/mms/iso_mms/asn1c/NativeEnumerated.c +++ b/src/mms/iso_mms/asn1c/NativeEnumerated.c @@ -28,7 +28,7 @@ asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { NativeInteger_encode_der, NULL, NULL, - //NativeEnumerated_encode_xer, + /* NativeEnumerated_encode_xer, */ NativeEnumerated_decode_uper, NativeEnumerated_encode_uper, 0, /* Use generic outmost tag fetcher */ diff --git a/src/mms/iso_mms/asn1c/UTF8String.c b/src/mms/iso_mms/asn1c/UTF8String.c index c89ff7a0..68c5c1b1 100644 --- a/src/mms/iso_mms/asn1c/UTF8String.c +++ b/src/mms/iso_mms/asn1c/UTF8String.c @@ -70,32 +70,34 @@ int UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { ssize_t len = UTF8String_length((const UTF8String_t *)sptr); -// switch(len) { -// case U8E_EINVAL: -// _ASN_CTFAIL(app_key, td, -// "%s: value not given", td->name); -// break; -// case U8E_TRUNC: -// _ASN_CTFAIL(app_key, td, -// "%s: truncated UTF-8 sequence (%s:%d)", -// td->name, __FILE__, __LINE__); -// break; -// case U8E_ILLSTART: -// _ASN_CTFAIL(app_key, td, -// "%s: UTF-8 illegal start of encoding (%s:%d)", -// td->name, __FILE__, __LINE__); -// break; -// case U8E_NOTCONT: -// _ASN_CTFAIL(app_key, td, -// "%s: UTF-8 not continuation (%s:%d)", -// td->name, __FILE__, __LINE__); -// break; -// case U8E_NOTMIN: -// _ASN_CTFAIL(app_key, td, -// "%s: UTF-8 not minimal sequence (%s:%d)", -// td->name, __FILE__, __LINE__); -// break; -// } +#if 0 + switch(len) { + case U8E_EINVAL: + _ASN_CTFAIL(app_key, td, + "%s: value not given", td->name); + break; + case U8E_TRUNC: + _ASN_CTFAIL(app_key, td, + "%s: truncated UTF-8 sequence (%s:%d)", + td->name, __FILE__, __LINE__); + break; + case U8E_ILLSTART: + _ASN_CTFAIL(app_key, td, + "%s: UTF-8 illegal start of encoding (%s:%d)", + td->name, __FILE__, __LINE__); + break; + case U8E_NOTCONT: + _ASN_CTFAIL(app_key, td, + "%s: UTF-8 not continuation (%s:%d)", + td->name, __FILE__, __LINE__); + break; + case U8E_NOTMIN: + _ASN_CTFAIL(app_key, td, + "%s: UTF-8 not minimal sequence (%s:%d)", + td->name, __FILE__, __LINE__); + break; + } +#endif return (len < 0) ? -1 : 0; } diff --git a/src/mms/iso_mms/asn1c/asn_internal.h b/src/mms/iso_mms/asn1c/asn_internal.h index 1965b16c..493b4336 100644 --- a/src/mms/iso_mms/asn1c/asn_internal.h +++ b/src/mms/iso_mms/asn1c/asn_internal.h @@ -11,7 +11,6 @@ #include "asn_application.h" /* Application-visible API */ -//#include "libiec61850_platform_includes.h" #include "lib_memory.h" #ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ diff --git a/src/mms/iso_mms/asn1c/asn_system.h b/src/mms/iso_mms/asn1c/asn_system.h index 76f69c5f..1292707c 100644 --- a/src/mms/iso_mms/asn1c/asn_system.h +++ b/src/mms/iso_mms/asn1c/asn_system.h @@ -47,12 +47,14 @@ #define inline __inline #endif #define ssize_t SSIZE_T -//typedef char int8_t; -//typedef short int16_t; -//typedef int int32_t; -//typedef unsigned char uint8_t; -//typedef unsigned short uint16_t; -//typedef unsigned int uint32_t; +#if 0 +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif #define WIN32_LEAN_AND_MEAN #include #include diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index 95ea5cbb..af32fc5d 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -1195,7 +1195,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload) if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: received confirmed request PDU (size=%i)\n", payload->size); - // TODO extract function + /* TODO extract function */ int bufPos = 1; int length; @@ -1267,7 +1267,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload) #endif /* MMS_FILE_SERVICE == 1 */ default: - // mmsServer_writeMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_UNRECOGNIZED_SERVICE, response); + /* mmsServer_writeMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_UNRECOGNIZED_SERVICE, response); */ if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: unexpected message from server!\n"); @@ -1287,7 +1287,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload) break; default: - // mmsServer_writeMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_UNRECOGNIZED_SERVICE, response); + /* mmsServer_writeMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_UNRECOGNIZED_SERVICE, response); */ if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: unexpected message from server!\n"); diff --git a/src/mms/iso_mms/client/mms_client_get_namelist.c b/src/mms/iso_mms/client/mms_client_get_namelist.c index 23de82b0..e67831b3 100644 --- a/src/mms/iso_mms/client/mms_client_get_namelist.c +++ b/src/mms/iso_mms/client/mms_client_get_namelist.c @@ -110,7 +110,7 @@ mmsClient_createMmsGetNameListRequestAssociationSpecific(long invokeId, ByteBuff bool mmsClient_parseGetNameListResponse(LinkedList* nameList, ByteBuffer* message) { - // TODO only parse get name list specific part! + /* TODO only parse get name list specific part here */ bool moreFollows = true; @@ -121,7 +121,7 @@ mmsClient_parseGetNameListResponse(LinkedList* nameList, ByteBuffer* message) uint8_t tag = buffer[bufPos++]; if (tag == 0xa2) { - // TODO parse confirmed error PDU + /* TODO parse confirmed error PDU */ goto exit_error; } if (tag != 0xa1) goto exit_error; diff --git a/src/mms/iso_mms/client/mms_client_journals.c b/src/mms/iso_mms/client/mms_client_journals.c index 0821ec61..6bb8fb13 100644 --- a/src/mms/iso_mms/client/mms_client_journals.c +++ b/src/mms/iso_mms/client/mms_client_journals.c @@ -33,8 +33,6 @@ #include "conversions.h" #include "mms_value_internal.h" -//TODO add event-based API to parse journal entries - static bool parseJournalVariable(uint8_t* buffer, int bufPos, int maxLength, MmsJournalVariable journalVariable) { diff --git a/src/mms/iso_mms/client/mms_client_named_variable_list.c b/src/mms/iso_mms/client/mms_client_named_variable_list.c index e34305fd..630eb9dd 100644 --- a/src/mms/iso_mms/client/mms_client_named_variable_list.c +++ b/src/mms/iso_mms/client/mms_client_named_variable_list.c @@ -353,7 +353,6 @@ mmsClient_createDefineNamedVariableListRequest( request->listOfVariable.list.array[i]->variableSpecification.choice.name.choice. domainspecific.itemId.buf = (uint8_t*) StringUtils_copyString(variableSpec->itemId); - //TODO add alternate access if (variableSpec->arrayIndex != -1) { AlternateAccess_t* alternateAccess = (AlternateAccess_t*) GLOBAL_CALLOC(1, sizeof(AlternateAccess_t)); diff --git a/src/mms/iso_mms/client/mms_client_write.c b/src/mms/iso_mms/client/mms_client_write.c index de80fdc9..358dd515 100644 --- a/src/mms/iso_mms/client/mms_client_write.c +++ b/src/mms/iso_mms/client/mms_client_write.c @@ -542,7 +542,6 @@ mmsClient_createWriteRequestAlternateAccessSingleIndexComponent(uint32_t invokeI /* Create list of variable specifications */ request->variableAccessSpecification.present = VariableAccessSpecification_PR_listOfVariable; request->variableAccessSpecification.choice.listOfVariable.list.count = 1; - //request->variableAccessSpecification.choice.listOfVariable.list.size = 1; request->variableAccessSpecification.choice.listOfVariable.list.array = (ListOfVariableSeq_t**) GLOBAL_CALLOC(1, sizeof(ListOfVariableSeq_t*)); diff --git a/src/mms/iso_mms/common/mms_common_msg.c b/src/mms/iso_mms/common/mms_common_msg.c index 47673a48..33571c86 100644 --- a/src/mms/iso_mms/common/mms_common_msg.c +++ b/src/mms/iso_mms/common/mms_common_msg.c @@ -350,7 +350,6 @@ void mmsMsg_createExtendedFilename(const char* basepath, char* extendedFileName, char* fileName) { #if (CONFIG_SET_FILESTORE_BASEPATH_AT_RUNTIME == 1) - // strncpy(extendedFileName, MmsServerConnection_getFilesystemBasepath(self), 512); strncpy(extendedFileName, basepath, 512); strncat(extendedFileName, fileName, 512); #else diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index 9273f13a..d4fa31a3 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -801,7 +801,7 @@ MmsValue_getUtcTimeInMsWithUs(const MmsValue* self, uint32_t* usec) fractionOfSecond += (valueArray[5] << 8); fractionOfSecond += (valueArray[6]); - uint64_t remainder = fractionOfSecond * 1000000ULL / 0x1000000ULL; // in usec + uint64_t remainder = fractionOfSecond * 1000000ULL / 0x1000000ULL; /* in usec */ uint64_t msVal = (timeval32 * 1000LL) + (remainder / 1000LL); diff --git a/src/mms/iso_mms/server/mms_access_result.c b/src/mms/iso_mms/server/mms_access_result.c index 5ee4936c..1ed962f0 100644 --- a/src/mms/iso_mms/server/mms_access_result.c +++ b/src/mms/iso_mms/server/mms_access_result.c @@ -28,7 +28,7 @@ static int encodeArrayAccessResult(MmsValue* value, uint8_t* buffer, int bufPos, bool encode) { - if (value == NULL) // TODO report internal error + if (value == NULL) /* TODO report internal error */ return 0; int elementsSize = 0; diff --git a/src/mms/iso_mms/server/mms_association_service.c b/src/mms/iso_mms/server/mms_association_service.c index 25c69dde..22b24a50 100644 --- a/src/mms/iso_mms/server/mms_association_service.c +++ b/src/mms/iso_mms/server/mms_association_service.c @@ -272,7 +272,7 @@ parseInitiateRequestPdu(MmsServerConnection self, uint8_t* buffer, int bufPos, i bufPos = BerDecoder_decodeLength(buffer, &length, bufPos, maxBufPos); if (bufPos < 0) { - // TODO write initiate error PDU! + /* TODO write initiate error PDU! */ return false; } @@ -328,7 +328,7 @@ mmsServer_handleInitiateRequest ( if (parseInitiateRequestPdu(self, buffer, bufPos, maxBufPos)) createInitiateResponse(self, response); else { - //TODO send initiate error PDU + /* TODO send initiate error PDU */ } } diff --git a/src/mms/iso_mms/server/mms_file_service.c b/src/mms/iso_mms/server/mms_file_service.c index 1bd29ef5..f93d44ea 100644 --- a/src/mms/iso_mms/server/mms_file_service.c +++ b/src/mms/iso_mms/server/mms_file_service.c @@ -808,7 +808,7 @@ mmsServer_handleFileCloseRequest( -static int //TODO remove redundancy - same as in client code! +static int /* TODO remove redundancy - same as in client code! */ encodeFileSpecification(uint8_t tag, char* fileSpecification, uint8_t* buffer, int bufPos) { uint32_t fileNameStringSize = strlen(fileSpecification); diff --git a/src/mms/iso_mms/server/mms_journal_service.c b/src/mms/iso_mms/server/mms_journal_service.c index 6008f955..0bbed87f 100644 --- a/src/mms/iso_mms/server/mms_journal_service.c +++ b/src/mms/iso_mms/server/mms_journal_service.c @@ -57,7 +57,7 @@ struct sJournalEncoder { int maxSize; int bufPos; int currentEntryBufPos; /* store start buffer position of current entry in case the whole JournalEntry will become too long */ - uint64_t currentEntryId; //TODO use a byte array for the generic MMS case! + uint64_t currentEntryId; /* For generic MMS case a byte array would be required! */ uint64_t currentTimestamp; bool moreFollows; }; @@ -92,7 +92,7 @@ entryDataCallback (void* parameter, const char* dataRef, uint8_t* data, int data uint8_t* buffer = encoder->buffer; - //TODO check if entry is too long for buffer! + /* TODO check if entry is too long for buffer! */ if (moreFollow) { int bufPos = encoder->bufPos; @@ -327,7 +327,7 @@ mmsServer_handleReadJournalRequest( } else { mmsMsg_createMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_REQUEST_INVALID_ARGUMENT, response); - return; // forward request to implementation class + return; /* forward request to implementation class */ } bufPos += length; @@ -361,7 +361,7 @@ mmsServer_handleReadJournalRequest( } else { mmsMsg_createMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_REQUEST_INVALID_ARGUMENT, response); - return; // forward request to implementation class + return; /* forward request to implementation class */ } bufPos += length; @@ -433,7 +433,7 @@ mmsServer_handleReadJournalRequest( } } - //TODO check if required fields are present + /* check if required fields are present */ if (hasNames == false) { if (DEBUG_MMS_SERVER) printf("MMS_SERVER: readJournal missing journal name\n"); @@ -442,7 +442,7 @@ mmsServer_handleReadJournalRequest( return; } - //TODO check valid field combinations + /* TODO check valid field combinations */ /* lookup journal */ MmsDevice* mmsDevice = MmsServer_getDevice(connection->server); diff --git a/src/mms/iso_mms/server/mms_named_variable_list_service.c b/src/mms/iso_mms/server/mms_named_variable_list_service.c index 3a0a78a7..5e4f0704 100644 --- a/src/mms/iso_mms/server/mms_named_variable_list_service.c +++ b/src/mms/iso_mms/server/mms_named_variable_list_service.c @@ -383,7 +383,7 @@ createNamedVariableList(MmsServer server, MmsDomain* domain, MmsDevice* device, accessSpecifier.arrayIndex = arrayIndex; accessSpecifier.componentName = componentName; - // check if element exists + /* check if element exists */ if (checkIfVariableExists(device, &accessSpecifier) == true) { MmsNamedVariableListEntry variable = @@ -394,7 +394,7 @@ createNamedVariableList(MmsServer server, MmsDomain* domain, MmsDevice* device, else { MmsNamedVariableList_destroy(namedVariableList); namedVariableList = NULL; - i = variableCount; // exit loop after freeing loop variables + i = variableCount; /* exit loop after freeing loop variables */ *mmsError = MMS_ERROR_DEFINITION_OBJECT_UNDEFINED; } } diff --git a/src/mms/iso_mms/server/mms_read_service.c b/src/mms/iso_mms/server/mms_read_service.c index 5a7a62d2..727f5ed6 100644 --- a/src/mms/iso_mms/server/mms_read_service.c +++ b/src/mms/iso_mms/server/mms_read_service.c @@ -268,7 +268,7 @@ alternateArrayAccess(MmsServerConnection connection, appendErrorToResultList(values, DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT); } - else { // invalid access + else { /* invalid access */ if (DEBUG_MMS_SERVER) printf("Invalid alternate access\n"); appendErrorToResultList(values, DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT); @@ -518,7 +518,7 @@ handleReadListOfVariablesRequest( LinkedList /**/ values = LinkedList_create(); if (isSpecWithResult(read)) { /* add specification to result */ - // ignore - not required for IEC 61850 + /* ignore - not required for IEC 61850 */ } int i; diff --git a/src/mms/iso_mms/server/mms_server_connection.c b/src/mms/iso_mms/server/mms_server_connection.c index bf2545a1..3a3196d4 100644 --- a/src/mms/iso_mms/server/mms_server_connection.c +++ b/src/mms/iso_mms/server/mms_server_connection.c @@ -747,7 +747,7 @@ MmsServerConnection_destroy(MmsServerConnection self) bool MmsServerConnection_addNamedVariableList(MmsServerConnection self, MmsNamedVariableList variableList) { - //TODO check if operation is allowed! + /* TODO check if operation is allowed! */ LinkedList_add(self->namedVariableLists, variableList); diff --git a/src/mms/iso_mms/server/mms_value_cache.c b/src/mms/iso_mms/server/mms_value_cache.c index f66c69a9..0af1d164 100644 --- a/src/mms/iso_mms/server/mms_value_cache.c +++ b/src/mms/iso_mms/server/mms_value_cache.c @@ -117,8 +117,10 @@ searchCacheForValue(MmsValueCache self, const char* itemId, char* parentId) MmsValue* MmsValueCache_lookupValue(MmsValueCache self, const char* itemId) { - // get value for first matching key substring! - // Then iterate the value for the exact value. + /* + * get value for first matching key substring! + * Then iterate the value for the exact value. + */ MmsValue* value = NULL; diff --git a/src/mms/iso_mms/server/mms_write_service.c b/src/mms/iso_mms/server/mms_write_service.c index 13eaec62..acc24bad 100644 --- a/src/mms/iso_mms/server/mms_write_service.c +++ b/src/mms/iso_mms/server/mms_write_service.c @@ -307,7 +307,7 @@ mmsServer_handleWriteRequest2( printf(" %s\n", printBuf); } else { - //TODO cleanup already decoded MmsValue instances + /* TODO cleanup already decoded MmsValue instances */ printf(" Failed to decode MMS data value\n"); mmsMsg_createMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_INVALID_PDU, response); return; diff --git a/src/mms/iso_presentation/iso_presentation.c b/src/mms/iso_presentation/iso_presentation.c index 328a2edb..b956248e 100644 --- a/src/mms/iso_presentation/iso_presentation.c +++ b/src/mms/iso_presentation/iso_presentation.c @@ -116,7 +116,7 @@ createConnectPdu(IsoPresentation* self, BufferChain writeBuffer, BufferChain pay normalModeLength += 2; - contentLength += normalModeLength; // + 2; + contentLength += normalModeLength; contentLength += 1 + BerEncoder_determineLengthSize(normalModeLength); diff --git a/src/mms/iso_server/iso_server.c b/src/mms/iso_server/iso_server.c index ddd43d81..3ea83a48 100644 --- a/src/mms/iso_server/iso_server.c +++ b/src/mms/iso_server/iso_server.c @@ -365,7 +365,7 @@ exit_function: #if (CONFIG_MMS_THREADLESS_STACK == 0) -// used by single and multi-threaded versions +/* used by single and multi-threaded versions */ static void handleIsoConnections(IsoServer self) { @@ -420,7 +420,7 @@ handleIsoConnections(IsoServer self) } #endif /* (CONFIG_MMS_THREADLESS_STACK == 0) */ -// used by non-threaded version +/* used by non-threaded version */ static void handleIsoConnectionsThreadless(IsoServer self) { @@ -470,7 +470,7 @@ handleIsoConnectionsThreadless(IsoServer self) } #if (CONFIG_MMS_THREADLESS_STACK != 1) -// only required for multi-threaded server! +/* only required for multi-threaded server! */ static void isoServerThread(void* isoServerParam) { diff --git a/src/vs/stdbool.h b/src/vs/stdbool.h index b949d597..da58d0e3 100644 --- a/src/vs/stdbool.h +++ b/src/vs/stdbool.h @@ -1 +1 @@ -// just to make Visual Studio Compiler happy! +/* just to make Visual Studio Compiler happy! */