- 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)
This commit is contained in:
parent
e7910ac830
commit
993d81116a
3 changed files with 28 additions and 15 deletions
|
@ -427,7 +427,12 @@ sendReport(ReportControl* self, bool isIntegrity, bool isGI)
|
|||
|
||||
/* Increase sequence number */
|
||||
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_destroyStatic(reportElements);
|
||||
|
@ -549,7 +554,7 @@ createDataSetReferenceForDefaultDataSet(ReportControlBlock* rcb, ReportControl*
|
|||
static MmsValue*
|
||||
createOptFlds(ReportControlBlock* reportControlBlock)
|
||||
{
|
||||
MmsValue* optFlds = MmsValue_newBitString(10);
|
||||
MmsValue* optFlds = MmsValue_newBitString(-10);
|
||||
uint8_t options = reportControlBlock->options;
|
||||
|
||||
if (options & RPT_OPT_SEQ_NUM)
|
||||
|
@ -574,7 +579,7 @@ createOptFlds(ReportControlBlock* reportControlBlock)
|
|||
|
||||
static MmsValue*
|
||||
createTrgOps(ReportControlBlock* reportControlBlock) {
|
||||
MmsValue* trgOps = MmsValue_newBitString(6);
|
||||
MmsValue* trgOps = MmsValue_newBitString(-6);
|
||||
|
||||
uint8_t triggerOps = reportControlBlock->trgOps;
|
||||
|
||||
|
@ -752,7 +757,7 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
|
|||
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
|
||||
namedVariable->name = copyString("OptFlds");
|
||||
namedVariable->type = MMS_BIT_STRING;
|
||||
namedVariable->typeSpec.bitString = 10;
|
||||
namedVariable->typeSpec.bitString = -10;
|
||||
rcb->typeSpec.structure.elements[5] = namedVariable;
|
||||
mmsValue->value.structure.components[5] = createOptFlds(reportControlBlock);
|
||||
|
||||
|
@ -767,14 +772,14 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
|
|||
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
|
||||
namedVariable->name = copyString("SqNum");
|
||||
namedVariable->type = MMS_UNSIGNED;
|
||||
namedVariable->typeSpec.unsignedInteger = 16;
|
||||
namedVariable->typeSpec.unsignedInteger = 8;
|
||||
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->name = copyString("TrgOps");
|
||||
namedVariable->type = MMS_BIT_STRING;
|
||||
namedVariable->typeSpec.bitString = 6;
|
||||
namedVariable->typeSpec.bitString = -6;
|
||||
rcb->typeSpec.structure.elements[8] = namedVariable;
|
||||
mmsValue->value.structure.components[8] = createTrgOps(reportControlBlock);
|
||||
|
||||
|
@ -877,7 +882,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
|
|||
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
|
||||
namedVariable->name = copyString("OptFlds");
|
||||
namedVariable->type = MMS_BIT_STRING;
|
||||
namedVariable->typeSpec.bitString = 10;
|
||||
namedVariable->typeSpec.bitString = -10;
|
||||
rcb->typeSpec.structure.elements[4] = namedVariable;
|
||||
mmsValue->value.structure.components[4] = createOptFlds(reportControlBlock);
|
||||
|
||||
|
@ -899,7 +904,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
|
|||
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
|
||||
namedVariable->name = copyString("TrgOps");
|
||||
namedVariable->type = MMS_BIT_STRING;
|
||||
namedVariable->typeSpec.bitString = 6;
|
||||
namedVariable->typeSpec.bitString = -6;
|
||||
rcb->typeSpec.structure.elements[7] = namedVariable;
|
||||
mmsValue->value.structure.components[7] = createTrgOps(reportControlBlock);
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ MmsValue_newBitString(int bitSize)
|
|||
return NULL;
|
||||
|
||||
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);
|
||||
|
||||
return self;
|
||||
|
|
|
@ -202,7 +202,7 @@ deleteVariableAccessAttributesResponse(
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
createVariableAccessAttributesResponse(
|
||||
MmsServerConnection* connection,
|
||||
char* domainId,
|
||||
|
@ -219,7 +219,10 @@ createVariableAccessAttributesResponse(
|
|||
|
||||
if (domain == NULL) {
|
||||
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);
|
||||
|
@ -232,7 +235,11 @@ createVariableAccessAttributesResponse(
|
|||
|
||||
if (namedVariable == NULL) {
|
||||
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);
|
||||
|
@ -261,14 +268,15 @@ createVariableAccessAttributesResponse(
|
|||
mmsServer_createConfirmedErrorPdu(invokeId, response,
|
||||
MMS_ERROR_SERVICE_OTHER);
|
||||
|
||||
return 0;
|
||||
goto exit_function;
|
||||
}
|
||||
|
||||
deleteVariableAccessAttributesResponse(getVarAccessAttr);
|
||||
|
||||
asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0);
|
||||
|
||||
return 0;
|
||||
exit_function:
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue