Commit 70e5da93 authored by Nathan Heldt-Sheller's avatar Nathan Heldt-Sheller

Merge "Merge branch 'feat-owned-readonly'"

parents 6e26c254 eea3fc82
...@@ -725,6 +725,13 @@ struct OicSecPdAcl ...@@ -725,6 +725,13 @@ struct OicSecPdAcl
OIC_SEC_ACL_V2 : OIC_SEC_ACL_V1) OIC_SEC_ACL_V2 : OIC_SEC_ACL_V1)
#define IS_OIC(specVer) ((specVer)[0] == 'c' && (specVer)[1] == 'o' && (specVer)[2] == 'r' && (specVer)[3] == 'e') #define IS_OIC(specVer) ((specVer)[0] == 'c' && (specVer)[1] == 'o' && (specVer)[2] == 'r' && (specVer)[3] == 'e')
#define IS_OCF(specVer) ((specVer)[0] == 'o' && (specVer)[1] == 'c' && (specVer)[2] == 'f')
#define GET_OCF_MAJOR_VER(specVer) ((int)((specVer)[4] - '0'))
#define GET_OCF_MINOR_VER(specVer) ((int)((specVer)[6] - '0'))
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -2289,7 +2289,15 @@ static OCStackResult PostOwnershipInformation(OTMContext_t* otmCtx) ...@@ -2289,7 +2289,15 @@ static OCStackResult PostOwnershipInformation(OTMContext_t* otmCtx)
uint8_t numOptions = 0; uint8_t numOptions = 0;
bool propertiesToInclude[DOXM_PROPERTY_COUNT]; bool propertiesToInclude[DOXM_PROPERTY_COUNT];
memset(propertiesToInclude, 0, sizeof(propertiesToInclude)); memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
propertiesToInclude[DOXM_OWNED] = true; if ( ! ( IS_OCF(otmCtx->selectedDeviceInfo->specVer)
&& ( GET_OCF_MAJOR_VER(otmCtx->selectedDeviceInfo->specVer) > 2
|| ( GET_OCF_MAJOR_VER(otmCtx->selectedDeviceInfo->specVer) == 2
&& GET_OCF_MINOR_VER(otmCtx->selectedDeviceInfo->specVer) >= 1) ) )
)
{
OIC_LOG_V(DEBUG, TAG, "%s: Pre ocf.2.1.x version detected", __func__);
propertiesToInclude[DOXM_OWNED] = true;
}
//include rowner uuid //include rowner uuid
propertiesToInclude[DOXM_ROWNERUUID] = true; propertiesToInclude[DOXM_ROWNERUUID] = true;
//doxm.rowneruuid set to the provisioningclient's /doxm.deviceuuid. //doxm.rowneruuid set to the provisioningclient's /doxm.deviceuuid.
......
...@@ -101,9 +101,6 @@ static bool IsReadyToEnterRFNOP(void) ...@@ -101,9 +101,6 @@ static bool IsReadyToEnterRFNOP(void)
// Note: pstat.dos.p asserted by DoStateChange(), so not checked here. // Note: pstat.dos.p asserted by DoStateChange(), so not checked here.
// Verify doxm.owned == TRUE.
VERIFY_TRUE_OR_EXIT(TAG, IsDoxmOwned(), WARNING);
// Verify doxm.devowneruuid != nil UUID. // Verify doxm.devowneruuid != nil UUID.
VERIFY_TRUE_OR_EXIT(TAG, !IsDoxmDevowneruuidTheNilUuid(), WARNING); VERIFY_TRUE_OR_EXIT(TAG, !IsDoxmDevowneruuidTheNilUuid(), WARNING);
...@@ -173,9 +170,6 @@ static bool IsReadyToEnterRFPRO(void) ...@@ -173,9 +170,6 @@ static bool IsReadyToEnterRFPRO(void)
// Note: pstat.dos.p asserted by DoStateChange(), so not checked here. // Note: pstat.dos.p asserted by DoStateChange(), so not checked here.
// Verify doxm.owned == TRUE.
VERIFY_TRUE_OR_EXIT(TAG, IsDoxmOwned(), WARNING);
// Verify doxm.devowneruuid != nil UUID. // Verify doxm.devowneruuid != nil UUID.
VERIFY_TRUE_OR_EXIT(TAG, !IsDoxmDevowneruuidTheNilUuid(), WARNING); VERIFY_TRUE_OR_EXIT(TAG, !IsDoxmDevowneruuidTheNilUuid(), WARNING);
...@@ -311,8 +305,16 @@ static bool EnterRFNOP(void) ...@@ -311,8 +305,16 @@ static bool EnterRFNOP(void)
// Unset pstat.cm RESET and TAKE_OWNER bits // Unset pstat.cm RESET and TAKE_OWNER bits
// Unset pstat.tm RESET and TAKE_OWNER bits // Unset pstat.tm RESET and TAKE_OWNER bits
// Set pstat.dos to RFNOP // Set pstat.dos to RFNOP
ret = EnterStateGeneric(true, false, false, false, false, DOS_RFNOP); VERIFY_SUCCESS(TAG,
EnterStateGeneric(true, false, false, false, false, DOS_RFNOP),
ERROR);
// Set doxm.owned = TRUE
VERIFY_SUCCESS(TAG, OC_STACK_OK == SetDoxmIsOwned(true), ERROR);
ret = true;
exit:
OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false"); OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false");
return ret; return ret;
} }
...@@ -328,8 +330,15 @@ static bool EnterRFOTM(void) ...@@ -328,8 +330,15 @@ static bool EnterRFOTM(void)
// Unset pstat.cm RESET bit, and set TAKE_OWNER bit // Unset pstat.cm RESET bit, and set TAKE_OWNER bit
// Unset pstat.tm RESET and TAKE_OWNER bits // Unset pstat.tm RESET and TAKE_OWNER bits
// Set pstat.dos to RFOTM // Set pstat.dos to RFOTM
ret = EnterStateGeneric(false, false, true, false, false, DOS_RFOTM); VERIFY_SUCCESS(TAG,
EnterStateGeneric(false, false, true, false, false, DOS_RFOTM),
ERROR);
// Set doxm.owned = FALSE
VERIFY_SUCCESS(TAG, OC_STACK_OK == SetDoxmIsOwned(false), ERROR);
ret = true;
exit:
OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false"); OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false");
return ret; return ret;
} }
...@@ -345,8 +354,15 @@ static bool EnterRFPRO(void) ...@@ -345,8 +354,15 @@ static bool EnterRFPRO(void)
// Unset pstat.cm RESET and TAKE_OWNER bits // Unset pstat.cm RESET and TAKE_OWNER bits
// Unset pstat.tm RESET and TAKE_OWNER bits // Unset pstat.tm RESET and TAKE_OWNER bits
// Set pstat.dos to RFPRO // Set pstat.dos to RFPRO
ret = EnterStateGeneric(false, false, false, false, false, DOS_RFPRO); VERIFY_SUCCESS(TAG,
EnterStateGeneric(false, false, false, false, false, DOS_RFPRO),
ERROR);
// Set doxm.owned = TRUE
VERIFY_SUCCESS(TAG, OC_STACK_OK == SetDoxmIsOwned(true), ERROR);
ret = true;
exit:
OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false"); OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false");
return ret; return ret;
} }
......
...@@ -111,7 +111,7 @@ static const uint8_t gDoxmPropertyAccessModes[DOXM_PROPERTY_COUNT][DOS_STATE_COU ...@@ -111,7 +111,7 @@ static const uint8_t gDoxmPropertyAccessModes[DOXM_PROPERTY_COUNT][DOS_STATE_COU
{ R, RW, R, R, R }, // .oxmsel { R, RW, R, R, R }, // .oxmsel
#endif // MULTIPLE_OWNER #endif // MULTIPLE_OWNER
{ R, R, R, R, R }, // .sct { R, R, R, R, R }, // .sct
{ R, RW, R, R, R }, // .owned { R, R, R, R, R }, // .owned
#ifdef MULTIPLE_OWNER #ifdef MULTIPLE_OWNER
{ RW, RW, RW, RW, RW }, // .subowner { RW, RW, RW, RW, RW }, // .subowner
{ RW, RW, RW, RW, RW }, // .mom { RW, RW, RW, RW, RW }, // .mom
...@@ -2112,8 +2112,10 @@ OCStackResult SetDoxmIsOwned(const bool isowned) ...@@ -2112,8 +2112,10 @@ OCStackResult SetDoxmIsOwned(const bool isowned)
if (gDoxm) if (gDoxm)
{ {
gDoxm->owned = isowned; gDoxm->owned = isowned;
VERIFY_SUCCESS(TAG, UpdatePersistentStorage(gDoxm), ERROR);
return OC_STACK_OK; return OC_STACK_OK;
} }
exit:
return OC_STACK_ERROR; return OC_STACK_ERROR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment