- fixed bug with wrong sqNum size for unbuffered RCBs (was 16 is now 8 bit)

- fixed bug with missing response for getVariableAccessAttributes if domain name is wrong
- changed types of trgOps and optFlds (-10, -6)
pull/6/head
Michael Zillgith 11 years ago
parent e7910ac830
commit 993d81116a

@ -427,7 +427,12 @@ sendReport(ReportControl* self, bool isIntegrity, bool isGI)
/* Increase sequence number */ /* Increase sequence number */
self->sqNum++; self->sqNum++;
MmsValue_setUint16(sqNum, self->sqNum);
/* Unbuffered reporting --> sqNum is 8 bit only!!! */
if (self->sqNum == 256)
self->sqNum = 0;
MmsValue_setUint8(sqNum, self->sqNum);
LinkedList_destroyDeep(deletableElements, (LinkedListValueDeleteFunction) MmsValue_delete); LinkedList_destroyDeep(deletableElements, (LinkedListValueDeleteFunction) MmsValue_delete);
LinkedList_destroyStatic(reportElements); LinkedList_destroyStatic(reportElements);
@ -549,7 +554,7 @@ createDataSetReferenceForDefaultDataSet(ReportControlBlock* rcb, ReportControl*
static MmsValue* static MmsValue*
createOptFlds(ReportControlBlock* reportControlBlock) createOptFlds(ReportControlBlock* reportControlBlock)
{ {
MmsValue* optFlds = MmsValue_newBitString(10); MmsValue* optFlds = MmsValue_newBitString(-10);
uint8_t options = reportControlBlock->options; uint8_t options = reportControlBlock->options;
if (options & RPT_OPT_SEQ_NUM) if (options & RPT_OPT_SEQ_NUM)
@ -574,7 +579,7 @@ createOptFlds(ReportControlBlock* reportControlBlock)
static MmsValue* static MmsValue*
createTrgOps(ReportControlBlock* reportControlBlock) { createTrgOps(ReportControlBlock* reportControlBlock) {
MmsValue* trgOps = MmsValue_newBitString(6); MmsValue* trgOps = MmsValue_newBitString(-6);
uint8_t triggerOps = reportControlBlock->trgOps; uint8_t triggerOps = reportControlBlock->trgOps;
@ -752,7 +757,7 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("OptFlds"); namedVariable->name = copyString("OptFlds");
namedVariable->type = MMS_BIT_STRING; namedVariable->type = MMS_BIT_STRING;
namedVariable->typeSpec.bitString = 10; namedVariable->typeSpec.bitString = -10;
rcb->typeSpec.structure.elements[5] = namedVariable; rcb->typeSpec.structure.elements[5] = namedVariable;
mmsValue->value.structure.components[5] = createOptFlds(reportControlBlock); mmsValue->value.structure.components[5] = createOptFlds(reportControlBlock);
@ -767,14 +772,14 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("SqNum"); namedVariable->name = copyString("SqNum");
namedVariable->type = MMS_UNSIGNED; namedVariable->type = MMS_UNSIGNED;
namedVariable->typeSpec.unsignedInteger = 16; namedVariable->typeSpec.unsignedInteger = 8;
rcb->typeSpec.structure.elements[7] = namedVariable; rcb->typeSpec.structure.elements[7] = namedVariable;
mmsValue->value.structure.components[7] = MmsValue_newUnsigned(16); mmsValue->value.structure.components[7] = MmsValue_newUnsigned(8);
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("TrgOps"); namedVariable->name = copyString("TrgOps");
namedVariable->type = MMS_BIT_STRING; namedVariable->type = MMS_BIT_STRING;
namedVariable->typeSpec.bitString = 6; namedVariable->typeSpec.bitString = -6;
rcb->typeSpec.structure.elements[8] = namedVariable; rcb->typeSpec.structure.elements[8] = namedVariable;
mmsValue->value.structure.components[8] = createTrgOps(reportControlBlock); mmsValue->value.structure.components[8] = createTrgOps(reportControlBlock);
@ -877,7 +882,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("OptFlds"); namedVariable->name = copyString("OptFlds");
namedVariable->type = MMS_BIT_STRING; namedVariable->type = MMS_BIT_STRING;
namedVariable->typeSpec.bitString = 10; namedVariable->typeSpec.bitString = -10;
rcb->typeSpec.structure.elements[4] = namedVariable; rcb->typeSpec.structure.elements[4] = namedVariable;
mmsValue->value.structure.components[4] = createOptFlds(reportControlBlock); mmsValue->value.structure.components[4] = createOptFlds(reportControlBlock);
@ -899,7 +904,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = copyString("TrgOps"); namedVariable->name = copyString("TrgOps");
namedVariable->type = MMS_BIT_STRING; namedVariable->type = MMS_BIT_STRING;
namedVariable->typeSpec.bitString = 6; namedVariable->typeSpec.bitString = -6;
rcb->typeSpec.structure.elements[7] = namedVariable; rcb->typeSpec.structure.elements[7] = namedVariable;
mmsValue->value.structure.components[7] = createTrgOps(reportControlBlock); mmsValue->value.structure.components[7] = createTrgOps(reportControlBlock);

@ -307,7 +307,7 @@ MmsValue_newBitString(int bitSize)
return NULL; return NULL;
self->type = MMS_BIT_STRING; self->type = MMS_BIT_STRING;
self->value.bitString.size = bitSize; self->value.bitString.size = abs(bitSize);
self->value.bitString.buf = (uint8_t*) GLOBAL_CALLOC(bitStringByteSize(self), 1); self->value.bitString.buf = (uint8_t*) GLOBAL_CALLOC(bitStringByteSize(self), 1);
return self; return self;

@ -202,7 +202,7 @@ deleteVariableAccessAttributesResponse(
} }
} }
static int static void
createVariableAccessAttributesResponse( createVariableAccessAttributesResponse(
MmsServerConnection* connection, MmsServerConnection* connection,
char* domainId, char* domainId,
@ -219,7 +219,10 @@ createVariableAccessAttributesResponse(
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);
return -1;
mmsServer_createConfirmedErrorPdu(invokeId, response,
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
goto exit_function;
} }
namedVariable = MmsDomain_getNamedVariable(domain, nameId); namedVariable = MmsDomain_getNamedVariable(domain, nameId);
@ -232,7 +235,11 @@ createVariableAccessAttributesResponse(
if (namedVariable == NULL) { if (namedVariable == NULL) {
if (DEBUG_MMS_SERVER) printf("MMS_SERVER: named variable %s not known\n", nameId); if (DEBUG_MMS_SERVER) printf("MMS_SERVER: named variable %s not known\n", nameId);
return -1;
mmsServer_createConfirmedErrorPdu(invokeId, response,
MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
goto exit_function;
} }
MmsPdu_t* mmsPdu = mmsServer_createConfirmedResponse(invokeId); MmsPdu_t* mmsPdu = mmsServer_createConfirmedResponse(invokeId);
@ -261,14 +268,15 @@ createVariableAccessAttributesResponse(
mmsServer_createConfirmedErrorPdu(invokeId, response, mmsServer_createConfirmedErrorPdu(invokeId, response,
MMS_ERROR_SERVICE_OTHER); MMS_ERROR_SERVICE_OTHER);
return 0; 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);
return 0; exit_function:
return;
} }
int int

Loading…
Cancel
Save