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 "ownershiptransfermanager.h"
\r
30 #endif // __cplusplus
\r
33 * The function is responsible for initializaton of the provisioning manager. It will load
\r
34 * provisioning database which have owned device's list and their linked status.
\r
35 * In addition, if there is a device(s) which has not up-to-date credentials, this function will
\r
36 * automatically try to update the deivce(s).
\r
38 * @param[in] dbPath file path of the sqlite3 db
\r
40 * @return OC_STACK_OK in case of success and other value otherwise.
\r
42 OCStackResult OCProvisionInit(const char* dbPath);
\r
45 * The function is responsible for discovery of device is current subnet. It will list
\r
46 * all the device in subnet which are not yet owned. Please call OCInit with OC_CLIENT_SERVER as
\r
49 * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
\r
50 * client before returning the list of devices.
\r
51 * @param[out] ppList List of candidate devices to be provisioned
\r
52 * @return OTM_SUCCESS in case of success and other value otherwise.
\r
54 OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList);
\r
57 * Do ownership transfer for un-owned device.
\r
59 * @param[in] ctx Application context would be returned in result callback
\r
60 * @param[in] targetDevices List of devices to perform ownership transfer.
\r
61 * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.
\r
62 * @return OC_STACK_OK in case of success and other value otherwise.
\r
64 OCStackResult OCDoOwnershipTransfer(void* ctx,
\r
65 OCProvisionDev_t *targetDevices,
\r
66 OCProvisionResultCB resultCallback);
\r
69 * API to register for particular OxM.
\r
71 * @param[in] Ownership transfer method.
\r
72 * @param[in] Implementation of callback functions for owership transfer.
\r
73 * @return OC_STACK_OK in case of success and other value otherwise.
\r
75 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData);
\r
78 * The function is responsible for discovery of owned device is current subnet. It will list
\r
79 * all the device in subnet which are owned by calling provisioning client.
\r
81 * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
\r
82 * client before returning the list of devices.
\r
83 * @param[out] ppList List of device owned by provisioning tool.
\r
84 * @return OTM_SUCCESS in case of success and other value otherwise.
\r
86 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
\r
89 * API to provision credentials between two devices and ACLs for the devices who act as a server.
\r
91 * @param[in] ctx Application context would be returned in result callback.
\r
92 * @param[in] type Type of credentials to be provisioned to the device.
\r
93 * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.
\r
94 * @param[in] acl ACL for device 1. If this is not required set NULL.
\r
95 * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.
\r
96 * @param[in] acl ACL for device 2. If this is not required set NULL.
\r
97 * @param[in] resultCallback callback provided by API user, callback will be called when
\r
98 * provisioning request recieves a response from first resource server.
\r
99 * @return OC_STACK_OK in case of success and other value otherwise.
\r
101 OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize,
\r
102 const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,
\r
103 const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,
\r
104 OCProvisionResultCB resultCallback);
\r
107 * API to send ACL information to device.
\r
109 * @param[in] ctx Application context would be returned in result callback.
\r
110 * @param[in] selectedDeviceInfo Selected target device.
\r
111 * @param[in] acl ACL to provision.
\r
112 * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
\r
113 request recieves a response from resource server.
\r
114 * @return OC_STACK_OK in case of success and other value otherwise.
\r
116 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl,
\r
117 OCProvisionResultCB resultCallback);
\r
120 * API to provision credential to devices.
\r
122 * @param[in] ctx Application context would be returned in result callback.
\r
123 * @param[in] type Type of credentials to be provisioned to the device.
\r
124 * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
\r
125 @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
\r
126 * @param[in] resultCallback callback provided by API user, callback will be called when
\r
127 * provisioning request recieves a response from first resource server.
\r
128 * @return OC_STACK_OK in case of success and other value otherwise.
\r
130 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,
\r
131 const OCProvisionDev_t *pDev1,
\r
132 const OCProvisionDev_t *pDev2,
\r
133 OCProvisionResultCB resultCallback);
\r
136 * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.
\r
138 * @param[in] ppList Pointer to OCProvisionDev_t which should be deleted.
\r
140 void OCDeleteDiscoveredDevices(OCProvisionDev_t **ppList);
\r
143 * API to delete memory allocated to OCProvisionResult_t list in callback function.
\r
145 * @note: This function must be called in the callback implementation after checking results.
\r
147 * @param[in] pList Pointer to OCProvisionResult_t list which should be deleted.
\r
149 void OCDeleteProvisionResults(OCProvisionResult_t *pList);
\r
153 #endif // __cplusplus
\r
155 #endif /* OCPROVISIONINGMANAGER_H_ */
\r