|
|
@ -805,6 +805,11 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* check if there is a pre configured owner */
|
|
|
|
|
|
|
|
if (reportControlBlock->clientReservation[0] > 0) {
|
|
|
|
|
|
|
|
MmsValue_setBoolean(mmsValue->value.structure.components[2], true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
reportControl->rcbValues = mmsValue;
|
|
|
|
reportControl->rcbValues = mmsValue;
|
|
|
|
|
|
|
|
|
|
|
|
reportControl->timeOfEntry = MmsValue_newBinaryTime(false);
|
|
|
|
reportControl->timeOfEntry = MmsValue_newBinaryTime(false);
|
|
|
@ -1267,7 +1272,7 @@ increaseConfRev(ReportControl* self)
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
checkReservationTimeout(ReportControl* rc)
|
|
|
|
checkReservationTimeout(ReportControl* rc)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (rc->enabled == false) {
|
|
|
|
if (rc->enabled == false && (rc->clientConnection == NULL)) {
|
|
|
|
if (rc->reservationTimeout > 0) {
|
|
|
|
if (rc->reservationTimeout > 0) {
|
|
|
|
if (Hal_getTimeInMs() > rc->reservationTimeout) {
|
|
|
|
if (Hal_getTimeInMs() > rc->reservationTimeout) {
|
|
|
|
|
|
|
|
|
|
|
@ -1307,6 +1312,9 @@ isIpAddressMatchingWithOwner(ReportControl* rc, const char* ipAddress)
|
|
|
|
|
|
|
|
|
|
|
|
if (owner != NULL) {
|
|
|
|
if (owner != NULL) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (MmsValue_getOctetStringSize(owner) == 0)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
if (strchr(ipAddress, '.') != NULL) {
|
|
|
|
if (strchr(ipAddress, '.') != NULL) {
|
|
|
|
uint8_t ipV4Addr[4];
|
|
|
|
uint8_t ipV4Addr[4];
|
|
|
|
|
|
|
|
|
|
|
@ -1336,16 +1344,23 @@ reserveRcb(ReportControl* rc, MmsServerConnection connection)
|
|
|
|
rc->reserved = true;
|
|
|
|
rc->reserved = true;
|
|
|
|
rc->clientConnection = connection;
|
|
|
|
rc->clientConnection = connection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->buffered) {
|
|
|
|
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
|
|
|
|
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
|
|
|
|
MmsValue* resvTmsVal = ReportControl_getRCBValue(rc, "ResvTms");
|
|
|
|
MmsValue* resvTmsVal = ReportControl_getRCBValue(rc, "ResvTms");
|
|
|
|
if (resvTmsVal)
|
|
|
|
if (resvTmsVal)
|
|
|
|
MmsValue_setInt16(resvTmsVal, rc->resvTms);
|
|
|
|
MmsValue_setInt16(resvTmsVal, rc->resvTms);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
MmsValue* resvVal = ReportControl_getRCBValue(rc, "Resv");
|
|
|
|
|
|
|
|
if (resvVal)
|
|
|
|
|
|
|
|
MmsValue_setBoolean(resvVal, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rc->reservationTimeout = Hal_getTimeInMs() + (RESV_TMS_IMPLICIT_VALUE * 1000);
|
|
|
|
|
|
|
|
updateOwner(rc, connection);
|
|
|
|
updateOwner(rc, connection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
MmsDataAccessError
|
|
|
|
MmsDataAccessError
|
|
|
|
Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* elementName, MmsValue* value,
|
|
|
|
Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* elementName, MmsValue* value,
|
|
|
|
MmsServerConnection connection)
|
|
|
|
MmsServerConnection connection)
|
|
|
@ -1354,7 +1369,8 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
|
|
|
|
|
|
|
|
|
|
|
|
ReportControl_lockNotify(rc);
|
|
|
|
ReportControl_lockNotify(rc);
|
|
|
|
|
|
|
|
|
|
|
|
bool resvTmsAccess = false;
|
|
|
|
bool resvTmsAccess = false; /* access is to RecvTms or Resv */
|
|
|
|
|
|
|
|
bool dontUpdate = false;
|
|
|
|
|
|
|
|
|
|
|
|
/* check reservation timeout for buffered RCBs */
|
|
|
|
/* check reservation timeout for buffered RCBs */
|
|
|
|
if (rc->buffered) {
|
|
|
|
if (rc->buffered) {
|
|
|
@ -1529,6 +1545,8 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(elementName, "Resv") == 0) {
|
|
|
|
if (strcmp(elementName, "Resv") == 0) {
|
|
|
|
|
|
|
|
resvTmsAccess = true;
|
|
|
|
|
|
|
|
|
|
|
|
rc->reserved = value->value.boolean;
|
|
|
|
rc->reserved = value->value.boolean;
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->reserved == true) {
|
|
|
|
if (rc->reserved == true) {
|
|
|
@ -1538,6 +1556,9 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
updateOwner(rc, NULL);
|
|
|
|
updateOwner(rc, NULL);
|
|
|
|
rc->clientConnection = NULL;
|
|
|
|
rc->clientConnection = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->resvTms == -1)
|
|
|
|
|
|
|
|
dontUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1717,8 +1738,11 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
|
|
|
|
|
|
|
|
|
|
|
|
MmsValue* rcbValue = ReportControl_getRCBValue(rc, elementName);
|
|
|
|
MmsValue* rcbValue = ReportControl_getRCBValue(rc, elementName);
|
|
|
|
|
|
|
|
|
|
|
|
if (rcbValue != NULL)
|
|
|
|
if (rcbValue) {
|
|
|
|
|
|
|
|
if (dontUpdate == false) {
|
|
|
|
MmsValue_update(rcbValue, value);
|
|
|
|
MmsValue_update(rcbValue, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
retVal = DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
|
|
|
|
retVal = DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
|
|
|
|
goto exit_function;
|
|
|
|
goto exit_function;
|
|
|
@ -1732,7 +1756,10 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
|
|
|
|
exit_function:
|
|
|
|
exit_function:
|
|
|
|
|
|
|
|
|
|
|
|
/* every successful write access reserves the RCB */
|
|
|
|
/* every successful write access reserves the RCB */
|
|
|
|
if ((rc->buffered) && (retVal == DATA_ACCESS_ERROR_SUCCESS) && (resvTmsAccess == false)) {
|
|
|
|
if ((retVal == DATA_ACCESS_ERROR_SUCCESS) && (resvTmsAccess == false)) {
|
|
|
|
|
|
|
|
if (rc->buffered) {
|
|
|
|
|
|
|
|
rc->reservationTimeout = Hal_getTimeInMs() + (RESV_TMS_IMPLICIT_VALUE * 1000);
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->resvTms == 0) {
|
|
|
|
if (rc->resvTms == 0) {
|
|
|
|
rc->resvTms = RESV_TMS_IMPLICIT_VALUE;
|
|
|
|
rc->resvTms = RESV_TMS_IMPLICIT_VALUE;
|
|
|
|
|
|
|
|
|
|
|
@ -1742,11 +1769,16 @@ exit_function:
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ReportControl_unlockNotify(rc);
|
|
|
|
ReportControl_unlockNotify(rc);
|
|
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection)
|
|
|
|
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection)
|
|
|
@ -1768,8 +1800,10 @@ Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection c
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->buffered == false) {
|
|
|
|
if (rc->buffered == false) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->resvTms != -1) {
|
|
|
|
MmsValue* resv = ReportControl_getRCBValue(rc, "Resv");
|
|
|
|
MmsValue* resv = ReportControl_getRCBValue(rc, "Resv");
|
|
|
|
MmsValue_setBoolean(resv, false);
|
|
|
|
MmsValue_setBoolean(resv, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rc->resvTms != -1)
|
|
|
|
if (rc->resvTms != -1)
|
|
|
|
updateOwner(rc, NULL);
|
|
|
|
updateOwner(rc, NULL);
|
|
|
|