- IEC 61850/MMS server: removed deprecated AttributeChangedHandler

pull/143/head
Michael Zillgith 8 years ago
parent d995c05fc0
commit 924b4ef5c1

@ -1,6 +1,8 @@
Changes to version 1.2.0
------------------------
- IEC 61850/MMS client/server: Added TLS support (TLS API and implementation for mbedtls)
- IEC 61850/MMS server: removed deprecated AttributeChangedHandler
- Added pkg-config file
- The Sampled Values APIs have been renamed. The old version of the API is deprecated but still supported and will be removed in the next major version of the library.

@ -1001,36 +1001,6 @@ IedServer_setSVCBHandler(IedServer self, SVControlBlock* svcb, SVCBEventHandler
* @{
*/
/**
* \brief callback handler to monitor client access to data attributes
*
* User provided callback function to observe (monitor) MMS client access to
* IEC 61850 data attributes. The application can install the same handler
* multiple times and distinguish data attributes by the dataAttribute parameter.
*
* \param the data attribute that has been written by an MMS client.
* \param connection the connection object of the client connection that invoked the write operation
*/
typedef void (*AttributeChangedHandler) (DataAttribute* dataAttribute, ClientConnection connection);
/**
* \deprecated Please use IedServer_handleWriteAccess instead!
* \brief Install an observer for a data attribute.
*
* This instructs the server to monitor write attempts by MMS clients to specific
* data attributes. If a successful write attempt happens the server will call
* the provided callback function to inform the application. This can be used to
* monitor important configuration values.
*
* \param self the instance of IedServer to operate on.
* \param dataAttribute the data attribute to monitor
* \param handler the callback function that is invoked if a client has written to
* the monitored data attribute.
*/
void
IedServer_observeDataAttribute(IedServer self, DataAttribute* dataAttribute,
AttributeChangedHandler handler);
/***************************************************************************
* Access control
**************************************************************************/

@ -38,7 +38,6 @@ struct sIedServer
IedModel* model;
MmsDevice* mmsDevice;
MmsServer mmsServer;
// IsoServer isoServer;
char* localIpAddress;
MmsMapping* mmsMapping;
LinkedList clientConnections;

@ -113,10 +113,6 @@ MmsMapping_addControlObject(MmsMapping* self, ControlObject* controlObject);
char*
MmsMapping_createMmsVariableNameFromObjectReference(const char* objectReference, FunctionalConstraint fc, char* buffer);
void
MmsMapping_addObservedAttribute(MmsMapping* self, DataAttribute* dataAttribute,
AttributeChangedHandler handler);
char*
MmsMapping_getNextNameElement(char* name);

@ -51,7 +51,7 @@ struct sMmsMapping {
#endif
LinkedList controlObjects;
LinkedList observedObjects;
LinkedList attributeAccessHandlers;
#if (CONFIG_IEC61850_SETTING_GROUPS == 1)

@ -417,8 +417,6 @@ IedServer_createWithTlsSupport(IedModel* dataModel, TLSConfiguration tlsConfigur
self->mmsDevice = MmsMapping_getMmsDeviceModel(self->mmsMapping);
// self->isoServer = IsoServer_create();
self->mmsServer = MmsServer_create(self->mmsDevice, tlsConfiguration);
MmsMapping_setMmsServer(self->mmsMapping, self->mmsServer);
@ -1238,13 +1236,6 @@ IedServer_disableGoosePublishing(IedServer self)
#endif /* (CONFIG_INCLUDE_GOOSE_SUPPORT == 1) */
}
void
IedServer_observeDataAttribute(IedServer self, DataAttribute* dataAttribute,
AttributeChangedHandler handler)
{
MmsMapping_addObservedAttribute(self->mmsMapping, dataAttribute, handler);
}
void
IedServer_setWriteAccessPolicy(IedServer self, FunctionalConstraint fc, AccessPolicy policy)
{

@ -1,7 +1,7 @@
/*
* mms_mapping.c
*
* Copyright 2013-2016 Michael Zillgith
* Copyright 2013-2017 Michael Zillgith
*
* This file is part of libIEC61850.
*
@ -42,12 +42,6 @@
#define DEBUG_IED_SERVER 0
#endif
typedef struct
{
DataAttribute* attribute;
AttributeChangedHandler handler;
} AttributeObserver;
typedef struct
{
DataAttribute* attribute;
@ -55,7 +49,6 @@ typedef struct
void* parameter;
} AttributeAccessHandler;
typedef struct
{
SettingGroupControlBlock* sgcb;
@ -1190,8 +1183,13 @@ createDataSets(MmsDevice* mmsDevice, IedModel* iedModel)
int iedModelNameLength = strlen(iedModel->name);
if (iedModelNameLength > 64)
goto exit_function; //TODO call exception handler!
if (iedModelNameLength > 64) {
if (DEBUG_IED_SERVER)
printf("IED_SERVER: IED model name too long!\n");
goto exit_function;
}
while (dataset != NULL) {
strncpy(domainName, iedModel->name, 64);
@ -1199,8 +1197,13 @@ createDataSets(MmsDevice* mmsDevice, IedModel* iedModel)
MmsDomain* dataSetDomain = MmsDevice_getDomain(mmsDevice, domainName);
if (dataSetDomain == NULL)
goto exit_function; //TODO call exception handler!
if (dataSetDomain == NULL) {
if (DEBUG_IED_SERVER)
printf("IED_SERVER: LD for dataset does not exist!\n");
goto exit_function;
}
MmsNamedVariableList varList = MmsNamedVariableList_create(dataSetDomain, dataset->name, false);
@ -1289,8 +1292,6 @@ MmsMapping_create(IedModel* model)
self->settingGroups = LinkedList_create();
#endif
self->observedObjects = LinkedList_create();
self->attributeAccessHandlers = LinkedList_create();
self->mmsDevice = createMmsModelFromIedModel(self, model);
@ -1337,8 +1338,6 @@ MmsMapping_destroy(MmsMapping* self)
LinkedList_destroyDeep(self->logInstances, (LinkedListValueDeleteFunction) LogInstance_destroy);
#endif
LinkedList_destroy(self->observedObjects);
LinkedList_destroy(self->attributeAccessHandlers);
IedModel_setAttributeValuesToNull(self->model);
@ -2093,21 +2092,6 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
else
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
/* Call observer callback */
LinkedList observerListElement = LinkedList_getNext(self->observedObjects);
while (observerListElement != NULL) {
AttributeObserver* observer = (AttributeObserver*) observerListElement->data;
DataAttribute* dataAttribute = observer->attribute;
if (checkIfValueBelongsToModelNode(dataAttribute, cachedValue, value) != NULL) {
observer->handler(dataAttribute, (ClientConnection) connection);
break; /* only all one handler per data attribute */
}
observerListElement = LinkedList_getNext(observerListElement);
}
return DATA_ACCESS_ERROR_SUCCESS;
}
else
@ -2117,18 +2101,6 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
}
void
MmsMapping_addObservedAttribute(MmsMapping* self, DataAttribute* dataAttribute,
AttributeChangedHandler handler)
{
AttributeObserver* observer = (AttributeObserver*) GLOBAL_MALLOC(sizeof(AttributeObserver));
observer->attribute = dataAttribute;
observer->handler = handler;
LinkedList_add(self->observedObjects, observer);
}
static AttributeAccessHandler*
getAccessHandlerForAttribute(MmsMapping* self, DataAttribute* dataAttribute)
{

@ -167,7 +167,6 @@ EXPORTS
IedServer_handleWriteAccess @421
IedServer_isRunning @422
IedServer_lockDataModel @423
IedServer_observeDataAttribute @424
IedServer_setAuthenticator @425
IedServer_setConnectionIndicationHandler @426
IedServer_setControlHandler @427

@ -191,7 +191,6 @@ EXPORTS
IedServer_handleWriteAccess @421
IedServer_isRunning @422
IedServer_lockDataModel @423
IedServer_observeDataAttribute @424
IedServer_setAuthenticator @425
IedServer_setConnectionIndicationHandler @426
IedServer_setControlHandler @427

Loading…
Cancel
Save