Commit 034c990a authored by Parkhi's avatar Parkhi Committed by Uze Choi

Refactoring EnrolleeSecurity class

  - provisionOwnership function is too long, so divide the function.

Change-Id: Ifd80fe5ceae70a5181c5020e014acda13215994c
Signed-off-by: default avatarParkhi <h_w.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16915Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent ff2eebfa
......@@ -52,8 +52,7 @@ namespace OIC
class EnrolleeSecurity : public std::enable_shared_from_this<EnrolleeSecurity>
{
public:
EnrolleeSecurity(std::shared_ptr< OC::OCResource > resource,
const std::string secDbPath);
EnrolleeSecurity(std::shared_ptr< OC::OCResource > resource);
ESResult provisionOwnership(SecurityProvStatusCbWithOption callback);
std::string getUUID() const;
......@@ -80,21 +79,29 @@ namespace OIC
ESSecurityCb cb,
std::weak_ptr<EnrolleeSecurity> this_ptr);
ESResult performOwnershipTransfer(ESResult& res);
bool isOwnedDeviceRegisteredInSVRDB();
ESResult performOwnershipTransfer();
bool isOwnedDeviceRegisteredInDB();
void removeDeviceWithUuidCB(OC::PMResultList_t *result, int hasError);
ESResult discoverTargetSecureResource();
ESOwnershipTransferData getOwnershipTransferDataFromUser
(SecurityProvStatusCbWithOption callback);
bool isTargetDeviceMine();
ESResult syncUpWithMediatorDB();
#ifdef MULTIPLE_OWNER
ESResult performMultipleOwnershipTransfer(const ESOwnershipTransferData& MOTdata);
void SelectMOTMethodCB(PMResultList_t *result, int hasError);
void PreconfigPinProvCB(PMResultList_t *result, int hasError);
void MultipleOwnershipTransferCb(OC::PMResultList_t *result, int hasError);
bool isSubOwnerIDMatched(std::shared_ptr< OC::OCSecureResource > foundDevice);
ESResult RequestSetPreconfPinData(const ESOwnershipTransferData ownershipTransferData);
ESResult RequestSetMOTMethod(const ESOwnershipTransferData ownershipTransferData);
#endif
void ownershipTransferCb(OC::PMResultList_t *result, int hasError, ESResult& res);
void convertUUIDToString(const uint8_t uuid[UUID_SIZE],
std::string& uuidString);
std::string getResourceDeviceAddress(const std::string& host);
bool isOwnerIDMatched(std::shared_ptr< OC::OCSecureResource > foundDevice);
OCUUIdentity* getMediatorDevID();
#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
public:
......
......@@ -319,7 +319,7 @@ namespace OIC
//TODO : DBPath is passed empty as of now. Need to take dbpath from application.
if(!m_localEnrolleeSecurity.get())
{
m_localEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource, "");
m_localEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource);
}
res = m_localEnrolleeSecurity->provisionOwnership(NULL);
......@@ -360,7 +360,7 @@ namespace OIC
if(!m_localEnrolleeSecurity.get())
{
m_localEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource, "");
m_localEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource);
}
res = m_localEnrolleeSecurity->provisionOwnership(securityProvStatusCbWithOption);
......@@ -589,7 +589,7 @@ namespace OIC
ESResult res = ESResult::ES_ERROR;
if(!m_cloudEnrolleeSecurity.get())
{
m_cloudEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource, "");
m_cloudEnrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource);
}
......
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