1 /* *****************************************************************
\r
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
\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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
19 * *****************************************************************/
\r
21 #ifndef OCPROVISIONINGMANAGER_H_
\r
22 #define OCPROVISIONINGMANAGER_H_
\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
34 #endif // __cplusplus
\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
42 * @param[in] dbPath file path of the sqlite3 db
\r
44 * @return OC_STACK_OK in case of success and other value otherwise.
\r
46 OCStackResult OCInitPM(const char *dbPath);
\r
49 * API to termiante the provisioning manager
\r
51 void OCTerminatePM();
\r
54 * API to cleanup PDM in case of timeout.
\r
55 * It will remove the PDM_DEVICE_INIT state devices from PDM.
\r
57 * @return OC_STACK_OK in case of success and other value otherwise.
\r
59 OCStackResult OCPDMCleanupForTimeout();
\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
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
71 OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t *deviceID,
\r
72 OCProvisionDev_t **ppFoundDevice);
\r
75 * The function is responsible for discovery of owned/unowned device is specified endpoint/MAC
\r
77 * It will return the found device even though timeout is not exceeded.
\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
87 OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t *deviceID,
\r
88 const char *hostAddress, OCConnectivityType connType,
\r
89 OCProvisionDev_t **ppFoundDevice);
\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
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
101 OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList);
\r
104 * Do ownership transfer for un-owned device.
\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
111 OCStackResult OCDoOwnershipTransfer(void *ctx,
\r
112 OCProvisionDev_t *targetDevices,
\r
113 OCProvisionResultCB resultCallback);
\r
116 * Do ownership transfer for un-owned device.
\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
124 OCStackResult OCDoCustomOwnershipTransfer(void *ctx,
\r
125 OCProvisionDev_t *selectedDevice,
\r
126 OCProvisionResultCB resultCallback,
\r
127 const OicSecOxm_t method);
\r
130 * API to set a allow status of OxM
\r
132 * @param[in] oxm Owership transfer method (ref. OicSecOxm_t)
\r
133 * @param[in] allowStatus allow status (true = allow, false = not allow)
\r
135 * @return OC_STACK_OK in case of success and other value otherwise.
\r
137 OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);
\r
140 #ifdef MULTIPLE_OWNER
\r
142 * API to perfrom multiple ownership transfer for MOT enabled device.
\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
149 OCStackResult OCDoMultipleOwnershipTransfer(void *ctx,
\r
150 OCProvisionDev_t *targetDevices,
\r
151 OCProvisionResultCB resultCallback);
\r
154 * API to remove sub-owner from resource server
\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
163 OCStackResult OCRemoveSubOwner(void *ctx,
\r
164 const OCProvisionDev_t *targetDeviceInfo,
\r
165 const OicUuid_t *subOwner,
\r
166 OCProvisionResultCB resultCallback);
\r
169 * API to remove all sub-owner from resource server
\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
177 OCStackResult OCRemoveAllSubOwner(void *ctx,
\r
178 const OCProvisionDev_t *targetDeviceInfo,
\r
179 OCProvisionResultCB resultCallback);
\r
181 #endif //MULTIPLE_OWNER
\r
184 * API to register for particular OxM.
\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
190 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t *callbackData);
\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
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
201 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
\r
203 #ifdef MULTIPLE_OWNER
\r
205 * The function is responsible for discovery of MOT enabled device is current subnet.
\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
212 OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout,
\r
213 OCProvisionDev_t **ppList);
\r
216 * The function is responsible for discovery of Multiple Owned device is current subnet.
\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
223 OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
\r
224 #endif //MULTIPLE_OWNER
\r
227 * API to provision credentials between two devices and ACLs for the devices who act as a server.
\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
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
245 * API to send ACL information to device.
\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
254 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
\r
256 OCProvisionResultCB resultCallback);
\r
259 * function to save ACL which has several ACE into Acl of SVR.
\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
264 OCStackResult OCSaveACL(const OicSecAcl_t *acl);
\r
267 * this function requests CRED information to resource.
\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
275 OCStackResult OCGetCredResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
\r
276 OCProvisionResultCB resultCallback);
\r
279 * this function requests ACL information to resource.
\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
287 OCStackResult OCGetACLResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
\r
288 OCProvisionResultCB resultCallback);
\r
291 * this function sends Direct-Pairing Configuration to a device.
\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
300 OCStackResult OCProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
\r
301 OicSecPconf_t *pconf,
\r
302 OCProvisionResultCB resultCallback);
\r
305 * API to provision credential to devices.
\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
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
320 #ifdef MULTIPLE_OWNER
\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
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
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
342 * API to add preconfigured PIN to local SVR DB.
\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
349 OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,
\r
350 const char *preconfigPin,
\r
351 size_t preconfigPinLen);
\r
354 * API to update 'doxm.mom' to resource server.
\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
362 OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
\r
363 const OicSecMomType_t momType, OCProvisionResultCB resultCallback);
\r
366 * API to update 'doxm.oxmsel' to resource server.
\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
374 OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
\r
375 const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);
\r
376 #endif //MULTIPLE_OWNER
\r
379 * Function to unlink devices.
\r
380 * This function will remove the credential & relasionship between the two devices.
\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
389 OCStackResult OCUnlinkDevices(void *ctx,
\r
390 const OCProvisionDev_t *pTargetDev1,
\r
391 const OCProvisionDev_t *pTargetDev2,
\r
392 OCProvisionResultCB resultCallback);
\r
395 * Function for device revocation
\r
396 * This function will remove credential of target device from all devices in subnet.
\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
407 OCStackResult OCRemoveDevice(void *ctx,
\r
408 unsigned short waitTimeForOwnedDeviceDiscovery,
\r
409 const OCProvisionDev_t *pTargetDev,
\r
410 OCProvisionResultCB resultCallback);
\r
413 * Function to device revocation
\r
414 * This function will remove credential of target device from all devices in subnet.
\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
423 OCStackResult OCRemoveDeviceWithUuid(void *ctx,
\r
424 unsigned short waitTimeForOwnedDeviceDiscovery,
\r
425 const OicUuid_t *pTargetUuid,
\r
426 OCProvisionResultCB resultCallback);
\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
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
439 OCStackResult OCResetDevice(void *ctx, unsigned short waitTimeForOwnedDeviceDiscovery,
\r
440 const OCProvisionDev_t *pTargetDev,
\r
441 OCProvisionResultCB resultCallback,
\r
442 OCClientContextDeleter deleteCallback);
\r
445 * This function resets SVR DB to its factory setting.
\r
447 *@return OC_STACK_OK in case of successful reset and other value otherwise.
\r
449 OCStackResult OCResetSVRDB(void);
\r
452 * This function configures SVR DB as self-ownership.
\r
454 *@return OC_STACK_OK in case of successful configue and other value otherwise.
\r
456 OCStackResult OCConfigSelfOwnership(void);
\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
465 * NOTE: Caller need to call OCDeleteDiscoveredDevices to delete memory allocated by this API for out
\r
466 * variables pOwnedDevList and pUnownedDevList.
\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
475 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,
\r
476 OCProvisionDev_t **pOwnedDevList,
\r
477 OCProvisionDev_t **pUnownedDevList);
\r
479 * This method is used to get linked devices' IDs.
\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
486 OCStackResult OCGetLinkedStatus(const OicUuid_t *uuidOfDevice,
\r
487 OCUuidList_t **uuidList,
\r
488 size_t *numOfDevices);
\r
491 * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.
\r
493 * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.
\r
495 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList);
\r
498 * API to delete memory allocated to OicUuid_t list.
\r
500 * @param[in] pList Pointer to OicUuid_t list which should be deleted.
\r
502 void OCDeleteUuidList(OCUuidList_t *pList);
\r
505 * This function deletes ACL data.
\r
507 * @param pAcl Pointer to OicSecAcl_t structure.
\r
509 void OCDeleteACLList(OicSecAcl_t *pAcl);
\r
512 * This function deletes PDACL data.
\r
514 * @param pPdAcl Pointer to OicSecPdAcl_t structure.
\r
516 void OCDeletePdAclList(OicSecPdAcl_t *pPdAcl);
\r
518 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
\r
520 * function to provision Trust certificate chain to devices.
\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
530 OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId,
\r
531 const OCProvisionDev_t *selectedDeviceInfo,
\r
532 OCProvisionResultCB resultCallback);
\r
534 * function to save Trust certificate chain into Cred of SVR.
\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
542 OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
\r
543 OicEncodingType_t encodingType, uint16_t *credId);
\r
545 * function to register callback, for getting notification for TrustCertChain change.
\r
547 * @param[in] TrustCertChainChangeCB notifier callback function
\r
548 * @return OC_STACK_OK in case of success and other value otherwise.
\r
550 OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB);
\r
553 * function to de-register TrustCertChain notification callback.
\r
555 void OCRemoveTrustCertChainNotifier(void);
\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
565 OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain,
\r
566 size_t *chainSize);
\r
569 * Function to select appropriate security provisioning method.
\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
577 OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods,
\r
578 size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType);
\r
581 * This function sets the callback to utilize peer certificate information
\r
583 OCStackResult OCSetPeerCertCallback(void *ctx, PeerCertCallback peerCertCallback);
\r
586 * Set selecting OTM callback.
\r
588 void SetSelectOTMCB(OTMSelectMethodCallback selectOTMcb);
\r
591 * Unset selecting OTM callback.
\r
593 void UnsetSelectOTMCB();
\r
595 #endif // __WITH_DTLS__ || __WITH_TLS__
\r
600 #endif // __cplusplus
\r
602 #endif /* OCPROVISIONINGMANAGER_H_ */
\r