replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / internal / provisioningdatabasemanager.h
index 45588b3..7e41f53 100644 (file)
 extern "C" {
 #endif
 
+typedef enum PdmDeviceState {
+    PDM_DEVICE_ACTIVE = 0,
+    PDM_DEVICE_STALE = 1,
+    PDM_DEVICE_INIT = 2,
+    PDM_DEVICE_UNKNOWN = 99
+}PdmDeviceState_t;
 
 /**
  * This method is used by provisioning manager to open provisioning database.
@@ -39,14 +45,35 @@ extern "C" {
 OCStackResult PDMInit(const char* dbPath);
 
 /**
+ * This method is used by provisioning manager to check device status.
+ *
+ * @param[in] uuid information about the target device's uuid.
+ * @param[out] result device status.
+ *
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult PDMGetDeviceState(const OicUuid_t* uuid, PdmDeviceState_t* result);
+
+/**
+ * This method is used by provisioning manager to update device status.
+ *
+ * @param[in] uuid id of device.
+ * @param[in] state device state. (ref. PdmDeviceState_t)
+ *
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult PDMSetDeviceState(const OicUuid_t* uuid, PdmDeviceState_t state);
+
+/**
  * This method is used by provisioning manager to check duplication of device's Device ID with
  * provisioning database.
  *
  * @param[in] uuidOfDevice information about the target device's uuid.
+ * @param[out] result true in case device UUID already exist otherwise false.
  *
- * @return false when non-duplication and true when duplication or uuidOfDevicea is NULL .
+ * @return OC_STACK_OK in case of success and other value otherwise.
  */
-bool PDMIsDuplicateDevice(const OicUuid_t* uuidOfDevice);
+OCStackResult PDMIsDuplicateDevice(const OicUuid_t* uuidOfDevice, bool* result);
 
 /**
  * This method is used by provisioning manager to add owned device's Device ID.
@@ -87,6 +114,15 @@ OCStackResult PDMUnlinkDevices(const OicUuid_t *uuidOfDevice1, const OicUuid_t *
 OCStackResult PDMDeleteDevice(const OicUuid_t *uuidOfDevice);
 
 /**
+ * This method is used by OTM & PDM to remove device information with device state.
+ *
+ * @param[in] state device state to be removed.
+ *
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult PDMDeleteDeviceWithState(const PdmDeviceState_t state);
+
+/**
  * This method is used by provisioning manager to get owned devices' Device IDs.
  *
  * @param[out] uuidList information about the list of owned devices' uuids.
@@ -152,6 +188,20 @@ void PDMDestoryOicUuidLinkList(OCUuidList_t* ptr);
  */
 void PDMDestoryStaleLinkList(OCPairList_t* ptr);
 
+/**
+ * This method is used by provisioning manager to check does the link exists between
+ * two devices or not.
+ *
+ * @param[in] uuidOfDevice1 UUID of device1.
+ * @param[in] uuidOfDevice2 UUID of device2.
+ * @param[out] result true when link exists otherwise false.
+ *
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult PDMIsLinkExists(const OicUuid_t* uuidOfDevice1, const OicUuid_t* uuidOfDevice2,
+                                bool *result);
+
+
 #ifdef __cplusplus
 }
 #endif