- MMS server: fixed problem in read with component access

pull/147/head v1.3.2
Michael Zillgith 7 years ago
parent 080b29464e
commit 9973ea165f

@ -837,6 +837,7 @@ SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return 0;
}
#if 0
asn_dec_rval_t
SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
@ -909,4 +910,4 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
rv.consumed = 0;
return rv;
}
#endif

@ -156,7 +156,7 @@ isAccessToArrayComponent(AlternateAccess_t* alternateAccess)
}
static MmsValue*
getComponent(AlternateAccess_t* alternateAccess, MmsVariableSpecification* namedVariable, MmsValue* variableValue)
getComponent(MmsServerConnection connection, MmsDomain* domain, AlternateAccess_t* alternateAccess, MmsVariableSpecification* namedVariable, char* variableName)
{
MmsValue* retValue = NULL;
@ -171,33 +171,39 @@ getComponent(AlternateAccess_t* alternateAccess, MmsVariableSpecification* named
int i;
for (i = 0; i < namedVariable->typeSpec.structure.elementCount;
i++) {
for (i = 0; i < namedVariable->typeSpec.structure.elementCount; i++) {
if (strlen(namedVariable->typeSpec.structure.elements[i]->name)
if ((int) strlen(namedVariable->typeSpec.structure.elements[i]->name)
== component.size) {
if (strncmp(
namedVariable->typeSpec.structure.elements[i]->name,
(char*) component.buf, component.size) == 0) {
MmsValue* value = MmsValue_getElement(variableValue, i);
if (!strncmp(namedVariable->typeSpec.structure.elements[i]->name,
(char*) component.buf, component.size))
{
if (strlen(variableName) + component.size < 199) {
strcat(variableName, "$");
strncat(variableName, (const char*) component.buf, component.size);
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.alternateAccess
!= NULL) {
retValue =
getComponent(
getComponent(connection, domain,
alternateAccess->list.array[0]->choice.unnamed->choice.selectAlternateAccess.alternateAccess,
namedVariable->typeSpec.structure.elements[i],
value);
variableName);
}
else {
retValue = mmsServer_getValue(connection->server, domain, variableName, connection);
}
}
else
retValue = value;
}
}
}
}
}
exit_function: return retValue;
exit_function:
return retValue;
}
static MmsValue*
@ -226,7 +232,7 @@ getComponentOfArrayElement(AlternateAccess_t* alternateAccess, MmsVariableSpecif
int i;
for (i = 0; i < structSpec->typeSpec.structure.elementCount; i++) {
if (strlen(structSpec->typeSpec.structure.elements[i]->name)
if ((int) strlen(structSpec->typeSpec.structure.elements[i]->name)
== component.size) {
if (strncmp(structSpec->typeSpec.structure.elements[i]->name,
(char*) component.buf, component.size) == 0) {
@ -341,7 +347,12 @@ addNamedVariableToResultList(MmsVariableSpecification* namedVariable, MmsDomain*
MmsValue* value = mmsServer_getValue(connection->server, domain, nameIdStr, connection);
if (alternateAccess != NULL) {
value = getComponent(alternateAccess, namedVariable, value);
char variableName[200];
variableName[0] = 0;
strcat(variableName, nameIdStr);
value = getComponent(connection, domain, alternateAccess, namedVariable, variableName);
if (value != NULL) {
appendValueToResultList(value, values);

Loading…
Cancel
Save