- added CONFIG_IEC61850_EDITION_1 configuration option

- removed "Owner" from RCBs for edition 1 builds
pull/6/head
Michael Zillgith 10 years ago
parent 44b94f0df0
commit 5261378603

@ -1,5 +1,6 @@
Changes to version 0.9.0.2 Changes to version 0.9.0.2
-------------------------- --------------------------
- added CONFIG_IEC61850_EDITION_1 configuration option to enable server builds for edition 1 (at the moment only remove "Owner" form RCBs).
- fixed encoding problem with negative frsmId in client file read service - fixed encoding problem with negative frsmId in client file read service
- allow 1 to 16 octet size ISO session selector (small API change in IsoConnectionParameters methods) - allow 1 to 16 octet size ISO session selector (small API change in IsoConnectionParameters methods)
- added C++ compatible headers to GOOSE/SV publisher headers - added C++ compatible headers to GOOSE/SV publisher headers

@ -36,7 +36,7 @@
* 0 ==> server runs in multi-threaded mode (one thread for each connection and * 0 ==> server runs in multi-threaded mode (one thread for each connection and
* one server background thread ) * one server background thread )
*/ */
#define CONFIG_MMS_SINGLE_THREADED 0 #define CONFIG_MMS_SINGLE_THREADED 1
/* /*
* Optimize stack for threadless operation - don't use semaphores * Optimize stack for threadless operation - don't use semaphores
@ -77,6 +77,9 @@
/* Set to 1 to include Sampled Values support in the build. Otherwise set to 0 */ /* Set to 1 to include Sampled Values support in the build. Otherwise set to 0 */
#define CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 1 #define CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 1
/* Set to 1 to compile for edition 1 server - default is 0 to compile for edition 2 */
#define CONFIG_IEC61850_EDITION_1 0
#ifdef _WIN32 #ifdef _WIN32
/* GOOSE will be disabled for Windows if ethernet support (winpcap) is not available */ /* GOOSE will be disabled for Windows if ethernet support (winpcap) is not available */

@ -74,6 +74,9 @@
/* Set to 1 to include Sampled Values support in the build. Otherwise set to 0 */ /* Set to 1 to include Sampled Values support in the build. Otherwise set to 0 */
#define CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 1 #define CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT 1
/* Set to 1 to compile for edition 1 server - default is 0 to compile for edition 2 */
#define CONFIG_IEC61850_EDITION_1 0
#ifdef _WIN32 #ifdef _WIN32
/* GOOSE will be disabled for Windows if ethernet support (winpcap) is not available */ /* GOOSE will be disabled for Windows if ethernet support (winpcap) is not available */

@ -47,6 +47,20 @@
#define CONFIG_IEC61850_BRCB_WITH_RESVTMS 0 #define CONFIG_IEC61850_BRCB_WITH_RESVTMS 0
#endif #endif
#ifndef CONFIG_IEC61850_EDITION_1
#define CONFIG_IEC61850_EDITION_1 0
#endif
#if (CONFIG_IEC61850_EDITION_1 == 1)
#define CONFIG_REPORTING_SUPPORTS_OWNER 0
#endif
#ifndef CONFIG_REPORTING_SUPPORTS_OWNER
#define CONFIG_REPORTING_SUPPORTS_OWNER 1
#endif
static ReportBuffer* static ReportBuffer*
ReportBuffer_create(void) ReportBuffer_create(void)
{ {
@ -269,6 +283,8 @@ updateTimeOfEntry(ReportControl* self, uint64_t currentTime)
static void static void
sendReport(ReportControl* self, bool isIntegrity, bool isGI) sendReport(ReportControl* self, bool isIntegrity, bool isGI)
{ {
updateTimeOfEntry(self, Hal_getTimeInMs());
LinkedList reportElements = LinkedList_create(); LinkedList reportElements = LinkedList_create();
LinkedList deletableElements = LinkedList_create(); LinkedList deletableElements = LinkedList_create();
@ -734,10 +750,17 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
MmsValue* mmsValue = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue)); MmsValue* mmsValue = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue));
mmsValue->deleteValue = false; mmsValue->deleteValue = false;
mmsValue->type = MMS_STRUCTURE; mmsValue->type = MMS_STRUCTURE;
mmsValue->value.structure.size = 12;
mmsValue->value.structure.components = (MmsValue**) GLOBAL_CALLOC(12, sizeof(MmsValue*));
rcb->typeSpec.structure.elementCount = 12; #if (CONFIG_REPORTING_SUPPORTS_OWNER == 1)
int structSize = 12;
#else
int structSize = 11;
#endif
mmsValue->value.structure.size = structSize;
mmsValue->value.structure.components = (MmsValue**) GLOBAL_CALLOC(structSize, sizeof(MmsValue*));
rcb->typeSpec.structure.elementCount = structSize;
rcb->typeSpec.structure.elements = (MmsVariableSpecification**) GLOBAL_CALLOC(12, rcb->typeSpec.structure.elements = (MmsVariableSpecification**) GLOBAL_CALLOC(12,
sizeof(MmsVariableSpecification*)); sizeof(MmsVariableSpecification*));
@ -834,12 +857,14 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
rcb->typeSpec.structure.elements[10] = namedVariable; rcb->typeSpec.structure.elements[10] = namedVariable;
mmsValue->value.structure.components[10] = MmsValue_newBoolean(false); mmsValue->value.structure.components[10] = MmsValue_newBoolean(false);
#if (CONFIG_REPORTING_SUPPORTS_OWNER == 1)
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("Owner"); namedVariable->name = copyString("Owner");
namedVariable->type = MMS_OCTET_STRING; namedVariable->type = MMS_OCTET_STRING;
namedVariable->typeSpec.octetString = -64; namedVariable->typeSpec.octetString = -64;
rcb->typeSpec.structure.elements[11] = namedVariable; rcb->typeSpec.structure.elements[11] = namedVariable;
mmsValue->value.structure.components[11] = MmsValue_newOctetString(0, 128); mmsValue->value.structure.components[11] = MmsValue_newOctetString(0, 128);
#endif /* (CONFIG_REPORTING_SUPPORTS_OWNER == 1) */
reportControl->rcbValues = mmsValue; reportControl->rcbValues = mmsValue;
@ -860,14 +885,15 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
rcb->name = copyString(reportControlBlock->name); rcb->name = copyString(reportControlBlock->name);
rcb->type = MMS_STRUCTURE; rcb->type = MMS_STRUCTURE;
int brcbElementCount; int brcbElementCount = 13;
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) #if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
brcbElementCount = 15; brcbElementCount++;
#else
brcbElementCount = 14;
#endif #endif
#if (CONFIG_REPORTING_SUPPORTS_OWNER == 1)
brcbElementCount++;
#endif
MmsValue* mmsValue = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue)); MmsValue* mmsValue = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue));
mmsValue->deleteValue = false; mmsValue->deleteValue = false;
@ -989,7 +1015,9 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
reportControl->timeOfEntry = mmsValue->value.structure.components[12]; reportControl->timeOfEntry = mmsValue->value.structure.components[12];
#if ((CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) || (CONFIG_REPORTING_SUPPORTS_OWNER == 1))
int currentIndex = 13; int currentIndex = 13;
#endif
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) #if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
@ -1001,12 +1029,14 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
currentIndex++; currentIndex++;
#endif /* (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) */ #endif /* (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) */
#if (CONFIG_REPORTING_SUPPORTS_OWNER == 1)
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("Owner"); namedVariable->name = copyString("Owner");
namedVariable->type = MMS_OCTET_STRING; namedVariable->type = MMS_OCTET_STRING;
namedVariable->typeSpec.octetString = -64; namedVariable->typeSpec.octetString = -64;
rcb->typeSpec.structure.elements[currentIndex] = namedVariable; rcb->typeSpec.structure.elements[currentIndex] = namedVariable;
mmsValue->value.structure.components[currentIndex] = MmsValue_newOctetString(0, 128); /* size 4 is enough to store client IPv4 address */ mmsValue->value.structure.components[currentIndex] = MmsValue_newOctetString(0, 128); /* size 4 is enough to store client IPv4 address */
#endif /* (CONFIG_REPORTING_SUPPORTS_OWNER == 1) */
reportControl->rcbValues = mmsValue; reportControl->rcbValues = mmsValue;
@ -1016,7 +1046,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
refreshTriggerOptions(reportControl); refreshTriggerOptions(reportControl);
return rcb; return rcb;
} } /* createBufferedReportControlBlock() */
static ReportControlBlock* static ReportControlBlock*
getRCBForLogicalNodeWithIndex(MmsMapping* self, LogicalNode* logicalNode, getRCBForLogicalNodeWithIndex(MmsMapping* self, LogicalNode* logicalNode,
@ -1118,15 +1148,12 @@ Reporting_createMmsUnbufferedRCBs(MmsMapping* self, MmsDomain* domain,
return namedVariable; return namedVariable;
} }
#define CONFIG_REPORTING_SUPPORTS_OWNER 1
static void static void
updateOwner(ReportControl* rc, MmsServerConnection connection) updateOwner(ReportControl* rc, MmsServerConnection connection)
{ {
rc->clientConnection = connection; rc->clientConnection = connection;
#if (CONFIG_REPORTING_SUPPORTS_OWNER == 1) #if (CONFIG_REPORTING_SUPPORTS_OWNER == 1)
MmsValue* owner = ReportControl_getRCBValue(rc, "Owner"); MmsValue* owner = ReportControl_getRCBValue(rc, "Owner");
if (owner != NULL) { if (owner != NULL) {
@ -1646,6 +1673,8 @@ enqueueReport(ReportControl* reportControl, bool isIntegrity, bool isGI, uint64_
reportControl->name, (unsigned) reportControl->sqNum, reportControl->enabled, reportControl->name, (unsigned) reportControl->sqNum, reportControl->enabled,
reportControl->isBuffering, reportControl->buffered, isIntegrity, isGI); reportControl->isBuffering, reportControl->buffered, isIntegrity, isGI);
updateTimeOfEntry(reportControl, Hal_getTimeInMs());
ReportBuffer* buffer = reportControl->reportBuffer; ReportBuffer* buffer = reportControl->reportBuffer;
/* calculate size of complete buffer entry */ /* calculate size of complete buffer entry */
@ -2362,8 +2391,6 @@ processEventsForReport(ReportControl* rc, uint64_t currentTimeInMs)
rc->triggered = false; rc->triggered = false;
} }
updateTimeOfEntry(rc, currentTimeInMs);
if (rc->buffered) if (rc->buffered)
enqueueReport(rc, false, true, currentTimeInMs); enqueueReport(rc, false, true, currentTimeInMs);
else else
@ -2391,7 +2418,6 @@ processEventsForReport(ReportControl* rc, uint64_t currentTimeInMs)
} }
rc->nextIntgReportTime = currentTimeInMs + rc->intgPd; rc->nextIntgReportTime = currentTimeInMs + rc->intgPd;
updateTimeOfEntry(rc, currentTimeInMs);
if (rc->buffered) if (rc->buffered)
enqueueReport(rc, true, false, currentTimeInMs); enqueueReport(rc, true, false, currentTimeInMs);

@ -37,16 +37,6 @@ Asn1PrimitiveValue_create(int size)
return self; return self;
} }
//Asn1PrimitiveValue*
//Asn1PrimitiveValue_createFromBuffer(uint8_t buffer, int bufferSize)
//{
// Asn1PrimitiveValue* self = GLOBAL_MALLOC(sizeof(Asn1PrimitiveValue));
// self->size = bufferSize;
// self->maxSize = bufferSize;
// self->octets = GLOBAL_MALLOC(1, bufferSize);
//
//}
Asn1PrimitiveValue* Asn1PrimitiveValue*
Asn1PrimitiveValue_clone(Asn1PrimitiveValue* self) Asn1PrimitiveValue_clone(Asn1PrimitiveValue* self)
{ {

Loading…
Cancel
Save