Merge all changes of easy setup in master branch to 1.2-rel branch
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / src / EnrolleeSecurity.h
old mode 100644 (file)
new mode 100755 (executable)
index 8ab91ed..a713ff3
@@ -32,7 +32,7 @@ namespace OIC
 {
     namespace Service
     {
-        #define ENROLEE_SECURITY_TAG "ENROLEE_SECURITY"
+        #define ENROLEE_SECURITY_TAG "ENROLLEE_SECURITY"
         #define UUID_SIZE (16)
         #define UUID_STRING_SIZE (37)
 
@@ -56,9 +56,7 @@ namespace OIC
                 const SecurityProvStatusCb securityProvStatusCb,
                 const SecurityPinCb securityPinCb,
                 const SecProvisioningDbPathCb secProvisioningDbPathCb);
-            void provisionOwnership();
-            void provisionSecurityForCloudServer(
-                std::string cloudUuid, int credId);
+            ESResult provisionOwnership();
             std::string getUUID() const;
 
         private:
@@ -70,30 +68,36 @@ namespace OIC
 
             std::mutex m_mtx;
             std::condition_variable m_cond;
-            std::atomic<bool>  aclResult;
-            std::atomic<bool>  certResult;
-
-            ESResult performCertProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                int credId);
-            ESResult performACLProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                std::string& cloudUuid);
+            std::atomic<bool> OTMResult;
+            std::atomic<bool> removeDeviceResult;
+            std::atomic<bool> aclResult;
+            std::atomic<bool> certResult;
 
             std::shared_ptr< OC::OCSecureResource > m_securedResource;
             std::shared_ptr< OC::OCSecureResource > findEnrolleeSecurityResource(
                 OC::DeviceList_t &list);
-            void performOwnershipTransfer();
+            ESResult performOwnershipTransfer();
             bool isOwnedDeviceRegisteredInSVRDB();
             void removeDeviceWithUuidCB(OC::PMResultList_t *result, int hasError);
             void ownershipTransferCb(OC::PMResultList_t *result, int hasError);
             void convertUUIDToString(const uint8_t uuid[UUID_SIZE],
                                                 std::string& uuidString);
-            void convertStringToUUID(OicUuid_t& uuid, const std::string uuidString);
-            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
 
+#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
+        public:
+            ESResult provisionSecurityForCloudServer(
+                std::string cloudUuid, int credId);
+        private:
+            ESResult performCertProvisioningForCloudServer(
+                std::shared_ptr< OC::OCSecureResource > ownedDevice,
+                int credId);
+            ESResult performACLProvisioningForCloudServer(
+                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);
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
         };
     }
 }