1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * *****************************************************************/
23 #include "ocprovisioningmanager.h"
24 #include "pmutility.h"
25 #include "ownershiptransfermanager.h"
26 #include "oic_malloc.h"
28 #include "secureresourceprovider.h"
29 #include "provisioningdatabasemanager.h"
30 #include "credresource.h"
32 #include "aclresource.h" //Note: SRM internal header
33 #include "pconfresource.h"
37 typedef struct Linkdata Linkdata_t;
41 const OCProvisionDev_t *pDev1;
42 OicSecAcl_t *pDev1Acl;
43 const OCProvisionDev_t *pDev2;
44 OicSecAcl_t *pDev2Acl;
45 OCProvisionResult_t *resArr;
47 int currentCountResults;
48 OCProvisionResultCB resultCallback;
53 * The function is responsible for initializaton of the provisioning manager. It will load
54 * provisioning database which have owned device's list and their linked status.
55 * TODO: In addition, if there is a device(s) which has not up-to-date credentials, this function will
56 * automatically try to update the deivce(s).
58 * @param[in] dbPath file path of the sqlite3 db
60 * @return OC_STACK_OK in case of success and other value otherwise.
62 OCStackResult OCInitPM(const char* dbPath)
64 return PDMInit(dbPath);
68 * The function is responsible for discovery of device is current subnet. It will list
69 * all the device in subnet which are not yet owned. Please call OCInit with OC_CLIENT_SERVER as
72 * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
73 * server before returning the list of devices.
74 * @param[out] ppList List of candidate devices to be provisioned
75 * @return OTM_SUCCESS in case of success and other value otherwise.
77 OCStackResult OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t **ppList)
79 if( ppList == NULL || *ppList != NULL || 0 == timeout)
81 return OC_STACK_INVALID_PARAM;
84 return PMDeviceDiscovery(timeout, false, ppList);
88 * The function is responsible for discovery of owned device is current subnet. It will list
89 * all the device in subnet which are owned by calling provisioning client.
91 * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
92 * server before returning the list of devices.
93 * @param[out] ppList List of device owned by provisioning tool.
94 * @return OTM_SUCCESS in case of success and other value otherwise.
96 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList)
98 if( ppList == NULL || *ppList != NULL || 0 == timeout)
100 return OC_STACK_INVALID_PARAM;
103 return PMDeviceDiscovery(timeout, true, ppList);
107 * API to register for particular OxM.
109 * @param[in] Ownership transfer method.
110 * @param[in] Implementation of callback functions for owership transfer.
111 * @return OC_STACK_OK in case of success and other value otherwise.
113 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData)
115 if(NULL == callbackData)
117 return OC_STACK_INVALID_CALLBACK ;
120 return OTMSetOwnershipTransferCallbackData(oxm, callbackData);
123 OCStackResult OCDoOwnershipTransfer(void* ctx,
124 OCProvisionDev_t *targetDevices,
125 OCProvisionResultCB resultCallback)
127 if( NULL == targetDevices )
129 return OC_STACK_INVALID_PARAM;
133 OIC_LOG(INFO, TAG, "OCDoOwnershipTransfer : NULL Callback");
134 return OC_STACK_INVALID_CALLBACK;
136 return OTMDoOwnershipTransfer(ctx, targetDevices, resultCallback);
140 * This function deletes memory allocated to linked list created by OCDiscover_XXX_Devices API.
142 * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.
144 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList)
146 PMDeleteDeviceList(pList);
150 * this function sends ACL information to resource.
152 * @param[in] ctx Application context would be returned in result callback.
153 * @param[in] selectedDeviceInfo Selected target device.
154 * @param[in] acl ACL to provision.
155 * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
156 request recieves a response from resource server.
157 * @return OC_STACK_OK in case of success and other value otherwise.
159 OCStackResult OCProvisionACL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl,
160 OCProvisionResultCB resultCallback)
162 return SRPProvisionACL(ctx, selectedDeviceInfo, acl, resultCallback);
166 * function to provision credential to devices.
168 * @param[in] ctx Application context would be returned in result callback.
169 * @param[in] type Type of credentials to be provisioned to the device.
170 * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
171 @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
172 * @param[in] resultCallback callback provided by API user, callback will be called when
173 * provisioning request recieves a response from first resource server.
174 * @return OC_STACK_OK in case of success and other value otherwise.
176 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,
177 const OCProvisionDev_t *pDev1,
178 const OCProvisionDev_t *pDev2,
179 OCProvisionResultCB resultCallback)
181 return SRPProvisionCredentials(ctx, type, keySize,
182 pDev1, pDev2, resultCallback);
187 * this function sends Direct-Pairing Configuration to a device.
189 * @param[in] ctx Application context would be returned in result callback.
190 * @param[in] selectedDeviceInfo Selected target device.
191 * @param[in] pconf PCONF pointer.
192 * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
193 request recieves a response from resource server.
194 * @return OC_STACK_OK in case of success and other value otherwise.
196 OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf,
197 OCProvisionResultCB resultCallback)
199 return SRPProvisionDirectPairing(ctx, selectedDeviceInfo, pconf, resultCallback);
203 * Function to unlink devices.
204 * This function will remove the credential & relationship between the two devices.
206 * @param[in] ctx Application context would be returned in result callback
207 * @param[in] pTargetDev1 first device information to be unlinked.
208 * @param[in] pTargetDev2 second device information to be unlinked.
209 * @param[in] resultCallback callback provided by API user, callback will be called when
210 * device unlink is finished.
211 * @return OC_STACK_OK in case of success and other value otherwise.
213 OCStackResult OCUnlinkDevices(void* ctx,
214 const OCProvisionDev_t* pTargetDev1,
215 const OCProvisionDev_t* pTargetDev2,
216 OCProvisionResultCB resultCallback)
218 OIC_LOG(INFO, TAG, "IN OCUnlinkDevices");
219 OCUuidList_t* idList = NULL;
222 if (!pTargetDev1 || !pTargetDev2 || !pTargetDev1->doxm || !pTargetDev2->doxm)
224 OIC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters");
225 return OC_STACK_INVALID_PARAM;
229 OIC_LOG(INFO, TAG, "OCUnlinkDevices : NULL Callback");
230 return OC_STACK_INVALID_CALLBACK;
232 if (0 == memcmp(&pTargetDev1->doxm->deviceID, &pTargetDev2->doxm->deviceID, sizeof(OicUuid_t)))
234 OIC_LOG(INFO, TAG, "OCUnlinkDevices : Same device ID");
235 return OC_STACK_INVALID_PARAM;
238 // Get linked devices with the first device.
239 OCStackResult res = PDMGetLinkedDevices(&(pTargetDev1->doxm->deviceID), &idList, &numOfDev);
240 if (OC_STACK_OK != res)
242 OIC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed");
247 OIC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices");
248 res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made
252 // Check the linked devices contains the second device. If yes send credential DELETE request.
253 OCUuidList_t* curDev = idList;
254 while (NULL != curDev)
256 if (memcmp(pTargetDev2->doxm->deviceID.id, curDev->dev.id, sizeof(curDev->dev.id)) == 0)
258 res = SRPUnlinkDevices(ctx, pTargetDev1, pTargetDev2, resultCallback);
259 if (OC_STACK_OK != res)
261 OIC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices.");
265 curDev = curDev->next;
267 OIC_LOG(DEBUG, TAG, "No matched pair found from provisioning database");
268 res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made
271 OIC_LOG(INFO, TAG, "OUT OCUnlinkDevices");
273 PDMDestoryOicUuidLinkList(idList);
278 * Function to device revocation
279 * This function will remove credential of target device from all devices in subnet.
281 * @param[in] ctx Application context would be returned in result callback
282 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
283 * @param[in] pTargetDev Device information to be revoked.
284 * @param[in] resultCallback callback provided by API user, callback will be called when
285 * credential revocation is finished.
286 * @return OC_STACK_OK in case of success and other value otherwise.
288 OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery,
289 const OCProvisionDev_t* pTargetDev,
290 OCProvisionResultCB resultCallback)
292 OIC_LOG(INFO, TAG, "IN OCRemoveDevice");
293 OCStackResult res = OC_STACK_ERROR;
294 if (!pTargetDev || 0 == waitTimeForOwnedDeviceDiscovery)
296 OIC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters");
297 return OC_STACK_INVALID_PARAM;
301 OIC_LOG(INFO, TAG, "OCRemoveDevice : NULL Callback");
302 return OC_STACK_INVALID_CALLBACK;
305 // Send DELETE requests to linked devices
306 OCStackResult resReq = OC_STACK_ERROR; // Check that we have to wait callback or not.
307 resReq = SRPRemoveDevice(ctx, waitTimeForOwnedDeviceDiscovery, pTargetDev, resultCallback);
308 if (OC_STACK_OK != resReq)
310 if (OC_STACK_CONTINUE == resReq)
312 OIC_LOG(DEBUG, TAG, "OCRemoveDevice : Revoked device has no linked device except PT.");
316 OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to invoke SRPRemoveDevice");
322 // Remove credential of revoked device from SVR database
323 const OicSecCred_t *cred = NULL;
324 cred = GetCredResourceData(&pTargetDev->doxm->deviceID);
327 OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to get credential of remove device.");
331 res = RemoveCredential(&cred->subject);
332 if (res != OC_STACK_RESOURCE_DELETED)
334 OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to remove credential.");
339 * Change the device status as stale status.
340 * If all request are successed, this device information will be deleted.
342 res = PDMSetDeviceStale(&pTargetDev->doxm->deviceID);
343 if (res != OC_STACK_OK)
345 OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to set device status as stale");
349 // TODO: We need to add new mechanism to clean up the stale state of the device.
353 //Close the DTLS session of the removed device.
354 CAEndpoint_t* endpoint = (CAEndpoint_t *)&pTargetDev->endpoint;
355 endpoint->port = pTargetDev->securePort;
356 CAResult_t caResult = CACloseDtlsSession(endpoint);
357 if(CA_STATUS_OK != caResult)
359 OIC_LOG_V(WARNING, TAG, "OCRemoveDevice : Failed to close DTLS session : %d", caResult);
363 * If there is no linked device, PM does not send any request.
364 * So we should directly invoke the result callback to inform the result of OCRemoveDevice.
366 if(OC_STACK_CONTINUE == res)
370 resultCallback(ctx, 0, NULL, false);
376 OIC_LOG(INFO, TAG, "OUT OCRemoveDevice");
382 * Internal Function to update result in link result array.
384 static void UpdateLinkResults(Linkdata_t *link, int device, OCStackResult stackresult)
387 OIC_LOG_V(INFO,TAG,"value of link->currentCountResults is %d",link->currentCountResults);
390 memcpy(link->resArr[(link->currentCountResults)].deviceId.id, link->pDev1->doxm->deviceID.id,UUID_LENGTH);
394 memcpy(link->resArr[(link->currentCountResults)].deviceId.id, link->pDev2->doxm->deviceID.id,UUID_LENGTH);
396 link->resArr[(link->currentCountResults)].res = stackresult;
397 ++(link->currentCountResults);
402 * Callback to handle ACL provisioning for device 2.
404 static void AclProv2CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError)
409 OIC_LOG(ERROR,TAG,"Context is Null in ACLProv 2");
413 Linkdata_t *link = (Linkdata_t*)ctx;
414 OCProvisionResultCB resultCallback = link->resultCallback;
419 UpdateLinkResults(link, 2,arr[0].res);
420 OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
421 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
424 OICFree(link->resArr);
428 UpdateLinkResults(link, 2, arr[0].res);
429 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
432 OICFree(link->resArr);
438 * Callback to handle ACL provisioning for device 1
440 static void AclProv1CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError)
445 OIC_LOG(ERROR,TAG,"Context is Null in ACLProv1");
449 Linkdata_t *link = (Linkdata_t*)ctx;
450 OCProvisionResultCB resultCallback = link->resultCallback;
454 OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
455 UpdateLinkResults(link, 1, arr[0].res);
456 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
459 OICFree(link->resArr);
463 UpdateLinkResults(link, 1, arr[0].res);
464 if (NULL != link->pDev2Acl)
466 OCStackResult res = SRPProvisionACL(ctx, link->pDev2, link->pDev2Acl, &AclProv2CB);
467 if (OC_STACK_OK!=res)
469 UpdateLinkResults(link, 2, res);
470 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
478 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
481 OICFree(link->resArr);
489 * Callback to handle credential provisioning.
491 static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError)
495 OIC_LOG(ERROR,TAG,"Error occured while credential provisioning");
498 Linkdata_t *link = (Linkdata_t*)ctx;
499 OCProvisionResultCB resultCallback = link->resultCallback;
500 OIC_LOG_V(INFO, TAG, "has error returned %d",hasError);
501 UpdateLinkResults(link, 1, arr[0].res);
502 UpdateLinkResults(link, 2, arr[1].res);
505 OIC_LOG(ERROR,TAG,"Error occured while credential provisioning");
506 ((OCProvisionResultCB)(resultCallback))(link->ctx, nOfRes,
509 OICFree(link->resArr);
513 if (NULL != link->pDev1Acl)
516 OCStackResult res = SRPProvisionACL(ctx, link->pDev1, link->pDev1Acl, &AclProv1CB);
517 if (OC_STACK_OK!=res)
519 OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 1");
520 UpdateLinkResults(link, 1, res);
521 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
524 OICFree(link->resArr);
528 else if (NULL!=link->pDev2Acl)
530 OIC_LOG(ERROR, TAG, "ACL for device 1 is NULL");
531 OCStackResult res = SRPProvisionACL(ctx, link->pDev2, link->pDev2Acl, &AclProv2CB);
532 if (OC_STACK_OK!=res)
534 OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 2");
535 UpdateLinkResults(link, 2, res);
536 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
539 OICFree(link->resArr);
545 OIC_LOG(INFO, TAG, "ACLs of both devices are NULL");
546 ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
549 OICFree(link->resArr);
555 * function to provision credentials between two devices and ACLs for the devices who act as a server.
557 * @param[in] ctx Application context would be returned in result callback.
558 * @param[in] type Type of credentials to be provisioned to the device.
559 * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
560 * @param[in] acl ACL for device 1. If this is not required set NULL.
561 * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
562 * @param[in] acl ACL for device 2. If this is not required set NULL.
563 * @param[in] resultCallback callback provided by API user, callback will be called when
564 * provisioning request recieves a response from first resource server.
565 * @return OC_STACK_OK in case of success and other value otherwise.
567 OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize,
568 const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,
569 const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,
570 OCProvisionResultCB resultCallback)
573 if (!pDev1 || !pDev2 || !pDev1->doxm || !pDev2->doxm)
575 OIC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters");
576 return OC_STACK_INVALID_PARAM;
580 OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : NULL Callback");
581 return OC_STACK_INVALID_CALLBACK;
583 if (!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256))
585 OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size");
586 return OC_STACK_INVALID_PARAM;
588 if (0 == memcmp(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, sizeof(OicUuid_t)))
590 OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Same device ID");
591 return OC_STACK_INVALID_PARAM;
594 OIC_LOG(DEBUG, TAG, "Checking link in DB");
595 bool linkExists = true;
596 OCStackResult res = PDMIsLinkExists(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, &linkExists);
597 if(res != OC_STACK_OK)
599 OIC_LOG(ERROR, TAG, "Internal Error Occured");
604 OIC_LOG(ERROR, TAG, "Link already exists");
605 return OC_STACK_INVALID_PARAM;
608 int noOfResults = 2; // Initial Value
609 if (NULL != pDev1Acl)
613 if (NULL != pDev2Acl)
617 Linkdata_t *link = (Linkdata_t*) OICMalloc(sizeof(Linkdata_t));
620 OIC_LOG(ERROR, TAG, "Failed to memory allocation");
621 return OC_STACK_NO_MEMORY;
623 OIC_LOG_V(INFO,TAG, "Maximum no od results %d",noOfResults);
626 link->pDev1Acl = pDev1Acl;
628 link->pDev2Acl = pDev2Acl;
630 // 1 call for each device for credential provisioning. implict call by SRPProvisioning credential
631 // 1 call for ACL provisioning for device 1 and 1 call for ACL provisioning for device 2.
632 link->numOfResults = noOfResults;
633 link->resultCallback = resultCallback;
634 link->currentCountResults = 0;
635 link->resArr = (OCProvisionResult_t*) OICMalloc(sizeof(OCProvisionResult_t)*noOfResults);
636 res = SRPProvisionCredentials(link, type, keySize,
637 pDev1, pDev2, &ProvisionCredsCB);
638 if (res != OC_STACK_OK)
640 OICFree(link->resArr);
647 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,
648 OCProvisionDev_t** pOwnedDevList,
649 OCProvisionDev_t** pUnownedDevList)
651 //TODO will be replaced by more efficient logic
652 if (pOwnedDevList == NULL || *pOwnedDevList != NULL || pUnownedDevList == NULL
653 || *pUnownedDevList != NULL || 0 == waittime)
655 return OC_STACK_INVALID_PARAM;
658 // Code for unowned discovery
659 OCProvisionDev_t *unownedDevice = NULL;
660 OCStackResult res = OCDiscoverUnownedDevices(waittime/2, &unownedDevice);
661 if (OC_STACK_OK != res)
663 OIC_LOG(ERROR,TAG, "Error in unowned discovery");
667 // Code for owned discovery
668 OCProvisionDev_t *ownedDevice = NULL;
669 res = OCDiscoverOwnedDevices(waittime/2, &ownedDevice);
670 if (OC_STACK_OK != res)
672 OIC_LOG(ERROR,TAG, "Error in owned discovery");
673 PMDeleteDeviceList(unownedDevice);
677 // Code to get list of all the owned devices.
678 OCUuidList_t *uuidList = NULL;
679 size_t numOfDevices = 0;
680 res = PDMGetOwnedDevices(&uuidList, &numOfDevices);
681 if (OC_STACK_OK != res)
683 OIC_LOG(ERROR, TAG, "Error while getting info from DB");
684 PMDeleteDeviceList(unownedDevice);
685 PMDeleteDeviceList(ownedDevice);
689 // Code to compare devices in owned list and deviceid from DB.
690 OCProvisionDev_t* pCurDev = ownedDevice;
691 size_t deleteCnt = 0;
694 if(true == PMDeleteFromUUIDList(uuidList, &pCurDev->doxm->deviceID))
698 pCurDev = pCurDev->next;
700 // If there is no remaind device in uuidList, we have to assign NULL to prevent free.
701 if (deleteCnt == numOfDevices)
705 // Code to add information of the devices which are currently off in owned list.
706 OCUuidList_t *powerOffDeviceList = uuidList;
707 while (powerOffDeviceList)
709 OCProvisionDev_t *ptr = (OCProvisionDev_t *)OICCalloc(1, sizeof (OCProvisionDev_t));
712 OIC_LOG(ERROR,TAG,"Fail to allocate memory");
713 PMDeleteDeviceList(unownedDevice);
714 PMDeleteDeviceList(ownedDevice);
715 OCDeleteUuidList(uuidList);
716 return OC_STACK_NO_MEMORY;
719 ptr->doxm = (OicSecDoxm_t*)OICCalloc(1, sizeof(OicSecDoxm_t));
720 if (NULL == ptr->doxm)
722 OIC_LOG(ERROR,TAG,"Fail to allocate memory");
723 PMDeleteDeviceList(unownedDevice);
724 PMDeleteDeviceList(ownedDevice);
725 OCDeleteUuidList(uuidList);
727 return OC_STACK_NO_MEMORY;
730 memcpy(ptr->doxm->deviceID.id, powerOffDeviceList->dev.id, sizeof(ptr->doxm->deviceID.id));
732 ptr->devStatus = DEV_STATUS_OFF;
733 LL_PREPEND(ownedDevice, ptr);
734 powerOffDeviceList = powerOffDeviceList->next;
737 OCDeleteUuidList(uuidList);
738 *pOwnedDevList = ownedDevice;
739 *pUnownedDevList = unownedDevice;
743 OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, OCUuidList_t** uuidList,
744 size_t* numOfDevices)
746 return PDMGetLinkedDevices(uuidOfDevice, uuidList, numOfDevices);
749 void OCDeleteUuidList(OCUuidList_t* pList)
751 PDMDestoryOicUuidLinkList(pList);
755 * This function deletes ACL data.
757 * @param pAcl Pointer to OicSecAcl_t structure.
759 void OCDeleteACLList(OicSecAcl_t* pAcl)
765 * This function deletes PDACL data.
767 * @param pPdAcl Pointer to OicSecPdAcl_t structure.
769 void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl)
771 FreePdAclList(pPdAcl);
777 * this function sends CRL information to resource.
779 * @param[in] ctx Application context would be returned in result callback.
780 * @param[in] selectedDeviceInfo Selected target device.
781 * @param[in] crl CRL to provision.
782 * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
783 request recieves a response from resource server.
784 * @return OC_STACK_OK in case of success and other value otherwise.
786 OCStackResult OCProvisionCRL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecCrl_t *crl,
787 OCProvisionResultCB resultCallback)
789 return SRPProvisionCRL(ctx, selectedDeviceInfo, crl, resultCallback);
791 #endif // __WITH_X509__