Merge tizen_5.0 codes into tizen_4.0
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / ocprovisioningmanager.h
1 /* *****************************************************************\r
2  *\r
3  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *     http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  * *****************************************************************/\r
20 \r
21 #ifndef OCPROVISIONINGMANAGER_H_\r
22 #define OCPROVISIONINGMANAGER_H_\r
23 \r
24 #include "octypes.h"\r
25 #include "pmtypes.h"\r
26 #include "casecurityinterface.h"\r
27 #include "ownershiptransfermanager.h"\r
28 #ifdef MULTIPLE_OWNER\r
29 #include "securevirtualresourcetypes.h"\r
30 #endif //MULTIPLE_OWNER\r
31 \r
32 #ifdef __cplusplus\r
33 extern "C" {\r
34 #endif // __cplusplus\r
35 \r
36 /**\r
37  * The function is responsible for initializaton of the provisioning manager. It will load\r
38  * provisioning database which have owned device's list and their linked status.\r
39  * TODO: In addition, if there is a device(s) which has not up-to-date credentials, this function will\r
40  * automatically try to update the deivce(s).\r
41  *\r
42  * @param[in] dbPath file path of the sqlite3 db\r
43  *\r
44  * @return OC_STACK_OK in case of success and other value otherwise.\r
45  */\r
46 OCStackResult OCInitPM(const char *dbPath);\r
47 \r
48 /**\r
49  * API to termiante the provisioning manager\r
50  */\r
51 void OCTerminatePM();\r
52 \r
53 /**\r
54  * API to cleanup PDM in case of timeout.\r
55  * It will remove the PDM_DEVICE_INIT state devices from PDM.\r
56  *\r
57  * @return OC_STACK_OK in case of success and other value otherwise.\r
58  */\r
59 OCStackResult OCPDMCleanupForTimeout();\r
60 \r
61 /**\r
62  * The function is responsible for discovery of owned/unowned device is specified endpoint/deviceID.\r
63  * It will return the found device even though timeout is not exceeded.\r
64  *\r
65  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
66  *                    server before returning the device.\r
67  * @param[in] deviceID         deviceID of target device.\r
68  * @param[out] ppFoundDevice     OCProvisionDev_t of found device\r
69  * @return OTM_SUCCESS in case of success and other value otherwise.\r
70  */\r
71 OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t *deviceID,\r
72                                      OCProvisionDev_t **ppFoundDevice);\r
73 \r
74 /**\r
75  * The function is responsible for discovery of owned/unowned device is specified endpoint/MAC\r
76  * address.\r
77  * It will return the found device even though timeout is not exceeded.\r
78  *\r
79  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
80  *                    server before returning the device.\r
81  * @param[in] deviceID         deviceID of target device.\r
82  * @param[in] hostAddress       MAC address of target device.\r
83  * @param[in] connType       ConnectivityType for discovery.\r
84  * @param[out] ppFoundDevice     OCProvisionDev_t of found device.\r
85  * @return OTM_SUCCESS in case of success and other value otherwise.\r
86  */\r
87 OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t *deviceID,\r
88         const char *hostAddress, OCConnectivityType connType,\r
89         OCProvisionDev_t **ppFoundDevice);\r
90 \r
91 /**\r
92  * The function is responsible for discovery of device is current subnet. It will list\r
93  * all the device in subnet which are not yet owned. Please call OCInit with OC_CLIENT_SERVER as\r
94  * OCMode.\r
95  *\r
96  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
97  *                    server before returning the list of devices.\r
98  * @param[out] ppList List of candidate devices to be provisioned\r
99  * @return OTM_SUCCESS in case of success and other value otherwise.\r
100  */\r
101 OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList);\r
102 \r
103 /**\r
104  * Do ownership transfer for un-owned device.\r
105  *\r
106  * @param[in] ctx Application context would be returned in result callback\r
107  * @param[in] targetDevices List of devices to perform ownership transfer.\r
108  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
109  * @return OC_STACK_OK in case of success and other value otherwise.\r
110  */\r
111 OCStackResult OCDoOwnershipTransfer(void *ctx,\r
112                                     OCProvisionDev_t *targetDevices,\r
113                                     OCProvisionResultCB resultCallback);\r
114 \r
115 /**\r
116  * Do ownership transfer for un-owned device.\r
117  *\r
118  * @param[in] ctx Application context would be returned in result callback\r
119  * @param[in] targetDevices List of devices to perform ownership transfer.\r
120  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
121  * @param[in] method OTM\r
122  * @return OC_STACK_OK in case of success and other value otherwise.\r
123  */\r
124 OCStackResult OCDoCustomOwnershipTransfer(void *ctx, \r
125                                     OCProvisionDev_t *selectedDevice,\r
126                                     OCProvisionResultCB resultCallback,\r
127                                     const OicSecOxm_t method);\r
128   \r
129 /**\r
130  * API to set a allow status of OxM\r
131  *\r
132  * @param[in] oxm Owership transfer method (ref. OicSecOxm_t)\r
133  * @param[in] allowStatus allow status (true = allow, false = not allow)\r
134  *\r
135  * @return OC_STACK_OK in case of success and other value otherwise.\r
136  */\r
137 OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);\r
138 \r
139 \r
140 #ifdef MULTIPLE_OWNER\r
141 /**\r
142  * API to perfrom multiple ownership transfer for MOT enabled device.\r
143  *\r
144  * @param[in] ctx Application context would be returned in result callback\r
145  * @param[in] targetDevices List of devices to perform ownership transfer.\r
146  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
147  * @return OC_STACK_OK in case of success and other value otherwise.\r
148  */\r
149 OCStackResult OCDoMultipleOwnershipTransfer(void *ctx,\r
150         OCProvisionDev_t *targetDevices,\r
151         OCProvisionResultCB resultCallback);\r
152 \r
153 /**\r
154  * API to remove sub-owner from resource server\r
155  *\r
156  * @param[in] ctx Application context would be returned in result callback\r
157  * @param[in] targetDeviceInfo Selected target device.\r
158  * @param[in] subOwner sub-owner UUID to be removed\r
159  * @param[in] resultCallback callback provided by API user, callback will be invoked when\r
160  *            DELETE 'subowneruuid' request recieves a response from resource server.\r
161  * @return OC_STACK_OK in case of success and other value otherwise.\r
162  */\r
163 OCStackResult OCRemoveSubOwner(void *ctx,\r
164                                const OCProvisionDev_t *targetDeviceInfo,\r
165                                const OicUuid_t *subOwner,\r
166                                OCProvisionResultCB resultCallback);\r
167 \r
168 /**\r
169  * API to remove all sub-owner from resource server\r
170  *\r
171  * @param[in] ctx Application context would be returned in result callback\r
172  * @param[in] targetDeviceInfo Selected target device.\r
173  * @param[in] resultCallback callback provided by API user, callback will be invoked when\r
174  *            DELETE 'subowneruuid' request recieves a response from resource server.\r
175  * @return OC_STACK_OK in case of success and other value otherwise.\r
176  */\r
177 OCStackResult OCRemoveAllSubOwner(void *ctx,\r
178                                   const OCProvisionDev_t *targetDeviceInfo,\r
179                                   OCProvisionResultCB resultCallback);\r
180 \r
181 #endif //MULTIPLE_OWNER\r
182 \r
183 /**\r
184  * API to register for particular OxM.\r
185  *\r
186  * @param[in] Ownership transfer method.\r
187  * @param[in] Implementation of callback functions for owership transfer.\r
188  * @return OC_STACK_OK in case of success and other value otherwise.\r
189  */\r
190 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t *callbackData);\r
191 \r
192 /**\r
193  * The function is responsible for discovery of owned device is current subnet. It will list\r
194  * all the device in subnet which are owned by calling provisioning client.\r
195  *\r
196  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
197  *                    server before returning the list of devices.\r
198  * @param[out] ppList List of device owned by provisioning tool.\r
199  * @return OTM_SUCCESS in case of success and other value otherwise.\r
200  */\r
201 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
202 \r
203 #ifdef MULTIPLE_OWNER\r
204 /**\r
205  * The function is responsible for discovery of MOT enabled device is current subnet.\r
206  *\r
207  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
208  *                    server before returning the list of devices.\r
209  * @param[out] ppList List of MOT enabled devices.\r
210  * @return OC_STACK_OK in case of success and other value otherwise.\r
211  */\r
212 OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout,\r
213         OCProvisionDev_t **ppList);\r
214 \r
215 /**\r
216  * The function is responsible for discovery of Multiple Owned device is current subnet.\r
217  *\r
218  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
219  *                    server before returning the list of devices.\r
220  * @param[out] ppList List of Multiple Owned devices.\r
221  * @return OC_STACK_OK in case of success and other value otherwise.\r
222  */\r
223 OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
224 #endif //MULTIPLE_OWNER\r
225 \r
226 /**\r
227  * API to provision credentials between two devices and ACLs for the devices who act as a server.\r
228  *\r
229  * @param[in] ctx Application context would be returned in result callback.\r
230  * @param[in] type Type of credentials to be provisioned to the device.\r
231  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
232  * @param[in] acl ACL for device 1. If this is not required set NULL.\r
233  * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
234  * @param[in] acl ACL for device 2. If this is not required set NULL.\r
235  * @param[in] resultCallback callback provided by API user, callback will be called when\r
236  *            provisioning request recieves a response from first resource server.\r
237  * @return OC_STACK_OK in case of success and other value otherwise.\r
238  */\r
239 OCStackResult OCProvisionPairwiseDevices(void *ctx, OicSecCredType_t type, size_t keySize,\r
240         const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,\r
241         const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,\r
242         OCProvisionResultCB resultCallback);\r
243 \r
244 /**\r
245  * API to send ACL information to device.\r
246  *\r
247  * @param[in] ctx Application context would be returned in result callback.\r
248  * @param[in] selectedDeviceInfo Selected target device.\r
249  * @param[in] acl ACL to provision.\r
250  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
251               request recieves a response from resource server.\r
252  * @return OC_STACK_OK in case of success and other value otherwise.\r
253  */\r
254 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
255                              OicSecAcl_t *acl,\r
256                              OCProvisionResultCB resultCallback);\r
257 \r
258 /**\r
259  * function to save ACL which has several ACE into Acl of SVR.\r
260  *\r
261  * @param acl ACL to be saved in Acl of SVR.\r
262  * @return  OC_STACK_OK in case of success and other value otherwise.\r
263  */\r
264 OCStackResult OCSaveACL(const OicSecAcl_t *acl);\r
265 \r
266 /**\r
267  * this function requests CRED information to resource.\r
268  *\r
269  * @param[in] ctx Application context would be returned in result callback.\r
270  * @param[in] selectedDeviceInfo Selected target device.\r
271  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
272               request recieves a response from resource server.\r
273  * @return  OC_STACK_OK in case of success and other value otherwise.\r
274  */\r
275 OCStackResult OCGetCredResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
276                                 OCProvisionResultCB resultCallback);\r
277 \r
278 /**\r
279  * this function requests ACL information to resource.\r
280  *\r
281  * @param[in] ctx Application context would be returned in result callback.\r
282  * @param[in] selectedDeviceInfo Selected target device.\r
283  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
284               request recieves a response from resource server.\r
285  * @return  OC_STACK_OK in case of success and other value otherwise.\r
286  */\r
287 OCStackResult OCGetACLResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
288                                OCProvisionResultCB resultCallback);\r
289 \r
290 /**\r
291  * this function sends Direct-Pairing Configuration to a device.\r
292  *\r
293  * @param[in] ctx Application context would be returned in result callback.\r
294  * @param[in] selectedDeviceInfo Selected target device.\r
295  * @param[in] pconf PCONF pointer.\r
296  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
297               request recieves a response from resource server.\r
298  * @return  OC_STACK_OK in case of success and other value otherwise.\r
299  */\r
300 OCStackResult OCProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
301                                        OicSecPconf_t *pconf,\r
302                                        OCProvisionResultCB resultCallback);\r
303 \r
304 /**\r
305  * API to provision credential to devices.\r
306  *\r
307  * @param[in] ctx Application context would be returned in result callback.\r
308  * @param[in] type Type of credentials to be provisioned to the device.\r
309  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
310    @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
311  * @param[in] resultCallback callback provided by API user, callback will be called when\r
312  *            provisioning request recieves a response from first resource server.\r
313  * @return OC_STACK_OK in case of success and other value otherwise.\r
314  */\r
315 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,\r
316                                      const OCProvisionDev_t *pDev1,\r
317                                      const OCProvisionDev_t *pDev2,\r
318                                      OCProvisionResultCB resultCallback);\r
319 \r
320 #ifdef MULTIPLE_OWNER\r
321 /**\r
322  * API to provision preconfigured PIN to device(NOT LIST).\r
323  * If device does not support the Preconfigured PIN OxM,\r
324  * OCProvisionPreconfigPin API will update the device's Doxm\r
325  * and then try preconfigured PIN provisioning once again.\r
326  *\r
327  * @param[in] ctx Application context would be returned in result callback.\r
328  * @param[in] targetDeviceInfo Selected target device.\r
329  * @param[in] preconfigPin string of preconfigured PIN.\r
330  * @param[in] preconfigPinLen string length of 'preconfigPin'.\r
331  * @param[in] resultCallback callback provided by API user, callback will be called when\r
332  *            provisioning request recieves a response from first resource server.\r
333  * @return OC_STACK_OK in case of success and other value otherwise.\r
334  */\r
335 OCStackResult OCProvisionPreconfigPin(void *ctx,\r
336                                       OCProvisionDev_t *targetDeviceInfo,\r
337                                       const char *preconfigPin,\r
338                                       size_t preconfigPinLen,\r
339                                       OCProvisionResultCB resultCallback);\r
340 \r
341 /**\r
342  * API to add preconfigured PIN to local SVR DB.\r
343  *\r
344  * @param[in] targetDeviceInfo Selected target device.\r
345  * @param[in] preconfigPin Preconfig PIN which is used while multiple owner authentication\r
346  * @param[in] preconfigPinLen Byte length of preconfigPin\r
347  * @return OC_STACK_OK in case of success and other value otherwise.\r
348  */\r
349 OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,\r
350                                 const char *preconfigPin,\r
351                                 size_t preconfigPinLen);\r
352 \r
353 /**\r
354  * API to update 'doxm.mom' to resource server.\r
355  *\r
356  * @param[in] targetDeviceInfo Selected target device.\r
357  * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom)\r
358  * @param[in] resultCallback callback provided by API user, callback will be called when\r
359  *            POST 'mom' request recieves a response from resource server.\r
360  * @return OC_STACK_OK in case of success and other value otherwise.\r
361  */\r
362 OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
363                               const OicSecMomType_t momType, OCProvisionResultCB resultCallback);\r
364 \r
365 /**\r
366  * API to update 'doxm.oxmsel' to resource server.\r
367  *\r
368  * @param[in] targetDeviceInfo Selected target device.\r
369  * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm)\r
370  * @param[in] resultCallback callback provided by API user, callback will be called when\r
371  *            POST 'oxmsel' request recieves a response from resource server.\r
372  * @return OC_STACK_OK in case of success and other value otherwise.\r
373  */\r
374 OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
375                                 const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);\r
376 #endif //MULTIPLE_OWNER\r
377 \r
378 /**\r
379  * Function to unlink devices.\r
380  * This function will remove the credential & relasionship between the two devices.\r
381  *\r
382  * @param[in] ctx Application context would be returned in result callback\r
383  * @param[in] pTargetDev1 fitst device information to be unlinked.\r
384  * @param[in] pTargetDev2 second device information to be unlinked.\r
385  * @param[in] resultCallback callback provided by API user, callback will be called when\r
386  *            device unlink is finished.\r
387  * @return OC_STACK_OK in case of success and other value otherwise.\r
388  */\r
389 OCStackResult OCUnlinkDevices(void *ctx,\r
390                               const OCProvisionDev_t *pTargetDev1,\r
391                               const OCProvisionDev_t *pTargetDev2,\r
392                               OCProvisionResultCB resultCallback);\r
393 \r
394 /**\r
395  * Function for device revocation\r
396  * This function will remove credential of target device from all devices in subnet.\r
397  *\r
398  * @param[in] ctx Application context would be returned in result callback\r
399  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
400  * @param[in] pTargetDev Device information to be revoked.\r
401  * @param[in] resultCallback callback provided by API user, callback will be called when\r
402  *            credential revocation is finished.\r
403  * @return OC_STACK_OK in case of success and other value otherwise.\r
404  *         if OC_STACK_OK is returned, the caller of this API should wait for callback.\r
405  *         OC_STACK_CONTINUE means operation is success but no need to wait for callback.\r
406  */\r
407 OCStackResult OCRemoveDevice(void *ctx,\r
408                              unsigned short waitTimeForOwnedDeviceDiscovery,\r
409                              const OCProvisionDev_t *pTargetDev,\r
410                              OCProvisionResultCB resultCallback);\r
411 \r
412 /*\r
413 * Function to device revocation\r
414 * This function will remove credential of target device from all devices in subnet.\r
415 *\r
416 * @param[in] ctx Application context would be returned in result callback\r
417 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
418 * @param[in] pTargetDev Device information to be revoked.\r
419 * @param[in] resultCallback callback provided by API user, callback will be called when\r
420 *            credential revocation is finished.\r
421  * @return  OC_STACK_OK in case of success and other value otherwise.\r
422 */\r
423 OCStackResult OCRemoveDeviceWithUuid(void *ctx,\r
424                                      unsigned short waitTimeForOwnedDeviceDiscovery,\r
425                                      const OicUuid_t *pTargetUuid,\r
426                                      OCProvisionResultCB resultCallback);\r
427 \r
428 /*\r
429  * Function to reset the target device.\r
430  * This function will remove credential and ACL of target device from all devices in subnet.\r
431  *\r
432  * @param[in] ctx Application context would be returned in result callback\r
433  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
434  * @param[in] pTargetDev Device information to be revoked.\r
435  * @param[in] resultCallback callback provided by API user, callback will be called when\r
436  *            credential revocation is finished.\r
437  * @return  OC_STACK_OK in case of success and other value otherwise.\r
438  */\r
439 OCStackResult OCResetDevice(void *ctx, unsigned short waitTimeForOwnedDeviceDiscovery,\r
440                             const OCProvisionDev_t *pTargetDev,\r
441                             OCProvisionResultCB resultCallback,\r
442                             OCClientContextDeleter deleteCallback);\r
443 \r
444 /**\r
445  * This function resets SVR DB to its factory setting.\r
446  *\r
447  *@return OC_STACK_OK in case of successful reset and other value otherwise.\r
448  */\r
449 OCStackResult OCResetSVRDB(void);\r
450 \r
451 /**\r
452  * This function configures SVR DB as self-ownership.\r
453  *\r
454  *@return OC_STACK_OK in case of successful configue and other value otherwise.\r
455  */\r
456 OCStackResult OCConfigSelfOwnership(void);\r
457 \r
458 /**\r
459  * API to get status of all the devices in current subnet. The status include endpoint information\r
460  * and doxm information which can be extracted duing owned and unowned discovery. Along with this\r
461  * information. The API will provide information about devices' status\r
462  * Device can have following states\r
463  *  - ON/OFF: Device is switched on or off.\r
464  *\r
465  * NOTE: Caller need to call OCDeleteDiscoveredDevices to delete memory allocated by this API for out\r
466  * variables pOwnedDevList and pUnownedDevList.\r
467  *\r
468  * @param[in] waitime Wait time for the API. The wait time will be divided by 2, and half of wait time\r
469  * will be used for unowned discovery and remaining half for owned discovery. So the wait time should be\r
470  * equal to or more than 2.\r
471  * @param[out] pOwnedDevList  list of owned devices.\r
472  * @param[out] pUnownedDevList  list of unowned devices.\r
473  * @return OC_STACK_OK in case of success and other value otherwise.\r
474  */\r
475 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,\r
476                                       OCProvisionDev_t **pOwnedDevList,\r
477                                       OCProvisionDev_t **pUnownedDevList);\r
478 /**\r
479  * This method is used to get linked devices' IDs.\r
480  *\r
481  * @param[in] uuidOfDevice a target device's uuid.\r
482  * @param[out] uuidList information about the list of linked devices' uuids.\r
483  * @param[out] numOfDevices total number of linked devices.\r
484  * @return OC_STACK_OK in case of success and other value otherwise.\r
485  */\r
486 OCStackResult OCGetLinkedStatus(const OicUuid_t *uuidOfDevice,\r
487                                 OCUuidList_t **uuidList,\r
488                                 size_t *numOfDevices);\r
489 \r
490 /**\r
491  * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.\r
492  *\r
493  * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.\r
494  */\r
495 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList);\r
496 \r
497 /**\r
498  * API to delete memory allocated to OicUuid_t list.\r
499  *\r
500  * @param[in] pList Pointer to OicUuid_t list which should be deleted.\r
501  */\r
502 void OCDeleteUuidList(OCUuidList_t *pList);\r
503 \r
504 /**\r
505  * This function deletes ACL data.\r
506  *\r
507  * @param pAcl Pointer to OicSecAcl_t structure.\r
508  */\r
509 void OCDeleteACLList(OicSecAcl_t *pAcl);\r
510 \r
511 /**\r
512  * This function deletes PDACL data.\r
513  *\r
514  * @param pPdAcl Pointer to OicSecPdAcl_t structure.\r
515  */\r
516 void OCDeletePdAclList(OicSecPdAcl_t *pPdAcl);\r
517 \r
518 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)\r
519 /**\r
520  * function to provision Trust certificate chain to devices.\r
521  *\r
522  * @param[in] ctx Application context would be returned in result callback.\r
523  * @param[in] type Type of credentials to be provisioned to the device.\r
524  * @param[in] credId CredId of trust certificate chain to be provisioned to the device.\r
525  * @param[in] selectedDeviceInfo Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
526  * @param[in] resultCallback callback provided by API user, callback will be called when\r
527  *            provisioning request recieves a response from first resource server.\r
528  * @return  OC_STACK_OK in case of success and other value otherwise.\r
529  */\r
530 OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId,\r
531                                         const OCProvisionDev_t *selectedDeviceInfo,\r
532                                         OCProvisionResultCB resultCallback);\r
533 /**\r
534  * function to save Trust certificate chain into Cred of SVR.\r
535  *\r
536  * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.\r
537  * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR\r
538  * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR\r
539  * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.\r
540  * @return  OC_STACK_OK in case of success and other value otherwise.\r
541  */\r
542 OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,\r
543                                    OicEncodingType_t encodingType, uint16_t *credId);\r
544 /**\r
545  * function to register callback, for getting notification for TrustCertChain change.\r
546  *\r
547  * @param[in] TrustCertChainChangeCB notifier callback function\r
548  * @return OC_STACK_OK in case of success and other value otherwise.\r
549  */\r
550 OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB);\r
551 \r
552 /**\r
553  * function to de-register TrustCertChain notification callback.\r
554  */\r
555 void OCRemoveTrustCertChainNotifier(void);\r
556 \r
557 /*\r
558  * Function to read Trust certificate chain from SVR.\r
559  * Caller must free when done using the returned trust certificate\r
560  * @param[in] credId CredId of trust certificate chain in SVR.\r
561  * @param[out] trustCertChain Trust certificate chain.\r
562  * @param[out] chainSize Size of trust certificate chain\r
563  * @return  OC_STACK_OK in case of success and other value otherwise.\r
564  */\r
565 OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain,\r
566                                    size_t *chainSize);\r
567 \r
568 /**\r
569  * Function to select appropriate security provisioning method.\r
570  *\r
571  * @param[in] supportedMethods   Array of supported methods\r
572  * @param[in] numberOfMethods   number of supported methods\r
573  * @param[out]  selectedMethod         Selected methods\r
574  * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER)\r
575  * @return  OC_STACK_OK on success\r
576  */\r
577 OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods,\r
578         size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType);\r
579 \r
580 /**\r
581  * This function sets the callback to utilize peer certificate information\r
582  */\r
583 OCStackResult OCSetPeerCertCallback(void *ctx, PeerCertCallback peerCertCallback);\r
584 \r
585 /*\r
586  * Set selecting OTM callback.\r
587  */\r
588 void SetSelectOTMCB(OTMSelectMethodCallback selectOTMcb);\r
589 \r
590 /*\r
591  * Unset selecting OTM callback.\r
592  */\r
593 void UnsetSelectOTMCB();\r
594 \r
595 #endif // __WITH_DTLS__ || __WITH_TLS__\r
596 \r
597 \r
598 #ifdef __cplusplus\r
599 }\r
600 #endif // __cplusplus\r
601 \r
602 #endif /* OCPROVISIONINGMANAGER_H_ */\r