Cloud ACE update
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / sample / cloud / cloudWrapper.h
1 /* *****************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  * *****************************************************************/
20 #ifndef OC_CLOUD_WRAPPER_H
21 #define OC_CLOUD_WRAPPER_H
22
23 #include "occloudprovisioning.h"
24
25 /**
26  * Certificate-Issue request function
27  *
28  * @param[in] endPoint          cloud host and port
29  * @param[in] callback          result callback
30  * @return  OCStackResult application result
31  */
32 OCStackResult OCWrapperCertificateIssueRequest(const OCDevAddr *endPoint, OCCloudResponseCB callback);
33
34 /**
35  * CRL GET request function
36  *
37  * @param[in] endPoint          cloud host and port
38  * @param[in] callback          result callback
39  * @return  OCStackResult application result
40  */
41 OCStackResult OCWrapperGetCRL(const OCDevAddr *endPoint, OCCloudResponseCB callback);
42
43 /**
44  * CRL POST request function (with Serial Numbers list to revoke)
45  *
46  * @param[in] endPoint          cloud host and port
47  * @param[in] callback          result callback
48  * @return  OCStackResult application result
49  */
50 OCStackResult OCWrapperPostCRL(const OCDevAddr *endPoint, OCCloudResponseCB callback);
51
52 /**
53  * ACL id retrieve by device id
54  *
55  * @param[in] endPoint          cloud host and port
56  * @param[in] callback          result callback
57  * @return  OCStackResult application result
58  */
59 OCStackResult OCWrapperAclIdGetByDevice(const OCDevAddr *endPoint, OCCloudResponseCB callback);
60
61 /**
62  * ACL id create
63  *
64  * @param[in] endPoint          cloud host and port
65  * @param[in] callback          result callback
66  * @return  OCStackResult application result
67  */
68 OCStackResult OCWrapperAclIdCreate(const OCDevAddr *endPoint, OCCloudResponseCB callback);
69
70 /**
71  * ACL id delete
72  *
73  * @param[in] endPoint          cloud host and port
74  * @param[in] callback          result callback
75  * @return  OCStackResult application result
76  */
77 OCStackResult OCWrapperAclIdDelete(const OCDevAddr *endPoint, OCCloudResponseCB callback);
78
79 /**
80  * ACL individual get info
81  *
82  * @param[in] endPoint          cloud host and port
83  * @param[in] callback          result callback
84  * @return  OCStackResult application result
85  */
86 OCStackResult OCWrapperAclIndividualGetInfo(const OCDevAddr *endPoint, OCCloudResponseCB callback);
87
88 /**
89  * ACL individual update ACE
90  *
91  * @param[in] endPoint          cloud host and port
92  * @param[in] callback          result callback
93  * @return  OCStackResult application result
94  */
95 OCStackResult OCWrapperAclIndividualUpdateAce(const OCDevAddr *endPoint, OCCloudResponseCB callback);
96
97 /**
98  * ACL individual update. Replaces an existing ACE with a new one
99  *
100  * @param[in] endPoint          cloud host and port
101  * @param[in] callback          result callback
102  * @return  OCStackResult application result
103  */
104
105 OCStackResult OCWrapperAclIndividualUpdate(const OCDevAddr *endPoint, OCCloudResponseCB callback);
106
107 /**
108  * ACL individual delete
109  *
110  * @param[in] endPoint          cloud host and port
111  * @param[in] callback          result callback
112  * @return  OCStackResult application result
113  */
114 OCStackResult OCWrapperAclIndividualDelete(const OCDevAddr *endPoint, OCCloudResponseCB callback);
115
116 /**
117  * ACL individual delete ACE
118  *
119  * @param[in] endPoint          cloud host and port
120  * @param[in] callback          result callback
121  * @return  OCStackResult application result
122  */
123 OCStackResult OCWrapperAclIndividualDeleteAce(const OCDevAddr *endPoint, OCCloudResponseCB callback);
124
125 /**
126  * ACL post group request function
127  *
128  * @param[in] endPoint          cloud host and port
129  * @param[in] callback          result callback
130  * @return  OCStackResult application result
131  */
132 OCStackResult OCWrapperAclCreateGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
133
134 /**
135  * ACL get group request function
136  *
137  * @param[in] endPoint          cloud host and port
138  * @param[in] callback          result callback
139  * @return  OCStackResult application result
140  */
141 OCStackResult OCWrapperAclFindMyGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
142
143 /**
144  * ACL delete group request function
145  *
146  * @param[in] endPoint          cloud host and port
147  * @param[in] callback          result callback
148  * @return  OCStackResult application result
149  */
150 OCStackResult OCWrapperAclDeleteGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
151
152 /**
153  * ACL join to invited group request function
154  *
155  * @param[in] endPoint          cloud host and port
156  * @param[in] callback          result callback
157  * @return  OCStackResult application result
158  */
159 OCStackResult OCWrapperAclJoinToInvitedGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
160
161 /**
162  * ACL observe group request function
163  *
164  * @param[in] endPoint          cloud host and port
165  * @param[in] callback          result callback
166  * @return  OCStackResult application result
167  */
168 OCStackResult OCWrapperAclObserveGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
169
170 /**
171  * ACL share device into group request function
172  *
173  * @param[in] endPoint          cloud host and port
174  * @param[in] callback          result callback
175  * @return  OCStackResult application result
176  */
177 OCStackResult OCWrapperAclShareDeviceIntoGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
178
179 /**
180  * ACL delete device from group request function
181  *
182  * @param[in] endPoint          cloud host and port
183  * @param[in] callback          result callback
184  * @return  OCStackResult application result
185  */
186 OCStackResult OCWrapperAclDeleteDeviceFromGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
187
188 /**
189  * ACL get group info request function
190  *
191  * @param[in] endPoint          cloud host and port
192  * @param[in] callback          result callback
193  * @return  OCStackResult application result
194  */
195 OCStackResult OCWrapperAclGroupGetInfo(const OCDevAddr *endPoint, OCCloudResponseCB callback);
196
197 /**
198  * ACL invite user to group request function
199  *
200  * @param[in] endPoint          cloud host and port
201  * @param[in] callback          result callback
202  * @return  OCStackResult application result
203  */
204 OCStackResult OCWrapperAclInviteUser(const OCDevAddr *endPoint, OCCloudResponseCB callback);
205
206 /**
207  * ACL get invitation request function
208  *
209  * @param[in] endPoint          cloud host and port
210  * @param[in] callback          result callback
211  * @return  OCStackResult application result
212  */
213 OCStackResult OCWrapperAclGetInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
214
215 /**
216  * ACL delete invitation request function (by receiver)
217  *
218  * @param[in] endPoint          cloud host and port
219  * @param[in] callback          result callback
220  * @return  OCStackResult application result
221  */
222 OCStackResult OCWrapperAclDeleteInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
223
224 /**
225  * ACL cancel invitation request function (by sender)
226  *
227  * @param[in] endPoint          cloud host and port
228  * @param[in] callback          result callback
229  * @return  OCStackResult application result
230  */
231 OCStackResult OCWrapperAclCancelInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
232
233 /**
234  * ACL check that given request can be applied to resource
235  *
236  * @param[in] endPoint          cloud host and port
237  * @param[in] callback          result callback
238  * @return  OCStackResult application result
239  */
240 OCStackResult OCWrapperAclPolicyCheck(const OCDevAddr *endPoint, OCCloudResponseCB callback);
241
242 /**
243  * Read user input (expect string value)
244  *
245  * @param[out] item           string item to fill
246  * @param[in] length          max allowed string length
247  * @param[in] description     item description
248  * @param[in] example         item example
249  */
250 void readString(char* item, int length, const char* description, const char* example);
251
252 /**
253  * Read user input (expect integer value)
254  *
255  * @param[out] item           integer item to fill
256  * @param[in] description     item description
257  * @param[in] example         item example
258  */
259 void readInteger(int* item, const char* description, const char* example);
260
261 /**
262  * Copies whole binary file to out variable
263  *
264  * @param[in] list           array of strings structure
265  * @param[out] out           byte array to fill
266  * @return                   negative error code
267  * */
268 int readFile(const char *name, OCByteString *out);
269
270 /**
271  * Print array of strings
272  *
273  * @param[in] list           array of strings
274  */
275 void printStringArray(stringArray_t *list);
276
277 /**
278  * Print invitation response
279  *
280  * @param[in] in           invitation response
281  */
282 void printInviteResponse(inviteResponse_t *in);
283
284 /**
285  * Clear invitation response
286  *
287  * @param[in] in           invitation response
288  */
289 void clearInviteResponse(inviteResponse_t *in);
290
291 #endif //OC_CLOUD_WRAPPER_H