b76512ccaa830371dac40cbcbaab201c0168a4af
[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  * API to set a allow status of OxM\r
117  *\r
118  * @param[in] oxm Owership transfer method (ref. OicSecOxm_t)\r
119  * @param[in] allowStatus allow status (true = allow, false = not allow)\r
120  *\r
121  * @return OC_STACK_OK in case of success and other value otherwise.\r
122  */\r
123 OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);\r
124 \r
125 \r
126 #ifdef MULTIPLE_OWNER\r
127 /**\r
128  * API to perfrom multiple ownership transfer for MOT enabled device.\r
129  *\r
130  * @param[in] ctx Application context would be returned in result callback\r
131  * @param[in] targetDevices List of devices to perform ownership transfer.\r
132  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
133  * @return OC_STACK_OK in case of success and other value otherwise.\r
134  */\r
135 OCStackResult OCDoMultipleOwnershipTransfer(void* ctx,\r
136                                       OCProvisionDev_t *targetDevices,\r
137                                       OCProvisionResultCB resultCallback);\r
138 \r
139 /**\r
140  * API to remove sub-owner from resource server\r
141  *\r
142  * @param[in] ctx Application context would be returned in result callback\r
143  * @param[in] targetDeviceInfo Selected target device.\r
144  * @param[in] subOwner sub-owner UUID to be removed\r
145  * @param[in] resultCallback callback provided by API user, callback will be invoked when\r
146  *            DELETE 'subowneruuid' request recieves a response from resource server.\r
147  * @return OC_STACK_OK in case of success and other value otherwise.\r
148  */\r
149 OCStackResult OCRemoveSubOwner(void* ctx,\r
150                                 const OCProvisionDev_t *targetDeviceInfo,\r
151                                 const OicUuid_t* subOwner,\r
152                                 OCProvisionResultCB resultCallback);\r
153 \r
154 /**\r
155  * API to remove all sub-owner from resource server\r
156  *\r
157  * @param[in] ctx Application context would be returned in result callback\r
158  * @param[in] targetDeviceInfo Selected target device.\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 OCRemoveAllSubOwner(void* ctx,\r
164                                 const OCProvisionDev_t *targetDeviceInfo,\r
165                                 OCProvisionResultCB resultCallback);\r
166 \r
167 #endif //MULTIPLE_OWNER\r
168 \r
169 /**\r
170  * API to register for particular OxM.\r
171  *\r
172  * @param[in] Ownership transfer method.\r
173  * @param[in] Implementation of callback functions for owership transfer.\r
174  * @return OC_STACK_OK in case of success and other value otherwise.\r
175  */\r
176 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData);\r
177 \r
178 /**\r
179  * The function is responsible for discovery of owned device is current subnet. It will list\r
180  * all the device in subnet which are owned by calling provisioning client.\r
181  *\r
182  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
183  *                    server before returning the list of devices.\r
184  * @param[out] ppList List of device owned by provisioning tool.\r
185  * @return OTM_SUCCESS in case of success and other value otherwise.\r
186  */\r
187 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
188 \r
189 #ifdef MULTIPLE_OWNER\r
190 /**\r
191  * The function is responsible for discovery of MOT enabled device is current subnet.\r
192  *\r
193  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
194  *                    server before returning the list of devices.\r
195  * @param[out] ppList List of MOT enabled devices.\r
196  * @return OC_STACK_OK in case of success and other value otherwise.\r
197  */\r
198 OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
199 \r
200 /**\r
201  * The function is responsible for discovery of Multiple Owned device is current subnet.\r
202  *\r
203  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
204  *                    server before returning the list of devices.\r
205  * @param[out] ppList List of Multiple Owned devices.\r
206  * @return OC_STACK_OK in case of success and other value otherwise.\r
207  */\r
208 OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
209 #endif //MULTIPLE_OWNER\r
210 \r
211 /**\r
212  * API to provision credentials between two devices and ACLs for the devices who act as a server.\r
213  *\r
214  * @param[in] ctx Application context would be returned in result callback.\r
215  * @param[in] type Type of credentials to be provisioned to the device.\r
216  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
217  * @param[in] acl ACL for device 1. If this is not required set NULL.\r
218  * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
219  * @param[in] acl ACL for device 2. If this is not required set NULL.\r
220  * @param[in] resultCallback callback provided by API user, callback will be called when\r
221  *            provisioning request recieves a response from first resource server.\r
222  * @return OC_STACK_OK in case of success and other value otherwise.\r
223  */\r
224 OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize,\r
225                                          const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,\r
226                                          const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,\r
227                                          OCProvisionResultCB resultCallback);\r
228 \r
229 /**\r
230  * API to send ACL information to device.\r
231  *\r
232  * @param[in] ctx Application context would be returned in result callback.\r
233  * @param[in] selectedDeviceInfo Selected target device.\r
234  * @param[in] acl ACL to provision.\r
235  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
236               request recieves a response from resource server.\r
237  * @return OC_STACK_OK in case of success and other value otherwise.\r
238  */\r
239 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl,\r
240                              OCProvisionResultCB resultCallback);\r
241 \r
242 /**\r
243  * function to save ACL which has several ACE into Acl of SVR.\r
244  *\r
245  * @param acl ACL to be saved in Acl of SVR.\r
246  * @return  OC_STACK_OK in case of success and other value otherwise.\r
247  */\r
248 OCStackResult OCSaveACL(const OicSecAcl_t* acl);\r
249 \r
250 /**\r
251  * this function requests CRED information to resource.\r
252  *\r
253  * @param[in] ctx Application context would be returned in result callback.\r
254  * @param[in] selectedDeviceInfo Selected target device.\r
255  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
256               request recieves a response from resource server.\r
257  * @return  OC_STACK_OK in case of success and other value otherwise.\r
258  */\r
259 OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
260                              OCProvisionResultCB resultCallback);\r
261 \r
262 /**\r
263  * this function requests ACL information to resource.\r
264  *\r
265  * @param[in] ctx Application context would be returned in result callback.\r
266  * @param[in] selectedDeviceInfo Selected target device.\r
267  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
268               request recieves a response from resource server.\r
269  * @return  OC_STACK_OK in case of success and other value otherwise.\r
270  */\r
271 OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
272                              OCProvisionResultCB resultCallback);\r
273 \r
274 /**\r
275  * this function sends Direct-Pairing Configuration to a device.\r
276  *\r
277  * @param[in] ctx Application context would be returned in result callback.\r
278  * @param[in] selectedDeviceInfo Selected target device.\r
279  * @param[in] pconf PCONF pointer.\r
280  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
281               request recieves a response from resource server.\r
282  * @return  OC_STACK_OK in case of success and other value otherwise.\r
283  */\r
284 OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf,\r
285                              OCProvisionResultCB resultCallback);\r
286 \r
287 /**\r
288  * API to provision credential to devices.\r
289  *\r
290  * @param[in] ctx Application context would be returned in result callback.\r
291  * @param[in] type Type of credentials to be provisioned to the device.\r
292  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
293    @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
294  * @param[in] resultCallback callback provided by API user, callback will be called when\r
295  *            provisioning request recieves a response from first resource server.\r
296  * @return OC_STACK_OK in case of success and other value otherwise.\r
297  */\r
298 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,\r
299                                       const OCProvisionDev_t *pDev1,\r
300                                       const OCProvisionDev_t *pDev2,\r
301                                       OCProvisionResultCB resultCallback);\r
302 \r
303 #ifdef MULTIPLE_OWNER\r
304 /**\r
305  * API to provision preconfigured PIN to device(NOT LIST).\r
306  * If device does not support the Preconfigured PIN OxM,\r
307  * OCProvisionPreconfigPin API will update the device's Doxm\r
308  * and then try preconfigured PIN provisioning once again.\r
309  *\r
310  * @param[in] ctx Application context would be returned in result callback.\r
311  * @param[in] targetDeviceInfo Selected target device.\r
312  * @param[in] preconfigPin string of preconfigured PIN.\r
313  * @param[in] preconfigPinLen string length of 'preconfigPin'.\r
314  * @param[in] resultCallback callback provided by API user, callback will be called when\r
315  *            provisioning request recieves a response from first resource server.\r
316  * @return OC_STACK_OK in case of success and other value otherwise.\r
317  */\r
318 OCStackResult OCProvisionPreconfigPin(void *ctx,\r
319                                       OCProvisionDev_t *targetDeviceInfo,\r
320                                       const char *preconfigPin,\r
321                                       size_t preconfigPinLen,\r
322                                       OCProvisionResultCB resultCallback);\r
323 \r
324 /**\r
325  * API to add preconfigured PIN to local SVR DB.\r
326  *\r
327  * @param[in] targetDeviceInfo Selected target device.\r
328  * @param[in] preconfigPin Preconfig PIN which is used while multiple owner authentication\r
329  * @param[in] preconfigPinLen Byte length of preconfigPin\r
330  * @return OC_STACK_OK in case of success and other value otherwise.\r
331  */\r
332 OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,\r
333                                 const char *preconfigPin,\r
334                                 size_t preconfigPinLen);\r
335 \r
336 /**\r
337  * API to update 'doxm.mom' to resource server.\r
338  *\r
339  * @param[in] targetDeviceInfo Selected target device.\r
340  * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom)\r
341  * @param[in] resultCallback callback provided by API user, callback will be called when\r
342  *            POST 'mom' request recieves a response from resource server.\r
343  * @return OC_STACK_OK in case of success and other value otherwise.\r
344  */\r
345 OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
346                             const OicSecMomType_t momType, OCProvisionResultCB resultCallback);\r
347 \r
348 /**\r
349  * API to update 'doxm.oxmsel' to resource server.\r
350  *\r
351  * @param[in] targetDeviceInfo Selected target device.\r
352  * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm)\r
353  * @param[in] resultCallback callback provided by API user, callback will be called when\r
354  *            POST 'oxmsel' request recieves a response from resource server.\r
355  * @return OC_STACK_OK in case of success and other value otherwise.\r
356  */\r
357 OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
358                                  const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);\r
359 #endif //MULTIPLE_OWNER\r
360 \r
361 /**\r
362  * Function to unlink devices.\r
363  * This function will remove the credential & relasionship between the two devices.\r
364  *\r
365  * @param[in] ctx Application context would be returned in result callback\r
366  * @param[in] pTargetDev1 fitst device information to be unlinked.\r
367  * @param[in] pTargetDev2 second device information to be unlinked.\r
368  * @param[in] resultCallback callback provided by API user, callback will be called when\r
369  *            device unlink is finished.\r
370  * @return OC_STACK_OK in case of success and other value otherwise.\r
371  */\r
372 OCStackResult OCUnlinkDevices(void* ctx,\r
373                               const OCProvisionDev_t* pTargetDev1,\r
374                               const OCProvisionDev_t* pTargetDev2,\r
375                               OCProvisionResultCB resultCallback);\r
376 \r
377 /**\r
378  * Function for device revocation\r
379  * This function will remove credential of target device from all devices in subnet.\r
380  *\r
381  * @param[in] ctx Application context would be returned in result callback\r
382  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
383  * @param[in] pTargetDev Device information to be revoked.\r
384  * @param[in] resultCallback callback provided by API user, callback will be called when\r
385  *            credential revocation is finished.\r
386  * @return OC_STACK_OK in case of success and other value otherwise.\r
387  *         if OC_STACK_OK is returned, the caller of this API should wait for callback.\r
388  *         OC_STACK_CONTINUE means operation is success but no need to wait for callback.\r
389  */\r
390 OCStackResult OCRemoveDevice(void* ctx,\r
391                              unsigned short waitTimeForOwnedDeviceDiscovery,\r
392                              const OCProvisionDev_t* pTargetDev,\r
393                              OCProvisionResultCB resultCallback);\r
394 \r
395 /*\r
396 * Function to device revocation\r
397 * This function will remove credential of target device from all devices in subnet.\r
398 *\r
399 * @param[in] ctx Application context would be returned in result callback\r
400 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
401 * @param[in] pTargetDev Device information to be revoked.\r
402 * @param[in] resultCallback callback provided by API user, callback will be called when\r
403 *            credential revocation is finished.\r
404  * @return  OC_STACK_OK in case of success and other value otherwise.\r
405 */\r
406 OCStackResult OCRemoveDeviceWithUuid(void* ctx,\r
407                                      unsigned short waitTimeForOwnedDeviceDiscovery,\r
408                                      const OicUuid_t* pTargetUuid,\r
409                                      OCProvisionResultCB resultCallback);\r
410 \r
411 /*\r
412  * Function to reset the target device.\r
413  * This function will remove credential and ACL of target device from all devices in subnet.\r
414  *\r
415  * @param[in] ctx Application context would be returned in result callback\r
416  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
417  * @param[in] pTargetDev Device information to be revoked.\r
418  * @param[in] resultCallback callback provided by API user, callback will be called when\r
419  *            credential revocation is finished.\r
420  * @return  OC_STACK_OK in case of success and other value otherwise.\r
421  */\r
422 OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery,\r
423                             const OCProvisionDev_t* pTargetDev,\r
424                             OCProvisionResultCB resultCallback);\r
425 \r
426 /**\r
427  * This function resets SVR DB to its factory setting.\r
428  *\r
429  *@return OC_STACK_OK in case of successful reset and other value otherwise.\r
430  */\r
431 OCStackResult OCResetSVRDB(void);\r
432 \r
433 /**\r
434  * This function configures SVR DB as self-ownership.\r
435  *\r
436  *@return OC_STACK_OK in case of successful configue and other value otherwise.\r
437  */\r
438 OCStackResult OCConfigSelfOwnership(void);\r
439 \r
440 /**\r
441  * API to get status of all the devices in current subnet. The status include endpoint information\r
442  * and doxm information which can be extracted duing owned and unowned discovery. Along with this\r
443  * information. The API will provide information about devices' status\r
444  * Device can have following states\r
445  *  - ON/OFF: Device is switched on or off.\r
446  *\r
447  * NOTE: Caller need to call OCDeleteDiscoveredDevices to delete memory allocated by this API for out\r
448  * variables pOwnedDevList and pUnownedDevList.\r
449  *\r
450  * @param[in] waitime Wait time for the API. The wait time will be divided by 2, and half of wait time\r
451  * will be used for unowned discovery and remaining half for owned discovery. So the wait time should be\r
452  * equal to or more than 2.\r
453  * @param[out] pOwnedDevList  list of owned devices.\r
454  * @param[out] pUnownedDevList  list of unowned devices.\r
455  * @return OC_STACK_OK in case of success and other value otherwise.\r
456  */\r
457 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,\r
458                                        OCProvisionDev_t** pOwnedDevList,\r
459                                        OCProvisionDev_t** pUnownedDevList);\r
460 /**\r
461  * This method is used to get linked devices' IDs.\r
462  *\r
463  * @param[in] uuidOfDevice a target device's uuid.\r
464  * @param[out] uuidList information about the list of linked devices' uuids.\r
465  * @param[out] numOfDevices total number of linked devices.\r
466  * @return OC_STACK_OK in case of success and other value otherwise.\r
467  */\r
468 OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice,\r
469                                   OCUuidList_t** uuidList,\r
470                                   size_t* numOfDevices);\r
471 \r
472 /**\r
473  * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.\r
474  *\r
475  * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.\r
476  */\r
477 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList);\r
478 \r
479 /**\r
480  * API to delete memory allocated to OicUuid_t list.\r
481  *\r
482  * @param[in] pList Pointer to OicUuid_t list which should be deleted.\r
483  */\r
484 void OCDeleteUuidList(OCUuidList_t* pList);\r
485 \r
486 /**\r
487  * This function deletes ACL data.\r
488  *\r
489  * @param pAcl Pointer to OicSecAcl_t structure.\r
490  */\r
491 void OCDeleteACLList(OicSecAcl_t* pAcl);\r
492 \r
493 /**\r
494  * This function deletes PDACL data.\r
495  *\r
496  * @param pPdAcl Pointer to OicSecPdAcl_t structure.\r
497  */\r
498 void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl);\r
499 \r
500 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)\r
501 /**\r
502  * function to provision Trust certificate chain to devices.\r
503  *\r
504  * @param[in] ctx Application context would be returned in result callback.\r
505  * @param[in] type Type of credentials to be provisioned to the device.\r
506  * @param[in] credId CredId of trust certificate chain to be provisioned to the device.\r
507  * @param[in] selectedDeviceInfo Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
508  * @param[in] resultCallback callback provided by API user, callback will be called when\r
509  *            provisioning request recieves a response from first resource server.\r
510  * @return  OC_STACK_OK in case of success and other value otherwise.\r
511  */\r
512 OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId,\r
513                                       const OCProvisionDev_t *selectedDeviceInfo,\r
514                                       OCProvisionResultCB resultCallback);\r
515 /**\r
516  * function to save Trust certificate chain into Cred of SVR.\r
517  *\r
518  * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.\r
519  * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR\r
520  * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR\r
521  * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.\r
522  * @return  OC_STACK_OK in case of success and other value otherwise.\r
523  */\r
524 OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,\r
525                                         OicEncodingType_t encodingType, uint16_t *credId);\r
526 /**\r
527  * function to register callback, for getting notification for TrustCertChain change.\r
528  *\r
529  * @param[in] TrustCertChainChangeCB notifier callback function\r
530  * @return OC_STACK_OK in case of success and other value otherwise.\r
531  */\r
532 OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB);\r
533 \r
534 /**\r
535  * function to de-register TrustCertChain notification callback.\r
536  */\r
537 void OCRemoveTrustCertChainNotifier(void);\r
538 \r
539 /*\r
540  * Function to read Trust certificate chain from SVR.\r
541  * Caller must free when done using the returned trust certificate\r
542  * @param[in] credId CredId of trust certificate chain in SVR.\r
543  * @param[out] trustCertChain Trust certificate chain.\r
544  * @param[out] chainSize Size of trust certificate chain\r
545  * @return  OC_STACK_OK in case of success and other value otherwise.\r
546  */\r
547 OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain,\r
548                                      size_t *chainSize);\r
549 \r
550 /**\r
551  * Function to select appropriate security provisioning method.\r
552  *\r
553  * @param[in] supportedMethods   Array of supported methods\r
554  * @param[in] numberOfMethods   number of supported methods\r
555  * @param[out]  selectedMethod         Selected methods\r
556  * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER)\r
557  * @return  OC_STACK_OK on success\r
558  */\r
559 OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods,\r
560         size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType);\r
561 \r
562 /**\r
563  * This function sets the callback to utilize peer certificate information\r
564  */\r
565 OCStackResult OCSetPeerCertCallback(void *ctx, PeerCertCallback peerCertCallback);\r
566 \r
567 #endif // __WITH_DTLS__ || __WITH_TLS__\r
568 \r
569 \r
570 #ifdef __cplusplus\r
571 }\r
572 #endif // __cplusplus\r
573 \r
574 #endif /* OCPROVISIONINGMANAGER_H_ */\r