- IEC 61850 server: fixed reservation timeout when reporting enabled

pull/147/head
Michael Zillgith 7 years ago
parent 1e1d649aae
commit 719c174f81

@ -143,6 +143,10 @@ include_directories(
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/hal") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/hal")
if(DEBUG)
set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)
if(BUILD_EXAMPLES) if(BUILD_EXAMPLES)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/examples) add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/examples)
endif(BUILD_EXAMPLES) endif(BUILD_EXAMPLES)

@ -99,7 +99,7 @@ main(int argc, char** argv)
/* disable MMS file service */ /* disable MMS file service */
IedServerConfig_enableFileService(config, false); IedServerConfig_enableFileService(config, false);
/* disable dynamic data set service */ /* enable dynamic data set service */
IedServerConfig_enableDynamicDataSetService(config, true); IedServerConfig_enableDynamicDataSetService(config, true);
/* disable log service */ /* disable log service */

@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--This file is generated using Kalkitech SCL Manager IEC61850 Configuration Tool (www.kalkitech.com)-->
<SCL xmlns="http://www.iec.ch/61850/2003/SCL"> <SCL xmlns="http://www.iec.ch/61850/2003/SCL">
<Header id="" version="4.0.2" revision="" toolID="" nameStructure="IEDName"> <Header id="" version="1.0.0" revision="" toolID="" nameStructure="IEDName">
</Header> </Header>
<Communication> <Communication>
<SubNetwork name="subnetwork1" type="8-MMS"> <SubNetwork name="subnetwork1" type="8-MMS">
<Text>Station bus</Text> <Text>Station bus</Text>
<BitRate unit="b/s">10</BitRate>
<ConnectedAP iedName="simpleIO" apName="accessPoint1"> <ConnectedAP iedName="simpleIO" apName="accessPoint1">
<Address> <Address>
<P type="IP">10.0.0.2</P> <P type="IP">192.168.2.223</P>
<P type="IP-SUBNET">255.255.255.0</P> <P type="IP-SUBNET">255.255.255.0</P>
<P type="IP-GATEWAY">10.0.0.1</P> <P type="IP-GATEWAY">10.0.0.1</P>
<P type="OSI-TSEL">0001</P> <P type="OSI-TSEL">0001</P>
@ -29,10 +27,7 @@
<ReadWrite /> <ReadWrite />
<GetCBValues /> <GetCBValues />
<ConfLNs fixPrefix="true" fixLnInst="true" /> <ConfLNs fixPrefix="true" fixLnInst="true" />
<GOOSE max="5" />
<GSSE max="5" />
<FileHandling /> <FileHandling />
<GSEDir />
<TimerActivatedControl /> <TimerActivatedControl />
</Services> </Services>
<AccessPoint name="accessPoint1"> <AccessPoint name="accessPoint1">

@ -348,6 +348,9 @@ getDataSetEntryWithIndex(DataSetEntry* dataSet, int index)
static bool static bool
sendReportSegment(ReportControl* self, bool isIntegrity, bool isGI) sendReportSegment(ReportControl* self, bool isIntegrity, bool isGI)
{ {
if (self->clientConnection == NULL)
return false;
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection); int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */ int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */
estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */ estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */
@ -1593,6 +1596,7 @@ increaseConfRev(ReportControl* self)
static void static void
checkReservationTimeout(ReportControl* rc) checkReservationTimeout(ReportControl* rc)
{ {
if (rc->enabled == false) {
if (rc->resvTms > 0) { if (rc->resvTms > 0) {
if (Hal_getTimeInMs() > rc->reservationTimeout) { if (Hal_getTimeInMs() > rc->reservationTimeout) {
rc->resvTms = 0; rc->resvTms = 0;
@ -1607,6 +1611,7 @@ checkReservationTimeout(ReportControl* rc)
} }
} }
} }
}
void void
ReportControl_readAccess(ReportControl* rc, char* elementName) ReportControl_readAccess(ReportControl* rc, char* elementName)
@ -2511,6 +2516,11 @@ exit_function:
static bool static bool
sendNextReportEntrySegment(ReportControl* self) sendNextReportEntrySegment(ReportControl* self)
{ {
if (self->clientConnection == NULL)
return false;
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
Semaphore_wait(self->reportBuffer->lock); Semaphore_wait(self->reportBuffer->lock);
if (self->reportBuffer->nextToTransmit == NULL) { if (self->reportBuffer->nextToTransmit == NULL) {
@ -2518,7 +2528,6 @@ sendNextReportEntrySegment(ReportControl* self)
return false; return false;
} }
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */ int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */
estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */ estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */

@ -25,7 +25,7 @@
#include "logging_api.h" #include "logging_api.h"
#include "libiec61850_platform_includes.h" #include "libiec61850_platform_includes.h"
#include <sqlite3.h> #include "sqlite3.h"
#ifndef DEBUG_LOG_STORAGE_DRIVER #ifndef DEBUG_LOG_STORAGE_DRIVER
#define DEBUG_LOG_STORAGE_DRIVER 0 #define DEBUG_LOG_STORAGE_DRIVER 0

@ -510,6 +510,9 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task)
IsoConnection_sendMessage(task->connection->isoConnection, response, false); IsoConnection_sendMessage(task->connection->isoConnection, response, false);
FileSystem_closeFile(task->fileHandle);
deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename);
MmsServer_releaseTransmitBuffer(self); MmsServer_releaseTransmitBuffer(self);
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)
@ -529,6 +532,9 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task)
IsoConnection_sendMessage(task->connection->isoConnection, response, false); IsoConnection_sendMessage(task->connection->isoConnection, response, false);
FileSystem_closeFile(task->fileHandle);
deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename);
MmsServer_releaseTransmitBuffer(self); MmsServer_releaseTransmitBuffer(self);
if (DEBUG_MMS_SERVER) if (DEBUG_MMS_SERVER)

Loading…
Cancel
Save