e22eb775c587cf0894993eb00de3239e8d0bf7bb
[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 "ownershiptransfermanager.h"\r
27 #ifdef MULTIPLE_OWNER\r
28 #include "securevirtualresourcetypes.h"\r
29 #endif //MULTIPLE_OWNER\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C" {\r
33 #endif // __cplusplus\r
34 \r
35 /**\r
36  * The function is responsible for initializaton of the provisioning manager. It will load\r
37  * provisioning database which have owned device's list and their linked status.\r
38  * TODO: In addition, if there is a device(s) which has not up-to-date credentials, this function will\r
39  * automatically try to update the deivce(s).\r
40  *\r
41  * @param[in] dbPath file path of the sqlite3 db\r
42  *\r
43  * @return OC_STACK_OK in case of success and other value otherwise.\r
44  */\r
45 OCStackResult OCInitPM(const char* dbPath);\r
46 \r
47 /**\r
48  * The function is responsible for discovery of owned/unowned device is specified endpoint/deviceID.\r
49  * It will return the found device even though timeout is not exceeded.\r
50  *\r
51  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
52  *                    server before returning the device.\r
53  * @param[in] deviceID         deviceID of target device.\r
54  * @param[out] ppFoundDevice     OCProvisionDev_t of found device\r
55  * @return OTM_SUCCESS in case of success and other value otherwise.\r
56  */\r
57 OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID,\r
58                              OCProvisionDev_t **ppFoundDevice);\r
59
60 /**
61  * The function is responsible for discovery of owned/unowned device is specified endpoint/MAC
62  * address.
63  * It will return the found device even though timeout is not exceeded.
64  *
65  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
66  *                    server before returning the device.
67  * @param[in] deviceID         deviceID of target device.
68  * @param[in] hostAddress       MAC address of target device.
69  * @param[in] connType       ConnectivityType for discovery.
70  * @param[out] ppFoundDevice     OCProvisionDev_t of found device.
71  * @return OTM_SUCCESS in case of success and other value otherwise.
72  */
73 OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID,
74                              const char* hostAddress, OCConnectivityType connType,
75                              OCProvisionDev_t **ppFoundDevice);
76 \r
77 /**\r
78  * The function is responsible for discovery of device is current subnet. It will list\r
79  * all the device in subnet which are not yet owned. Please call OCInit with OC_CLIENT_SERVER as\r
80  * OCMode.\r
81  *\r
82  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
83  *                    server before returning the list of devices.\r
84  * @param[out] ppList List of candidate devices to be provisioned\r
85  * @return OTM_SUCCESS in case of success and other value otherwise.\r
86  */\r
87 OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList);\r
88 \r
89 /**\r
90  * Do ownership transfer for un-owned device.\r
91  *\r
92  * @param[in] ctx Application context would be returned in result callback\r
93  * @param[in] targetDevices List of devices to perform ownership transfer.\r
94  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
95  * @return OC_STACK_OK in case of success and other value otherwise.\r
96  */\r
97 OCStackResult OCDoOwnershipTransfer(void* ctx,\r
98                                     OCProvisionDev_t *targetDevices,\r
99                                     OCProvisionResultCB resultCallback);\r
100 \r
101 /**\r
102  * API to set a allow status of OxM\r
103  *\r
104  * @param[in] oxm Owership transfer method (ref. OicSecOxm_t)\r
105  * @param[in] allowStatus allow status (true = allow, false = not allow)\r
106  *\r
107  * @return OC_STACK_OK in case of success and other value otherwise.\r
108  */\r
109 OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);\r
110 \r
111 #ifdef MULTIPLE_OWNER\r
112 /**\r
113  * API to perfrom multiple ownership transfer for MOT enabled device.\r
114  *\r
115  * @param[in] ctx Application context would be returned in result callback\r
116  * @param[in] targetDevices List of devices to perform ownership transfer.\r
117  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.\r
118  * @return OC_STACK_OK in case of success and other value otherwise.\r
119  */\r
120 OCStackResult OCDoMultipleOwnershipTransfer(void* ctx,\r
121                                       OCProvisionDev_t *targetDevices,\r
122                                       OCProvisionResultCB resultCallback);\r
123 #endif //MULTIPLE_OWNER\r
124 \r
125 /**\r
126  * API to register for particular OxM.\r
127  *\r
128  * @param[in] Ownership transfer method.\r
129  * @param[in] Implementation of callback functions for owership transfer.\r
130  * @return OC_STACK_OK in case of success and other value otherwise.\r
131  */\r
132 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData);\r
133 \r
134 /**\r
135  * The function is responsible for discovery of owned device is current subnet. It will list\r
136  * all the device in subnet which are owned by calling provisioning client.\r
137  *\r
138  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
139  *                    server before returning the list of devices.\r
140  * @param[out] ppList List of device owned by provisioning tool.\r
141  * @return OTM_SUCCESS in case of success and other value otherwise.\r
142  */\r
143 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
144 \r
145 #ifdef MULTIPLE_OWNER\r
146 /**\r
147  * The function is responsible for discovery of MOT enabled device is current subnet.\r
148  *\r
149  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
150  *                    server before returning the list of devices.\r
151  * @param[out] ppList List of MOT enabled devices.\r
152  * @return OC_STACK_OK in case of success and other value otherwise.\r
153  */\r
154 OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
155 \r
156 /**\r
157  * The function is responsible for discovery of Multiple Owned device is current subnet.\r
158  *\r
159  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from\r
160  *                    server before returning the list of devices.\r
161  * @param[out] ppList List of Multiple Owned devices.\r
162  * @return OC_STACK_OK in case of success and other value otherwise.\r
163  */\r
164 OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);\r
165 #endif //MULTIPLE_OWNER\r
166 \r
167 /**\r
168  * API to provision credentials between two devices and ACLs for the devices who act as a server.\r
169  *\r
170  * @param[in] ctx Application context would be returned in result callback.\r
171  * @param[in] type Type of credentials to be provisioned to the device.\r
172  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
173  * @param[in] acl ACL for device 1. If this is not required set NULL.\r
174  * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.\r
175  * @param[in] acl ACL for device 2. If this is not required set NULL.\r
176  * @param[in] resultCallback callback provided by API user, callback will be called when\r
177  *            provisioning request recieves a response from first resource server.\r
178  * @return OC_STACK_OK in case of success and other value otherwise.\r
179  */\r
180 OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize,\r
181                                          const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,\r
182                                          const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,\r
183                                          OCProvisionResultCB resultCallback);\r
184 \r
185 /**\r
186  * API to send ACL information to device.\r
187  *\r
188  * @param[in] ctx Application context would be returned in result callback.\r
189  * @param[in] selectedDeviceInfo Selected target device.\r
190  * @param[in] acl ACL to provision.\r
191  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
192               request recieves a response from resource server.\r
193  * @return OC_STACK_OK in case of success and other value otherwise.\r
194  */\r
195 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl,\r
196                              OCProvisionResultCB resultCallback);\r
197 \r
198 /**\r
199  * function to save ACL which has several ACE into Acl of SVR.\r
200  *\r
201  * @param acl ACL to be saved in Acl of SVR.\r
202  * @return  OC_STACK_OK in case of success and other value otherwise.\r
203  */\r
204 OCStackResult OCSaveACL(const OicSecAcl_t* acl);\r
205 \r
206 /**\r
207  * this function requests CRED information to resource.\r
208  *\r
209  * @param[in] ctx Application context would be returned in result callback.\r
210  * @param[in] selectedDeviceInfo Selected target device.\r
211  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
212               request recieves a response from resource server.\r
213  * @return  OC_STACK_OK in case of success and other value otherwise.\r
214  */\r
215 OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
216                              OCProvisionResultCB resultCallback);\r
217 \r
218 /**\r
219  * this function requests ACL information to resource.\r
220  *\r
221  * @param[in] ctx Application context would be returned in result callback.\r
222  * @param[in] selectedDeviceInfo Selected target device.\r
223  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
224               request recieves a response from resource server.\r
225  * @return  OC_STACK_OK in case of success and other value otherwise.\r
226  */\r
227 OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,\r
228                              OCProvisionResultCB resultCallback);\r
229 \r
230 /**\r
231  * this function sends Direct-Pairing Configuration to a device.\r
232  *\r
233  * @param[in] ctx Application context would be returned in result callback.\r
234  * @param[in] selectedDeviceInfo Selected target device.\r
235  * @param[in] pconf PCONF pointer.\r
236  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
237               request recieves a response from resource server.\r
238  * @return  OC_STACK_OK in case of success and other value otherwise.\r
239  */\r
240 OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf,\r
241                              OCProvisionResultCB resultCallback);\r
242 \r
243 /**\r
244  * API to provision credential to devices.\r
245  *\r
246  * @param[in] ctx Application context would be returned in result callback.\r
247  * @param[in] type Type of credentials to be provisioned to the device.\r
248  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
249    @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
250  * @param[in] resultCallback callback provided by API user, callback will be called when\r
251  *            provisioning request recieves a response from first resource server.\r
252  * @return OC_STACK_OK in case of success and other value otherwise.\r
253  */\r
254 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,\r
255                                       const OCProvisionDev_t *pDev1,\r
256                                       const OCProvisionDev_t *pDev2,\r
257                                       OCProvisionResultCB resultCallback);\r
258 \r
259 #ifdef MULTIPLE_OWNER\r
260 /**\r
261  * API to provision preconfigured PIN to device(NOT LIST).\r
262  * If device does not support the Preconfigured PIN OxM,\r
263  * OCProvisionPreconfigPin API will update the device's Doxm\r
264  * and then try preconfigured PIN provisioning once again.\r
265  *\r
266  * @param[in] ctx Application context would be returned in result callback.\r
267  * @param[in] targetDeviceInfo Selected target device.\r
268  * @param[in] preconfigPin string of preconfigured PIN.\r
269  * @param[in] preconfigPinLen string length of 'preconfigPin'.\r
270  * @param[in] resultCallback callback provided by API user, callback will be called when\r
271  *            provisioning request recieves a response from first resource server.\r
272  * @return OC_STACK_OK in case of success and other value otherwise.\r
273  */\r
274 OCStackResult OCProvisionPreconfigPin(void *ctx,\r
275                                       OCProvisionDev_t *targetDeviceInfo,\r
276                                       const char *preconfigPin,\r
277                                       size_t preconfigPinLen,\r
278                                       OCProvisionResultCB resultCallback);\r
279 \r
280 /**\r
281  * API to add preconfigured PIN to local SVR DB.\r
282  *\r
283  * @param[in] targetDeviceInfo Selected target device.\r
284  * @param[in] preconfigPin Preconfig PIN which is used while multiple owner authentication\r
285  * @param[in] preconfigPinLen Byte length of preconfigPin\r
286  * @return OC_STACK_OK in case of success and other value otherwise.\r
287  */\r
288 OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,\r
289                                 const char *preconfigPin, \r
290                                 size_t preconfigPinLen);\r
291 \r
292 /**\r
293  * API to update 'doxm.mom' to resource server.\r
294  *\r
295  * @param[in] targetDeviceInfo Selected target device.\r
296  * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom)\r
297  * @param[in] resultCallback callback provided by API user, callback will be called when\r
298  *            POST 'mom' request recieves a response from resource server.\r
299  * @return OC_STACK_OK in case of success and other value otherwise.\r
300  */\r
301 OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
302                             const OicSecMomType_t momType, OCProvisionResultCB resultCallback);\r
303 \r
304 /**\r
305  * API to update 'doxm.oxmsel' to resource server.\r
306  *\r
307  * @param[in] targetDeviceInfo Selected target device.\r
308  * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm)\r
309  * @param[in] resultCallback callback provided by API user, callback will be called when\r
310  *            POST 'oxmsel' request recieves a response from resource server.\r
311  * @return OC_STACK_OK in case of success and other value otherwise.\r
312  */\r
313 OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,\r
314                                  const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);\r
315 #endif //MULTIPLE_OWNER\r
316 \r
317 /**\r
318  * Function to unlink devices.\r
319  * This function will remove the credential & relasionship between the two devices.\r
320  *\r
321  * @param[in] ctx Application context would be returned in result callback\r
322  * @param[in] pTargetDev1 fitst device information to be unlinked.\r
323  * @param[in] pTargetDev2 second device information to be unlinked.\r
324  * @param[in] resultCallback callback provided by API user, callback will be called when\r
325  *            device unlink is finished.\r
326  * @return OC_STACK_OK in case of success and other value otherwise.\r
327  */\r
328 OCStackResult OCUnlinkDevices(void* ctx,\r
329                               const OCProvisionDev_t* pTargetDev1,\r
330                               const OCProvisionDev_t* pTargetDev2,\r
331                               OCProvisionResultCB resultCallback);\r
332 \r
333 /**\r
334  * Function for device revocation\r
335  * This function will remove credential of target device from all devices in subnet.\r
336  *\r
337  * @param[in] ctx Application context would be returned in result callback\r
338  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
339  * @param[in] pTargetDev Device information to be revoked.\r
340  * @param[in] resultCallback callback provided by API user, callback will be called when\r
341  *            credential revocation is finished.\r
342  * @return OC_STACK_OK in case of success and other value otherwise.\r
343  *         if OC_STACK_OK is returned, the caller of this API should wait for callback.\r
344  *         OC_STACK_CONTINUE means operation is success but no need to wait for callback.\r
345  */\r
346 OCStackResult OCRemoveDevice(void* ctx,\r
347                              unsigned short waitTimeForOwnedDeviceDiscovery,\r
348                              const OCProvisionDev_t* pTargetDev,\r
349                              OCProvisionResultCB resultCallback);\r
350 \r
351 /*\r
352 * Function to device revocation\r
353 * This function will remove credential of target device from all devices in subnet.\r
354 *\r
355 * @param[in] ctx Application context would be returned in result callback\r
356 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
357 * @param[in] pTargetDev Device information to be revoked.\r
358 * @param[in] resultCallback callback provided by API user, callback will be called when\r
359 *            credential revocation is finished.\r
360  * @return  OC_STACK_OK in case of success and other value otherwise.\r
361 */\r
362 OCStackResult OCRemoveDeviceWithUuid(void* ctx,\r
363                                      unsigned short waitTimeForOwnedDeviceDiscovery,\r
364                                      const OicUuid_t* pTargetUuid,\r
365                                      OCProvisionResultCB resultCallback);\r
366 \r
367 /*\r
368  * Function to reset the target device.\r
369  * This function will remove credential and ACL of target device from all devices in subnet.\r
370  *\r
371  * @param[in] ctx Application context would be returned in result callback\r
372  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)\r
373  * @param[in] pTargetDev Device information to be revoked.\r
374  * @param[in] resultCallback callback provided by API user, callback will be called when\r
375  *            credential revocation is finished.\r
376  * @return  OC_STACK_OK in case of success and other value otherwise.\r
377  */\r
378 OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery,\r
379                             const OCProvisionDev_t* pTargetDev,\r
380                             OCProvisionResultCB resultCallback);\r
381 \r
382 /**\r
383  * This function resets SVR DB to its factory setting.\r
384  *\r
385  *@return OC_STACK_OK in case of successful reset and other value otherwise.\r
386  */\r
387 OCStackResult OCResetSVRDB(void);\r
388 \r
389 /**\r
390  * API to get status of all the devices in current subnet. The status include endpoint information\r
391  * and doxm information which can be extracted duing owned and unowned discovery. Along with this\r
392  * information. The API will provide information about devices' status\r
393  * Device can have following states\r
394  *  - ON/OFF: Device is switched on or off.\r
395  *\r
396  * NOTE: Caller need to call OCDeleteDiscoveredDevices to delete memory allocated by this API for out\r
397  * variables pOwnedDevList and pUnownedDevList.\r
398  *\r
399  * @param[in] waitime Wait time for the API. The wait time will be divided by 2, and half of wait time\r
400  * will be used for unowned discovery and remaining half for owned discovery. So the wait time should be\r
401  * equal to or more than 2.\r
402  * @param[out] pOwnedDevList  list of owned devices.\r
403  * @param[out] pUnownedDevList  list of unowned devices.\r
404  * @return OC_STACK_OK in case of success and other value otherwise.\r
405  */\r
406 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,\r
407                                        OCProvisionDev_t** pOwnedDevList,\r
408                                        OCProvisionDev_t** pUnownedDevList);\r
409 /**\r
410  * This method is used to get linked devices' IDs.\r
411  *\r
412  * @param[in] uuidOfDevice a target device's uuid.\r
413  * @param[out] uuidList information about the list of linked devices' uuids.\r
414  * @param[out] numOfDevices total number of linked devices.\r
415  * @return OC_STACK_OK in case of success and other value otherwise.\r
416  */\r
417 OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice,\r
418                                   OCUuidList_t** uuidList,\r
419                                   size_t* numOfDevices);\r
420 \r
421 /**\r
422  * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.\r
423  *\r
424  * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.\r
425  */\r
426 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList);\r
427 \r
428 /**\r
429  * API to delete memory allocated to OicUuid_t list.\r
430  *\r
431  * @param[in] pList Pointer to OicUuid_t list which should be deleted.\r
432  */\r
433 void OCDeleteUuidList(OCUuidList_t* pList);\r
434 \r
435 /**\r
436  * This function deletes ACL data.\r
437  *\r
438  * @param pAcl Pointer to OicSecAcl_t structure.\r
439  */\r
440 void OCDeleteACLList(OicSecAcl_t* pAcl);\r
441 \r
442 /**\r
443  * This function deletes PDACL data.\r
444  *\r
445  * @param pPdAcl Pointer to OicSecPdAcl_t structure.\r
446  */\r
447 void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl);\r
448 \r
449 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)\r
450 /**\r
451  * this function sends CRL information to resource.\r
452  *\r
453  * @param[in] ctx Application context would be returned in result callback.\r
454  * @param[in] selectedDeviceInfo Selected target device.\r
455  * @param[in] crl CRL to provision.\r
456  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning\r
457               request recieves a response from resource server.\r
458  * @return  OC_STACK_OK in case of success and other value otherwise.\r
459  */\r
460 OCStackResult OCProvisionCRL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecCrl_t *crl,\r
461                              OCProvisionResultCB resultCallback);\r
462 \r
463 /**\r
464  * function to provision Trust certificate chain to devices.\r
465  *\r
466  * @param[in] ctx Application context would be returned in result callback.\r
467  * @param[in] type Type of credentials to be provisioned to the device.\r
468  * @param[in] credId CredId of trust certificate chain to be provisioned to the device.\r
469  * @param[in] selectedDeviceInfo Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.\r
470  * @param[in] resultCallback callback provided by API user, callback will be called when\r
471  *            provisioning request recieves a response from first resource server.\r
472  * @return  OC_STACK_OK in case of success and other value otherwise.\r
473  */\r
474 OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId,\r
475                                       const OCProvisionDev_t *selectedDeviceInfo,\r
476                                       OCProvisionResultCB resultCallback);\r
477 /**\r
478  * function to save Trust certificate chain into Cred of SVR.\r
479  *\r
480  * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.\r
481  * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR\r
482  * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR\r
483  * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.\r
484  * @return  OC_STACK_OK in case of success and other value otherwise.\r
485  */\r
486 OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,\r
487                                         OicEncodingType_t encodingType, uint16_t *credId);\r
488 /**\r
489  * function to register callback, for getting notification for TrustCertChain change.\r
490  *\r
491  * @param[in] TrustCertChainChangeCB notifier callback function\r
492  * @return OC_STACK_OK in case of success and other value otherwise.\r
493  */\r
494 OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB);\r
495 \r
496 /**\r
497  * function to de-register TrustCertChain notification callback.\r
498  */\r
499 void OCRemoveTrustCertChainNotifier(void);\r
500 \r
501 /*\r
502  * Function to read Trust certificate chain from SVR.\r
503  * Caller must free when done using the returned trust certificate\r
504  * @param[in] credId CredId of trust certificate chain in SVR.\r
505  * @param[out] trustCertChain Trust certificate chain.\r
506  * @param[out] chainSize Size of trust certificate chain\r
507  * @return  OC_STACK_OK in case of success and other value otherwise.\r
508  */\r
509 OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain,\r
510                                      size_t *chainSize);\r
511 \r
512 #endif // __WITH_DTLS__ || __WITH_TLS__\r
513 \r
514 \r
515 #ifdef __cplusplus\r
516 }\r
517 #endif // __cplusplus\r
518 \r
519 #endif /* OCPROVISIONINGMANAGER_H_ */\r