- fixed problem with MMS_DYNAMIC_DATA_SETS define

pull/6/head
Michael Zillgith 11 years ago
parent 44e53861be
commit 6fd4024113

@ -17,7 +17,7 @@
#define DEBUG_COTP 0
#define DEBUG_ISO_SERVER 0
#define DEBUG_ISO_CLIENT 0
#define DEBUG_IED_SERVER 1
#define DEBUG_IED_SERVER 0
#define DEBUG_IED_CLIENT 0
#define DEBUG_MMS_CLIENT 0
#define DEBUG_MMS_SERVER 0
@ -160,7 +160,7 @@
#define MMS_GET_NAME_LIST 1
#define MMS_GET_VARIABLE_ACCESS_ATTRIBUTES 1
#define MMS_DATA_SET_SERVICE 1
#define MMS_DYNAMIC_DATA_SETS 1
#define MMS_DYNAMIC_DATA_SETS 0
#define MMS_GET_DATA_SET_ATTRIBUTES 1
#define MMS_STATUS_SERVICE 1
#define MMS_IDENTIFY_SERVICE 1

@ -493,6 +493,7 @@ updateReportDataset(MmsMapping* mapping, ReportControl* rc, MmsValue* newDatSet,
DataSet* dataSet = IedModel_lookupDataSet(mapping->model, dataSetName);
#if (MMS_DYNAMIC_DATA_SETS == 1)
if (dataSet == NULL) {
dataSet = MmsMapping_getDomainSpecificDataSet(mapping, dataSetName);
@ -518,6 +519,12 @@ updateReportDataset(MmsMapping* mapping, ReportControl* rc, MmsValue* newDatSet,
}
else
rc->isDynamicDataSet = false;
#else
if (dataSet == NULL)
goto exit_function;
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
deleteDataSetValuesShadowBuffer(rc);

@ -90,7 +90,7 @@ MmsValue_createArray(MmsVariableSpecification* elementType, int size);
* \return the size of the array
*/
uint32_t
MmsValue_getArraySize(MmsValue* self);
MmsValue_getArraySize(const MmsValue* self);
/**
* \brief Get an element of an array or structure.
@ -639,13 +639,13 @@ MmsValue*
MmsValue_newOctetString(int size, int maxSize);
MmsValue*
MmsValue_newStructure(MmsVariableSpecification* typeSpec);
MmsValue_newStructure(const MmsVariableSpecification* typeSpec);
MmsValue*
MmsValue_createEmptyStructure(int size);
MmsValue*
MmsValue_newDefaultValue(MmsVariableSpecification* typeSpec);
MmsValue_newDefaultValue(const MmsVariableSpecification* typeSpec);
MmsValue*
MmsValue_newIntegerFromInt8(int8_t integer);
@ -679,7 +679,7 @@ MmsValue_newDouble(double variable);
* \return an MmsValue instance that is an exact copy of the given instance.
*/
MmsValue*
MmsValue_clone(MmsValue* self);
MmsValue_clone(const MmsValue* self);
/**
* \brief Create a (deep) copy of an MmsValue instance in a user provided buffer
@ -692,7 +692,7 @@ MmsValue_clone(MmsValue* self);
* \return a pointer to the position in the buffer just after the last byte written.
*/
uint8_t*
MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress);
MmsValue_cloneToBuffer(const MmsValue* self, uint8_t* destinationAddress);
/**
* \brief Determine the required amount of bytes by a clone.
@ -705,7 +705,7 @@ MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress);
* \return the number of bytes required by a clone
*/
int
MmsValue_getSizeInMemory(MmsValue* self);
MmsValue_getSizeInMemory(const MmsValue* self);
/**
* \brief Delete an MmsValue instance.

@ -74,7 +74,7 @@ struct sMmsServer {
MmsConnectionHandler connectionHandler;
void* connectionHandlerParameter;
MmsNamedVariableListChangedHandler variableListChangedHandler;
MmsNamedVariableListChangedHandler variableListChangedHandler; //TODO this is only required if dynamic data sets are supported!
void* variableListChangedHandlerParameter;
Map openConnections;

@ -905,7 +905,7 @@ MmsValue_toUnixTimestamp(const MmsValue* self)
}
int
MmsValue_getSizeInMemory(MmsValue* self)
MmsValue_getSizeInMemory(const MmsValue* self)
{
int memorySize = sizeof(MmsValue);
@ -953,7 +953,7 @@ MmsValue_getSizeInMemory(MmsValue* self)
}
uint8_t*
MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress)
MmsValue_cloneToBuffer(const MmsValue* self, uint8_t* destinationAddress)
{
MmsValue* newValue = (MmsValue*) destinationAddress;
@ -1027,7 +1027,7 @@ MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress)
// create a deep clone
MmsValue*
MmsValue_clone(MmsValue* self)
MmsValue_clone(const MmsValue* self)
{
MmsValue* newValue = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue));
@ -1116,7 +1116,7 @@ exit_function:
}
uint32_t
MmsValue_getArraySize(MmsValue* self)
MmsValue_getArraySize(const MmsValue* self)
{
return self->value.structure.size;
}
@ -1314,7 +1314,7 @@ MmsValue_getOctetStringBuffer(MmsValue* self)
}
MmsValue*
MmsValue_newStructure(MmsVariableSpecification* typeSpec)
MmsValue_newStructure(const MmsVariableSpecification* typeSpec)
{
MmsValue* self = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue));
@ -1336,7 +1336,7 @@ MmsValue_newStructure(MmsVariableSpecification* typeSpec)
}
MmsValue*
MmsValue_newDefaultValue(MmsVariableSpecification* typeSpec)
MmsValue_newDefaultValue(const MmsVariableSpecification* typeSpec)
{
MmsValue* self = NULL;

@ -207,6 +207,7 @@ getnamedVariableListsVMDSpecific(MmsServerConnection* connection)
return nameList;
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
static LinkedList
getNamedVariableListAssociationSpecific(MmsServerConnection* connection)
{
@ -218,7 +219,9 @@ getNamedVariableListAssociationSpecific(MmsServerConnection* connection)
return nameList;
}
#endif
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
#endif /* (MMS_DATA_SET_SERVICE == 1) */
static void
createNameListResponse(
@ -493,6 +496,7 @@ mmsServer_handleGetNameListRequest(
}
#if (MMS_DATA_SET_SERVICE == 1)
#if (MMS_DYNAMIC_DATA_SETS == 1)
else if (objectScope == OBJECT_SCOPE_ASSOCIATION) { /* association-specific */
if (objectClass == OBJECT_CLASS_NAMED_VARIABLE_LIST) {
@ -505,6 +509,7 @@ mmsServer_handleGetNameListRequest(
else
mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED);
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
#endif /* (MMS_DATA_SET_SERVICE == 1) */
else {

@ -605,6 +605,7 @@ mmsServer_handleGetNamedVariableListAttributesRequest(
mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
else if (request->present == ObjectName_PR_aaspecific) {
char listName[65];
@ -624,6 +625,7 @@ mmsServer_handleGetNamedVariableListAttributesRequest(
else
mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
else {
mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED);
}

@ -650,6 +650,7 @@ handleReadNamedVariableListRequest(
}
}
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
else if (read->variableAccessSpecification.choice.variableListName.present ==
ObjectName_PR_aaspecific)
{
@ -672,6 +673,7 @@ handleReadNamedVariableListRequest(
else
createNamedVariableListResponse(connection, namedList, invokeId, response, read, &accessSpec);
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
else
mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED);
}

@ -301,7 +301,10 @@ MmsServerConnection_init(MmsServerConnection* connection, MmsServer server, IsoC
self->dataStructureNestingLevel = 0;
self->server = server;
self->isoConnection = isoCon;
#if (MMS_DYNAMIC_DATA_SETS == 1)
self->namedVariableLists = LinkedList_create();
#endif
IsoConnection_installListener(isoCon, messageReceived, (void*) self);
@ -320,10 +323,14 @@ MmsServerConnection_destroy(MmsServerConnection* self)
FileSystem_closeFile(self->frsms[frsmIndex].fileHandle);
#endif
#if (MMS_DYNAMIC_DATA_SETS == 1)
LinkedList_destroyDeep(self->namedVariableLists, (LinkedListValueDeleteFunction) MmsNamedVariableList_destroy);
#endif
GLOBAL_FREEMEM(self);
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
bool
MmsServerConnection_addNamedVariableList(MmsServerConnection* self, MmsNamedVariableList variableList)
{
@ -361,6 +368,8 @@ MmsServerConnection_getNamedVariableList(MmsServerConnection* self, char* variab
return variableList;
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
char*
MmsServerConnection_getClientAddress(MmsServerConnection* self)
@ -368,11 +377,13 @@ MmsServerConnection_getClientAddress(MmsServerConnection* self)
return IsoConnection_getPeerAddress(self->isoConnection);
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
LinkedList
MmsServerConnection_getNamedVariableLists(MmsServerConnection* self)
{
return self->namedVariableLists;
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
uint32_t
MmsServerConnection_getLastInvokeId(MmsServerConnection* self)

Loading…
Cancel
Save