Change-Id: I0a65b0a1b1a65c8659b0bc253c4d74087612e75d
Signed-off-by: amar <amar.sri@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15589
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jongsung Lee <js126.lee@samsung.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
(cherry picked from commit
714a7678ef1cc6d488f85ab13a623e4adb53f971)
Reviewed-on: https://gerrit.iotivity.org/gerrit/16125
size_t chainSize);
#endif // __WITH_DTLS__ || __WITH_TLS__
+
+ /**
+ * This function configures SVR DB as self-ownership.
+ *
+ *@return OC_STACK_OK in case of successful configue and other value otherwise.
+ */
+ static OCStackResult configSelfOwnership();
+
};
/**
std::cout << " 19. Provision pre configure PIN for Multiple Ownership Transfer Mode"<<std::endl;
std::cout << " 20. Add pre configure PIN for Multiple Ownership Transfer Mode"<<std::endl;
#endif
+ std::cout << " 21. Configure SVRdb as Self-OwnerShip"<<std::endl;
std::cout << " 99. Exit loop"<<std::endl;
}
break;
}
#endif //MULTIPLE_OWNER
+ case 21:
+ {
+ OCStackResult result;
+ result = OCSecure::configSelfOwnership();
+ if (OC_STACK_OK != result)
+ {
+ std::cout<<"configSelfOwnership API error. Please check SVR DB"<<std::endl;
+ }
+ else
+ {
+ std::cout<<"Success to configures SVR DB as self-ownership"<<std::endl;
+ }
+ break;
+ }
case 99:
default:
out = 1;
return result;
}
+ OCStackResult OCSecure::configSelfOwnership()
+ {
+ OCStackResult result;
+ auto cLock = OCPlatform_impl::Instance().csdkLock().lock();
+
+ if (cLock)
+ {
+ std::lock_guard<std::recursive_mutex> lock(*cLock);
+ result = OCConfigSelfOwnership();
+ }
+ else
+ {
+ oclog() <<"Mutex not found";
+ result = OC_STACK_ERROR;
+ }
+ return result;
+ }
+
+
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
OCStackResult OCSecure::saveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
OicEncodingType_t encodingType, uint16_t *credId)