- IEC 61850 server: number of dynamic data sets configurable at runtime

pull/72/head
Michael Zillgith 7 years ago
parent a0adcf94e7
commit aa86d3b259

@ -69,6 +69,24 @@ namespace IEC61850.Server
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedServerConfig_enableDynamicDataSetService(IntPtr self, [MarshalAs(UnmanagedType.I1)] bool enable);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedServerConfig_setMaxAssociationSpecificDataSets(IntPtr self, int maxDataSets);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int IedServerConfig_getMaxAssociationSpecificDataSets(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedServerConfig_setMaxDomainSpecificDataSets(IntPtr self, int maxDataSets);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int IedServerConfig_getMaxDomainSpecificDataSets(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedServerConfig_setMaxDataSetEntries(IntPtr self, int maxDataSetEntries);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int IedServerConfig_getMaxDatasSetEntries(IntPtr self);
internal IntPtr self;
public IedServerConfig ()
@ -132,6 +150,10 @@ namespace IEC61850.Server
}
}
/// <summary>
/// Enable/Disable dynamic data set service for MMS
/// </summary>
/// <value><c>true</c> if dynamic data set service enabled; otherwise, <c>false</c>.</value>
public bool DynamicDataSetServiceEnabled
{
get {
@ -142,6 +164,48 @@ namespace IEC61850.Server
}
}
/// <summary>
/// Gets or sets the maximum number of data set entries for dynamic data sets
/// </summary>
/// <value>The max. number data set entries.</value>
public int MaxDataSetEntries
{
get {
return IedServerConfig_getMaxDatasSetEntries (self);
}
set {
IedServerConfig_setMaxDataSetEntries (self, value);
}
}
/// <summary>
/// Gets or sets the maximum number of association specific (non-permanent) data sets.
/// </summary>
/// <value>The max. number of association specific data sets.</value>
public int MaxAssociationSpecificDataSets
{
get {
return IedServerConfig_getMaxAssociationSpecificDataSets (self);
}
set {
IedServerConfig_setMaxAssociationSpecificDataSets (self, value);
}
}
/// <summary>
/// Gets or sets the maximum number of domain specific (permanent) data sets.
/// </summary>
/// <value>The max. numebr of domain specific data sets.</value>
public int MaxDomainSpecificDataSets
{
get {
return IedServerConfig_getMaxDomainSpecificDataSets (self);
}
set {
IedServerConfig_setMaxDomainSpecificDataSets (self, value);
}
}
/// <summary>
/// Releases all resource used by the <see cref="IEC61850.Server.IedServerConfig"/> object.
/// </summary>

@ -60,6 +60,12 @@ struct sIedServerConfig
/** when true (default) enable dynamic data set services for MMS */
bool enableDynamicDataSetService;
/** the maximum number of allowed association specific data sets */
int maxAssociationSpecificDataSets;
/** the maximum number of allowed domain specific data sets */
int maxDomainSpecificDataSets;
/** maximum number of data set entries of dynamic data sets */
int maxDataSetEntries;
@ -141,6 +147,8 @@ IedServerConfig_getMaxMmsConnections(IedServerConfig self);
/**
* \brief Set the basepath of the file services
*
* NOTE: the basepath specifies the local directory that is served by MMS file services
*
* \param basepath new file service base path
*/
void
@ -168,12 +176,6 @@ IedServerConfig_enableFileService(IedServerConfig self, bool enable);
bool
IedServerConfig_isFileServiceEnabled(IedServerConfig self);
void
IedServerConfig_enableSetFileService(IedServerConfig self, bool enable);
bool
IedServerConfig_isSetFileServiceEnabled(IedServerConfig self);
/**
* \brief Enable/disable the dynamic data set service for MMS
*
@ -190,30 +192,61 @@ IedServerConfig_enableDynamicDataSetService(IedServerConfig self, bool enable);
bool
IedServerConfig_isDynamicDataSetServiceEnabled(IedServerConfig self);
/**
* \brief Set the maximum allowed number of association specific (non-permanent) data sets
*
* NOTE: This specifies the maximum number of non-permanent data sets per connection. When
* the connection is closed these data sets are deleted automatically.
*
* \param maxDataSets maximum number of allowed data sets.
*/
void
IedServerConfig_setMaxAssociationSpecificDataSets(IedServerConfig self, int maxDataSets);
/**
* \brief Get the maximum allowed number of association specific (non-permanent) data sets
*
* \return maximum number of allowed data sets.
*/
int
IedServerConfig_getMaxAssociationSpecificDataSets(IedServerConfig self);
/**
* \brief Set the maximum allowed number of domain specific (permanent) data sets
*
* \param maxDataSets maximum number of allowed data sets.
*/
void
IedServerConfig_setMaxDomainSpecificDataSets(IedServerConfig self, int maxDataSets);
/**
* \brief Set the maximum number of entries in a dynamic data set
* \brief Get the maximum allowed number of domain specific (permanent) data sets
*
* \return maximum number of allowed data sets.
*/
int
IedServerConfig_getMaxDomainSpecificDataSets(IedServerConfig self);
/**
* \brief Set the maximum number of entries in dynamic data sets
*
* NOTE: this comprises the base data set entries (can be simple or complex variables).
* When the client tries to create a data set with more member the request will be
* rejected and the data set will not be created.
*
* \param maxDataSetEntries the maximum number of entries allowed in a data set
*/
void
IedServerConfig_setMaxDataSetEntries(IedServerConfig self, int maxDataSetEntries);
/**
* \brief Get the maximum number of entries in dynamic data sets
*
* \return the maximum number of entries allowed in a data sets
*/
int
IedServerConfig_getMaxDatasSetEntries(IedServerConfig self);
void
IedServerConfig_enableWriteDataSetService(IedServerConfig self, bool enable);
bool
IedServerConfig_isWriteDataSetServiceEnabled(IedServerConfig self);
/**
* \brief Enable/disable the log service for MMS
*

@ -437,6 +437,8 @@ IedServer_createWithConfig(IedModel* dataModel, TLSConfiguration tlsConfiguratio
if (serverConfiguration) {
MmsServer_enableFileService(self->mmsServer, serverConfiguration->enableFileService);
MmsServer_enableDynamicNamedVariableListService(self->mmsServer, serverConfiguration->enableDynamicDataSetService);
MmsServer_setMaxAssociationSpecificDataSets(self->mmsServer, serverConfiguration->maxAssociationSpecificDataSets);
MmsServer_setMaxDomainSpecificDataSets(self->mmsServer, serverConfiguration->maxDomainSpecificDataSets);
MmsServer_setMaxDataSetEntries(self->mmsServer, serverConfiguration->maxDataSetEntries);
MmsServer_enableJournalService(self->mmsServer, serverConfiguration->enableLogService);
MmsServer_setFilestoreBasepath(self->mmsServer, serverConfiguration->fileServiceBasepath);

@ -28,6 +28,14 @@
#define CONFIG_MMS_MAX_NUMBER_OF_DATA_SET_MEMBERS 100
#endif
#ifndef CONFIG_MMS_MAX_NUMBER_OF_ASSOCIATION_SPECIFIC_DATA_SETS
#define CONFIG_MMS_MAX_NUMBER_OF_ASSOCIATION_SPECIFIC_DATA_SETS 10
#endif
#ifndef CONFIG_MMS_MAX_NUMBER_OF_DOMAIN_SPECIFIC_DATA_SETS
#define CONFIG_MMS_MAX_NUMBER_OF_DOMAIN_SPECIFIC_DATA_SETS 10
#endif
IedServerConfig
IedServerConfig_create()
{
@ -38,6 +46,8 @@ IedServerConfig_create()
self->fileServiceBasepath = StringUtils_copyString(CONFIG_VIRTUAL_FILESTORE_BASEPATH);
self->enableFileService = true;
self->enableDynamicDataSetService = true;
self->maxAssociationSpecificDataSets = CONFIG_MMS_MAX_NUMBER_OF_ASSOCIATION_SPECIFIC_DATA_SETS;
self->maxDomainSpecificDataSets = CONFIG_MMS_MAX_NUMBER_OF_DOMAIN_SPECIFIC_DATA_SETS;
self->maxDataSetEntries = CONFIG_MMS_MAX_NUMBER_OF_DATA_SET_MEMBERS;
self->enableLogService = true;
self->edition = IEC_61850_EDITION_2;
@ -119,6 +129,30 @@ IedServerConfig_isDynamicDataSetServiceEnabled(IedServerConfig self)
return self->enableDynamicDataSetService;
}
void
IedServerConfig_setMaxAssociationSpecificDataSets(IedServerConfig self, int maxDataSets)
{
self->maxAssociationSpecificDataSets = maxDataSets;
}
int
IedServerConfig_getMaxAssociationSpecificDataSets(IedServerConfig self)
{
return self->maxAssociationSpecificDataSets;
}
void
IedServerConfig_setMaxDomainSpecificDataSets(IedServerConfig self, int maxDataSets)
{
self->maxDomainSpecificDataSets = maxDataSets;
}
int
IedServerConfig_getMaxDomainSpecificDataSets(IedServerConfig self)
{
return self->maxDomainSpecificDataSets;
}
void
IedServerConfig_setMaxDataSetEntries(IedServerConfig self, int maxDataSetEntries)
{

@ -255,11 +255,29 @@ MmsServer_enableFileService(MmsServer self, bool enable);
void
MmsServer_enableDynamicNamedVariableListService(MmsServer self, bool enable);
/**
* \brief Set the maximum number of association specific data sets (per connection)
*
* \param[in] self the MmsServer instance
* \param[in] maxDataSets maximum number association specific data sets
*/
void
MmsServer_setMaxAssociationSpecificDataSets(MmsServer self, int maxDataSets);
/**
* \brief Set the maximum number of domain specific data sets
*
* \param[in] self the MmsServer instance
* \param[in] maxDataSets maximum number domain specific data sets
*/
void
MmsServer_setMaxDomainSpecificDataSets(MmsServer self, int maxDataSets);
/**
* \brief Set the maximum number of data set entries (for dynamic data sets)
*
* \param[in] self the MmsServer instance
* \param[in] maximum number of dynamic data set entires
* \param[in] maxDataSetEntries maximum number of dynamic data set entries
*/
void
MmsServer_setMaxDataSetEntries(MmsServer self, int maxDataSetEntries);

@ -170,6 +170,8 @@ struct sMmsServer {
bool dynamicVariableListServiceEnabled;
int maxDataSetEntries;
bool journalServiceEnabled;
int maxAssociationSpecificDataSets;
int maxDomainSpecificDataSets;
#endif /* (CONFIG_SET_FILESTORE_BASEPATH_AT_RUNTIME == 1) */
};

@ -453,7 +453,11 @@ mmsServer_handleDefineNamedVariableListRequest(
goto exit_free_struct;
}
#if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1)
if (LinkedList_size(domain->namedVariableLists) < connection->server->maxDomainSpecificDataSets) {
#else
if (LinkedList_size(domain->namedVariableLists) < CONFIG_MMS_MAX_NUMBER_OF_DOMAIN_SPECIFIC_DATA_SETS) {
#endif
char variableListName[65];
if (request->variableListName.choice.domainspecific.itemId.size > 64) {
@ -498,7 +502,11 @@ mmsServer_handleDefineNamedVariableListRequest(
}
else if (request->variableListName.present == ObjectName_PR_aaspecific) {
#if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1)
if (LinkedList_size(connection->namedVariableLists) < connection->server->maxAssociationSpecificDataSets) {
#else
if (LinkedList_size(connection->namedVariableLists) < CONFIG_MMS_MAX_NUMBER_OF_ASSOCIATION_SPECIFIC_DATA_SETS) {
#endif
char variableListName[65];

@ -72,6 +72,8 @@ MmsServer_create(MmsDevice* device, TLSConfiguration tlsConfiguration)
self->dynamicVariableListServiceEnabled = true;
self->journalServiceEnabled = true;
self->maxDataSetEntries = CONFIG_MMS_MAX_NUMBER_OF_DATA_SET_MEMBERS;
self->maxAssociationSpecificDataSets = CONFIG_MMS_MAX_NUMBER_OF_ASSOCIATION_SPECIFIC_DATA_SETS;
self->maxDomainSpecificDataSets = CONFIG_MMS_MAX_NUMBER_OF_DOMAIN_SPECIFIC_DATA_SETS;
#endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */
return self;
@ -138,6 +140,18 @@ MmsServer_enableJournalService(MmsServer self, bool enable)
self->journalServiceEnabled = enable;
}
void
MmsServer_setMaxAssociationSpecificDataSets(MmsServer self, int maxDataSets)
{
self->maxAssociationSpecificDataSets = maxDataSets;
}
void
MmsServer_setMaxDomainSpecificDataSets(MmsServer self, int maxDataSets)
{
self->maxDomainSpecificDataSets = maxDataSets;
}
#endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */
void

@ -616,3 +616,8 @@ EXPORTS
IedServerConfig_getMaxMmsConnections
IedServerConfig_setMaxDataSetEntries
IedServerConfig_getMaxDatasSetEntries
IedServerConfig_setMaxAssociationSpecificDataSets
IedServerConfig_getMaxAssociationSpecificDataSets
IedServerConfig_setMaxDomainSpecificDataSets
IedServerConfig_getMaxDomainSpecificDataSets

@ -744,3 +744,7 @@ EXPORTS
IedServerConfig_getMaxMmsConnections
IedServerConfig_setMaxDataSetEntries
IedServerConfig_getMaxDatasSetEntries
IedServerConfig_setMaxAssociationSpecificDataSets
IedServerConfig_getMaxAssociationSpecificDataSets
IedServerConfig_setMaxDomainSpecificDataSets
IedServerConfig_getMaxDomainSpecificDataSets

Loading…
Cancel
Save