- C library: removed C++ style line comments

pull/93/head
Michael Zillgith 7 years ago
parent 6a7266da93
commit 1d61afaa8b

@ -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
------------------------

@ -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;

@ -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;

@ -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)
{

@ -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.

@ -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;
}

@ -49,8 +49,6 @@ struct sIedConnectionOutstandingCall {
bool cont;
} getFileDirectory;
} specificParameter2; /* function/service specific parameter */
//void* specificParameter2; /* function/service specific parameter */
};
struct sIedConnection

@ -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)
{

@ -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;

@ -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;

@ -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;

@ -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:

@ -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);

@ -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 */

@ -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;

@ -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;

@ -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)
*

@ -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;

@ -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;

@ -623,8 +623,6 @@ AcseConnection_createAssociateRequestMessage(AcseConnection* self,
{
contentLength += 2;
//if (authParameter->value.password.passwordLength == 0)
passwordLength = authParameter->value.password.passwordLength;
authValueStringLength = BerEncoder_determineLengthSize(

@ -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;

@ -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;

@ -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"),

@ -6,7 +6,7 @@
#include <asn_internal.h>
#include <INTEGER.h>
#include <asn_codecs_prim.h> /* Encoder and decoder of a primitive type */
//#include <errno.h>
/* #include <errno.h> */
/*
* 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;
}

@ -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 */

@ -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;
}

@ -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. */

@ -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 <windows.h>
#include <float.h>

@ -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");

@ -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;

@ -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)
{

@ -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));

@ -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*));

@ -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

@ -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);

@ -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;

@ -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 */
}
}

@ -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);

@ -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);

@ -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;
}
}

@ -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 /*<MmsValue>*/ values = LinkedList_create();
if (isSpecWithResult(read)) { /* add specification to result */
// ignore - not required for IEC 61850
/* ignore - not required for IEC 61850 */
}
int i;

@ -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);

@ -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;

@ -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;

@ -116,7 +116,7 @@ createConnectPdu(IsoPresentation* self, BufferChain writeBuffer, BufferChain pay
normalModeLength += 2;
contentLength += normalModeLength; // + 2;
contentLength += normalModeLength;
contentLength += 1 + BerEncoder_determineLengthSize(normalModeLength);

@ -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)
{

@ -1 +1 @@
// just to make Visual Studio Compiler happy!
/* just to make Visual Studio Compiler happy! */

Loading…
Cancel
Save