|
|
@ -1089,6 +1089,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);
|
|
|
@ -1553,7 +1558,7 @@ increaseConfRev(ReportControl* self)
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
checkReservationTimeout(MmsMapping* self, ReportControl* rc)
|
|
|
|
checkReservationTimeout(MmsMapping* self, 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) {
|
|
|
|
|
|
|
|
|
|
|
@ -1602,6 +1607,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];
|
|
|
|
|
|
|
|
|
|
|
@ -1631,23 +1639,31 @@ 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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MmsDataAccessError retVal = DATA_ACCESS_ERROR_SUCCESS;
|
|
|
|
MmsDataAccessError retVal = DATA_ACCESS_ERROR_SUCCESS;
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
@ -1824,6 +1840,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) {
|
|
|
@ -1833,6 +1851,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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2012,8 +2033,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;
|
|
|
@ -2027,7 +2051,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;
|
|
|
|
|
|
|
|
|
|
|
@ -2037,6 +2064,10 @@ exit_function:
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
reserveRcb(rc, connection);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (CONFIG_IEC61850_SERVICE_TRACKING == 1)
|
|
|
|
#if (CONFIG_IEC61850_SERVICE_TRACKING == 1)
|
|
|
|
|
|
|
|
|
|
|
@ -2056,6 +2087,7 @@ exit_function:
|
|
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection)
|
|
|
|
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection)
|
|
|
@ -2077,8 +2109,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);
|
|
|
|