|
|
|
@ -32,250 +32,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
static int
|
|
|
|
createTypeSpecification (
|
|
|
|
createTypeSpecification (
|
|
|
|
MmsVariableSpecification* namedVariable,
|
|
|
|
MmsVariableSpecification* namedVariable,
|
|
|
|
TypeSpecification_t* typeSpec)
|
|
|
|
TypeSpecification_t* typeSpec)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (namedVariable->type == MMS_ARRAY) {
|
|
|
|
if (namedVariable->type == MMS_ARRAY) {
|
|
|
|
typeSpec->present = TypeSpecification_PR_array;
|
|
|
|
typeSpec->present = TypeSpecification_PR_array;
|
|
|
|
|
|
|
|
|
|
|
|
asn_long2INTEGER(&(typeSpec->choice.array.numberOfElements),
|
|
|
|
asn_long2INTEGER(&(typeSpec->choice.array.numberOfElements),
|
|
|
|
(long) namedVariable->typeSpec.array.elementCount);
|
|
|
|
(long) namedVariable->typeSpec.array.elementCount);
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.array.packed = NULL;
|
|
|
|
typeSpec->choice.array.packed = NULL;
|
|
|
|
typeSpec->choice.array.elementType = (TypeSpecification_t*) GLOBAL_CALLOC(1, sizeof(TypeSpecification_t));
|
|
|
|
typeSpec->choice.array.elementType = (TypeSpecification_t*) GLOBAL_CALLOC(1, sizeof(TypeSpecification_t));
|
|
|
|
|
|
|
|
|
|
|
|
createTypeSpecification(namedVariable->typeSpec.array.elementTypeSpec,
|
|
|
|
createTypeSpecification(namedVariable->typeSpec.array.elementTypeSpec,
|
|
|
|
typeSpec->choice.array.elementType);
|
|
|
|
typeSpec->choice.array.elementType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (namedVariable->type == MMS_STRUCTURE) {
|
|
|
|
else if (namedVariable->type == MMS_STRUCTURE) {
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->present = TypeSpecification_PR_structure;
|
|
|
|
typeSpec->present = TypeSpecification_PR_structure;
|
|
|
|
|
|
|
|
|
|
|
|
int componentCount = namedVariable->typeSpec.structure.elementCount;
|
|
|
|
int componentCount = namedVariable->typeSpec.structure.elementCount;
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.count = componentCount;
|
|
|
|
typeSpec->choice.structure.components.list.count = componentCount;
|
|
|
|
typeSpec->choice.structure.components.list.size = componentCount;
|
|
|
|
typeSpec->choice.structure.components.list.size = componentCount;
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array
|
|
|
|
typeSpec->choice.structure.components.list.array
|
|
|
|
= (StructComponent_t**) GLOBAL_CALLOC(componentCount, sizeof(StructComponent_t*));
|
|
|
|
= (StructComponent_t**) GLOBAL_CALLOC(componentCount, sizeof(StructComponent_t*));
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < componentCount; i++) {
|
|
|
|
for (i = 0; i < componentCount; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array[i] =
|
|
|
|
typeSpec->choice.structure.components.list.array[i] =
|
|
|
|
(StructComponent_t*) GLOBAL_CALLOC(1, sizeof(StructComponent_t));
|
|
|
|
(StructComponent_t*) GLOBAL_CALLOC(1, sizeof(StructComponent_t));
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName =
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName =
|
|
|
|
(Identifier_t*) GLOBAL_CALLOC(1, sizeof(Identifier_t));
|
|
|
|
(Identifier_t*) GLOBAL_CALLOC(1, sizeof(Identifier_t));
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName->buf =
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName->buf =
|
|
|
|
(uint8_t*) StringUtils_copyString(namedVariable->typeSpec.structure.elements[i]->name);
|
|
|
|
(uint8_t*) StringUtils_copyString(namedVariable->typeSpec.structure.elements[i]->name);
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName->size =
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentName->size =
|
|
|
|
strlen(namedVariable->typeSpec.structure.elements[i]->name);
|
|
|
|
strlen(namedVariable->typeSpec.structure.elements[i]->name);
|
|
|
|
|
|
|
|
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentType =
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentType =
|
|
|
|
(TypeSpecification_t*) GLOBAL_CALLOC(1, sizeof(TypeSpecification_t));
|
|
|
|
(TypeSpecification_t*) GLOBAL_CALLOC(1, sizeof(TypeSpecification_t));
|
|
|
|
|
|
|
|
|
|
|
|
createTypeSpecification(namedVariable->typeSpec.structure.elements[i],
|
|
|
|
createTypeSpecification(namedVariable->typeSpec.structure.elements[i],
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
switch (namedVariable->type) {
|
|
|
|
switch (namedVariable->type) {
|
|
|
|
case MMS_BOOLEAN:
|
|
|
|
case MMS_BOOLEAN:
|
|
|
|
typeSpec->present = TypeSpecification_PR_boolean;
|
|
|
|
typeSpec->present = TypeSpecification_PR_boolean;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_BIT_STRING:
|
|
|
|
case MMS_BIT_STRING:
|
|
|
|
typeSpec->present = TypeSpecification_PR_bitstring;
|
|
|
|
typeSpec->present = TypeSpecification_PR_bitstring;
|
|
|
|
typeSpec->choice.bitstring = namedVariable->typeSpec.bitString;
|
|
|
|
typeSpec->choice.bitstring = namedVariable->typeSpec.bitString;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_INTEGER:
|
|
|
|
case MMS_INTEGER:
|
|
|
|
typeSpec->present = TypeSpecification_PR_integer;
|
|
|
|
typeSpec->present = TypeSpecification_PR_integer;
|
|
|
|
typeSpec->choice.integer = namedVariable->typeSpec.integer;
|
|
|
|
typeSpec->choice.integer = namedVariable->typeSpec.integer;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_UNSIGNED:
|
|
|
|
case MMS_UNSIGNED:
|
|
|
|
typeSpec->present = TypeSpecification_PR_unsigned;
|
|
|
|
typeSpec->present = TypeSpecification_PR_unsigned;
|
|
|
|
typeSpec->choice.Unsigned = namedVariable->typeSpec.unsignedInteger;
|
|
|
|
typeSpec->choice.Unsigned = namedVariable->typeSpec.unsignedInteger;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_FLOAT:
|
|
|
|
case MMS_FLOAT:
|
|
|
|
typeSpec->present = TypeSpecification_PR_floatingpoint;
|
|
|
|
typeSpec->present = TypeSpecification_PR_floatingpoint;
|
|
|
|
typeSpec->choice.floatingpoint.exponentwidth =
|
|
|
|
typeSpec->choice.floatingpoint.exponentwidth =
|
|
|
|
namedVariable->typeSpec.floatingpoint.exponentWidth;
|
|
|
|
namedVariable->typeSpec.floatingpoint.exponentWidth;
|
|
|
|
typeSpec->choice.floatingpoint.formatwidth =
|
|
|
|
typeSpec->choice.floatingpoint.formatwidth =
|
|
|
|
namedVariable->typeSpec.floatingpoint.formatWidth;
|
|
|
|
namedVariable->typeSpec.floatingpoint.formatWidth;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_OCTET_STRING:
|
|
|
|
case MMS_OCTET_STRING:
|
|
|
|
typeSpec->present = TypeSpecification_PR_octetstring;
|
|
|
|
typeSpec->present = TypeSpecification_PR_octetstring;
|
|
|
|
typeSpec->choice.octetstring = namedVariable->typeSpec.octetString;
|
|
|
|
typeSpec->choice.octetstring = namedVariable->typeSpec.octetString;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_VISIBLE_STRING:
|
|
|
|
case MMS_VISIBLE_STRING:
|
|
|
|
typeSpec->present = TypeSpecification_PR_visiblestring;
|
|
|
|
typeSpec->present = TypeSpecification_PR_visiblestring;
|
|
|
|
typeSpec->choice.visiblestring = namedVariable->typeSpec.visibleString;
|
|
|
|
typeSpec->choice.visiblestring = namedVariable->typeSpec.visibleString;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_STRING:
|
|
|
|
case MMS_STRING:
|
|
|
|
typeSpec->present = TypeSpecification_PR_mMSString;
|
|
|
|
typeSpec->present = TypeSpecification_PR_mMSString;
|
|
|
|
typeSpec->choice.mMSString = namedVariable->typeSpec.mmsString;
|
|
|
|
typeSpec->choice.mMSString = namedVariable->typeSpec.mmsString;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_UTC_TIME:
|
|
|
|
case MMS_UTC_TIME:
|
|
|
|
typeSpec->present = TypeSpecification_PR_utctime;
|
|
|
|
typeSpec->present = TypeSpecification_PR_utctime;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MMS_BINARY_TIME:
|
|
|
|
case MMS_BINARY_TIME:
|
|
|
|
typeSpec->present = TypeSpecification_PR_binarytime;
|
|
|
|
typeSpec->present = TypeSpecification_PR_binarytime;
|
|
|
|
|
|
|
|
|
|
|
|
if (namedVariable->typeSpec.binaryTime == 6)
|
|
|
|
if (namedVariable->typeSpec.binaryTime == 6)
|
|
|
|
typeSpec->choice.binarytime = 1;
|
|
|
|
typeSpec->choice.binarytime = 1;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
typeSpec->choice.binarytime = 0;
|
|
|
|
typeSpec->choice.binarytime = 0;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
printf("MMS-SERVER: Unsupported type %i!\n", namedVariable->type);
|
|
|
|
printf("MMS-SERVER: Unsupported type %i!\n", namedVariable->type);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
freeTypeSpecRecursive(TypeSpecification_t* typeSpec) {
|
|
|
|
freeTypeSpecRecursive(TypeSpecification_t* typeSpec) {
|
|
|
|
if (typeSpec->present == TypeSpecification_PR_structure) {
|
|
|
|
if (typeSpec->present == TypeSpecification_PR_structure) {
|
|
|
|
int elementCount =
|
|
|
|
int elementCount =
|
|
|
|
typeSpec->choice.structure.components.list.count;
|
|
|
|
typeSpec->choice.structure.components.list.count;
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < elementCount; i++) {
|
|
|
|
for (i = 0; i < elementCount; i++) {
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentName->buf);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentName->buf);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentName);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentName);
|
|
|
|
freeTypeSpecRecursive(typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
freeTypeSpecRecursive(typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]->componentType);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.structure.components.list.array);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (typeSpec->present == TypeSpecification_PR_array) {
|
|
|
|
else if (typeSpec->present == TypeSpecification_PR_array) {
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.array.numberOfElements.buf);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.array.numberOfElements.buf);
|
|
|
|
freeTypeSpecRecursive(typeSpec->choice.array.elementType);
|
|
|
|
freeTypeSpecRecursive(typeSpec->choice.array.elementType);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.array.elementType);
|
|
|
|
GLOBAL_FREEMEM(typeSpec->choice.array.elementType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
deleteVariableAccessAttributesResponse(
|
|
|
|
deleteVariableAccessAttributesResponse(
|
|
|
|
GetVariableAccessAttributesResponse_t* getVarAccessAttr)
|
|
|
|
GetVariableAccessAttributesResponse_t* getVarAccessAttr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (getVarAccessAttr->typeSpecification.present == TypeSpecification_PR_structure) {
|
|
|
|
if (getVarAccessAttr->typeSpecification.present == TypeSpecification_PR_structure) {
|
|
|
|
int count = getVarAccessAttr->typeSpecification.choice.structure.components.list.count;
|
|
|
|
int count = getVarAccessAttr->typeSpecification.choice.structure.components.list.count;
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentName->buf);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentName->buf);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentName);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentName);
|
|
|
|
TypeSpecification_t* typeSpec =
|
|
|
|
TypeSpecification_t* typeSpec =
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentType;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]->componentType;
|
|
|
|
freeTypeSpecRecursive(typeSpec);
|
|
|
|
freeTypeSpecRecursive(typeSpec);
|
|
|
|
GLOBAL_FREEMEM(typeSpec);
|
|
|
|
GLOBAL_FREEMEM(typeSpec);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.structure.components.list.array);
|
|
|
|
|
|
|
|
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.array = NULL;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.array = NULL;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.count = 0;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.count = 0;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.size = 0;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.structure.components.list.size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (getVarAccessAttr->typeSpecification.present == TypeSpecification_PR_array) {
|
|
|
|
else if (getVarAccessAttr->typeSpecification.present == TypeSpecification_PR_array) {
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.array.numberOfElements.buf);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.array.numberOfElements.buf);
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.numberOfElements.buf = NULL;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.numberOfElements.buf = NULL;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.numberOfElements.size = 0;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.numberOfElements.size = 0;
|
|
|
|
freeTypeSpecRecursive(getVarAccessAttr->typeSpecification.choice.array.elementType);
|
|
|
|
freeTypeSpecRecursive(getVarAccessAttr->typeSpecification.choice.array.elementType);
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.array.elementType);
|
|
|
|
GLOBAL_FREEMEM(getVarAccessAttr->typeSpecification.choice.array.elementType);
|
|
|
|
|
|
|
|
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.elementType = NULL;
|
|
|
|
getVarAccessAttr->typeSpecification.choice.array.elementType = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
createVariableAccessAttributesResponse(
|
|
|
|
createVariableAccessAttributesResponse(
|
|
|
|
MmsServerConnection connection,
|
|
|
|
MmsServerConnection connection,
|
|
|
|
char* domainId,
|
|
|
|
char* domainId,
|
|
|
|
char* nameId,
|
|
|
|
char* nameId,
|
|
|
|
int invokeId,
|
|
|
|
int invokeId,
|
|
|
|
ByteBuffer* response)
|
|
|
|
ByteBuffer* response)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MmsDevice* device = MmsServer_getDevice(connection->server);
|
|
|
|
MmsDevice* device = MmsServer_getDevice(connection->server);
|
|
|
|
|
|
|
|
|
|
|
|
MmsVariableSpecification* namedVariable = NULL;
|
|
|
|
MmsVariableSpecification* namedVariable = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
MmsDomain* domain = NULL;
|
|
|
|
MmsDomain* domain = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (domainId != NULL) {
|
|
|
|
if (domainId != NULL) {
|
|
|
|
domain = MmsDevice_getDomain(device, domainId);
|
|
|
|
domain = MmsDevice_getDomain(device, domainId);
|
|
|
|
|
|
|
|
|
|
|
|
if (domain == NULL) {
|
|
|
|
if (domain == NULL) {
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: domain %s not known\n", domainId);
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: domain %s not known\n", domainId);
|
|
|
|
|
|
|
|
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namedVariable = MmsDomain_getNamedVariable(domain, nameId);
|
|
|
|
namedVariable = MmsDomain_getNamedVariable(domain, nameId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
|
|
|
|
#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
namedVariable = MmsDevice_getNamedVariable(device, nameId);
|
|
|
|
namedVariable = MmsDevice_getNamedVariable(device, nameId);
|
|
|
|
#endif /* (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1) */
|
|
|
|
#endif /* (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1) */
|
|
|
|
|
|
|
|
|
|
|
|
if (namedVariable == NULL) {
|
|
|
|
if (namedVariable == NULL) {
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: named variable %s.%s not known\n", domainId, nameId);
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: named variable %s.%s not known\n", domainId, nameId);
|
|
|
|
|
|
|
|
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
|
|
|
|
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool accessAllowed = mmsServer_checkListAccess(connection->server, domain, nameId, connection);
|
|
|
|
bool accessAllowed = mmsServer_checkListAccess(connection->server, domain, nameId, connection);
|
|
|
|
|
|
|
|
|
|
|
|
if (!accessAllowed) {
|
|
|
|
if (!accessAllowed) {
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
printf("MMS_SERVER: named variable %s/%s not visible due to access restrictions\n", domainId, nameId);
|
|
|
|
printf("MMS_SERVER: named variable %s/%s not visible due to access restrictions\n", domainId, nameId);
|
|
|
|
|
|
|
|
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
mmsMsg_createServiceErrorPdu(invokeId, response,
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
|
|
|
|
|
|
|
|
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MmsPdu_t* mmsPdu = mmsServer_createConfirmedResponse(invokeId);
|
|
|
|
MmsPdu_t* mmsPdu = mmsServer_createConfirmedResponse(invokeId);
|
|
|
|
|
|
|
|
|
|
|
|
mmsPdu->choice.confirmedResponsePdu.confirmedServiceResponse.present =
|
|
|
|
mmsPdu->choice.confirmedResponsePdu.confirmedServiceResponse.present =
|
|
|
|
ConfirmedServiceResponse_PR_getVariableAccessAttributes;
|
|
|
|
ConfirmedServiceResponse_PR_getVariableAccessAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
GetVariableAccessAttributesResponse_t* getVarAccessAttr;
|
|
|
|
GetVariableAccessAttributesResponse_t* getVarAccessAttr;
|
|
|
|
|
|
|
|
|
|
|
|
getVarAccessAttr = &(mmsPdu->choice.confirmedResponsePdu.
|
|
|
|
getVarAccessAttr = &(mmsPdu->choice.confirmedResponsePdu.
|
|
|
|
confirmedServiceResponse.choice.getVariableAccessAttributes);
|
|
|
|
confirmedServiceResponse.choice.getVariableAccessAttributes);
|
|
|
|
|
|
|
|
|
|
|
|
getVarAccessAttr->mmsDeletable = 0;
|
|
|
|
getVarAccessAttr->mmsDeletable = 0;
|
|
|
|
|
|
|
|
|
|
|
|
createTypeSpecification(namedVariable, &getVarAccessAttr->typeSpecification);
|
|
|
|
createTypeSpecification(namedVariable, &getVarAccessAttr->typeSpecification);
|
|
|
|
|
|
|
|
|
|
|
|
asn_enc_rval_t rval =
|
|
|
|
asn_enc_rval_t rval =
|
|
|
|
der_encode(&asn_DEF_MmsPdu, mmsPdu, mmsServer_write_out, (void*) response);
|
|
|
|
der_encode(&asn_DEF_MmsPdu, mmsPdu, mmsServer_write_out, (void*) response);
|
|
|
|
|
|
|
|
|
|
|
|
if (rval.encoded == -1) {
|
|
|
|
if (rval.encoded == -1) {
|
|
|
|
response->size = 0;
|
|
|
|
response->size = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
printf("MMS getVariableAccessAttributes: message to large! send error PDU!\n");
|
|
|
|
printf("MMS getVariableAccessAttributes: message to large! send error PDU!\n");
|
|
|
|
@ -284,81 +284,80 @@ createVariableAccessAttributesResponse(
|
|
|
|
MMS_ERROR_SERVICE_OTHER);
|
|
|
|
MMS_ERROR_SERVICE_OTHER);
|
|
|
|
|
|
|
|
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
deleteVariableAccessAttributesResponse(getVarAccessAttr);
|
|
|
|
deleteVariableAccessAttributesResponse(getVarAccessAttr);
|
|
|
|
|
|
|
|
|
|
|
|
asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0);
|
|
|
|
asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0);
|
|
|
|
|
|
|
|
|
|
|
|
exit_function:
|
|
|
|
exit_function:
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
int
|
|
|
|
mmsServer_handleGetVariableAccessAttributesRequest(
|
|
|
|
mmsServer_handleGetVariableAccessAttributesRequest(
|
|
|
|
MmsServerConnection connection,
|
|
|
|
MmsServerConnection connection,
|
|
|
|
uint8_t* buffer, int bufPos, int maxBufPos,
|
|
|
|
uint8_t* buffer, int bufPos, int maxBufPos,
|
|
|
|
uint32_t invokeId,
|
|
|
|
uint32_t invokeId,
|
|
|
|
ByteBuffer* response)
|
|
|
|
ByteBuffer* response)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int retVal = 0;
|
|
|
|
int retVal = 0;
|
|
|
|
|
|
|
|
|
|
|
|
GetVariableAccessAttributesRequest_t* request = 0;
|
|
|
|
GetVariableAccessAttributesRequest_t* request = 0;
|
|
|
|
|
|
|
|
|
|
|
|
asn_dec_rval_t rval; /* Decoder return value */
|
|
|
|
asn_dec_rval_t rval; /* Decoder return value */
|
|
|
|
|
|
|
|
|
|
|
|
rval = ber_decode(NULL, &asn_DEF_GetVariableAccessAttributesRequest,
|
|
|
|
rval = ber_decode(NULL, &asn_DEF_GetVariableAccessAttributesRequest,
|
|
|
|
(void**) &request, buffer + bufPos, maxBufPos - bufPos);
|
|
|
|
(void**) &request, buffer + bufPos, maxBufPos - bufPos);
|
|
|
|
|
|
|
|
|
|
|
|
if (rval.code == RC_OK) {
|
|
|
|
if (rval.code == RC_OK) {
|
|
|
|
if (request->present == GetVariableAccessAttributesRequest_PR_name) {
|
|
|
|
if (request->present == GetVariableAccessAttributesRequest_PR_name) {
|
|
|
|
if (request->choice.name.present == ObjectName_PR_domainspecific) {
|
|
|
|
if (request->choice.name.present == ObjectName_PR_domainspecific) {
|
|
|
|
Identifier_t domainId = request->choice.name.choice.domainspecific.domainId;
|
|
|
|
Identifier_t domainId = request->choice.name.choice.domainspecific.domainId;
|
|
|
|
Identifier_t nameId = request->choice.name.choice.domainspecific.itemId;
|
|
|
|
Identifier_t nameId = request->choice.name.choice.domainspecific.itemId;
|
|
|
|
|
|
|
|
|
|
|
|
char* domainIdStr = StringUtils_createStringFromBuffer(domainId.buf, domainId.size);
|
|
|
|
char* domainIdStr = StringUtils_createStringFromBuffer(domainId.buf, domainId.size);
|
|
|
|
char* nameIdStr = StringUtils_createStringFromBuffer(nameId.buf, nameId.size);
|
|
|
|
char* nameIdStr = StringUtils_createStringFromBuffer(nameId.buf, nameId.size);
|
|
|
|
|
|
|
|
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
if (DEBUG_MMS_SERVER)
|
|
|
|
printf("MMS_SERVER: getVariableAccessAttributes domainId: %s nameId: %s\n", domainIdStr, nameIdStr);
|
|
|
|
printf("MMS_SERVER: getVariableAccessAttributes domainId: %s nameId: %s\n", domainIdStr, nameIdStr);
|
|
|
|
|
|
|
|
|
|
|
|
createVariableAccessAttributesResponse(connection, domainIdStr, nameIdStr, invokeId, response);
|
|
|
|
createVariableAccessAttributesResponse(connection, domainIdStr, nameIdStr, invokeId, response);
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL_FREEMEM(domainIdStr);
|
|
|
|
GLOBAL_FREEMEM(domainIdStr);
|
|
|
|
GLOBAL_FREEMEM(nameIdStr);
|
|
|
|
GLOBAL_FREEMEM(nameIdStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
|
|
|
|
#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
|
|
|
|
else if (request->choice.name.present == ObjectName_PR_vmdspecific) {
|
|
|
|
else if (request->choice.name.present == ObjectName_PR_vmdspecific) {
|
|
|
|
Identifier_t nameId = request->choice.name.choice.vmdspecific;
|
|
|
|
Identifier_t nameId = request->choice.name.choice.vmdspecific;
|
|
|
|
|
|
|
|
|
|
|
|
char* nameIdStr = StringUtils_createStringFromBuffer(nameId.buf, nameId.size);
|
|
|
|
char* nameIdStr = StringUtils_createStringFromBuffer(nameId.buf, nameId.size);
|
|
|
|
|
|
|
|
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: getVariableAccessAttributes (VMD specific) nameId: %s\n", nameIdStr);
|
|
|
|
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: getVariableAccessAttributes (VMD specific) nameId: %s\n", nameIdStr);
|
|
|
|
|
|
|
|
|
|
|
|
createVariableAccessAttributesResponse(connection, NULL, nameIdStr, invokeId, response);
|
|
|
|
createVariableAccessAttributesResponse(connection, NULL, nameIdStr, invokeId, response);
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL_FREEMEM(nameIdStr);
|
|
|
|
GLOBAL_FREEMEM(nameIdStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1) */
|
|
|
|
#endif /* (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1) */
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest with name other than domainspecific is not supported!\n");
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest with name other than domainspecific is not supported!\n");
|
|
|
|
retVal = -1;
|
|
|
|
retVal = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest with address not supported!\n");
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest with address not supported!\n");
|
|
|
|
retVal = -1;
|
|
|
|
retVal = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest parsing request failed!\n");
|
|
|
|
if (DEBUG_MMS_SERVER) printf("GetVariableAccessAttributesRequest parsing request failed!\n");
|
|
|
|
retVal = -1;
|
|
|
|
retVal = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
asn_DEF_GetVariableAccessAttributesRequest.free_struct(&asn_DEF_GetVariableAccessAttributesRequest, request, 0);
|
|
|
|
asn_DEF_GetVariableAccessAttributesRequest.free_struct(&asn_DEF_GetVariableAccessAttributesRequest, request, 0);
|
|
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* (MMS_GET_VARIABLE_ACCESS_ATTRIBUTES == 1) */
|
|
|
|
#endif /* (MMS_GET_VARIABLE_ACCESS_ATTRIBUTES == 1) */
|
|
|
|
|
|
|
|
|
|
|
|
|