provisioning: Rename some C++ headers to avoid collision with CSDK ones
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 24 Nov 2016 10:20:23 +0000 (11:20 +0100)
committerPhil Coval <philippe.coval@osg.samsung.com>
Thu, 24 Nov 2016 15:38:49 +0000 (15:38 +0000)
The name clash only happens
 on case insensitive filesystems (ie HPFS on MacOS),
 there is ambiguity with C header ie:
  ./resource/csdk/security/provisioning/include/ocprovisioningmanager.h
  ./resource/include/OCProvisioningManager.h

Renaming to .hpp suffix prevent the problem.

Note, one other approach would be to use namespaces

Like:
   #include <iotivity/csdk/ocprovisioningmanager.h> vs
   #include <iotivity/oc/ocprovisioningmanager.h> or similar

Change-Id: Ie311344a98fd056e5b54f329819090a36a901589
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14747
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
22 files changed:
android/android_api/base/jni/JniDisplayPinListener.h
android/android_api/base/jni/JniOcCloudProvisioning.h
android/android_api/base/jni/JniOcProvisioning.h
android/android_api/base/jni/JniOcSecureResource.h
android/android_api/base/jni/JniPinCheckListener.h
android/android_api/base/jni/JniProvisionResultListner.h
android/android_api/base/jni/JniSecureUtils.h
resource/docs/cpp-doc/Doxyfile
resource/include/OCCloudProvisioning.h [deleted file]
resource/include/OCCloudProvisioning.hpp [new file with mode: 0755]
resource/include/OCProvisioningManager.h [deleted file]
resource/include/OCProvisioningManager.hpp [new file with mode: 0644]
resource/provisioning/examples/cloudClient.cpp
resource/provisioning/examples/cloudWrapper.cpp
resource/provisioning/examples/cloudWrapper.h
resource/provisioning/examples/provisioningclient.cpp
resource/provisioning/src/OCCloudProvisioning.cpp
resource/provisioning/src/OCProvisioningManager.cpp
resource/provisioning/unittests/OCCloudProvisioningTest.cpp
resource/provisioning/unittests/OCProvisioningTest.cpp
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator_cpp.cpp

index 67c97529fdb4e66f153b7273d2cd4ea20bc4efbd..6d6e1c5a187cf63e1489a54506f2fb529a365432 100644 (file)
@@ -21,7 +21,7 @@
 */
 #include <jni.h>
 #include "JniOcStack.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 #ifndef _Included_org_iotivity_base_DisplayPinListener
 #define _Included_org_iotivity_base_DisplayPinListener
index 58693c73dfdcf32a4ff86a34813ccbbc38bd0458..52edbe2a715dfbdda412803fe730797f7a86f92c 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 #include "JniOcStack.h"
-#include "OCCloudProvisioning.h"
+#include "OCCloudProvisioning.hpp"
 #include "JniOcCloudResultListener.h"
 #include "JniGetAclIdByDeviceListener.h"
 #include <mutex>
index 290744ec51a13548b1595bdeafe45ff8dad9733b..3b8fa0b44cd0b99c3e10f43ed9d142c4a9a0a313 100644 (file)
@@ -20,7 +20,7 @@
 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 */
 #include "JniOcStack.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 #include "JniSecureUtils.h"
 #include "oxmjustworks.h"
 #include "oxmrandompin.h"
index 213f20db269cda3504d5db8357bf92e33679e7a2..55218e6a8b6a5162d5ace87dcfbfa6ea102c2391 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "JniOcStack.h"
 #include "JniProvisionResultListner.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 #include <mutex>
 
 #ifndef _Included_org_iotivity_base_OcSecureResource
index 74d150d2074b3fbc6afe87dccaee7fb780396dff..988401b30dbc6753e4a60efc9d9f704561fb8209 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 #include "JniOcStack.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 #ifndef _Included_org_iotivity_base_PinCheckListener
 #define _Included_org_iotivity_base_PinCheckListener
index 59a0945e2dc0d3382c5a223d15f984498e15a34e..d3d4ac6169662f1a4076bea2b439d91af37de750 100644 (file)
@@ -21,7 +21,7 @@
 */
 #include <jni.h>
 #include "JniOcStack.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 #ifndef _Included_org_iotivity_base_OcProvisioning_JniProvisionResultListner
 #define _Included_org_iotivity_base_OcProvisioning_JniProvisionResultListner
index c7226a54498803c076b9b8a5153753135fd6dfae..f6d757e43bfc58af26ba8f732b1717b75e50146f 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 #include "JniOcStack.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 class JniSecureUtils
 {
index 964164f3a569b8bc9f2fa7f55de535ab1246ff5e..3a6f5ae805818c7430055c2baedf7f79b72867ef 100644 (file)
@@ -666,7 +666,7 @@ INPUT                  = . \
                          ../../include/OCResourceRequest.h \
                          ../../include/OCResourceResponse.h \
                          ../../include/OCResource.h \
-                         ../../include/OCProvisioningManager.h \
+                         ../../include/OCProvisioningManager.hpp \
                          ../../csdk/stack/include/octypes.h \
                          ../../csdk/stack/include/ocstackconfig.h \
                          guides \
diff --git a/resource/include/OCCloudProvisioning.h b/resource/include/OCCloudProvisioning.h
deleted file mode 100755 (executable)
index 491f68a..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-//****************************************************************\r
-//\r
-// Copyright 2016 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#ifndef OC_CLOUD_PROVISIONING_CXX_H_\r
-#define OC_CLOUD_PROVISIONING_CXX_H_\r
-\r
-#include <thread>\r
-\r
-#include "occloudprovisioning.h"\r
-#include "OCApi.h"\r
-#include "OCPlatform_impl.h"\r
-#include "CAManager.h"\r
-\r
-namespace OC\r
-{\r
-    typedef std::function<void(OCStackResult result, void *data)> ResponseCallBack;\r
-    typedef std::function<void(OCStackResult result, std::string aclId)> AclIdResponseCallBack;\r
-\r
-    /**\r
-     * Context to be passed to the underlying stack. This is passed back as argument\r
-     * to the callback function\r
-     */\r
-    struct CloudProvisionContext\r
-    {\r
-        ResponseCallBack callback;\r
-        CloudProvisionContext(ResponseCallBack cb) : callback(cb){}\r
-    };\r
-\r
-    struct AclIdContext\r
-    {\r
-        AclIdResponseCallBack callback;\r
-        AclIdContext(AclIdResponseCallBack cb) : callback(cb){}\r
-    };\r
-\r
-    class OCCloudProvisioning\r
-    {\r
-\r
-        private:\r
-            OCDevAddr  m_devAddr;\r
-        public:\r
-\r
-            /**\r
-             * API to construct the CloudProvisioning\r
-             * @param ipAddr address of the cloud server\r
-             * @param port port of the cloud server\r
-             */\r
-            OCCloudProvisioning(std::string& ipAddr, uint16_t port);\r
-            ~OCCloudProvisioning();\r
-\r
-            void setIpAddr(std::string& ipAddr)\r
-            {\r
-                memcpy(m_devAddr.addr, ipAddr.c_str(), MAX_ADDR_STR_SIZE);\r
-            }\r
-\r
-            void setPort(uint16_t port)\r
-            {\r
-                m_devAddr.port = port;\r
-            }\r
-\r
-            /**\r
-             * API to Request a certificate from the cloud\r
-             * @param callback function called by the stack on completion of request\r
-             * @return ::OC_STACK_OK on Success and other values otherwise\r
-             */\r
-            OCStackResult requestCertificate(ResponseCallBack callback);\r
-\r
-            /**\r
-             * API to get ACL ID for the device\r
-             * @param deviceId device ID for which the Acl ID is requested\r
-             * @param callback function called by the stack on completion of request\r
-             * @return ::OC_STACK_OK on Success and other values otherwise\r
-             */\r
-            OCStackResult getAclIdByDevice(const std::string& deviceId, AclIdResponseCallBack callback);\r
-\r
-            /**\r
-             * API to get ACL information about the given Acl ID\r
-             * @param aclId ACL ID for which the Acl information is requested\r
-             * @param callback function called by the stack on completion of request\r
-             * @return ::OC_STACK_OK on Success and other values otherwise\r
-             */\r
-            OCStackResult getIndividualAclInfo(const std::string& aclId, ResponseCallBack callback);\r
-\r
-            /**\r
-             * API to get certificate revocation list\r
-             * @param callback function called by the stack on completion of request\r
-             * @return ::OC_STACK_OK on Success and other values otherwise\r
-             */\r
-            OCStackResult getCRL(ResponseCallBack callback);\r
-\r
-            /**\r
-             * API to post the  certificate revocation list to cloud\r
-             * @param thisUpdate thisUpdate [mandatory param]\r
-             * @param nextUpdate nextUpdate [mandatory param]\r
-             * @param crl revocation list [optional]\r
-             * @param serialNumbers [optional]\r
-             * @param callback function called by the stack on completion of request\r
-             * @return ::OC_STACK_OK on Success and other values otherwise\r
-             */\r
-            OCStackResult postCRL(const std::string& thisUpdate,\r
-                    const std::string& nextUpdate,\r
-                    const OCByteString *crl,\r
-                    const stringArray_t *serialNumbers,\r
-                    ResponseCallBack callback);\r
-\r
-            /**\r
-             * Common callback wrapper for all the callback functions.\r
-             * @param ctx user context passed to the request API\r
-             * @param result result of the request performed\r
-             * @param data response data\r
-             */\r
-            static void callbackWrapper(void* ctx, OCStackResult result, void* data);\r
-\r
-            /**\r
-             * Callback wrapper for Acl ID get request\r
-             * @param ctx user context passed to the request API\r
-             * @param result result of the request performed\r
-             * @param data AclID for the device\r
-             */\r
-            static void aclIdResponseWrapper(void* ctx, OCStackResult result, void* data);\r
-    };\r
-}\r
-#endif //OC_CLOUD_PROVISIONING_CXX_H_\r
diff --git a/resource/include/OCCloudProvisioning.hpp b/resource/include/OCCloudProvisioning.hpp
new file mode 100755 (executable)
index 0000000..491f68a
--- /dev/null
@@ -0,0 +1,139 @@
+//****************************************************************\r
+//\r
+// Copyright 2016 Samsung Electronics All Rights Reserved.\r
+//\r
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
+\r
+#ifndef OC_CLOUD_PROVISIONING_CXX_H_\r
+#define OC_CLOUD_PROVISIONING_CXX_H_\r
+\r
+#include <thread>\r
+\r
+#include "occloudprovisioning.h"\r
+#include "OCApi.h"\r
+#include "OCPlatform_impl.h"\r
+#include "CAManager.h"\r
+\r
+namespace OC\r
+{\r
+    typedef std::function<void(OCStackResult result, void *data)> ResponseCallBack;\r
+    typedef std::function<void(OCStackResult result, std::string aclId)> AclIdResponseCallBack;\r
+\r
+    /**\r
+     * Context to be passed to the underlying stack. This is passed back as argument\r
+     * to the callback function\r
+     */\r
+    struct CloudProvisionContext\r
+    {\r
+        ResponseCallBack callback;\r
+        CloudProvisionContext(ResponseCallBack cb) : callback(cb){}\r
+    };\r
+\r
+    struct AclIdContext\r
+    {\r
+        AclIdResponseCallBack callback;\r
+        AclIdContext(AclIdResponseCallBack cb) : callback(cb){}\r
+    };\r
+\r
+    class OCCloudProvisioning\r
+    {\r
+\r
+        private:\r
+            OCDevAddr  m_devAddr;\r
+        public:\r
+\r
+            /**\r
+             * API to construct the CloudProvisioning\r
+             * @param ipAddr address of the cloud server\r
+             * @param port port of the cloud server\r
+             */\r
+            OCCloudProvisioning(std::string& ipAddr, uint16_t port);\r
+            ~OCCloudProvisioning();\r
+\r
+            void setIpAddr(std::string& ipAddr)\r
+            {\r
+                memcpy(m_devAddr.addr, ipAddr.c_str(), MAX_ADDR_STR_SIZE);\r
+            }\r
+\r
+            void setPort(uint16_t port)\r
+            {\r
+                m_devAddr.port = port;\r
+            }\r
+\r
+            /**\r
+             * API to Request a certificate from the cloud\r
+             * @param callback function called by the stack on completion of request\r
+             * @return ::OC_STACK_OK on Success and other values otherwise\r
+             */\r
+            OCStackResult requestCertificate(ResponseCallBack callback);\r
+\r
+            /**\r
+             * API to get ACL ID for the device\r
+             * @param deviceId device ID for which the Acl ID is requested\r
+             * @param callback function called by the stack on completion of request\r
+             * @return ::OC_STACK_OK on Success and other values otherwise\r
+             */\r
+            OCStackResult getAclIdByDevice(const std::string& deviceId, AclIdResponseCallBack callback);\r
+\r
+            /**\r
+             * API to get ACL information about the given Acl ID\r
+             * @param aclId ACL ID for which the Acl information is requested\r
+             * @param callback function called by the stack on completion of request\r
+             * @return ::OC_STACK_OK on Success and other values otherwise\r
+             */\r
+            OCStackResult getIndividualAclInfo(const std::string& aclId, ResponseCallBack callback);\r
+\r
+            /**\r
+             * API to get certificate revocation list\r
+             * @param callback function called by the stack on completion of request\r
+             * @return ::OC_STACK_OK on Success and other values otherwise\r
+             */\r
+            OCStackResult getCRL(ResponseCallBack callback);\r
+\r
+            /**\r
+             * API to post the  certificate revocation list to cloud\r
+             * @param thisUpdate thisUpdate [mandatory param]\r
+             * @param nextUpdate nextUpdate [mandatory param]\r
+             * @param crl revocation list [optional]\r
+             * @param serialNumbers [optional]\r
+             * @param callback function called by the stack on completion of request\r
+             * @return ::OC_STACK_OK on Success and other values otherwise\r
+             */\r
+            OCStackResult postCRL(const std::string& thisUpdate,\r
+                    const std::string& nextUpdate,\r
+                    const OCByteString *crl,\r
+                    const stringArray_t *serialNumbers,\r
+                    ResponseCallBack callback);\r
+\r
+            /**\r
+             * Common callback wrapper for all the callback functions.\r
+             * @param ctx user context passed to the request API\r
+             * @param result result of the request performed\r
+             * @param data response data\r
+             */\r
+            static void callbackWrapper(void* ctx, OCStackResult result, void* data);\r
+\r
+            /**\r
+             * Callback wrapper for Acl ID get request\r
+             * @param ctx user context passed to the request API\r
+             * @param result result of the request performed\r
+             * @param data AclID for the device\r
+             */\r
+            static void aclIdResponseWrapper(void* ctx, OCStackResult result, void* data);\r
+    };\r
+}\r
+#endif //OC_CLOUD_PROVISIONING_CXX_H_\r
diff --git a/resource/include/OCProvisioningManager.h b/resource/include/OCProvisioningManager.h
deleted file mode 100644 (file)
index dd60ced..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-//****************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef OC_PROVISIONINGMANAGER_CXX_H_
-#define OC_PROVISIONINGMANAGER_CXX_H_
-
-#include <thread>
-
-#include "pinoxmcommon.h"
-#include "ocprovisioningmanager.h"
-#include "OCApi.h"
-#include "OCPlatform_impl.h"
-
-namespace OC
-{
-    class OCSecureResource;
-
-    typedef std::vector<std::shared_ptr<OCSecureResource>> DeviceList_t;
-    typedef std::vector<OicUuid_t> UuidList_t;
-    typedef std::vector<OCProvisionResult_t> PMResultList_t;
-    typedef std::function<void(PMResultList_t *result, int hasError)> ResultCallBack;
-    typedef std::function<void(uint16_t credId, uint8_t *trustCertChain,
-            size_t chainSize)>CertChainCallBack;
-
-    struct ProvisionContext
-    {
-        ResultCallBack callback;
-        ProvisionContext(ResultCallBack cb) : callback(cb){}
-    };
-
-    struct TrustCertChainContext
-    {
-        CertChainCallBack callback;
-        TrustCertChainContext(CertChainCallBack cb) : callback(cb){}
-    };
-    /**
-     * This class is for credential's to be set to devices.
-     * The types supported are
-     *              0:  no security mode
-     *              1:  symmetric pair-wise key
-     *              2:  symmetric group key
-     *              4:  asymmetric key
-     *              8:  signed asymmetric key (aka certificate)
-     *              16: PIN /password
-     */
-    class Credential
-    {
-            OicSecCredType_t type;
-            size_t keySize;
-        public:
-            Credential() = default;
-            Credential(OicSecCredType_t type, size_t size) : type(type), keySize(size)
-            {}
-
-            /**
-             * API to get credential type of device.
-             * @return credential type of device.
-             */
-            OicSecCredType_t getCredentialType() const
-            {
-                return type;
-            }
-
-            /**
-             * API to get size of credential key type.
-             * @return size of credential key type.
-             */
-            size_t getCredentialKeySize() const
-            {
-                return keySize;
-            }
-
-            /**
-             * API to set credential type of device.
-             * Device can have following credential types
-             *  - symmetric pair-wise key
-             *  - symmetric group key
-             *  - asymmetric key
-             *  - signed asymmetric key (aka certificate)
-             *  - PIN /password
-             * @param type credential type.
-             */
-            void setCredentialType(OicSecCredType_t type)
-            {
-                this->type = type;
-            }
-
-            /**
-             * API to set size of credential key type.
-             * @param keySize credential key size.
-             * @note can be either 128 or 256 for symmetric pair-wise key
-             */
-            void setCredentialKeySize(size_t keySize)
-            {
-                this->keySize = keySize;
-            }
-    };
-
-    class OCSecure
-    {
-        public:
-            /**
-             * The API is responsible for initialization of the provisioning manager. It will load
-             * provisioning database which have owned device's list and their linked status.
-             *
-             * @param dbPath file path of the sqlite3 database.
-             *
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult provisionInit(const std::string& dbPath);
-
-            /**
-             * API is responsible for discovery of devices in it's subnet. It will list
-             * all the device in subnet which are not yet owned.
-             *
-             * @param timeout Timeout in seconds, time until which function will listen to
-             *                    responses from server before returning the list of devices.
-             * @param list List of candidate devices to be provisioned.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult discoverUnownedDevices(unsigned short timeout,
-                    DeviceList_t &list);
-
-            /**
-             * API is responsible for discovery of devices in it's subnet. It will list
-             * all the device in subnet which are already owned by calling provisioning client.
-             *
-             * @param timeout Timeout in seconds, time until which function will listen to
-             *                    responses from server before returning the list of devices.
-             * @param list List of owned devices.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult discoverOwnedDevices(unsigned short timeout,
-                    DeviceList_t &list);
-
-            /**
-             * API is responsible for discovery of devices in specified endpoint/deviceID.
-             * And this function will only return the specified device's response.
-             *
-             * @param timeout Timeout in seconds, time until which function will listen to
-             *                    responses from server before returning the specified device.
-             * @param deviceID  deviceID of target device
-             * @param foundDevice OCSecureResource object of found device.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.\n
-             *         ::OC_STACK_INVALID_PARAM when deviceID is NULL or ppFoundDevice is not
-             *                                  initailized.
-             */
-            static OCStackResult discoverSingleDevice(unsigned short timeout,
-                    const OicUuid_t* deviceID,
-                    std::shared_ptr<OCSecureResource> &foundDevice);
-
-            /**
-             * API for registering Ownership transfer methods for a particular transfer Type.
-             *
-             * @param oxm Ownership transfer method.
-             * @param callbackData CallbackData Methods for ownership transfer.
-             * @param inputPin Callback method to input pin for verification.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult setOwnerTransferCallbackData(OicSecOxm_t oxm,
-                    OTMCallbackData_t* callbackData, InputPinCallback inputPin);
-
-            /**
-             * API to get status of all the devices in current subnet. The status include endpoint
-             * information and doxm information which can be extracted during owned and unowned
-             * discovery. Along with this information, API will provide information about
-             * devices' status.
-             * Device can have following states
-             *  - ON/OFF: Device is switched on or off.
-             *
-             * @param timeout Wait time for the API.
-             * @param ownedDevList  List of owned devices.
-             * @param unownedDevList  List of unowned devices.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult getDevInfoFromNetwork(unsigned short timeout,
-                    DeviceList_t &ownedDevList,
-                    DeviceList_t &unownedDevList);
-            /**
-             * Server API to register callback to display stack generated PIN.
-             *
-             * @param displayPin Callback Method to Display generated PIN.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult setDisplayPinCB(GeneratePinCallback displayPin);
-
-            /**
-             * API to remove device credential and ACL from all devices in subnet.
-             *
-             * @param resultCallback Callback provided by API user, callback will be called when
-             *            credential revocation is finished.
-             * @param uuid Device uuid to be revoked.
-             * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
-             *            discovery in seconds.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
-                    std::string uuid,
-                    ResultCallBack resultCallback);
-
-            /**
-             * API to save ACL which has several ACE into Acl of SVR.
-             *
-             * @param acl ACL to be saved in Acl of SVR.
-             * @return  OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult saveACL(const OicSecAcl_t* acl);
-
-#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
-            /**
-             * API to save Trust certificate chain into Cred of SVR.
-             *
-             * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.
-             * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR
-             * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR
-             * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.
-             * @return  OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult saveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
-                                        OicEncodingType_t encodingType, uint16_t *credId);
-
-            /*
-            * API to read Trust certificate chain from SVR.
-            * Caller must free when done using the returned trust certificate
-            * @param[in] credId CredId of trust certificate chain in SVR.
-            * @param[out] trustCertChain Trust certificate chain.
-            * @param[out] chainSize Size of trust certificate chain
-            * @return  OC_STACK_OK in case of success and other value otherwise.
-            */
-            static OCStackResult readTrustCertChain(uint16_t credId, uint8_t **trustCertChain,
-                                     size_t *chainSize);
-
-            /**
-             * API to register Notifier for trustCertChain change.
-             *
-             * @param[in] TrustCertChainChangeCB trustCertChain Change will be
-             * notified asynchronously. User need to "delete[]" trustCertChain
-             * in the callback function.
-             * @return  OC_STACK_OK in case of success and other value otherwise.
-             */
-            static OCStackResult registerTrustCertChangeNotifier(CertChainCallBack);
-
-            /**
-             * API to remove Already registered Notifier.
-             *
-             *@return  OC_STACK_OK always, kept it for symmetry.
-             */
-            static OCStackResult removeTrustCertChangeNotifier();
-
-            /**
-             * Notifier wrapper for trustCertChain change.
-             *
-             * @param[in] ctx  User context returned in callback
-             * @param[in] credId  trustCertChain changed for this ID
-             * @param[in] trustCertChain trustcertchain binary blob
-             * @param[in] chainSize size of trustCertChain
-             */
-            static void certCallbackWrapper(void* ctx, uint16_t credId, uint8_t *trustCertChain,
-                                size_t chainSize);
-#endif // __WITH_DTLS__ || __WITH_TLS__
-
-    };
-
-    /**
-     * This class represents a secure virtual device, which can be provisioned by the
-     * provisioning client.
-     */
-    class OCSecureResource
-    {
-        private:
-            std::weak_ptr<std::recursive_mutex> m_csdkLock;
-            OCProvisionDev_t *devPtr;   // pointer to device.
-
-        public:
-            OCSecureResource();
-            OCSecureResource(std::weak_ptr<std::recursive_mutex> csdkLock, OCProvisionDev_t *dPtr);
-
-            ~OCSecureResource();
-
-            /**
-             * API to provision credentials between two devices and ACLs for the devices who
-             * act as a server.
-             *
-             * @param cred  Type of credentials & key size to be provisioned to the device.
-             * @param acl1  ACL for device 1. If this is not required set NULL.
-             * @param device2  Second device to be provisioned.
-             * @param acl2  ACL for device 2. If this is not required set NULL.
-             * @param resultCallback Callback will be called when provisioning request receives
-             *                           a response from first resource server.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult provisionPairwiseDevices(const Credential &cred, const OicSecAcl_t* acl1,
-                    const OCSecureResource &device2, const OicSecAcl_t* acl2,
-                    ResultCallBack resultCallback);
-
-            /**
-             * API to do ownership transfer for un-owned device.
-             *
-             * @param resultCallback Result callback function to be invoked when
-             *                           ownership transfer finished.
-             * @return ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult doOwnershipTransfer(ResultCallBack resultCallback);
-
-            /**
-             * API to send ACL information to resource.
-             *
-             * @param acl ACL to provision.
-             * @param resultCallback Callback will be called when provisioning request
-             *                           receives a response from resource server.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult provisionACL(const OicSecAcl_t* acl,
-                    ResultCallBack resultCallback);
-
-            /**
-             * API to provision credential to devices.
-             *
-             * @param cred Type of credentials to be provisioned to the device.
-             * @param device2 Second device' instance, representing resource to be provisioned.
-             * @param resultCallback Callback will be called when provisioning request receives
-             *                           a response from first resource server.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult provisionCredentials(const Credential &cred,
-                    const OCSecureResource &device2,
-                    ResultCallBack resultCallback);
-
-           /**
-            * API to remove the credential & relationship between the two devices.
-            *
-            * @param device2 Second device information to be unlinked.
-            * @param resultCallback Callback provided by API user, callback will be called when
-            *            device unlink is finished.
-            * @return  ::OC_STACK_OK in case of success and other value otherwise.
-            */
-            OCStackResult unlinkDevices(const OCSecureResource &device2,
-                    ResultCallBack resultCallback);
-
-            /**
-             * API to remove device credential from all devices in subnet.
-             *
-             * @param resultCallback Callback provided by API user, callback will be called when
-             *            credential revocation is finished.
-             * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
-             *            discovery in seconds.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult removeDevice(unsigned short waitTimeForOwnedDeviceDiscovery,
-                    ResultCallBack resultCallback);
-
-            /**
-             * API to provision DirectPairing to devices.
-             *
-             * @param pconf pointer to PCONF (Pairing Configuration).
-             * @param resultCallback Callback will be called when provisioning request receives
-             *                           a response from first resource server.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult provisionDirectPairing(const OicSecPconf_t *pconf,
-                    ResultCallBack resultCallback);
-
-#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
-            /**
-             * API to provision cert.
-             *
-             * @param type type of cred.
-             * @param credId id of cert.
-             * @param resultCallback Callback will be called when provisioning request
-             *                           receives a response from resource server.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult provisionTrustCertChain(OicSecCredType_t type, uint16_t credId,
-                    ResultCallBack resultCallback);
-
-#endif // __WITH_DTLS__ or __WITH_TLS__
-
-            /**
-             * This method is used to get linked devices' IDs.
-             *
-             * @param uuidList Information about the list of linked devices uuids.
-             * @return  ::OC_STACK_OK in case of success and other value otherwise.
-             */
-            OCStackResult getLinkedDevices(UuidList_t &uuidList);
-
-            /**
-             * API to get the device ID of this resource.
-             * @return device ID.
-             */
-            std::string getDeviceID();
-
-            /**
-             * API to get the information of device for provisioning.
-             * @return  @ref OCProvisionDev_t Reference provides information of device for provisioning.
-             */
-            OCProvisionDev_t* getDevPtr()const;
-
-            /**
-             * This function returns the device's IP address.
-             * @return device address.
-             */
-            std::string getDevAddr();
-
-            /**
-             * This function returns the device's Status.
-             * @return Device status (1 = ON and 2 = OFF).
-             */
-            int getDeviceStatus();
-
-            /**
-             * This function provides the owned status of the device.
-             * @return Device owned status.
-             */
-            bool getOwnedStatus();
-
-
-            /**
-             * Common callback wrapper, which will be called from OC-APIs.
-             */
-            static void callbackWrapper(void* ctx, int nOfRes,
-                    OCProvisionResult_t *arr, bool hasError);
-
-        private:
-            void validateSecureResource();
-    };
-
-}
-#endif // OC_PROVISIONINGMANAGER_CXX_H_
diff --git a/resource/include/OCProvisioningManager.hpp b/resource/include/OCProvisioningManager.hpp
new file mode 100644 (file)
index 0000000..dd60ced
--- /dev/null
@@ -0,0 +1,445 @@
+//****************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef OC_PROVISIONINGMANAGER_CXX_H_
+#define OC_PROVISIONINGMANAGER_CXX_H_
+
+#include <thread>
+
+#include "pinoxmcommon.h"
+#include "ocprovisioningmanager.h"
+#include "OCApi.h"
+#include "OCPlatform_impl.h"
+
+namespace OC
+{
+    class OCSecureResource;
+
+    typedef std::vector<std::shared_ptr<OCSecureResource>> DeviceList_t;
+    typedef std::vector<OicUuid_t> UuidList_t;
+    typedef std::vector<OCProvisionResult_t> PMResultList_t;
+    typedef std::function<void(PMResultList_t *result, int hasError)> ResultCallBack;
+    typedef std::function<void(uint16_t credId, uint8_t *trustCertChain,
+            size_t chainSize)>CertChainCallBack;
+
+    struct ProvisionContext
+    {
+        ResultCallBack callback;
+        ProvisionContext(ResultCallBack cb) : callback(cb){}
+    };
+
+    struct TrustCertChainContext
+    {
+        CertChainCallBack callback;
+        TrustCertChainContext(CertChainCallBack cb) : callback(cb){}
+    };
+    /**
+     * This class is for credential's to be set to devices.
+     * The types supported are
+     *              0:  no security mode
+     *              1:  symmetric pair-wise key
+     *              2:  symmetric group key
+     *              4:  asymmetric key
+     *              8:  signed asymmetric key (aka certificate)
+     *              16: PIN /password
+     */
+    class Credential
+    {
+            OicSecCredType_t type;
+            size_t keySize;
+        public:
+            Credential() = default;
+            Credential(OicSecCredType_t type, size_t size) : type(type), keySize(size)
+            {}
+
+            /**
+             * API to get credential type of device.
+             * @return credential type of device.
+             */
+            OicSecCredType_t getCredentialType() const
+            {
+                return type;
+            }
+
+            /**
+             * API to get size of credential key type.
+             * @return size of credential key type.
+             */
+            size_t getCredentialKeySize() const
+            {
+                return keySize;
+            }
+
+            /**
+             * API to set credential type of device.
+             * Device can have following credential types
+             *  - symmetric pair-wise key
+             *  - symmetric group key
+             *  - asymmetric key
+             *  - signed asymmetric key (aka certificate)
+             *  - PIN /password
+             * @param type credential type.
+             */
+            void setCredentialType(OicSecCredType_t type)
+            {
+                this->type = type;
+            }
+
+            /**
+             * API to set size of credential key type.
+             * @param keySize credential key size.
+             * @note can be either 128 or 256 for symmetric pair-wise key
+             */
+            void setCredentialKeySize(size_t keySize)
+            {
+                this->keySize = keySize;
+            }
+    };
+
+    class OCSecure
+    {
+        public:
+            /**
+             * The API is responsible for initialization of the provisioning manager. It will load
+             * provisioning database which have owned device's list and their linked status.
+             *
+             * @param dbPath file path of the sqlite3 database.
+             *
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult provisionInit(const std::string& dbPath);
+
+            /**
+             * API is responsible for discovery of devices in it's subnet. It will list
+             * all the device in subnet which are not yet owned.
+             *
+             * @param timeout Timeout in seconds, time until which function will listen to
+             *                    responses from server before returning the list of devices.
+             * @param list List of candidate devices to be provisioned.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult discoverUnownedDevices(unsigned short timeout,
+                    DeviceList_t &list);
+
+            /**
+             * API is responsible for discovery of devices in it's subnet. It will list
+             * all the device in subnet which are already owned by calling provisioning client.
+             *
+             * @param timeout Timeout in seconds, time until which function will listen to
+             *                    responses from server before returning the list of devices.
+             * @param list List of owned devices.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult discoverOwnedDevices(unsigned short timeout,
+                    DeviceList_t &list);
+
+            /**
+             * API is responsible for discovery of devices in specified endpoint/deviceID.
+             * And this function will only return the specified device's response.
+             *
+             * @param timeout Timeout in seconds, time until which function will listen to
+             *                    responses from server before returning the specified device.
+             * @param deviceID  deviceID of target device
+             * @param foundDevice OCSecureResource object of found device.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.\n
+             *         ::OC_STACK_INVALID_PARAM when deviceID is NULL or ppFoundDevice is not
+             *                                  initailized.
+             */
+            static OCStackResult discoverSingleDevice(unsigned short timeout,
+                    const OicUuid_t* deviceID,
+                    std::shared_ptr<OCSecureResource> &foundDevice);
+
+            /**
+             * API for registering Ownership transfer methods for a particular transfer Type.
+             *
+             * @param oxm Ownership transfer method.
+             * @param callbackData CallbackData Methods for ownership transfer.
+             * @param inputPin Callback method to input pin for verification.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult setOwnerTransferCallbackData(OicSecOxm_t oxm,
+                    OTMCallbackData_t* callbackData, InputPinCallback inputPin);
+
+            /**
+             * API to get status of all the devices in current subnet. The status include endpoint
+             * information and doxm information which can be extracted during owned and unowned
+             * discovery. Along with this information, API will provide information about
+             * devices' status.
+             * Device can have following states
+             *  - ON/OFF: Device is switched on or off.
+             *
+             * @param timeout Wait time for the API.
+             * @param ownedDevList  List of owned devices.
+             * @param unownedDevList  List of unowned devices.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult getDevInfoFromNetwork(unsigned short timeout,
+                    DeviceList_t &ownedDevList,
+                    DeviceList_t &unownedDevList);
+            /**
+             * Server API to register callback to display stack generated PIN.
+             *
+             * @param displayPin Callback Method to Display generated PIN.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult setDisplayPinCB(GeneratePinCallback displayPin);
+
+            /**
+             * API to remove device credential and ACL from all devices in subnet.
+             *
+             * @param resultCallback Callback provided by API user, callback will be called when
+             *            credential revocation is finished.
+             * @param uuid Device uuid to be revoked.
+             * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
+             *            discovery in seconds.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult removeDeviceWithUuid(unsigned short waitTimeForOwnedDeviceDiscovery,
+                    std::string uuid,
+                    ResultCallBack resultCallback);
+
+            /**
+             * API to save ACL which has several ACE into Acl of SVR.
+             *
+             * @param acl ACL to be saved in Acl of SVR.
+             * @return  OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult saveACL(const OicSecAcl_t* acl);
+
+#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+            /**
+             * API to save Trust certificate chain into Cred of SVR.
+             *
+             * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.
+             * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR
+             * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR
+             * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.
+             * @return  OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult saveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
+                                        OicEncodingType_t encodingType, uint16_t *credId);
+
+            /*
+            * API to read Trust certificate chain from SVR.
+            * Caller must free when done using the returned trust certificate
+            * @param[in] credId CredId of trust certificate chain in SVR.
+            * @param[out] trustCertChain Trust certificate chain.
+            * @param[out] chainSize Size of trust certificate chain
+            * @return  OC_STACK_OK in case of success and other value otherwise.
+            */
+            static OCStackResult readTrustCertChain(uint16_t credId, uint8_t **trustCertChain,
+                                     size_t *chainSize);
+
+            /**
+             * API to register Notifier for trustCertChain change.
+             *
+             * @param[in] TrustCertChainChangeCB trustCertChain Change will be
+             * notified asynchronously. User need to "delete[]" trustCertChain
+             * in the callback function.
+             * @return  OC_STACK_OK in case of success and other value otherwise.
+             */
+            static OCStackResult registerTrustCertChangeNotifier(CertChainCallBack);
+
+            /**
+             * API to remove Already registered Notifier.
+             *
+             *@return  OC_STACK_OK always, kept it for symmetry.
+             */
+            static OCStackResult removeTrustCertChangeNotifier();
+
+            /**
+             * Notifier wrapper for trustCertChain change.
+             *
+             * @param[in] ctx  User context returned in callback
+             * @param[in] credId  trustCertChain changed for this ID
+             * @param[in] trustCertChain trustcertchain binary blob
+             * @param[in] chainSize size of trustCertChain
+             */
+            static void certCallbackWrapper(void* ctx, uint16_t credId, uint8_t *trustCertChain,
+                                size_t chainSize);
+#endif // __WITH_DTLS__ || __WITH_TLS__
+
+    };
+
+    /**
+     * This class represents a secure virtual device, which can be provisioned by the
+     * provisioning client.
+     */
+    class OCSecureResource
+    {
+        private:
+            std::weak_ptr<std::recursive_mutex> m_csdkLock;
+            OCProvisionDev_t *devPtr;   // pointer to device.
+
+        public:
+            OCSecureResource();
+            OCSecureResource(std::weak_ptr<std::recursive_mutex> csdkLock, OCProvisionDev_t *dPtr);
+
+            ~OCSecureResource();
+
+            /**
+             * API to provision credentials between two devices and ACLs for the devices who
+             * act as a server.
+             *
+             * @param cred  Type of credentials & key size to be provisioned to the device.
+             * @param acl1  ACL for device 1. If this is not required set NULL.
+             * @param device2  Second device to be provisioned.
+             * @param acl2  ACL for device 2. If this is not required set NULL.
+             * @param resultCallback Callback will be called when provisioning request receives
+             *                           a response from first resource server.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult provisionPairwiseDevices(const Credential &cred, const OicSecAcl_t* acl1,
+                    const OCSecureResource &device2, const OicSecAcl_t* acl2,
+                    ResultCallBack resultCallback);
+
+            /**
+             * API to do ownership transfer for un-owned device.
+             *
+             * @param resultCallback Result callback function to be invoked when
+             *                           ownership transfer finished.
+             * @return ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult doOwnershipTransfer(ResultCallBack resultCallback);
+
+            /**
+             * API to send ACL information to resource.
+             *
+             * @param acl ACL to provision.
+             * @param resultCallback Callback will be called when provisioning request
+             *                           receives a response from resource server.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult provisionACL(const OicSecAcl_t* acl,
+                    ResultCallBack resultCallback);
+
+            /**
+             * API to provision credential to devices.
+             *
+             * @param cred Type of credentials to be provisioned to the device.
+             * @param device2 Second device' instance, representing resource to be provisioned.
+             * @param resultCallback Callback will be called when provisioning request receives
+             *                           a response from first resource server.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult provisionCredentials(const Credential &cred,
+                    const OCSecureResource &device2,
+                    ResultCallBack resultCallback);
+
+           /**
+            * API to remove the credential & relationship between the two devices.
+            *
+            * @param device2 Second device information to be unlinked.
+            * @param resultCallback Callback provided by API user, callback will be called when
+            *            device unlink is finished.
+            * @return  ::OC_STACK_OK in case of success and other value otherwise.
+            */
+            OCStackResult unlinkDevices(const OCSecureResource &device2,
+                    ResultCallBack resultCallback);
+
+            /**
+             * API to remove device credential from all devices in subnet.
+             *
+             * @param resultCallback Callback provided by API user, callback will be called when
+             *            credential revocation is finished.
+             * @param waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device
+             *            discovery in seconds.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult removeDevice(unsigned short waitTimeForOwnedDeviceDiscovery,
+                    ResultCallBack resultCallback);
+
+            /**
+             * API to provision DirectPairing to devices.
+             *
+             * @param pconf pointer to PCONF (Pairing Configuration).
+             * @param resultCallback Callback will be called when provisioning request receives
+             *                           a response from first resource server.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult provisionDirectPairing(const OicSecPconf_t *pconf,
+                    ResultCallBack resultCallback);
+
+#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+            /**
+             * API to provision cert.
+             *
+             * @param type type of cred.
+             * @param credId id of cert.
+             * @param resultCallback Callback will be called when provisioning request
+             *                           receives a response from resource server.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult provisionTrustCertChain(OicSecCredType_t type, uint16_t credId,
+                    ResultCallBack resultCallback);
+
+#endif // __WITH_DTLS__ or __WITH_TLS__
+
+            /**
+             * This method is used to get linked devices' IDs.
+             *
+             * @param uuidList Information about the list of linked devices uuids.
+             * @return  ::OC_STACK_OK in case of success and other value otherwise.
+             */
+            OCStackResult getLinkedDevices(UuidList_t &uuidList);
+
+            /**
+             * API to get the device ID of this resource.
+             * @return device ID.
+             */
+            std::string getDeviceID();
+
+            /**
+             * API to get the information of device for provisioning.
+             * @return  @ref OCProvisionDev_t Reference provides information of device for provisioning.
+             */
+            OCProvisionDev_t* getDevPtr()const;
+
+            /**
+             * This function returns the device's IP address.
+             * @return device address.
+             */
+            std::string getDevAddr();
+
+            /**
+             * This function returns the device's Status.
+             * @return Device status (1 = ON and 2 = OFF).
+             */
+            int getDeviceStatus();
+
+            /**
+             * This function provides the owned status of the device.
+             * @return Device owned status.
+             */
+            bool getOwnedStatus();
+
+
+            /**
+             * Common callback wrapper, which will be called from OC-APIs.
+             */
+            static void callbackWrapper(void* ctx, int nOfRes,
+                    OCProvisionResult_t *arr, bool hasError);
+
+        private:
+            void validateSecureResource();
+    };
+
+}
+#endif // OC_PROVISIONINGMANAGER_CXX_H_
index 4bf0ccad1fcbfbf4c5084dc629df9e05f9c866a4..0d1be84d65a0e14a80f7d03781070d742a796c09 100644 (file)
@@ -33,7 +33,7 @@
 #include "cloudAuth.h"
 #include "cloudWrapper.h"
 #include "OCApi.h"
-#include "OCCloudProvisioning.h"
+#include "OCCloudProvisioning.hpp"
 
 #ifdef __unix__
 #include <unistd.h> //for unlink
index 0ee71100a8f2d8da7eb6f90ecd39dfdf5e5e9f22..aa124dcc1f7ad6eebad1e370a4ea9fbf57272eba 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "logger.h"
 #include "occloudprovisioning.h"
-#include "OCCloudProvisioning.h"
+#include "OCCloudProvisioning.hpp"
 #include "oic_malloc.h"
 #include "oic_string.h"
 #include "utils.h"
index 51e5538c9bec5e2e0cc2ebd52e04106157a34957..9fb74f622c609281d56130f457bb7d6ad44b7dda 100644 (file)
@@ -21,7 +21,7 @@
 #define OC_CLOUD_WRAPPER_H
 
 #include "occloudprovisioning.h"
-#include "OCCloudProvisioning.h"
+#include "OCCloudProvisioning.hpp"
 
 using namespace OC;
 /**
index a5d3fc409d3b033eee4c55993770b8b4269cdaca..9e2f1d8800a3a78ad874bdfda67dfc8764b2899c 100644 (file)
@@ -33,7 +33,7 @@
 #include "oic_string.h"
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 #include "oxmjustworks.h"
 #include "oxmrandompin.h"
 #include "aclresource.h"
index 2e6d4a8f4af30990efe8b8f54225f412af2e05f8..295704d8b5bc2f57d3677292d7fccd96d3a5d15c 100644 (file)
@@ -19,7 +19,7 @@
  * *****************************************************************/
 
 #include "ocstack.h"
-#include "OCCloudProvisioning.h"
+#include "OCCloudProvisioning.hpp"
 
 namespace OC
 {
index 42e3af4111198eb763ef1dcef185bccd4f53de6d..0c82538a7b9de0b5e992e2c58afc5958cee60c1d 100644 (file)
@@ -21,7 +21,7 @@
 #include "ocstack.h"
 #include "srmutility.h"
 #include "base64.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 namespace OC
 {
index 81b0ac254037dbe54e9a209f364bf53505e2558f..d4592775a9705044afdc368dd1cd36d33fe57640 100755 (executable)
@@ -24,8 +24,8 @@
 #include <OCPlatform_impl.h>
 #include <oxmjustworks.h>
 #include <oxmrandompin.h>
-#include <OCProvisioningManager.h>
-#include "OCCloudProvisioning.h"
+#include <OCProvisioningManager.hpp>
+#include <OCCloudProvisioning.hpp>
 #include <gtest/gtest.h>
 
 #define TIMEOUT 5
index 41567f0bde5e4c8ad49e41c88545b76e46af96f3..11e198b6c8ad893867b90dd70ab346c677b01760 100755 (executable)
@@ -25,7 +25,7 @@
 #include <oxmjustworks.h>
 #include <oxmrandompin.h>
 #include <srmutility.h>
-#include <OCProvisioningManager.h>
+#include <OCProvisioningManager.hpp>
 #include <gtest/gtest.h>
 
 #define TIMEOUT 5
index db9fc7b37d13ffba6c8ab514e5f2bb1d3fbee6e4..2e9b3fa176ed609b9dca2fec731b392cb6637782 100755 (executable)
@@ -26,7 +26,7 @@
 #include <condition_variable>
 
 #include "ESRichCommon.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 namespace OIC
 {
index 144685dd09bd88c496addbf9ec6ab84a6ab02a4d..9452a3e810804ae29b6e6a213e325f8ec933d0f2 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "OCProvisioningManager.h"
+#include "OCProvisioningManager.hpp"
 
 #include "EasySetup.h"
 #include "ESRichCommon.h"