X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Feasy-setup%2Fmediator%2Frichsdk%2Fsrc%2FEnrolleeSecurity.h;h=fbf676e759ed88e9100d0773999b616830f212f6;hb=refs%2Ftags%2Faccepted%2Ftizen%2Funified%2F20171010.063815;hp=4a4e4c1ae227754f39d4751fede6fcff6345f150;hpb=ee7c7b1f7a64c8fa4a67bccd9dcf3fd01c896a24;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h b/service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h index 4a4e4c1..fbf676e 100755 --- a/service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h +++ b/service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h @@ -25,14 +25,15 @@ #include #include + #include "ESRichCommon.h" -#include "OCProvisioningManager.h" +#include "OCProvisioningManager.hpp" namespace OIC { namespace Service { - #define ENROLEE_SECURITY_TAG "ENROLLEE_SECURITY" + #define ENROLEE_SECURITY_TAG "ES_ENROLLEE_SECURITY" #define UUID_SIZE (16) #define UUID_STRING_SIZE (37) @@ -41,22 +42,18 @@ namespace OIC class OCSecureResource; typedef std::vector PMResultList_t; + typedef std::function ESSecurityCb; /** * This class contains the methods needed for security layer interaction. * * @see EnrolleeSecurity */ - class EnrolleeSecurity + class EnrolleeSecurity : public std::enable_shared_from_this { public: - EnrolleeSecurity(std::shared_ptr< OC::OCResource > resource, - const std::string secDbPath); - void registerCallbackHandler( - const SecurityProvStatusCb securityProvStatusCb, - const SecurityPinCb securityPinCb, - const SecProvisioningDbPathCb secProvisioningDbPathCb); - ESResult provisionOwnership(); + EnrolleeSecurity(std::shared_ptr< OC::OCResource > resource); + ESResult provisionOwnership(SecurityProvStatusCbWithOption callback); std::string getUUID() const; private: @@ -67,19 +64,48 @@ namespace OIC std::mutex m_mtx; std::condition_variable m_cond; - std::atomic OTMResult; + std::atomic otmResult; + std::atomic enableMOTModeResult; + std::atomic motMethodProvResult; + std::atomic preConfigPinProvResult; std::atomic removeDeviceResult; std::atomic aclResult; std::atomic certResult; + std::string m_mediatorID; std::shared_ptr< OC::OCSecureResource > m_securedResource; + static void onEnrolleeSecuritySafetyCB(OC::PMResultList_t *result, + int hasError, + ESSecurityCb cb, + std::weak_ptr this_ptr); + ESResult performOwnershipTransfer(); - bool isOwnedDeviceRegisteredInSVRDB(); + bool isOwnedDeviceRegisteredInDB(); void removeDeviceWithUuidCB(OC::PMResultList_t *result, int hasError); - void ownershipTransferCb(OC::PMResultList_t *result, int hasError); + ESResult discoverTargetSecureResource(); + ESOwnershipTransferData getOwnershipTransferDataFromUser + (SecurityProvStatusCbWithOption callback); + ESResult syncUpWithMediatorDB(); +#ifdef MULTIPLE_OWNER + ESResult performMultipleOwnershipTransfer(const ESOwnershipTransferData& MOTdata); + void changeMOTMethodCB(PMResultList_t *result, int hasError); + + 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& MOTData); + ESResult requestSetMOTMethod(const ESOwnershipTransferData& MOTData); + ESResult requestEnableMOTMode(); + ESResult provisionMOTConfig(const ESOwnershipTransferData& MOTData); +#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); + std::string getMediatorDevID(); #if defined(__WITH_DTLS__) && defined(__WITH_TLS__) public: @@ -93,8 +119,8 @@ namespace OIC std::shared_ptr< OC::OCSecureResource > ownedDevice, std::string& cloudUuid); OicSecAcl_t* createAcl(const OicUuid_t cloudUuid); - void ACLProvisioningCb(PMResultList_t *result, int hasError); - void CertProvisioningCb(PMResultList_t *result, int hasError); + void aclProvisioningCb(PMResultList_t *result, int hasError); + void certProvisioningCb(PMResultList_t *result, int hasError); #endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__) }; }