|
|
@ -1,7 +1,7 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* mms_read_service.c
|
|
|
|
* mms_read_service.c
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright 2013 Michael Zillgith
|
|
|
|
* Copyright 2013-2018 Michael Zillgith
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This file is part of libIEC61850.
|
|
|
|
* This file is part of libIEC61850.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -140,9 +140,17 @@ deleteValueList(LinkedList values)
|
|
|
|
static bool
|
|
|
|
static bool
|
|
|
|
isAccessToArrayComponent(AlternateAccess_t* alternateAccess)
|
|
|
|
isAccessToArrayComponent(AlternateAccess_t* alternateAccess)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.
|
|
|
|
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.alternateAccess != NULL)
|
|
|
|
alternateAccess != NULL)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
if (alternateAccess->list.array[0]->choice.unnamed->
|
|
|
|
|
|
|
|
choice.selectAlternateAccess.alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.accessSelection.present ==
|
|
|
|
|
|
|
|
AlternateAccessSelection__selectAlternateAccess__accessSelection_PR_component)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -161,19 +169,28 @@ getComponentOfArrayElement(AlternateAccess_t* alternateAccess, MmsVariableSpecif
|
|
|
|
if (component.size > 129)
|
|
|
|
if (component.size > 129)
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
|
|
|
|
|
|
|
|
int elementCount = namedVariable->typeSpec.structure.elementCount;
|
|
|
|
MmsVariableSpecification* structSpec;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (namedVariable->type == MMS_ARRAY)
|
|
|
|
MmsVariableSpecification* structSpec = namedVariable->typeSpec.array.elementTypeSpec;
|
|
|
|
structSpec = namedVariable->typeSpec.array.elementTypeSpec;
|
|
|
|
|
|
|
|
else if (namedVariable->type == MMS_STRUCTURE)
|
|
|
|
|
|
|
|
structSpec = namedVariable;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
goto exit_function;
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < elementCount; i++) {
|
|
|
|
for (i = 0; i < structSpec->typeSpec.structure.elementCount; i++) {
|
|
|
|
if (strncmp (structSpec->typeSpec.structure.elements[i]->name, (char*) component.buf,
|
|
|
|
if (strncmp (structSpec->typeSpec.structure.elements[i]->name, (char*) component.buf,
|
|
|
|
component.size) == 0)
|
|
|
|
component.size) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MmsValue* value = MmsValue_getElement(structuredValue, i);
|
|
|
|
MmsValue* value = MmsValue_getElement(structuredValue, i);
|
|
|
|
|
|
|
|
|
|
|
|
retValue = value;
|
|
|
|
if (isAccessToArrayComponent(alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.alternateAccess)) {
|
|
|
|
|
|
|
|
retValue = getComponentOfArrayElement(alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.alternateAccess,
|
|
|
|
|
|
|
|
structSpec->typeSpec.structure.elements[i], value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
retValue = value;
|
|
|
|
|
|
|
|
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -242,8 +259,10 @@ alternateArrayAccess(MmsServerConnection connection,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
appendValueToResultList(value, values);
|
|
|
|
if (value)
|
|
|
|
|
|
|
|
appendValueToResultList(value, values);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
appendErrorToResultList(values, DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* access error */
|
|
|
|
else /* access error */
|
|
|
|
appendErrorToResultList(values, DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT);
|
|
|
|
appendErrorToResultList(values, DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT);
|
|
|
|