62ba04bd76f1c68a33f9b993a8ebb1faeba2ff76
[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 delete
99  *
100  * @param[in] endPoint          cloud host and port
101  * @param[in] callback          result callback
102  * @return  OCStackResult application result
103  */
104 OCStackResult OCWrapperAclIndividualDelete(const OCDevAddr *endPoint, OCCloudResponseCB callback);
105
106 /**
107  * ACL individual delete ACE
108  *
109  * @param[in] endPoint          cloud host and port
110  * @param[in] callback          result callback
111  * @return  OCStackResult application result
112  */
113 OCStackResult OCWrapperAclIndividualDeleteAce(const OCDevAddr *endPoint, OCCloudResponseCB callback);
114
115 /**
116  * ACL post group request function
117  *
118  * @param[in] endPoint          cloud host and port
119  * @param[in] callback          result callback
120  * @return  OCStackResult application result
121  */
122 OCStackResult OCWrapperAclCreateGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
123
124 /**
125  * ACL get group request function
126  *
127  * @param[in] endPoint          cloud host and port
128  * @param[in] callback          result callback
129  * @return  OCStackResult application result
130  */
131 OCStackResult OCWrapperAclFindMyGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
132
133 /**
134  * ACL delete group request function
135  *
136  * @param[in] endPoint          cloud host and port
137  * @param[in] callback          result callback
138  * @return  OCStackResult application result
139  */
140 OCStackResult OCWrapperAclDeleteGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
141
142 /**
143  * ACL join to invited group request function
144  *
145  * @param[in] endPoint          cloud host and port
146  * @param[in] callback          result callback
147  * @return  OCStackResult application result
148  */
149 OCStackResult OCWrapperAclJoinToInvitedGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
150
151 /**
152  * ACL observe group request function
153  *
154  * @param[in] endPoint          cloud host and port
155  * @param[in] callback          result callback
156  * @return  OCStackResult application result
157  */
158 OCStackResult OCWrapperAclObserveGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
159
160 /**
161  * ACL share device into group request function
162  *
163  * @param[in] endPoint          cloud host and port
164  * @param[in] callback          result callback
165  * @return  OCStackResult application result
166  */
167 OCStackResult OCWrapperAclShareDeviceIntoGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
168
169 /**
170  * ACL delete device from group request function
171  *
172  * @param[in] endPoint          cloud host and port
173  * @param[in] callback          result callback
174  * @return  OCStackResult application result
175  */
176 OCStackResult OCWrapperAclDeleteDeviceFromGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
177
178 /**
179  * ACL get group info request function
180  *
181  * @param[in] endPoint          cloud host and port
182  * @param[in] callback          result callback
183  * @return  OCStackResult application result
184  */
185 OCStackResult OCWrapperAclGroupGetInfo(const OCDevAddr *endPoint, OCCloudResponseCB callback);
186
187 /**
188  * ACL invite user to group request function
189  *
190  * @param[in] endPoint          cloud host and port
191  * @param[in] callback          result callback
192  * @return  OCStackResult application result
193  */
194 OCStackResult OCWrapperAclInviteUser(const OCDevAddr *endPoint, OCCloudResponseCB callback);
195
196 /**
197  * ACL get invitation request function
198  *
199  * @param[in] endPoint          cloud host and port
200  * @param[in] callback          result callback
201  * @return  OCStackResult application result
202  */
203 OCStackResult OCWrapperAclGetInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
204
205 /**
206  * ACL delete invitation request function (by receiver)
207  *
208  * @param[in] endPoint          cloud host and port
209  * @param[in] callback          result callback
210  * @return  OCStackResult application result
211  */
212 OCStackResult OCWrapperAclDeleteInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
213
214 /**
215  * ACL cancel invitation request function (by sender)
216  *
217  * @param[in] endPoint          cloud host and port
218  * @param[in] callback          result callback
219  * @return  OCStackResult application result
220  */
221 OCStackResult OCWrapperAclCancelInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
222
223 /**
224  * ACL check that given request can be applied to resource
225  *
226  * @param[in] endPoint          cloud host and port
227  * @param[in] callback          result callback
228  * @return  OCStackResult application result
229  */
230 OCStackResult OCWrapperAclPolicyCheck(const OCDevAddr *endPoint, OCCloudResponseCB callback);
231
232 /**
233  * Read user input (expect string value)
234  *
235  * @param[out] item           string item to fill
236  * @param[in] length          max allowed string length
237  * @param[in] description     item description
238  * @param[in] example         item example
239  */
240 void readString(char* item, int length, const char* description, const char* example);
241
242 /**
243  * Read user input (expect integer value)
244  *
245  * @param[out] item           integer item to fill
246  * @param[in] description     item description
247  * @param[in] example         item example
248  */
249 void readInteger(int* item, const char* description, const char* example);
250
251 /**
252  * Copies whole binary file to out variable
253  *
254  * @param[in] list           array of strings structure
255  * @param[out] out           byte array to fill
256  * @return                   negative error code
257  * */
258 int readFile(const char *name, OCByteString *out);
259
260 /**
261  * Print array of strings
262  *
263  * @param[in] list           array of strings
264  */
265 void printStringArray(stringArray_t *list);
266
267 /**
268  * Print invitation response
269  *
270  * @param[in] in           invitation response
271  */
272 void printInviteResponse(inviteResponse_t *in);
273
274 /**
275  * Clear invitation response
276  *
277  * @param[in] in           invitation response
278  */
279 void clearInviteResponse(inviteResponse_t *in);
280
281 #endif //OC_CLOUD_WRAPPER_H