1 /* *****************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * *****************************************************************/
20 #ifndef OC_CLOUD_PROVISIONING_H
21 #define OC_CLOUD_PROVISIONING_H
24 #include "securevirtualresourcetypes.h"
30 typedef void (*OCCloudResponseCB )(void* ctx, OCStackResult result, void* data);
32 typedef struct cloudAce cloudAce_t;
36 OicUuid_t subjectuuid;
39 OicSecRsrc_t *resources;
40 OicSecValidity_t *validities;
50 stringArray_t gidlist;
51 stringArray_t midlist;
55 stringArrayPair_t invite;
56 stringArrayPair_t invited;
60 * Certificate-Issue request function
62 * @param[in] ctx user-defined context
63 * @param[in] endPoint cloud host and port
64 * @param[in] callback optional result callback, can be NULL if not required
65 * @return OCStackResult application result
67 OCStackResult OCCloudCertificateIssueRequest(void* ctx,
68 const OCDevAddr *endPoint,
69 OCCloudResponseCB callback);
72 * CRL GET request function
74 * @param[in] ctx user-defined context
75 * @param[in] endPoint cloud host and port
76 * @param[in] callback optional result callback, can be NULL if not required
77 * @return OCStackResult application result
79 OCStackResult OCCloudGetCRL(void* ctx,
80 const OCDevAddr *endPoint,
81 OCCloudResponseCB callback);
84 * CRL POST request function (with Serial Numbers list to revoke)
86 * @param[in] ctx user-defined context
87 * @param[in] thisUpdate mandatory parameter thisUpdate
88 * @param[in] nextUpdate mandatory parameter nextUpdate
89 * @param[in] crl optional parameter crl
90 * @param[in] serialNumbers optional parameter serial numbers
91 * @param[in] endPoint cloud host and port
92 * @param[in] callback optional result callback, can be NULL if not required
93 * @return OCStackResult application result
95 OCStackResult OCCloudPostCRL(void* ctx,
96 const char *thisUpdate,
97 const char *nextUpdate,
98 const OCByteString *crl,
99 const stringArray_t *serialNumbers,
100 const OCDevAddr *endPoint,
101 OCCloudResponseCB callback);
104 * ACL id retrieve by device id
106 * @param[in] ctx user-defined context
107 * @param[in] deviceId mandatory parameter device id
108 * @param[in] endPoint cloud host and port
109 * @param[in] callback optional result callback, can be NULL if not required
110 * @return OCStackResult application result
112 OCStackResult OCCloudGetAclIdByDevice(void* ctx,
113 const char *deviceId,
114 const OCDevAddr *endPoint,
115 OCCloudResponseCB callback);
120 * @param[in] ctx user-defined context
121 * @param[in] ownerId mandatory parameter owner id
122 * @param[in] deviceId mandatory parameter device id
123 * @param[in] endPoint cloud host and port
124 * @param[in] callback optional result callback, can be NULL if not required
125 * @return OCStackResult application result
127 OCStackResult OCCloudAclIdCreate(void* ctx,
129 const char *deviceId,
130 const OCDevAddr *endPoint,
131 OCCloudResponseCB callback);
136 * @param[in] ctx user-defined context
137 * @param[in] aclId mandatory parameter acl id
138 * @param[in] endPoint cloud host and port
139 * @param[in] callback optional result callback, can be NULL if not required
140 * @return OCStackResult application result
142 OCStackResult OCCloudAclIdDelete(void* ctx,
144 const OCDevAddr *endPoint,
145 OCCloudResponseCB callback);
148 * ACL individual get info
150 * @param[in] ctx user-defined context
151 * @param[in] aclId mandatory parameter acl id
152 * @param[in] endPoint cloud host and port
153 * @param[in] callback optional result callback, can be NULL if not required
154 * @return OCStackResult application result
156 OCStackResult OCCloudAclIndividualGetInfo(void* ctx,
158 const OCDevAddr *endPoint,
159 OCCloudResponseCB callback);
162 * ACL individual update ACE
164 * @param[in] ctx user-defined context
165 * @param[in] aclId mandatory parameter acl id
166 * @param[in] aces mandatory parameter aces
167 * @param[in] endPoint cloud host and port
168 * @param[in] callback optional result callback, can be NULL if not required
169 * @return OCStackResult application result
171 OCStackResult OCCloudAclIndividualUpdateAce(void* ctx,
173 const cloudAce_t *aces,
174 const OCDevAddr *endPoint,
175 OCCloudResponseCB callback);
178 * ACL individual update
180 * @param[in] ctx user-defined context
181 * @param[in] aclId mandatory parameter acl id
182 * @param[in] aceId mandatory parameter target ace id
183 * @param[in] aces mandatory parameter aces
184 * @param[in] endPoint cloud host and port
185 * @param[in] callback optional result callback, can be NULL if not required
186 * @return OCStackResult application result
188 OCStackResult OCCloudAclIndividualUpdate(void* ctx,
191 const cloudAce_t *aces,
192 const OCDevAddr *endPoint,
193 OCCloudResponseCB callback);
196 * ACL individual delete - replaces ACE with given aceid with provided ACE
198 * @param[in] ctx user-defined context
199 * @param[in] aclId mandatory parameter acl id
200 * @param[in] endPoint cloud host and port
201 * @param[in] callback optional result callback, can be NULL if not required
202 * @return OCStackResult application result
204 OCStackResult OCCloudAclIndividualDelete(void* ctx,
206 const OCDevAddr *endPoint,
207 OCCloudResponseCB callback);
210 * ACL individual delete ACE
212 * @param[in] ctx user-defined context
213 * @param[in] aclId mandatory parameter acl id
214 * @param[in] aceId target ace id
215 * @param[in] endPoint cloud host and port
216 * @param[in] callback optional result callback, can be NULL if not required
217 * @return OCStackResult application result
219 OCStackResult OCCloudAclIndividualDeleteAce(void* ctx,
222 const OCDevAddr *endPoint,
223 OCCloudResponseCB callback);
226 * ACL post group request function
228 * @param[in] ctx user-defined context
229 * @param[in] groupType mandatory parameter group type
230 * @param[in] groupMasterId optional parameter group master id
231 * @param[in] endPoint cloud host and port
232 * @param[in] callback optional result callback, can be NULL if not required
233 * @return OCStackResult application result
235 OCStackResult OCCloudAclCreateGroup(void* ctx,
236 const char *groupType,
237 const char *groupMasterId,
238 const OCDevAddr *endPoint,
239 OCCloudResponseCB callback);
242 * ACL get group request function
244 * @param[in] ctx user-defined context
245 * @param[in] memberId mandatory parameter member id
246 * @param[in] endPoint cloud host and port
247 * @param[in] callback optional result callback, can be NULL if not required
248 * @return OCStackResult application result
250 OCStackResult OCCloudAclFindMyGroup(void* ctx,
251 const char *memberId,
252 const OCDevAddr *endPoint,
253 OCCloudResponseCB callback);
256 * ACL delete group request function
258 * @param[in] ctx user-defined context
259 * @param[in] groupId mandatory parameter group id
260 * @param[in] groupMasterId optional parameter group master id
261 * @param[in] endPoint cloud host and port
262 * @param[in] callback optional result callback, can be NULL if not required
263 * @return OCStackResult application result
265 OCStackResult OCCloudAclDeleteGroup(void* ctx,
267 const char *groupMasterId,
268 const OCDevAddr *endPoint,
269 OCCloudResponseCB callback);
272 * ACL join to invited group request function
274 * @param[in] ctx user-defined context
275 * @param[in] groupId mandatory parameter group id
276 * @param[in] endPoint cloud host and port
277 * @param[in] callback optional result callback, can be NULL if not required
278 * @return OCStackResult application result
280 OCStackResult OCCloudAclJoinToInvitedGroup(void* ctx,
282 const OCDevAddr *endPoint,
283 OCCloudResponseCB callback);
286 * ACL observe group request function
288 * @param[in] ctx user-defined context
289 * @param[in] groupId mandatory parameter group id
290 * @param[in] endPoint cloud host and port
291 * @param[in] callback optional result callback, can be NULL if not required
292 * @return OCStackResult application result
294 OCStackResult OCCloudAclObserveGroup(void* ctx,
296 const OCDevAddr *endPoint,
297 OCCloudResponseCB callback);
300 * ACL share device into group request function
302 * @param[in] ctx user-defined context
303 * @param[in] groupId mandatory parameter group id
304 * @param[in] memberIds mandatory parameter members list
305 * @param[in] deviceIds mandatory parameter devices list
306 * @param[in] endPoint cloud host and port
307 * @param[in] callback optional result callback, can be NULL if not required
308 * @return OCStackResult application result
310 OCStackResult OCCloudAclShareDeviceIntoGroup(void* ctx,
312 const stringArray_t *memberIds,
313 const stringArray_t *deviceIds,
314 const OCDevAddr *endPoint,
315 OCCloudResponseCB callback);
318 * ACL delete device from group request function
320 * @param[in] ctx user-defined context
321 * @param[in] groupId mandatory parameter group id
322 * @param[in] memberIds mandatory parameter members list
323 * @param[in] deviceIds mandatory parameter devices list
324 * @param[in] endPoint cloud host and port
325 * @param[in] callback optional result callback, can be NULL if not required
326 * @return OCStackResult application result
328 OCStackResult OCCloudAclDeleteDeviceFromGroup(void* ctx,
330 const stringArray_t *memberIds,
331 const stringArray_t *deviceIds,
332 const OCDevAddr *endPoint,
333 OCCloudResponseCB callback);
336 * ACL get group info request function
338 * @param[in] ctx user-defined context
339 * @param[in] groupId mandatory parameter group id
340 * @param[in] memberId optional parameter member id
341 * @param[in] endPoint cloud host and port
342 * @param[in] callback optional result callback, can be NULL if not required
343 * @return OCStackResult application result
345 OCStackResult OCCloudAclGroupGetInfo(void* ctx,
347 const char *memberId,
348 const OCDevAddr *endPoint,
349 OCCloudResponseCB callback);
352 * ACL invite user to group request function
354 * @param[in] ctx user-defined context
355 * @param[in] userId optional parameter user id
356 * @param[in] groupIds mandatory parameter groups list
357 * @param[in] memberIds mandatory parameter members list
358 * @param[in] endPoint cloud host and port
359 * @param[in] callback optional result callback, can be NULL if not required
360 * @return OCStackResult application result
362 OCStackResult OCCloudAclInviteUser(void* ctx,
364 const stringArray_t *groupIds,
365 const stringArray_t *memberIds,
366 const OCDevAddr *endPoint,
367 OCCloudResponseCB callback);
370 * ACL get invitation request function
372 * @param[in] ctx user-defined context
373 * @param[in] userId optional parameter user id
374 * @param[in] endPoint cloud host and port
375 * @param[in] callback optional result callback, can be NULL if not required
376 * @return OCStackResult application result
378 OCStackResult OCCloudAclGetInvitation(void* ctx,
380 const OCDevAddr *endPoint,
381 OCCloudResponseCB callback);
384 * ACL delete invitation request function (by receiver)
386 * @param[in] ctx user-defined context
387 * @param[in] userId optional parameter user id
388 * @param[in] groupId mandatory parameter group id
389 * @param[in] endPoint cloud host and port
390 * @param[in] callback optional result callback, can be NULL if not required
391 * @return OCStackResult application result
393 OCStackResult OCCloudAclDeleteInvitation(void* ctx,
396 const OCDevAddr *endPoint,
397 OCCloudResponseCB callback);
400 * ACL cancel invitation request function (by sender)
402 * @param[in] ctx user-defined context
403 * @param[in] userId optional parameter user id
404 * @param[in] groupId mandatory parameter group id
405 * @param[in] memberId mandatory parameter member id
406 * @param[in] endPoint cloud host and port
407 * @param[in] callback optional result callback, can be NULL if not required
408 * @return OCStackResult application result
410 OCStackResult OCCloudAclCancelInvitation(void* ctx,
413 const char *memberId,
414 const OCDevAddr *endPoint,
415 OCCloudResponseCB callback);
418 * ACL check that given request can be applied to resource
420 * @param[in] ctx user-defined context
421 * @param[in] subjectId mandatory parameter subject id
422 * @param[in] deviceId mandatory parameter device id
423 * @param[in] method mandatory parameter method
424 * @param[in] uri mandatory parameter uri
425 * @param[in] endPoint cloud host and port
426 * @param[in] callback optional result callback, can be NULL if not required
427 * @return OCStackResult application result
429 OCStackResult OCCloudAclPolicyCheck(void* ctx,
430 const char *subjectId,
431 const char *deviceId,
434 const OCDevAddr *endPoint,
435 OCCloudResponseCB callback);
439 #endif // __cplusplus
440 #endif //OC_CLOUD_PROVISIONING_H